Professional Documents
Culture Documents
@ElectricalDocument - Automation - Logic
@ElectricalDocument - Automation - Logic
یکیازبهترینوبروزترین
کانالهایمهندسیبرق
INSTRUMENTATION
AUTOMATION LOGIC
TRAINING MANUAL
Course EXP-MN-SI080
Revision 0
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
INSTRUMENTATION
AUTOMATION LOGIC
CONTENTS
1. OBJECTIVES ..................................................................................................................6
2. THE NUMBERING SYSTEMS AND CODES ..................................................................7
2.1. REPRESENTATION OF NUMBERS.........................................................................8
2.2. BINARY-TO-DECIMAL CONVERSION.....................................................................9
2.3. DECIMAL-TO-BINARY CONVERSION.....................................................................9
2.3.1. Conversion of the integer part ...........................................................................9
2.3.2. Conversion of the fractional part......................................................................10
2.4. OCTAL NUMBERING SYSTEM..............................................................................11
2.4.1. Octal-to-Decimal Conversion...........................................................................11
2.4.2. Decimal-to-Octal Conversion...........................................................................12
2.4.3. Octal-to-Binary Conversion .............................................................................12
2.4.4. Binary-to-Octal Conversion .............................................................................13
2.5. HEXADECIMAL NUMBERING SYSTEM ................................................................14
2.5.1. Hexadecimal-to-Decimal Conversion ..............................................................15
2.5.2. Decimal-to-Hexadecimal Conversion ..............................................................15
2.5.3. Hexadecimal-to-Binary Conversion .................................................................16
2.5.4. Binary-to-Hexadecimal Conversion .................................................................16
2.5.5. Hexadecimal counting .....................................................................................16
2.5.6. Usefulness of the Hexadecimal system...........................................................17
2.6. BCD CODE .............................................................................................................18
2.6.1. Comparison between BCD code and binary numbers.....................................19
2.7. THE GRAY CODE OR REFLECTED BINARY CODE ............................................20
2.8. SUMMARY OF THE DIFFERENT CODES .............................................................22
2.9. ALPHANUMERICAL CODES..................................................................................23
2.9.1. ASCII code ......................................................................................................23
3. BINARY ARITHMETIC...................................................................................................26
3.1. REPRESENTATION OF POSITIVE INTEGERS.....................................................26
3.2. BINARY ADDITION.................................................................................................26
3.3. REPRESENTATION OF SIGNED INTEGERS .......................................................28
3.3.1. Notation in one's complement .........................................................................28
3.3.2. Two's complement notation .............................................................................29
3.3.3. Study of binary numbers signed with two's complement .................................30
4. COMBINATORIAL LOGIC .............................................................................................32
4.1. DEFINITIONS .........................................................................................................32
4.1.1. The logic states ...............................................................................................32
4.1.2. Positive logic and negative logic......................................................................32
4.1.3. The logic variables ..........................................................................................33
4.1.4. The logic functions ..........................................................................................33
4.2. LOGIC FUNCTIONS WITH ONE AND TWO VARIABLES......................................34
4.2.1. Functions with one variable .............................................................................34
4.2.2. Functions with two variables............................................................................34
4.3. TRUTH TABLE........................................................................................................35
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 2 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
1. OBJECTIVES
The purpose of this course is to ensure the future instrumentation specialist has a basic
knowledge of automation logic on a predominantly oil-oriented industrial site.
At the end of the course, in the area of automation logic, the trainee should:
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The decimal system is just as important because it is used universally to represent values
in the everyday world.
It will therefore sometimes be necessary to convert decimal values into binary values
before they can be processed in a digital circuit.
Example: when you key in a decimal number on your calculator (or the keyboard of your
computer), the internal circuits convert this decimal number into a binary value.
Likewise, there will be situations where the binary values given by a digital circuit will have
to be converted into decimal values so they can be read.
Example: your calculator (or your computer) calculates the answer to a problem using the
binary system and then converts those answers into decimal values before displaying
them.
We know the binary and decimal systems, so let us now look at the other numbering
systems very widely used in digital circuits. These are the octal (base 8) and
hexadecimal (base 16) numbering systems that are both used for the same purpose: to
provide an efficient tool for representing large binary numbers.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Example:
In base 16, we need 16 symbols, so we use the 10 digits plus the letters A to F, that
is to say : 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
Remark:
It must be noted that the choice of digit symbols makes the task much easier, simply
because we are above all used to dealing with the decimal system (10 symbols).
The weight of a digit depends on its position in the number. We use the term positional
representation, that is:
Remark: The formula above gives N in the base in which we are carrying out the
operations (in this case base B). For us, this will generally be the base 10.
A digit is called a ‘bit’ (contraction of binary digit). The bit associated with the lowest
weight in the base is the LSB (Least Significant Bit), and the one associated with the
greatest weight is the MSB (Most Significant Bit)
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
1 1 0 1 1 Binary
1.24 + 1.23 + 0.22 + 1.21 + 1.20
16 + 8 + 0 + 2 + 1 = 2710 Decimal
1 0 1 1 0 1 0 1 Binary
1.27 + 0.26 + 1.25 + 1.24 + 0.23 + 1.22 + 0.21 + 1.20
128 + 0 + 32 + 16 + 0 + 4 + 0 + 1 = 18110 Decimal
You will note that the method consists of finding the weights (the powers of 2) for each
position of the number where there is 1, and then of adding them all up.
You should also note that the Most Significant Bit has a weight of 27 even if it is the eighth
bit; this is because the Least Significant Bit is the first bit and its weight is always 20.
The method that is best suited to small numbers consists of adopting an approach based
on the positional representation in binary code. The decimal number is simply expressed
as a sum of powers of 2, and we then write 1s and 0s opposite the appropriate binary
positions.
Here is an example:
4510 = 32 + 8 + 4 + 1 = 25 + 0 + 23 + 22 + 0 + 20 = 1 0 1 1 0 12
Note that there is a 0 opposite positions 21 and 24, because these positions are not used to
find the sum in question. This is a trial-and-error method.
This method is best suited to large decimal numbers; it consists of repeating the division
by 2.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
This conversion method is illustrated for the number 2510. We use repeated divisions by 2
of the decimal number to be converted. At each division, we obtain a quotient and a
remainder.
It is important to note that the resulting binary number is obtained by writing the first
remainder at the position of the Least Significant Bit (LSB) and the last at the position of
the Most Significant Bit (MSB).
Example:
25 / 2 = 12 Remainder 1 LSB
12 / 2 = 6 Remainder 0
6/2 = 3 Remainder 0
3/2 = 1 Remainder 1
1/2 = 0 Remainder 1 MSB
2510 = 1 1 0 0 12
The conversion of the fractional part is carried out using the reverse operator, that is to say
by multiplication.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
a-1 appears as the integer part of the multiplication of fractional N by b; a-2 is the integer
part of the multiplication of the remainder by b; a-3 is the integer part of the multiplication of
the new remainder by b.
This conversion method is illustrated below for the number 0.37510. We use successive
multiplications by 2 of the decimal number to be converted. We obtain an integer part and
a remainder at each multiplication.
It is important to note that the resulting binary number is obtained by writing the first digit at
the position of the Most Significant Bit (MSB).
Example:
The octal numbering system is a base eight system, which means that it uses eight
possible symbols, that is 0, 1, 2, 3, 4, 5, 6 and 7. So, each digit in an octal number has a
value of between 0 and 7.
…. . ….
83 82 81 80 8-1 8-2 8-3
We convert an octal number into its decimal equivalent by multiplying each octal digit by its
positional weight.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Example:
. . .
3728 = 3 (8²) + 7 (81) + 2 (80)
. . .
= 3 64 + 7 8 + 2 1
= 25010
It is possible to convert a decimal integer into its octal equivalent using the same repeated
divisions method as we used for the decimal-to-binary conversion, but dividing by 8 rather
than by 2.
Example:
266 / 8 = 33 Remainder 2
33 / 8 = 4 Remainder 1
4/8 = 0 Remainder 4
26610 = 4128
Note that the first remainder becomes the Least Significant Bit digit of the octal number
and that the last remainder becomes the Most Significant Bit digit.
If you use a calculator to carry out divisions, the result will be a number with a fractional
part rather than a remainder.
The main advantage of the octal numbering system lies in the ease with which it is
possible to go from an octal number to a binary number.
This conversion is made by transforming each digit of the octal number into its 3-digit
binary equivalent.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In the table below, you can see the eight octal symbols expressed in binary.
Octal digit 0 1 2 3 4 5 6 7
Binary equivalent 000 001 010 011 100 101 110 111
Using this table, you can convert any octal number by transforming each of the digits. For
example, the conversion of 4728 goes like this:
4 7 2
100 111 010
So, the octal number 4728 is equivalent to the binary number 100111010.
The conversion of a binary number into an octal number is quite simply the reverse of the
previous operation.
You just have to make groups of three bits with the binary number, starting from the LSB
digit, then convert these triplets starting from the LSB digit, and finally convert these
triplets into their octal equivalent (see table 1 ‘Octal symbols expressed in binary’).
Sometimes the binary number will not form an exact number of groups of three. In this
case, you can add one or two zeros to the left of the MSB to form the last triplet (if you
read from right to left).
Note that by adding a zero to the left of the MSB you will obtain an exact number of
triplets.
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 13 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The hexadecimal system is a base 16 system, which means that there must be 16
possible digit symbols which, in this case, are the ten digits 0 to 9 plus the upper case
letters A, B, C, D, E and F.
The table below shows the relationship between the hexadecimal, decimal and binary
systems. You can see that the binary equivalent of each hexadecimal digit is a group of 4
bits.
Hexadecimal Decimal Binary
0 0 0000
1 1 0001
2 2 0010
3 3 0011
4 4 0100
5 5 0101
6 6 0110
7 7 0111
8 8 1000
9 9 1001
A 10 1010
B 11 1011
C 12 1100
D 13 1101
E 14 1110
F 15 1111
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
A hexadecimal number can be converted into its decimal equivalent based on the fact that
a weight is assigned to each position of a hexadecimal digit; in this case, the number 16 is
raised to a certain power.
The LSB digit has a weight of 160 = 1, the digit immediately to the left has a weight of
161 = 16, the next digit immediately to the left has a weight of 162 = 256, and so on.
Example:
You may remember that for the decimal-to-binary conversion we used a repetition of
divisions by 2, that for the decimal-to-octal conversion, a repetition of divisions by 8.
So, to convert a decimal number into a hexadecimal number you just have to proceed in
the same way, but dividing by 16 instead.
You will note how the remainders of the divisions become digits in the hexadecimal
number; and also how the remainders greater than 9 are expressed by the letters A to F.
Example:
423 / 16 = 26 Remainder 7
26 / 16 = 1 Remainder 10
1 / 16 = 0 Remainder 1
42310 = 1A716
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Like the octal numbering system, the hexadecimal numbering system serves as an
abbreviated way of representing binary numbers. There is really nothing difficult about
converting a hexadecimal number into a binary number, because each hexadecimal digit
is replaced by its 4-bit binary equivalent (see ‘table of codes’).
Example:
9F216 = 9 F 2
= 1001 1111 0010
= 1001111100102
This conversion is quite simply the reverse of the previous conversion. You divide the
binary number into groups of four bits, and then you replace each group with its equivalent
hexadecimal digit. If necessary, you add zeros to the left to obtain a final group of 4 digits.
Example:
To go from a hexadecimal number to its binary equivalent, you must know the sequence of
4-bit binary numbers (0000 to 1111) and the corresponding number in hexadecimal.
Once this correspondence has become an automatic reflex, you will be able to make the
conversions quickly without any calculations. This explains why the hexadecimal system is
so practical for representing large binary numbers.
When you count using the hexadecimal system, the value in the number's position
increases in steps of 1 from 0 to F.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
When the digit in one position is F, the next digit in that position is 0 and the digit
immediately to the left increases by 1. This is what we can see in the following sequences
of hexadecimal numbers:
1st sequence of numbers: 38, 39, 3A, 3B, 3C, 3D, 3E, 3F, 40, 41, 42
2nd sequence of numbers: 6F8, 6F9, 6FA, 6FB, 6FC, 6FD, 6FE, 6FF, 700
The ease with which conversions between the binary and hexadecimal systems can be
made explains why the hexadecimal system has become an abbreviated way of
expressing large binary numbers. It is not rare in a computer to find binary numbers up to
64 bits long.
These binary numbers, as we will see, are not always numerical values but may
correspond to a certain code representing non-numerical information. In a computer, a
binary number may be:
a real number,
an instruction code,
a group of bits indicating the status of the computer's internal and external devices.
When you have to work with a large number of very long binary numbers, it is a better idea
to write those numbers in hexadecimal rather than in binary.
However, do not forget that digital circuits and systems only function in binary and that it is
purely for the sake of convenience for the operators that we use hexadecimal notation.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The action of making a special group of symbols correspond to numbers, letters or words
is called coding and the group of symbols, a code.
One of the codes you know best is, perhaps, Morse code where we use a series of dots
and dashes to represent the letters of the alphabet.
We have seen that any decimal number can be converted into its binary equivalent. It is
possible to consider the group of 0s and 1s in the binary number as a code that represents
the decimal number.
When you convert a decimal number into its binary equivalent, we say that you are doing
pure binary coding.
Digital circuits function with binary numbers expressed in one form or another during their
internal operations, despite the fact that the outside world is in decimal. This means that
conversions between the binary and decimal systems have to be made frequently.
We know that for large numbers conversions of this type may be very long and laborious.
This is why, in certain situations, we use a coding of decimal numbers that combines
certain characteristics of the binary system and of the decimal system.
This is called Binary Coded Decimal (BCD). If you represent each digit of a decimal
number by its binary equivalent, you obtain this BCD code.
As the highest decimal digit is 9, you will need 4 bits to code the digits.
Example:
Let us take the decimal number 874 and replace each digit with its binary equivalent, this
gives:
8 7 4 Decimal
1000 0111 0100 BCD
Once again, we can see that each digit has been converted into its pure binary equivalent.
Note that we always make 4 bits correspond to each digit.
Of course, only the binary groups 0000 to 1001 are used. BCD code does not use the
groups 1010, 1011, 1100, 1101, 1110 and 1111.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In other words, only ten of the 16 combinations of 4 bits are used. If one of the
"unacceptable" combinations appears in a machine that uses BCD code, it is generally a
sign that an error has occurred.
It is important to realise that BCD code is not a numbering system like octal, decimal or
hexadecimal systems. In fact, this code is the decimal system whose digits have been
converted into their binary equivalent. Furthermore, you must understand that a BCD
number is not a pure binary number. When you code using the pure binary system, you
take the decimal number as a whole and convert it into binary, without splitting it up.
When you code in BCD, each individual digit is replaced by its binary equivalent.
Example:
Let us take the number 137 and find its pure binary number and then its BCD equivalent:
BCD code requires 12 bits to represent the number 137 whereas in pure binary only 8 bits
are needed. You need more bits in BCD than in pure binary to represent decimal numbers
with more than one digit.
As you know, this is because BCD code does not use all the possible combinations of
groups of 4 bits; it is not a particularly efficient type of code.
The main advantage of BCD code lies in the relative ease with which you can go from this
code to a decimal number and vice versa. You only have to remember the groups of 4 bits
for the digits 0 to 9.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
This code is constructed in such a way that the transition from one value to the next only
requires the modification of a single bit. We say that two values that only differ by a single
bit are adjacent.
Natural Reflected
Decimal
Binary Binary
0000 0 0000
0001 1 0001
0010 2 0011
0011 3 0010
0100 4 0110
0101 5 0111
0110 6 0101
0111 7 0100
1000 8 1100
1001 9 1101
1010 10 1111
1011 11 1110
1100 12 1010
1101 13 1011
1110 14 1001
1111 15 1000
In the table above, you can see that two adjacent values are not necessarily side by side
but are always symmetrical with respect to one of the axes.
This code cannot be used to carry out arithmetic operations. However, we will find Gray
code very useful later on for making simplifications on logic functions.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
But Gray code is also very often used in situations where other codes, such as Binary
code, can produce incorrect results at the time of transitions causing a change of several
bits in the code.
For example, in natural binary code when you go from the value 0111 to the value 1000,
the 4 bits change at the same time. But at the level of a real device this situation is virtually
impossible. Several transient states will therefore be generated.
Example:
0111→1111→1011→1001→1000
These transient states may be taken into account and cause the device to function
incorrectly. However, this situation is impossible if you use Gray code because only a
single bit is changed at a time during a transition.
These codes are used in the angular position sensors that are used in servo-control
systems. These sensors may be made up of a light source and a disk on which a pattern is
etched so that photosensitive cells reproduce the desired combination directly.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Natural Reflected
Decimal Octal Hexadecimal
Binary Binary
0000 00 00 0 0000
0001 01 01 1 0001
0010 02 02 2 0011
0011 03 03 3 0010
0100 04 04 4 0110
0101 05 05 5 0111
0110 06 06 6 0101
0111 07 07 7 0100
1000 08 10 8 1100
1001 09 11 9 1101
1010 10 12 A 1111
1011 11 13 B 1110
1100 12 14 C 1010
1101 13 15 D 1011
1110 14 16 E 1001
1111 15 17 F 1000
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Codes of this type are called alphanumerical. A complete set of characters must include
the 26 lower case letters, the 26 upper case letters, the ten digits, the seven punctuation
signs and between 20 and 40 special characters such as +, /, #,%.
It could be said that an alphanumerical code reproduces all the characters and
miscellaneous functions found on a standard computer keyboard.
The best-known and most widely used alphanumerical code is of course ASCII code
(American Standard Code for Information Interchange), which is used in most
microcomputers and mobile phones, etc.
Standard ASCII code (pronounced "aski") is a code on 7 bits, so using it we can therefore
represent 27 = 128 coded elements. This is largely sufficient for reproducing all the usual
letters on a keyboard and the control functions such as <RETURN> and LINEFEED.
The table below gives the standard ASCII code. In this table, we have also given the
hexadecimal equivalent in addition to each character's binary group.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
0..3 0 1 2 3 4 5 6 7
0 NUL DLE Space 0 Nat P ` p
1 SOH DC1 ! 1 A Q a q
2 STX DC2 ‘’ 2 B R b r
3 ETX DC3 # 3 C S c s
4 EOT DC4 $ 4 D T d t
5 ENQ NAK % 5 E U e u
6 ACK SYN & 6 F V f v
7 BEL ETB ‘ 7 G W g w
8 BS CAN ( 8 H X h x
9 HT EM ) 9 I Y i y
A LF SUB * : J Z j z
B VT ESC + ; K Nat k Nat
C FF FS , < L Nat l Nat
D CR GS - = M Nat m Nat
E SO RS . > N ^ n ~
F SI US / ? O _ o DEL
The major shortcoming with ASCII code, when used in Europe, is that it does not include
accented characters. Certain computer hardware manufacturers have modified ASCII
code, replacing certain characters that are not widely used with accented characters.
IBM preferred to add an eighth bit to ASCII code, where the accented characters then
corresponded to codes higher than 128; IBM code, which is used in all PC and compatible
computers, also makes it possible to represent small drawings, some Greek letters and
semi-graphic characters (horizontal and vertical bars, etc.).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
3. BINARY ARITHMETIC
The various arithmetic operations performed in computers and calculators concern
numbers expressed in binary notation. As such, numerical arithmetic can be a very
complex subject, particularly if you wish to understand all the calculation methods and the
theory on which they are based.
Fortunately, technicians do not have to learn the complete arithmetical theory, at least not
until you have become experienced programmers.
In this chapter, we are going concentrate our efforts on the basic principles that will enable
you to understand how computers perform basic arithmetic operations. We will only look at
the representation of integers.
Firstly, we will see how to carry out the binary arithmetic operations by hand, we will then
look at real logic circuits that materialise some of the operations in a digital system.
For positive integers, we will use their equivalent representation in binary. As computers
have finite physical dimensions, there will be a maximum possible number of bits (logic
variables) depending on the machine, which will limit us in the size of the numbers.
In the case of a representation on 8 bits, we can represent 256 values, that is to say the
numbers 0 to 255.
from 0 to 2N-1.
The addition of two binary numbers is just the same as the addition of two decimal
numbers. In fact, binary addition is simpler as fewer cases have to be learned.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
376
+ 431
= 807
We start by adding the LSB column digits, which gives 7. We then add the second column
digits, which gives the sum of 10, that is 0 with 1 carried over to the third column. For the
third column, the sum of the two digits plus the 1 carried over gives 8.
The same rules apply to binary addition. However, only four cases can occur when you
add two binary digits, whatever their column.
0+0 = 0
1+0 = 1
1+1 = 10 = 0 + 1 carried over to the column to the left
1+1+1 = 11 = 1 + 1 carried over to the column to the left
The last case only occurs when, for a given column, we add two 1s plus a 1 carried over
from the column to the right.
There is no point studying additions with more than two binary numbers, because in all
digital systems the adder circuits do not process more than two numbers to be added; they
find the sum of the first two and then add that sum to the third number, and so on.
This isn't really a drawback, because, in general, modern digital machines can complete
an addition in a few nanoseconds.
Addition is the most important arithmetic operation in digital systems. The subtraction,
multiplication and division operations performed by computers are, essentially, simple
variations of the addition operation.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We must define a convention for representing the sign in binary notation, as most
computers process negative numbers as well as positive numbers.
The first solution consists of adding a bit to the number. This is called the sign bit.
The simplest convention consists of assigning 0 state to the positive sign and 1 state to the
negative sign. This convention is known as sign-magnitude representation.
We use the sign bit to indicate whether the memorised binary number is positive or
negative.
Example:
A6 A5 A4 A3 A2 A1 A0
0 1 1 0 1 0 0 = + 5210
Sign bit Magnitude = 5210
A6 A5 A4 A3 A2 A1 A0
1 1 1 0 1 0 0 = - 5210
Sign bit Magnitude = 5210
The numbers reproduced in the example above are made up of a bit sign and six
magnitude bits. The latter correspond to the exact binary equivalent of the decimal value
presented.
Although the magnitude sign notation is direct, computers and calculators do not usually
use it because of the complexity of performing arithmetic operations with this notation. The
two's complement notation tends to be used more in these machines to represent signed
binary numbers.
Before examining how this works, we must see how to obtain the equivalent of a binary
number in one's equivalent and in two's equivalent.
One's complement of a binary number is obtained by replacing each 0 with a 1 and each 1
with a 0. In other words, by complementing each bit in the number.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Example:
One's complement of a number is therefore the inversion of each bit using the NOT logic
function.
Two's complement is very widely used because it is the natural representation of negative
numbers. If we do the subtraction 2-3 we immediately obtain -1 represented in two's
complement.
We are going to see that ‘1111’ is the representation of the number -1 on 4 bits.
Example:
Two's complement of a number is therefore the inversion of each bit by means of the NOT
function, followed by the addition of 1.
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 29 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Here is the value of the number -1 on 4 bits. We start by expressing the number 1 on 4
bits, than we apply the two's complement calculation rule.
Here is how we write signed binary numbers using two's complement notation.
If the number is positive, its magnitude is the exact binary magnitude and its sign bit is a
0in front of the MSB. That is what we can see in the example above for + 4510.
Example :
0 1 0 1 1 0 1 = +4510
Sign bit Exact magnitude
1 0 1 0 0 1 1 = -4510
Sign bit Two's complement
If the number is negative, its magnitude is two's complement of the exact magnitude and
its sign bit is a 1 to the left of the MSB; you can see this in the representation of the
number -4510 above.
Two's complement notation is used to express signed binary numbers because, as we will
see later on, using this notation we can do a subtraction when in reality we do an addition.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
This is important in the case of computers because, using the same circuits, we can do
subtractions and additions.
In many situations, the number of bits is defined by the length of the registers that contain
the binary numbers, hence the need to add 0s to obtain the required number of bits.
Example:
+2 = 00010
11101 One's complement
+ 1 Add 1
= 11110 Two's complement of the digit -2 on 5 bits
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
4. COMBINATORIAL LOGIC
4.1. DEFINITIONS
Boolean algebra is essentially different from ordinary algebra due to the constants and
variables that can only take two possible values: 0 and 1. A Boolean variable is a
magnitude which can, at different moments, take the value 1 or 0.
Boolean variables are often used to represent a system's state. We can say that a light is
either on or off.
We will materialise this by indicating that the light is either at 1 (for on) or at 0 (for off). This
is the same thing with a switch which is either open (0) or closed (1). So the Boolean
values 0 and 1 do not represent real numbers but, rather, the logic state of a variable. In
the area of numerical logic, we use other expressions that are synonymous with 0 and 1.
False True
Off On
Low High
No Yes
Open Closed
By convention, when the active level 1 is greater than level 0 we say that we are using the
positive logic convention, otherwise we say that we are using the negative logic
convention.
Example:
Let us take a binary variable represented by a voltage that can take two values (0V, +5V),
it is possible to define the logic levels as shown in the tables below.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
0V Low 0
+5 V High 1
0V High 1
+5 V Low 0
A logic variable is a magnitude that can only take the two logic states. They are mutually
exclusive.
Boolean algebra is a tool that makes it possible to express the effects that the various
digital circuits have on the logic variables and handle them with a view to determining the
best way of materialising a certain logic function.
Because there are only two possible values, Boolean algebra is more easy to use than
ordinary algebra.
In Boolean algebra, there are no fractions, decimal parts, negative numbers, square roots,
cubic roots, logarithms, imaginary numbers, etc.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The fact that the input variables have a finite number of possible values means that there
are a finite number of functions for a given number of variables.
We are going to start by examining the possible logic functions with one variable and then
with two variables.
By studying these two cases, we will discover all the basic operators in Boolean algebra,
and therefore the logic systems.
One variable, as we have seen earlier on, has two logic states (0 and 1) and enables us to
obtain 4 possible functions with that single variable (22).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Many logic circuits have several inputs but only one output.
A truth table informs us of a logic circuit's reaction (its output value) to various
combinations of logic levels applied to the inputs.
B A X
0 0 ?
0 1 ?
1 0 ?
1 1 ?
C B A X
0 0 0 ?
0 0 1 ?
0 1 0 ?
0 1 1 ?
1 0 0 ?
1 0 1 ?
1 1 0 ?
1 1 1 ?
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
D C B A X
0 0 0 0 ?
0 0 0 1 ?
0 0 1 0 ?
0 0 1 1 ?
0 1 0 0 ?
0 1 0 1 ?
0 1 1 0 ?
0 1 1 1 ?
1 0 0 0 ?
1 0 0 1 ?
1 0 1 0 ?
1 0 1 1 ?
1 1 0 0 ?
1 1 0 1 ?
1 1 1 0 ?
1 1 1 1 ?
In each of these tables, all the possible combinations of 0 and 1 for the inputs (D, C, B, A)
appear on the left, whereas output X's resulting logic level is given on the right. For the
moment there are only "? " in these columns, because the output values are different for
each circuit.
Remark:
Note that in the two-input truth table, there are four lines, in the three-input table there are
eight lines and in the four-input table there are sixteen.
You will have understood that for a table of N inputs, there are 2N lines. Furthermore, you
will no doubt note that the succession of combinations corresponds to the binary counting
sequence, in such a way that all the combinations can be determined directly and that you
cannot forget any of them.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Let us take two independent logic variables, A and B. When we combine A and B by
means of the OR logic function, the result X is expressed using the following expression:
X=A+B
In this equation, the + sign indicates a logical OR. The output function is active if A OR B is
active. The following truth table defines how this operator functions:
A B X=A+B
0 0 0
0 1 1
1 0 1
1 1 1
A two-input OR gate is a circuit whose output is active if one or other of the inputs is
active.
Generally speaking, the output function from an n-input OR gate is active (level 1) if only
one input is active (logic level 1). The output function is inactive (logic level 0) if all the
inputs are inactive (logic level 0).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Let us take two independent logic variables, A and B. When we combine A and B by
means of the AND logic function, the result X is expressed symbolically using the following
expression:
X=A.B
In this expression, the (.) sign indicates the Boolean AND operation, whose operating rules
are given in the truth table below:
A B X=A.B
0 0 0
0 1 0
1 0 0
1 1 1
According to this table, you can easily deduce that the AND logic function corresponds to a
multiplication in binary. When A or B is 0, the product is null; when A and B are at 1, their
product is 1. We can therefore state that in the AND operation the answer is 1 only if all
the inputs are at 1, and that in all other cases it will be 0.
The figure above shows us a two-input AND gate. The output from this gate is equal to the
logic AND of the two inputs, that is to say X = A. B
In other words, the AND gate is a logic circuit that activates its output (logic level 1) only
when all its inputs are active (1). In all other cases, the output from the AND gate is
inactive (logic level 0).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Generally speaking, the output function from an n-input AND gate is active (logic level 1)
only when all the inputs are active (logic level 1).
The output from an AND gate is inactive (logic level 0) if only one of the inputs is inactive
(logic level 0).
The NOT operator, unlike the AND and OR operators, only concerns one input variable.
For example, if variable A is submitted to a NOT operation, the result is given by the
following expression:
X=A
The NOT operation is also called the inversion or complementation operation. A different
sign is used to indicate an inversion: an exclamation mark (!). So:
!A = A
A X=A
0 1
1 0
The figure below shows the symbol used for a NOT circuit, more commonly called
inverter. This type of circuit always has only one input, and its output takes the logic level
opposite to the input's logic level.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In digital systems, there are very often two other types of logic gate: the NOR gate and the
NAND gate.
In fact, these two gates correspond to combinations of basic AND, OR and NOT
operations, and it is relatively easy to describe them using the Boolean algebra functions
that you already know.
In the figure above, you can see the symbol for the two-input NOR gate. You will note that
it is the symbol of an OR gate, but with a little circle at its tip. This little circle corresponds
to an inversion operation. NOR gate operation is therefore similar to that of an OR gate
followed by an INVERTER.
The truth table below shows us that the output from a NOR gate is exactly the reverse of
the output from an OR gate for all the input combinations.
A B X = A+ B
0 0 1
0 1 0
1 0 0
1 1 0
In general, the output function from an n-input NOR gate is only active (logic level 1) when
all the inputs are inactive (logic level 0). The output from a NOR gate is inactive (logic level
0) if only one of the inputs is active (logic level 1).
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 40 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
With De Morgan's theorem, we can show that the NOR gate is equivalent to:
W = A+ B = A×B
You can see that this is the symbol for an AND gate, but with a little circle at its tip.
Once again, this little circle corresponds to an inversion operation. NAND gate operation is
therefore similar to that of an AND gate followed by an INVERTER.
A B X = A× B
0 0 1
0 1 1
1 0 1
1 1 0
The truth table above shows us that the output from a NAND gate is exactly the reverse of
the output from an AND gate for all the input combinations.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In general, the output function from an n-input NAND gate is only active (logic level 1) if
only one input is inactive (logic level 0). The output from a NAND gate is inactive (logic
level 0) only when all the inputs are active (logic level 1).
With De Morgan's theorem, we can show that the NAND gate is equivalent to:
X = A× B = A + B
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
There are two special logic circuits, which are often used in digital systems: the exclusive
OR circuit and the exclusive NOR circuit.
The output from an Exclusive OR gate is high only when the two inputs are at different
logic levels. Exclusive OR gates always have two inputs only. By that, we mean that
Exclusive OR gates with three or four inputs do not exist.
A B X = A⊕ B
0 0 0
0 1 1
1 0 1
1 1 0
In general, the output function from an exclusive OR gate indicates the difference between
the two input signals. The output is active (logic level 1) if the inputs have different logic
states.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The operation of an exclusive XNOR circuit is the exact opposite of that of an exclusive
OR circuit. The output from an Exclusive XNOR gate is at its high level only when the two
inputs are at the same logic levels.
A B X = A⊕ B
0 0 1
0 1 0
1 0 0
1 1 1
In general, the output from an exclusive NOR gate indicates that the two input signals are
equal. The output is active (logic level 1) if the logic state of the two inputs is identical.
The exclusive NOR operator has a special property. The output inversion can be applied
to one or other of the inputs, that is to say:
A⊕ B = A ⊕ B = A⊕ B
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
IO
YES
00
I=O
11
NO IO
01
O=I 10
abO
AND
000
010
O=a.b
100
111
abO
OR
000
011
O=a+b
101
111
abO
NAND
001
011
O = a×b 101
110
abO
NOR
001
010
O =a+b 100
110
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
abO
Exclusive OR
(EXOR) 000
011
O = a⊕b 101
110
abO
Exclusive NOR
(EXNOR) 001
010
O = a⊕b 100
111
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Any logic circuit, whatever its complexity, can be described by means of the Boolean
operations that have already been described, because the AND gate, OR gate and NOT
gate are the basic component circuits of digital systems.
By using the Boolean expression for each of the gates, we can easily find the equation
corresponding to the output.
Example:
This combination is an input to the OR gate, whose other input is the signal C.
The effect of the latter gate is to add its inputs logically, which gives the output expression:
X = A. B + C (this equation could also have been written X = C + A. B, because the order
of the terms in an OR function is immaterial).
This rule for determining the order of the operations is the same as the rule used in
ordinary algebra.
Figure 9: Example of a logic circuit where the expression of the output is in brackets
Here is another example, the result of the OR gate is simply A + B. The output from this
gate is sent to the input of the AND gate, and the latter's other input receives signal C.
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 47 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
You can see that by using brackets you can indicate that the OR operator applies first of
all to A and B.
The AND operator is then applied to the output from the OR gate and input C.
Whenever you have an INVERTER in the diagram of a logic circuit, its equation is simply
the expression of its input with a line above it.
Examples:
In this example, input A passes through an INVERTER whose output is A . This output
from the inverter is joined together with B in an OR gate, so that the output equation from
this gate is equal to A + B
Figure 11: Example with an inverter on the output from the OR gate
In this example, the output from the OR gate equals A + B, and this output is fed into an
INVERTER. Output X from the latter therefore becomes ( A + B) , because the complete
expression is inverted.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
For example, if you need a circuit such that X = ABC, you immediately know that you need
a three-input AND gate. The reasoning that we used for these simple cases can be
extended to other more complex circuits.
Example:
This Boolean expression consists of three terms ( AC , BC , A BC ) which are added together
logically. From this we can deduce that we need an OR gate with 3n inputs to which the
AC, BC, ABC signals are applied respectively.
Each input to the OR gate is a logic product, which means that we needed three AND
gates fed by the appropriate inputs to produce these terms.
From this, we can therefore easily deduce the logic circuit that we will have to make.
Figure 12: Example of the construction of a logic circuit deduced from a Boolean
expression
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We have seen how Boolean algebra can be used to analyse a logic circuit and express
that circuit in mathematical form. We are going to start with the two postulates governing
BOOLEAN algebra.
5.9.1. Postulates
A× A = 0
These two postulates materialise the fact that the inverse of a variable can never take the
same value as the variable.
We will see later on that a violation of these postulates is possible at the time of the
transient states in the circuits.
This violation may cause random behaviour on the functions that depend on those
variables.
Boole's theorem is a rule that makes it possible to simplify logic expressions and, at the
same time, logic circuits.
According to the following theorems, X is a logic variable that takes either the value 0, or
the value 1:
X ×0 = 0
X ×1 = 1
X×X = X
X×X =0
X +0 = X
X +1 = X
X+X =X
X + X =1
Before introducing you to Boole's other theorems, we must mention that in the theorems
above, the variable X may correspond to an expression that includes more than one
variable.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
For example, if we have AB( AB), we can say that, by posing X = AB and according to the
theorem, the equation is equal to 0.
Theorem No. 1: X + Y = Y + X
Theorem No. 2: X . Y = Y . X
Theorem No. 3: X + ( Y + Z ) = (X + Y) + Z = X + Y + Z
Theorem No. 5: X ( Y + Z ) = XY + XZ
Theorem No. 6: ( W + X ) . (Y + Z ) = WY + XY + WZ + XZ
Theorem No. 7: X + XY = X
Theorem No. 8: X + XY = X + Y
Theorems 1 and 2 show that AND and OR are commutative composition laws
(commutativity), so the order of the multiplication or logic addition of the two variables is
immaterial, the result will be the same.
Theorems 3 and 4 show that AND and OR are associative composition laws
(associativity), which means that we can group together, in any way we want, the
variables in a multiplication or logic addition expression.
Theorems 5 and 6 show us that the logic multiplication is distributive with respect to the
logic addition, that is to say we can develop an expression by multiplying it term by term,
just like in ordinary algebra. This theorem also demonstrates that an expression can be
factorised. By that, we mean that if we have a sum of terms, each of which includes a
common variable, it is possible to factorise that variable, just as you can in ordinary
algebra.
Theorems 1 to 6 are easy to remember because they are identical to those in ordinary
algebra. But theorems 7 and 8, however, are not found in ordinary algebra. They can be
demonstrated by verifying all the possibilities of X and Y.
All these theorems are extremely useful for simplifying a logic expression, that is to say to
obtain an expression with fewer terms. The simplified expression makes it possible to
make a circuit that is less complex than the one corresponding to the original expression.
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 51 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We owe two of the most important theorems in Boolean algebra to the mathematician De
Morgan. De Morgan's theorems are extremely useful for simplifying expressions that
include sums or products of complemented variables.
1st theorem: ( X + Y ) = X × Y
2nd theorem: ( X × Y ) = X + Y
De Morgan's 1st theorem states that the complemented logical sum of two variables is
equal to the logical product of the complements of those two variables.
Likewise, the 2nd theorem stipulates that the complemented logical product of two
variables is equal to the logical sum of the complements of those two variables.
These two theorems can be demonstrated simply by verifying all the possibilities of X and
Y.
Although these theorems were formulated for the simple X and Y variables, they remain
equally true for the cases where X and Y are expressions including several variables.
( AB + C ) = ( AB ) × C
The result you obtain can be simplified once more, because there is still a complemented
logical product. By virtue of the 2nd theorem, we obtain:
AB × C = ( A + B) × C
AB × C = AC + BC
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We can say that these logic circuits are combinatorial because at any moment the logic
level collected at the output only depends on the logic levels applied to the inputs.
A combinatorial circuit does not have any storage mechanism (memory); consequently, its
output only reacts to the signals present at its inputs.
In this chapter, we are therefore going to study combinatorial circuits. Firstly, we are going
to place the accent on the simplification (minimisation) of circuits. To do this, we are going
to use two methods:
Karnaugh maps.
The methods for simplifying and designing logic circuits that we are going to examine
mean that we have to express the logic equations in the form of a sum of products, some
examples of which are given here:
ABC + ABC
AB + A BC + C D + D
A B + CD + EF + GK
Each of these three expressions of a sum of products is made up of at least two terms of a
logical product (AND term) in relation with the OR operator.
Each AND term includes one or more variables expressed in its normal form or in its
complemented form.
For example, in the sum of products ABC + A BC , the first logical product consists of the
non-complemented variables A, B and C, whereas the second product includes the non-
complemented variable B and the complemented variables A and C. You must note that in
a sum of products, the complementation sign cannot be placed above more than one
variable in a term (for example, you cannot have ABC ).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Once you have the expression of a logic circuit, it may be possible to minimise in order to
obtain an equation counting fewer terms or fewer variables per term.
This new equation can then serve as a model for constructing a circuit that is entirely
equivalent to the original circuit but which requires fewer gates.
We have simplified the first circuit, given that they produce the same logical decisions. It
goes without saying that the simpler circuit is preferable because it has fewer gates; it is
also smaller and less costly to produce.
In the following chapters, we will see two different ways of simplifying logic circuits. The
first way is based on the application of Boolean algebra theorems; this way, as we will see,
depends very greatly on instinct and experience.
The other way (Karnaugh maps), on the contrary, follows a systematic approach, similar to
a recipe.
The Boolean algebra theorems studied in the previous chapter can be of great help for
simplifying the expression of a logic circuit. Unfortunately, it is not always easy to know
which theorems you should use to obtain the best result. Furthermore, there is nothing to
say that the simplified expression is in its most minimised form and that there are no other
possible simplifications.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Example:
Z = ABC + AB ( A C )
Z = ABC + AB + AB C
Z = AC ( B + B ) + AB : Simplification by factorisation
Z = AC (1) + AB
Z = AC + AB
Frequently, the expression of requirements for a logic circuit to be designed is given in text
form (e.g. a functional analysis). This form cannot be used to determine a circuit's
equation. The truth table is used to specify how the circuit operates.
This first phase corresponds to the circuit's design. The following steps will allow us to
determine the logical diagram. This then concerns the reinitialisation steps.
The first design step will be seen in the exercises. Here, we are going to give all the
development steps allowing us to go from the circuit's truth table to its logic diagram.
The truth table specifies the output's logic level for each combination of inputs. We can
then determine the circuit's Boolean expression from this truth table.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Here is the general procedure that brings us to the expression of the output from a truth
table:
For each case in the table that gives 1 as output, we write the logical product (AND
term) that corresponds to it.
We must find all the input variables in each AND term either in direct form or in
complemented form. In one particular case, if the variable is 0, then its symbol is
complemented in the corresponding AND term,
We then logically sum (OR operator) all the logical products obtained, which gives
the definitive expression of the output.
The truth table enables us to establish the expression of the output in the form of a sum of
products. It is then possible to construct the circuit using AND, OR and NOT gates. You
need an AND gate for each logical product and an OR gate whose inputs are the outputs
from the AND gates.
Generally, it is possible to simplify the expression obtained. The goal is to make the
simplest circuit possible. It will be cheaper and often faster!
Example:
N° C B A X Minterm equation
0 0 0 0 0
1 0 0 1 0
2 0 1 0 1 CB A
3 0 1 1 1 C BA
4 1 0 0 0
5 1 0 1 0
6 1 1 0 0
7 1 1 1 1 CBA
In this example, we can see that there are three combinations that produce a value 1 for
output X. The AND terms for each of these combinations are given on the right of the truth
table. We use the term minterm equation for this.
The complete expression is obtained by doing logic ORs for these three minterms, which
gives us:
X = C BA + C BA + CBA
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We can write this logic expression in a compact form by indicating only the number of the
minterms that are at 1, that is:
X = ∑ 2,3,7
We now have a non-simplified logic equation. The first solution is to use Boolean algebra
to look for the simplest expression. This requires a great deal of experience and practice.
But there is an effective graphic method: the Karnaugh map.
The Karnaugh map is a graphic tool that makes it possible to simplify a logic equation in a
methodical way. We can then obtain the optimum diagram corresponding to the
combinatorial logic circuit.
Although the Karnaugh maps can be used for problems with any number of input
variables, in practice, they are not particularly useful when there are more than 6 variables.
In addition, in this section of the course, we are not going to look at problems with more
than four inputs.
Cases of circuits with five or six inputs pose major problems. Above that, it is advisable to
solve Karnaugh maps with a computer programme.
Just like the truth table, the Karnaugh map is an instrument that evidences the
correspondence between the logic inputs and the output you want to obtain.
The figure below shows us three examples of Karnaugh maps for two, three and four
variables, along with the corresponding truth tables.
B A X
0 0 1 BA B
0 1 0 A 0 1
1 0 0 0 1 0
1 1 1 BA 1 0 1
Figure 14: Example of a truth table with its associated Karnaugh map
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The truth table gives the value of the output X (figure on the left), but the Karnaugh map
organises the information in a different way. For each line of the truth table, there is a
corresponding box in the Karnaugh map.
But the boxes in the Karnaugh map are not in the same order.
For example, in the figure above, the truth table's B A = 0 0 line corresponds to the box
situated at the intersection of B = 0 and A = 0 in the Karnaugh map.
B A X
0 0 1 BA B
0 1 0 A 0 1
1 0 0 0 1 0
1 1 1 BA 1 0 1
Given that for this line X equals 1, we write 1 in this box. Likewise, we associate the box
whose coordinates are B = 1 and A = 1 with the B A = 1 1 line. As X equals 1 in this case,
we will find 1 in that box.
The construction of the Karnaugh map guarantees that only one variable changes
between two adjacent boxes.
Example:
In the table below, we are going to see the case of the box situated at the intersection of
C B = 1 1 and A = 0 which corresponds to the minterm = CBA
C B A X CB
0 0 0 1 CBA A 00 01 11 10
0 0 1 1 C BA 0 CBA CB A CB A CBA
0 1 0 1 CB A 1 C BA C BA CBA C BA
0 1 1 0
1 0 0 0 CB
1 0 1 0 A 00 01 11 10
1 1 0 1 CB A 0 1 1 1 0
1 1 1 0 1 1 0 0 0
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We can therefore see another property of the Karnaugh map, each box has as many
adjacent boxes as there are variables.
6.5.2. Group
CB
A 00 01 11 10
0 0 1 0 0
1 0 1 0 0
The example above reproduces the Karnaugh map corresponding to a certain truth table
with three variables. In this map, there are two vertically adjacent 1s.
These two terms can be grouped (combined), which results in the variable A being
eliminated.
The same principle always applies for any vertically or horizontally adjacent pairs of 1s.
The top line is considered to be adjacent to the bottom line, and ditto for the leftmost
column and the rightmost column.
We can simplify variable A using Boolean algebra. The logic equation of the grouping
corresponds to the logical sum of the two minterms, that is:
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
DC
BA 00 01 11 10
00 0 0 0 0 CB
01 0 0 0 0 A 00 01 11 10
11 1 1 1 1 0 0 0 1 1
10 0 0 0 0 1 0 0 1 1
a) X = BA b) X = C
DC DC
BA 00 01 11 10 BA 00 01 11 10
00 0 0 0 0 00 1 0 0 1
01 0 1 1 0 01 0 0 0 0
11 0 1 1 0 11 0 0 0 0
10 0 0 0 0 10 1 0 0 1
c) X = CA d) X = C A
A Karnaugh map may contain four adjacent 1s. The figure above shows several examples
of groups of four.
In a), the four 1s are adjacent horizontally, whereas in b), they are adjacent vertically.
The table in c) has four 1s arranged in a square that are considered to be adjacent to each
other.
The 1s in d) are also adjacent because, as we have already said, in a Karnaugh map, the
top and bottom lines and the right and left columns are considered to be adjacent.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
When eight adjacent 1s are grouped together, we say that there is a group of eight. In the
figure below, we can see two examples of groups of eight. A group of eight in a Karnaugh
map with four variables gives rise to the elimination of three variables.
DC DC
BA 00 01 11 10 BA 00 01 11 10
00 0 0 0 0 00 1 0 0 1
01 1 1 1 1 01 1 0 0 1
11 1 1 1 1 11 1 0 0 1
10 0 0 0 0 10 1 0 0 1
a) X = A b) X = C
We have just seen how groups of two, four and eight adjacent 1s in a Karnaugh map lead
to a simplified expression.
It is clear that the more 1s that are grouped together, the greater the number of variables
eliminated will be. More precisely, a group of two 1s causes the elimination of one
variable, a group of four 1s, the elimination of two variables and a group of eight 1s, the
elimination of three variables and so on.
The group of 2n 1s makes it possible to simplify n variables. Here are the steps for
simplifying a Boolean expression using the Karnaugh maps method:
Draw the Karnaugh map and place the 1s in the squares corresponding to the lines
in the truth table whose output is 1. Place a 0 in the other squares,
Examine the Karnaugh map and identify the possible groups. Find the largest ones,
Then start by circling the so-called isolated 1s that belong to a single group. That
means that for those 1s, there is only one grouping possibility,
Then continue to take the largest groups that include 1s (a single one at least) that
do not belong to another group,
You must take all the 1s in the Karnaugh map. It is permitted to use the same 1
several times,
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 61 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Perform logic ORs between all the terms resulting from the groupings.
Certain logic circuits can be designed for certain combinations of inputs that do not
correspond to any particular logic state for the output. The main reason is often that these
combinations of inputs will never occur. In other words, there are certain combinations of
inputs for which it does not really matter whether the output is HIGH or LOW.
Example:
CB
C B A Z A 00 01 11 10
0 0 0 0 0 0 0 1 X
0 0 1 0 1 0 0 1 1
0 1 0 0 Z=A
0 1 1 X
1 0 0 X CB
1 0 1 1 A 00 01 11 10
1 0 0 1 0 0 0 1 1
1 0 1 1 1 0 0 1 1
In this table, none of the states of output Z is present for the combinations C B A = 100
and C B A = 0 1 1. On the contrary, we have written an X. This X means a "don't care"
condition.
There are several reasons that can explain the presence of "don't care" conditions, the
most common being that, in certain situations, these input combinations can never occur
and so there is no point indicating an output value for those combinations.
In the presence of "don't care" conditions, we must indicate which output X is replaced by
a 0 and which X is replaced by a 1. The choice is given by looking for the most efficient
way of grouping together the adjacent 1s in the Karnaugh map. The goal is to obtain the
simplest expression.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
When the problem to be solved includes more than four or five inputs, the methodology
using the truth table and the Karnaugh map no longer applies.
We have seen that the use of Karnaugh maps is limited to 4 or 5 variables. It will also be
difficult to establish a truth table when the number of inputs is high. If we have a system
with 10 inputs, the truth table will have 1024 lines! We must therefore adapt our
methodology.
It will be a question of breaking our problem down. We must be capable of identifying sub-
functions.
We then need to examine the main standard combinatorial functions. These functions are
also called MSI functions for ‘Medium Scale Integration’. These are functions that are more
complex than simple logic gates.
These functions were very quickly integrated into circuits in the TTL and CMOS families.
They have the advantage of being less costly in the form of an electronic circuit. The most
commonly used functions have been integrated.
multiplexing (MUX)
decoding (X/Y)
priority encoder
comparator (COMP)
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
6.7. MULTIPLEXER
A multiplexer is a combinatorial system that puts its only output at the value of one of its 2n
data inputs, the number of the selected input being provided on the n command inputs.
Here we show the truth table for a 2 to 1 multiplexer, its logic diagram and the IEC
symbols for this function:
compact TDV
Sel Output
0 In0
1 In1
Figure 19: The multiplexer, its truth table, logic diagram and symbol
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Figure 20: The diagram for circuit ALS157 containing four 2 to 1 multiplexers, IEC symbol
Note that we have 4 multiplexers with the same command block in the standard circuit
(74ALS157). Multiplexers are symbolised by superimposed rectangles, with the first one
marked MUX.
The command block is shown as a rectangle with notches on top of 4 blocks. An additional
EN (ENable) input appears. The output from multiplexers is only active if the EN input = 1,
which is equivalent to saying that terminal 15 is at its low level.
In the multiplexing block, the input marked 1 indicates that the output takes the value of B
if the selection input G1, terminal 1, takes the value 1 (high level). Input A will be taken into
account for G1 = 0. The numbers in brackets are the numbers of the circuit's terminals.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
6.8. DECODER
A decoder is used to identify which combination is active. It includes an input with n bits to
be decoded (selection), a validation input (enable), and 2n outputs. The output whose
number corresponds to the coded value given at input will be active if the enable is active.
All the other outputs are inactive. The decoder only has one active output at a time.
You will see that decoders often have low active outputs.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The figure below shows a 2-to-4 decoder. The selection signal is comprised of 2 bits.
There will then be 4 outputs because there are 22 possible combinations for the selection.
This decoder also has an activation signal (enable). When it is inactive (logic state 1, low
active), all the outputs are inactive (state 0). When the authorisation signal (enable) is
active, the output corresponding to the selection code is active.
EN Sel1 Sel0 Y3 Y2 Y1 Y0
0 X X 0 0 0 0
1 0 0 0 0 0 1
1 0 1 0 0 1 0
1 1 0 0 1 0 0
1 1 1 1 0 0 0
Here is a decoder with 3 selection bits, it makes it possible to decode the 8 combinations
of a 3-bit vector.
In circuit ALS138, activation of the outputs depends on EN, which is the result of AND
between the inputs ( G1, G 2 A, G 2 B ).
EN = G1 × G 2 A × G 2 B
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
6.9. COMPARATOR
The function for making a comparison between two binary numbers is very frequently
used. A comparator is a circuit that indicates whether two binary numbers are higher,
equal or lower. In the case of a modular circuit, there are three inputs in order to determine
whether the previous bits are higher, equal or lower.
Figure a) below gives us the IEC symbol of an "equals" comparator with the ‘=’ input for
the chaining.
Figure b) gives us the IEC symbol of a 4-bit modular comparator with the three ‘<’, ‘=’, ‘>’
outputs.
The function for comparing N bits can be broken down with several 1-bit comparators.
This breakdown may be done in series or in parallel; the figure below shows us the series
breakdown of the comparison.
This breakdown requires less in terms of hardware, but the propagation time through the
complete comparator is longer.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The figure above shows the parallel breakdown of the comparison. Each bit is compared
then an AND gate calculates the result. This breakdown requires an AND gate with N
inputs.
The advantage is that you will have a much shorter propagation time, i.e.:
tp COMPn = 1 × tp COMP1 + tp ET
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
7. ELEMENTARY MEMORIES
Until now, the systems studied were combinatorial systems, that is to say that
there is one and one only combination of output variables for each combination of
input variables. Combinatorial logic quickly reaches its limits and not many systems that
use this method. Indeed, in most cases it is difficult to keep the combination of input
variables corresponding to one action.
Let us take the simple case of a bench-mounted drill: in combinatorial logic, in order to
make the spindle rotate, the operator must keep the "spindle rotation" pushbutton held
down, otherwise the spindle will stop rotating. He will therefore not be able to hold the
part to be drilled and lower the drill to carry out the drilling operation.
To overcome this problem, we simply need the machine "to remember" that the spindle
rotation button has been pressed, in other words the machine must have a memory
function.
A logic system based on the utilisation of the memory function introduced here will be
called sequential logic.
We propose here to look for the logical diagrams of a sequential circuit with two inputs and
one output.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Furthermore, we assume that the time separating two consecutive changes of state of
R and of S is longer than the memory's overall response time.
A sequential circuit is in a stable state when all of that circuit's component parts are
themselves in a stable state. This state will be characterised by a perfect knowledge of:
From here on, we will identify a stable state with a letter or number (arbitrary) in a
circle.
During this time t the circuit is no longer in a stable state because it is in the process of
changing: it is said to be in a transient state. From here on, we will identify them with a
non-circled letter or number, which characterises the stable state towards which the
change will be made.
the possible stable phases are numbered in turn, with each number circled.
links, joining these different phases, indicate the possible transitions from one
stable phase to the other. The transition direction is indicated by an arrow,
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We write:
close to each circle, the combination of input stable states and the
corresponding state (or states) of the output function,
after each link, the combination of input variables that cause and characterise the
transition;
We give it a shape that reveals the possible symmetries to the best. The diagram of our
problem's stable states will therefore be as follows:
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
This is in fact a table with the same presentation as the Karnaugh maps. It is constructed
in the following way:
The number of columns is equal to the number of combinations that can be made
with the independent input variables at your disposal (primary variables).
The number of lines is equal to the number of stable phases to which the problem
posed leads.
Each stable phase is entered in the chronological order of occurrence in the column
corresponding to the combination of primary input variables that gave rise to it.
Each unstable phase (transient) preceding each stable phase is entered in the
same column as the phase following it, on the previous line.
RS
00 01 11 10 Q
c 2 - 4 0
3 d 5 or 6 - 1
e 2 - 4 1
1 - 5 or 6 f 0
- 2 g 4 0
- 2 h 4 1
In this primitive matrix we can see that for the combination R S = 0 0 output Q may be
equal to 1 (line 3) or equal to 0 (line 0).
In order to differentiate between these two lines, input variables R and S alone are
insufficient; to do this we need to introduce a secondary variable (or internal variable).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In this first case, we do not take into account line 6 (R S = 1→ Q = 1), and we only keep
lines 1, 2, 3, 4 and S.
We can only merge two lines if they do not have a stable state in the same column.
The secondary variables are encoded by taking as value for Q's unstable states the same
value as that of the corresponding stable state.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In this second case, we do not take into account line 5 (R S = 1 1 -> Q = 0), we only keep
lines 1, 2, 3, 4 and 6.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
R S Qn Remarks
0 0 Qn-1 Memory state
0 1 1 Set to 1 (S = Set)
1 0 0 Reset to 0 (R = Reset)
1 1 -
By prohibiting the use of this combination for inputs R and S, we have a single implication
table for the RS memories.
Furthermore this combination may pose problems if we attempt to pass directly from the
latter to the combination R S = 0 0, we arrive at a random type of memory operation.
In fact it will then be impossible to know the state of output Q (Q can equal 1 or 0) because
two variables cannot simultaneously change state, there will always be one that changes
state before the other, but which one?
Remark:
Given their drawbacks, RS memories are not commercialised, however RS memories are
found (usually called a "latch"), the most common application of this memory being the
anti-bounce circuit.
R S Q1n Q2n
0 0 - -
0 1 0 1
1 0 1 0
1 1 Q1n-1 Q2n-1
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Example:
Let us examine what happens when we close a switch (end-of-travel sensor, etc.).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
As column tn indicates Q's state just after the command edge of clock T (or H), we have
the following implication table for the synchronous RS memory:
tn-1 tn
T (or H) R S Qn
0 φ φ Qn-1
0 0 Qn-1
0 1 1
1 0 0
1 1 -
Prepare the R and S commands without disturbing the memory (T = 0) and only
validate them at the desired moment (T = 1).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
For T = 1: the inputs are sensitive to disturbances but because they must be
sensitive to the command signals, this situation is inevitable.
The memory stores anything when T varies at the same time as R and/or S.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
tn-1 tn
T (or H) D Qn
0 φ Qn-1
0 0
1 1
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
8. FLIP-FLOPS
The memorisation of information is an essential, but not sufficient, operation in all
processing systems (measuring apparatus, computer, etc.). Besides counting (pulses) we
want to copy at the rate of a clock (levels 1 and 0), transmit in series on a wire (and at
precisely known instants) information stored in parallel permanently in a memory.
In any case, we need a periodic clock and a single item of information per period to enable
the receiver to recognise the items of information without any ambiguity. But when the
clock equals 1, RST (or RSH) and DT (or D latch) memories are sensitive to disturbances
that may cause a modification of the transmitted information.
To make up for this drawback, the solution is to open the emitting memory's input for a
time just sufficient to allow it to enter the information to be transmitted during the following
clock period and close it during the rest of the period. This brings us to three solutions,
including the circuits called flop-flops:
Reduce the time during which we have T = 1 at the minimum value and at the limit,
for the length of one edge,
Make a transmitter circuit that is not sensitive to T's level 1s but, rather, to its edges
(either rising or falling but not to both types),
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
8.1.2. Operation
Let us suppose we have the following initial state: R = S = 0; T = 0 and Q = O. From that
state, let us place inputs R and S in such a way that R = 0 and S = 1.
For T = 0, nothing changes at the output from the system, indeed the "master" memory is
isolated from its outputs; consequently outputs Qm and QM cannot take another value,
whereas the inputs of the "slave" memory, although it is active (T = 0 -* T2 = 1), do not
change state.
When T = 1, the "slave" memory is isolated from its inputs and therefore Q remains equal
to 0; however as the "master" memory becomes active it stores the variations of R and S
leading to Qm = 1 and Qm = 0. This state remains stable as long as T = 1 and that inputs
R and S do not change state.
We have seen that the RST or DT memories are open to disturbances as long as signal T
is at 1, and during that time any variation in the inputs makes the state of the outputs
change.
"Master-slave" operation improves the situation slightly because any disturbance occurring
at the inputs when T is at 1, does not make the output change but it is stored in the
"master" memory and appears at the output as soon as T switches to 0.
Therefore, the longer the time we have T 1, the greater the risk of receiving disturbances.
So we have thought of shortening this time as much as possible and, as the shortest time
is the time of an edge, we arrive at the solution of flip-flops operating on the edges (rising
or falling) of clock T.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The flip-flop stores the information present on its inputs at the time of the clock's active
edge and then it blocks itself, and its output displays the stored information.
This is a delayed action system: the information is taken into account at the instant of the
clock's rising edge, but the output only delivers the information when the clock returns to
its 0 level.
The "master" memory has a self-blocking system that allows it to operate on the clock's
active edges (rising), the "slave" memory – locked when T = 1 – copies the memory's state
when T = 0.
It can be locked either when T = 1 and open when T = 0 (case of commercially available
flip-flops), or a flip-flop that operates on the falling edge which copies the "master's" state
at the time of this falling edge (not currently available commercially).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
A modulo n counter is a system which, under the action of input signals (clock), can
successively occupy n different stable states.
To obtain the counting function (modulo-2 counter) you just have to wire the inputs so that
S=Q and R–Q.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The output only takes into account one item of information per clock pulse.
8.2.2. D flip-flop
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
REMARK:
The rising edge triggered D flip-flop also makes it possible to perform the counting
function; you just have to connect input D to output Q to obtain this function.
8.2.3. JK flip-flop
The "master-slave" RST flip-flop can be used to perform the counting function, but then it
cannot perform any other function because, in that configuration, it does not have any
other available inputs.
By modifying the input circuit it is possible to have other accessible inputs, while keeping
the counting function, you then have a new type of flip-flop, called a JK flip-flop.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Although the JK flip-flop is derived from the "master-slave" RST flip-flop, it is not
necessarily "master-slave", in fact the JK flip-flop is commercialised not only for "master-
slave" operation but also for edge triggered (rising or falling) operation and "data look out"
operation.
The operating mode does not change in any way the effect of inputs J and K on outputs Q
and –Q, only the moment when the result appears changes.
Consequently, we can give a single implication table that is suited to the different types of
JK flip-flop.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
A shift register consists of n flip-flops. It can therefore store n bits of information. These
flip-flops are interconnected in such a way that the logic state of the rank i flip-flop is
transmitted to the rank i+1 flip-flop when the clock signal is applied to the system.
The information present in the last flip-flop of such a register is always physically
accessible. This is the output from the shift register.
Series input: the information is presented bit-by-bit to the input of the first flip-flop
and is introduced there at each clock pulse. At the same time, the clock's state is
transmitted to the next flip-flop. This operating mode makes it possible, among
other things, to make the digital delay line. This type of shift register is said to have
a series input and output.
Parallel input: the n-bit information is introduced in a single go into the shift
register, which is necessarily made up of n stages. To do this we have access to
the input of each flip-flop making up the register. Generally, an inhibit gate will be
used to make the transfer and ensure the isolation required between the register
and the exterior once the transfer has been made. This register is said to have a
parallel input and series output. This type of register is used in the parallel-series
transformation. Lastly, we can design an output parallel; to achieve that, the
outputs from the register's flip-flops must simply be accessible.
a clock input which, in shift mode, will push the binary information from one
flip-flop to the next.
a loading/shift input.
a "series data" input that introduces information bit after bit into the first flip-flop.
And lastly, the output from the register, which is the last flip-flop; access to the
outputs from intermediate flip-flops also being possible to ensure a parallel output.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
A modulo N counter is a system with N stable states that can go from one to another under
the influence of pulses applied to its input.
Remark:
The rank n-1 flip-flop will be connected to the rank n flip-flop in the following way:
If the flip-flops used are flip-flops that act on the rising edge, then output from the
rank n-1 flip-flop will be connected to input T (or H) of the rank n flip-flop.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
It is easy to make the transformation from a counter into a down-count counter: in the case
of falling edge triggered or master-slave flip-flops, you just have to apply to the flip-flops’
clock inputs (T), instead of to outputs Q, the signals from outputs Q. In the case of rising
edge triggered flip-flops, you apply outputs Q to the clock inputs (T) instead of outputs Q.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
An incomplete-cycle counter must "skip" all the unwanted states; these may be
consecutive, for example 10, 11, ..., 15 for a decimal counter (making a decade in BCD),
or disjointed for signal generators.
Although short-lived, state 10 (transient state) exists, which means precautions must be
taken when analysing the counter's states.
Equation F for the combinatorial resetting circuit will be given in the following Karnaugh
map (Be careful! The flip-flops' reset input is active on a low):
BA
DC 00 01 11 10
00 1 1 1 1
01 1 1 1 1
11 X X X X
10 1 1 X 0
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
F = BD
REMARK:
The lengths of the RESET and Set to One actions are quite dispersed; as soon as one flip-
flop changes state before the others, the output signal from the RESET and Set to One
decoder changes state and no longer acts on the other flip-flops which have not yet
changed state. It is it is therefore necessary to place a delay r on the output from the
decoder to maintain the RESET or Set to One signal for a sufficient length of time.
Drawbacks
If you look at how an asynchronous counter acts just after the command pulse
edge, you will see that each flip-flop (except the first one) must wait for the one
preceding it to have changed state so that it can, where applicable, change state
itself. Consequently, the switching times are added to each other, which limits the
counter's operating speed.
Transient states
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The propagation of the flip-flop trigger signals, such as is required in this type of
counter, causes transient states that are undesirable because they are present for a
non-negligible lapse of time.
For this, we have assumed that each flip-flop has the same response time: tr.
In this particular case, the time required by the counter to stabilise at its final value
(1000) is 4 tr and, even more seriously, it passes through successive error states
that it keeps for time tr (of the order of 20 ns for a fast flip-flop). This represents a
prohibitive drawback when the counter is used by fast devices.
A good example is address decoding which, as it uses fast circuits, would make
stray decodings correspond with each intermediate state.
Advantages
Speed
It could be assumed that the operating speed is only limited by the maximum
frequency that the first flip-flop can receive. But this advantage is limited by the
counter's stabilisation time if you have to use all or some of its states.
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 95 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In a synchronous counter (or a down-count counter), the flip-flops that must change state
do so at the same time, triggered by an active edge of a clock pulse.
Combinatorial circuits provide the inputs (D and JK) of each of the flip-flops with the
levels corresponding to the states that they must take at the time of the clock
pulse's active edge.
The combinatorial circuit is designed from the implication table expressing, according to
the flip-flops' outputs A, B, ..., N, the counter's states in the order in which they occur.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Qn Qn+1 J K
0 0 0 X
0 1 1 X
1 0 X 1
1 1 X 0
Example: let us construct a modulo-16 synchronous counter using natural binary as code.
The method consists of looking for the command equations for each flip-flop's inputs J
and K.
To do this we complete an implication table (table below) by writing in front of each state
the value that inputs J and K must take in order to obtain the next state.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
N° D C B A JA KA JB KB JC KC JD KD
0 0 0 0 0 1 X 0 X 0 X 0 X
1 0 0 0 1 X 1 1 X 0 X 0 X
2 0 0 1 0 1 X X 0 0 X 0 X
3 0 0 1 1 X 1 X 1 1 X 0 X
4 0 1 0 0 1 X 0 X X 0 0 X
5 0 1 0 1 X 1 1 X X 0 0 X
6 0 1 1 0 1 X X 0 X 0 0 X
7 0 1 1 1 X 1 X 1 X 1 1 X
8 1 0 0 0 1 X 0 X 0 X X 0
9 1 0 0 1 X 1 1 X 0 X X 0
10 1 0 1 0 1 X X 0 0 X X 0
11 1 0 1 1 X 1 X 1 1 X X 0
12 1 1 0 0 1 X 0 X X 0 X 0
13 1 1 0 1 X 1 1 X X 0 X 0
14 1 1 1 0 1 X X 0 X 0 X 0
15 1 1 1 1 X 1 X 1 X 1 X 1
To determine the equations for the necessary combinatorial circuits, the Ji and Ki in the
table above are then carried over to the Karnaugh maps:
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We can then draw this counter's logic diagram, however it must be noted that there are
two possible ways of wiring the four flip-flops:
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Like in the previous paragraph, we are going to take an example to explain the design
method.
You just have to modify the circuits looping back to the Ji and Ki in order for the setup to
recycle on the tenth pulse. The previous table remains unchanged until the ninth pulse, but
the Ji and Ki on line no. 9 must have a different value.
No. D C B A JA KA JB KB JC KC JD KD
0 0 0 0 0 1 X 0 X 0 X 0 X
1 0 0 0 1 X 1 1 X 0 X 0 X
2 0 0 1 0 1 X X 0 0 X 0 X
3 0 0 1 1 X 1 X 1 1 X 0 X
4 0 1 0 0 1 X 0 X X 0 0 X
5 0 1 0 1 X 1 1 X X 0 0 X
6 0 1 1 0 1 X X 0 X 0 0 X
7 0 1 1 1 X 1 X 1 X 1 1 X
8 1 0 0 0 1 X 0 X 0 X X 0
9 1 0 0 1 X 1 0 X 0 X X 1
10 1 0 1 0 1 X X 0 0 X X 0
11 1 0 1 1 X 1 X 1 1 X X 0
12 1 1 0 0 1 X 0 X X 0 X 0
13 1 1 0 1 X 1 1 X X 0 X 0
14 1 1 1 0 1 X X 0 X 0 X 0
15 1 1 1 1 X 1 X 1 X 1 X 1
States 10 to 15 are now unused, but if further to a stray pulse one of these states was
reached, the system, after a few pulses, would have to resume its normal operation. This
could be, obtained, for example, if Ji and Ki then all equalled 1 or took the same values as
in the full-cycle counter, which ensures a reset when state 15 has been passed.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
By adopting this second solution, only box 9 is modified in the above Karnaugh maps.
Furthermore, by comparing line 9 with the old one, we can see that only the values of JB
and KD have changed, which gives us the following as the new equations for JB and KD:
Remark:
By systematically writing "don't cares" (X) in all the unused boxes (10 to 15), we obtain a
simpler system (this is possible because the 10 to 15 states are no longer used):
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
But you must check that from the abnormal states (10 to 15) you return to the permitted
states.
N° D C B A JA KA JB KB JC KC JD KD
10 1 0 1 0 1 1 0 0 0 0 0 0
One pulse will only act on A and fall to:
11 1 0 1 1 1 1 0 1 1 1 0 1
The following pulse gives:
4 0 1 0 0 Which is a normal state
From 12
12 1 1 0 0 1 1 0 0 0 0 0 0
The following pulse acts on A only, that is:
13 1 1 0 1 1 1 0 1 0 0 0 1
From this state we fall to:
4 0 1 0 0 Which is a normal state
From 14 :
14 1 1 1 1 1 1 0 0 0 0 0 0
Gives:
15 1 1 1 1 1 1 0 1 1 1 1 1
0 0 0 0 0 State 0
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
9. INTEGRATED COUNTERS
The commercially available integrated counters are:
Put in series by the synchronous mode only or put in series by the asynchronous or
synchronous modes.
Putting into
Loading Reversible Type
series
74 190 DCB
Asynchronous
or synchronous
74 191 0, 1, …, 15
Asynchronous Yes
74 193 0, 1, …, 15
Asynchronous
74 192 DCB
74 161
0, 1, …, 15
74 163
No
74160
DCB
74162
Synchronous Synchronous
74 168 DCB
Yes
74 169 0, 1, …, 15
These circuits are reversible synchronous counters (up/down-count counter). The 74192
circuits are BCD counters (decimal) and the 74193 circuits are 4-bit binary counters.
Synchronisation is obtained by the simultaneous triggering of all the flip-flops enabling the
outputs to change logic level at the same time, in accordance with the command logic.
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 103 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
This operating mode eliminates the counting transient states on the outputs, a disturbance
phenomenon inherent to asynchronous counters.
The four master-slave flip-flops are triggered by the rising edge on one of the clock inputs.
The information present in these two counters on the loading inputs (A, B, C, D) is
transferred to outputs QA, QB, QC, QD when the loading command (LOAD) is at low (0),
as this action is independent from the clock and the counter's previous state: this is
asynchronous loading. This property makes it possible to use these counters as modulo-
N dividers simply by modifying the counting cycle by means of the programming inputs.
The reset input (CLEAR) is active on a high level (1); it is independent from the LOAD
input states and from the clock's inputs to count up (COUNT UP) or down (COUNT
DOWN): this CLEAR input is asynchronous and takes priority over the LOAD input.
The logic symbols for 74193 and 74192 counters are shown in the figure below:
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
These counters are designed in such a way they can be juxtaposed without the need for
any external logic.
The "CARRY" and "BORROW" outputs make it possible to sequence down-counting and
up-counting functions. The "BORROW" output delivers a pulse whose length is equal to
one clock cycle, when the counter is in negative overflow.
Likewise, the "CARRY" output delivers a pulse whose length is equal to one clock cycle on
the up-counting input when the counter is in positive overflow. The circuits can easily be
juxtaposed by connecting the "BORROW" and "CARRY" outputs to the next counter's
"COUNT DOWN" and "COUNT UP" inputs (immediately higher weight).
Remark:
The "CARRY" counting output produces a pulse when the counter reaches its last
state (9 for the 74192, and 15 for the 74193),
The "BORROW" counting output produces a pulse when the count-down counter
reaches its 0 state.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
These circuits are reversible synchronous counters (count up/count down). 74190 circuits
are BCD counters (decimal) and 74191 circuits are 4-bit binary counters.
Synchronous operation is due to the simultaneous commanding of all the flip-flops whose
output logic levels change at the same time in accordance with the command logic.
This operating mode eliminates the counting transient states on the outputs that are
inherent to asynchronous counters (clock transmitted from one flip-flop to another).
The four master-slave flip-flops are triggered by a rising edge on the clock input (CLOCK)
if the validation input ( ENABLE ) is at its low level. If the validation input ( ENABLE ) is at its
high level, counting is stopped.
The changes of logic level on the validation input ( ENABLE ) must only occur when the
clock input is at its high level.
The counting direction is determined by the state of the DOWN / UP counting direction
input.
When the input is at its low logic level, the counter counts up, and when it is at its high
logic level, the counter counts down.
If the count up/count down input changes state when the clock input is at its low logic level,
a triggering may occur that is equivalent to a stray clock pulse.
If during a loading pulse, the count up/count down input is at its high logic level with the
clock and the validation input at low logic level, the incorrect carry may be transmitted.
These counters are fully programmable, which means that the outputs can be set at any
logic level by forcing the LOAD loading input to the low logic level and applying the data to
the programming inputs (A, B, C, D).
These items of data will be copied to the outputs independently from the state of the clock
input, this loading is asynchronous. This property means it is possible to use these
counters as modulo-N dividers simply by modifying the counting cycle via the
programming inputs.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The logic symbols for 74190 and 74191 counters are given in the figure below:
In order to facilitate their extension, these counters have two outputs: a "clock
propagation" ( RIPPLECLOCK ) output and a "maximum/minimum counting" (Max / Min)
output.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The latter delivers a pulse lasting about one complete clock cycle, when the counter is in
overflow in one direction or the other. The "maximum/minimum counting" output provides a
degree of anticipation that is required for high-speed operation.
The "clock propagation" ( RIPPLECLOCK ) output delivers a negative pulse with a length
equal to that of a clock low logic level under the same conditions.
Putting in synchronous series: the first counter is permanently validated ( ENABLE = 0) and
its ( RIPPLECLOCK ) output commands the second counter's validation input, etc.. All the
clock inputs are commanded simultaneously: the counter is therefore synchronous, but the
validation commands, as they propagate from one circuit to the next, reduce the clock's
Training Manual EXP-MN-SI080-EN
Last revised on: 14/11/2008 Page 110 / 137
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
maximum frequency. Like with putting in asynchronous series, the DOWN / UP command
signal must not vary when the clock is in its low state.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Synchronous operation is due to the fact that all the flip-flops are triggered simultaneously.
The outputs change logic level at the same time in accordance with the validation inputs
(ENABLE T and ENABLE P) and the internal logic.
This operating mode eliminates the counting transients that appear on the outputs from the
asynchronous counters (clock propagation).
Triggering of the four flip-flops is carried out during the clock's positive transition.
These counters are fully programmable, which means that the outputs can be set to any
logic level.
As programming is synchronous, the fact of imposing a low level on the loading input
( LOAD ) inhibits the counter and after the positive transition of the next clock the data
present on the programming inputs (A, B, C, D) are copied to the outputs, independently
from the logic levels of the validation inputs (ENABLE T and ENABLE P). This loading is
therefore synchronous.
The positive transition on the loading input ( LOAD ) of the 74160 and 74163 circuits must
take place when the clock input is at its low logic level with the validation inputs (ENABLE
T and ENABLE P) at their high logic level. This restriction does not apply to the 74 LS
160A, 74 LS 161 A, 74 LS 162A and 74 LS 163A circuits.
Resetting of the 74160, 74161, 74LS 160A and 74LS 161 A circuits is asynchronous and a
low logic level applied to the CLEAR input sets the outputs of the four flip-flops to the low
logic level independently from the clock's logic levels, from the loading input or from the
validation inputs, resetting takes priority.
Resetting of the 74162, 74163, 74LS 162A et 74LS 163A circuits is synchronous and a low
logic level on the CLEAR input sets the outputs from the four flip-flops to the low logic level
after the clock's next rising edge, independently from the logic levels of the validation
inputs.
This synchronous resetting makes it possible to modify the length of the counting cycle by
encoding the desired maximum counting value with an external NAND gate. The output
from this gate connected to the resetting input ( CLEAR ) resets the outputs (low logic level
on the four outputs).
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The rising edge on the reset input ( CLEAR ) of the 74162 and 74163 circuits must take
place when the clock's input is at low logic level with the validation and loading inputs at
the high logic level.
The carry look-ahead circuit enables synchronous counting on N bits without any
additional logic. The "RIPPLE CARRY" output and the two counting validation inputs
(ENABLE T and ENABLE P) are intended for this application.
The two counting validation inputs (ENABLE T and ENABLE P) must be at the high logic
level to enable counting and the ENABLE T input is used to validate the carry output. Once
it has been validated, this output delivers a positive pulse whose duration is more or less
the same as that of the QA output's high logic level.
This pulse, which indicates a counting overflow on the counter, can be used to validate the
various successive stages. The negative transitions on the validation inputs (ENABLE T
and ENABLE P) of the 74160 and 74163 circuits must only occur when the clock is at its
high logic level. This restriction does not apply to the 74LS 160A and 74LS 163A circuits,
which have a totally independent clock circuit.
The modifications of logic level which occur on the command inputs (ENABLE T; ENABLE
P and CLEAR) and which would modify functioning, do not have any effect during the
active edge of the clock signal.
Counter operation (validated, not validated, being loaded or being counted) is only
determined by the conditions encountered during the stable states.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Counters can be put in series in a fully synchronous way without any external components
thanks to the internal logic circuits that create the RIPPLE CARRY signal. The
authorisation to count is given by the AND: ENABLE T. ENABLE P.
For the second counter we have ENABLE P. ENABLE T =1 during state 15 (74161, 74LS
161 A, 74163 and 74LS 163 A) or 9 (74160, 74LS 160A, 74162 and 74LS 162A) of the first
counter and this makes it possible to increment the second counter by 1. The figure below
shows how these counters are connected in cascade (10 at the most because the fan-out
from the RIPPLE CARRY terminal = 1): a counter can only be incremented when all the
counters preceding it are at 15 (or 9).
Remark:
A RIPPLE CARRY output must not be used to command an asynchronous logic circuit
because this output can deliver stray pulses due to the differences between the flip-flop A,
B, C, D propagation times.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We load the counter with the value 16 - N each time the RIPPLE CARRY output passes to
1 (counter in state 15 =1111) figure 10.8. This setup can be extended to several circuits.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
We decode the output information so that state N commands the synchronous resetting
(CLEAR) of the counter, when state N is detected; resetting takes place on the next clock
pulse; so the counter's state is N+1.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Once the counter arrives in state N2, it is decoded and commands the loading of state N1
at the time of the next clock pulse. The figure below shows a counter that counts from 7 to
12. This setup can be extended to n stages.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Figure 78: Operating timing diagrams for 74LS160A and 74LS162A counters
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Figure 79: Operating timing diagrams for 74LS161A and 74LS163A counters
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
10. MEMORIES
10.1. GENERAL
Access to an item of information is gained via the address bus. The address bus
is always one way.
The information is delivered on the data bus. The data bus can be two way if you
can read and write in memory or one way if you can only read it.
The control bus contains the various signals making it possible to manage
memory operations such as reading and writing.
The capacity of a memory defines the amount of information it can store, that is to say the
number of cells it contains. The capacity is expressed in bits or in bytes.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
1 byte = 8 bits
210 bytes = 1024 bytes = 1 kb (kilobyte)
220 bytes = 1024 kb = 1 Mb (Megabyte)
230 bytes = 1024 Mb = 1 Gb (Gigabyte)
Conclusion:
10.1.2. Organisation
A memory is made up of data (or words) made up of 8, 16, 32 or 64 bits, or even more.
There are two different types of access to the information contained in a memory:
Random or direct access: each word can be accessed directly and individually by
means of its address,
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
10.1.4. Speed
The access time (Tacc) is the time that elapses between the instant when the address is
set and the moment when the data item is available.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The internal architecture, that is to say the structure of a ROM memory package is highly
complex, but it is not essential to know all the details. However, it may be worthwhile
examining a simplified diagram of the internal architecture as shown in the figure below.
A register matrix (R): the register matrix is the set of elements that really memorise
the data in the ROM. Each register is made up of a certain number of memory cells
equal to the length of the word.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
In the present case, each register contains an 8-bit word. The registers are
arranged in a square matrix as is common in semi-conductor memory chips. It is
possible to indicate the position of each register by giving its row and its column.
The 8 data outputs from each register are connected to an internal bus which "runs"
through the whole circuit.
Each register has two validation inputs E, which must both be high in order for the
data item in the addressed register to be placed on the bus.
An output buffer register: the register that is validated by the address inputs places
its data item on the data bus. This item of data feeds output buffers that will deliver
it to the external data outputs if CS is high. If CS is low, the output buffers are in
their high-impedance state, and the data outputs are "floating".
p data outputs
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
its size or capacity: it is always a power of 2 (11c, 2k, 4k, 8k, 16k bytes), 1 k bytes
=1024 bytes (0 to 1023), and determines the number of registers contained in the
memory and, consequently, the width of the address bus (A_bus).
the data format: it is always a power of 2 and determines the width of the data bus
(D Bus)
the access time in nanoseconds (time it takes to read or write an item of data
depending on the type of memory).
In this type of ROM, the data are written in the memory locations (programming) by the
manufacturer according to the customer's specifications. We use the negative of a
photographic contact print, called mask, to establish the electrical interconnections in the
chip.
A special mask is required for each different set of information to be stored in memory.
Because these masks are costly to make, this type of memory is only economically viable
for very large production runs.
These memories only differ from the previous ones in that they can be programmed by the
user. You must note that like for MROMs, they cannot be erased or programmed.
EPROMs can be programmed by the user, but it is also possible to erase and reprogram
them as often as desired.
To erase an EPROM you just have to expose it to Ultra Violet light, which penetrates
through a window on the chip for about 30 minutes.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The difference with respect to an EPROM lies in the way the data are cleared by applying
a signal, which has the advantage, on the one hand, of being faster and on the other hand
of making it possible to select the information to be erased. This can be done either on a
programming console or directly by the application in which the memory is located.
These have a window above their package that makes it possible to expose the
chip to UV light for 10 to 20 min. It can be reprogrammed several times.
The operating principle means that the data is slightly less secure than in a ROM or a
PROM. If the window is not blocked off after programming or if the ambient
temperature is high, there is a risk of one or more bits being spontaneously erased.
The data is erased electrically. This can therefore be done without removing the
package from its support. They enable the selective erasing of data.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
A Random Access Memory (RAM) is a memory in which you can write or read data, and
that is its difference with respect to a Read Only Memory.
A RAM can be considered as an assembly of registers storing an item of data and which
has an exclusive address. Typically RAMs have a capacity of 1k, 4k, 8k, 16k or 64 kbytes
and word lengths of 1, 4 or 8 bits.
The figure below shows the simplified architecture of a RAM. With a view to having as few
pins as possible on an integrated circuit package, the manufacturers often combine the
data input and output functions on the input/output (I/O) pins. The input L / E
commands the function of the I/O pins.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
a read/write input
Static Random Access Memories are memories that keep the data as long as the chip is
powered. The cells in these memories are essentially flip-flops that remain in a given state
(storage of one bit) indefinitely as long as the circuit remains powered.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The major difference between static and dynamic RAMs lies in the fact that dynamic
memory cells only keep their data for a limited time, typically 2ms, after which they must be
refreshed at regular time intervals to ensure the memory keeps the data.
The need to refresh the data is a significant drawback for dynamic memories.
However, they do have the advantage of dissipating very little power and of being very
economical, which is a direct consequence of the cell's simplicity.
In a micro-computerised system, all the memories are mounted in parallel on the various
buses. So, when an address is sent to the address bus (A_bus) all the interfaces and all
the memories will receive that address.
Only one chip is concerned, so it is necessary to create a chip selection circuit which,
according to the address emitted, only validates one memory at a time.
Each circuit (memory or interface) has one or more chip selection inputs (CS: Chip Select),
and very often these inputs are active on a low (0 logic) but this is not always the case.
In order to create the command signals (CS), you have to elaborate a combinatorial circuit,
called address decoder. To simplify the creation of this circuit we use decoders/
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
The problem is therefore to determine which wires of the address bus must be connected
to the decoder/demultiplexer's various inputs, as well as the outputs from the
decoder/demultiplexer that will have to be used to select the required chip.
We are going to take two examples to illustrate the method for creating the CSs.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Example 1:
Let us make the circuit for selecting two memories: one ROM 4K x 8 base addresses
$1000 and one RAM 8K x 8 base addresses $2000.
To create the CSs, on each component we must look for all of the bits in the address bus
that remain unchanged whatever the memory cell targeted in the memory concerned.
Base High
Memory A15 A14 A13 A12
address address
ROM $1000 $1FFF 0 0 0 1
RAM $2000 $3FFF 0 0 1 X
From this table we can determine the type of decoder/demultiplexer that must be used. In
our case we need a 3-to-8 (or 1-out-of-9) decoder/demultiplexer. Once the
decoder/demultiplexer has been chosen, you have to determine the selection circuit's
logic diagram.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Example 2 :
M1: 4K x 8 at $1000
M2: 4K x 8 at $2000
M3: 16K x 8 at $8000
M4: 16K x 8 at $0000
Base High
Memory A15 A14 A13 A12
address address
M1 $1000 $1FFF 0 0 0 1
M2 $2000 $2FFF 0 0 1 0
M3 $8000 $BFFF 1 0 X X
M4 $C000 $FFFF 1 1 X X
There are no invariable bits for selecting the memories, so we must use a 4-to-16 (or 1-
out-of 16) decoder/demultiplexer.
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
Field Operations Training
Instrumentation
Automation Logic
Telegram: @ElectricalDocument
@ElectricalDocument
یکیازبهترینوبروزترین
کانالهایمهندسیبرق