NUMBERING SYSTEM Decimal System The radix or base
NUMBERING SYSTEM
Decimal System The radix or base of a number system determines the total number of different symbols or digits used by the system. The decimal system has a base of 10. In the decimal system, 10 unique numbers or digits ( 0 through 9) are used: the total number of symbols is the same as the base, and the symbol with the largest value is 1 less than the base.
Decimal System The decimal system can be summarized as follows: Ten digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Base: 10 Weights: 1, 100, 1000, …(powers of base 10)
Decimal System Weighted value in the decimal system
Binary System The binary system has a base of 2. The only allowable digits are 0 and 1 Digital Signal Waveform: with digital circuits it is easy to distinguish between two voltage levels - +5 V and O V, which can be related to the binary digits 1 and 0. High (H) (1) Volts +5 Low (L) (0) 0 Time
Binary System The binary system can be summarized as follows: Two digits: 0, 1 Base: 2 Weights: 1, 2, 4, 8, 16, 32, …(powers of base 2)
Binary to Decimal Conversion n n Convert binary to decimal by summing the positions that contain a 1. E. g. : Convert the binary number 1001012 to decimal. Solution:
Decimal to Binary Conversion n n Use repeated division E. g. : Convert the decimal number 37 to binary 3710=1001012 Solution:
Logic 0, Logic 1 n n Programmable controllers can only understand a signal that is On or Off (present or not present). The binary system is a system in which there are only two numbers, 1 and 0. Binary 1 indicates that a signal is present, or the switch is On. Binary 0 indicates that the signal is not present, or the switch is Off.
Exercise n i) iii) iv) v) Convert the following decimal number to binary : 12 25 58 82 100 (Answer : 1100) (Answer : 11001) (Answer : 111010) (Answer : 1010010) (Answer : 1100010)
Octal System The octal numbering system can be summarized as follows: Eight digits: 0, 1, 2, 3, 4, 5, 6, 7 Base: 8 Weights: 1, 8, 64, 512, …(powers of base 8) The octal number system is sometimes used because 8 data bits make up a byte of information that can be easily addressed by the PLC user or programmer.
Octal System Octal uses eight characters the numbers 0 through 7 to represent numbers. There is no 8 or 9 character in octal. Binary number can easily be converted to octal by grouping bits 3 at a time and writing the equivalent octal character for each group. Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Octal Binary 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Octal System Octal is also a weighted number system. The column weights are powers of 8, which increase from right to left. Column weights {5128 3 82 64 81 8 80. 1.
Binary to Octal Conversion Express 1 001 011 000 001 1102 in octal: Group the binary number by 3 -bits starting from the right. Thus, 1130168
Octal to Decimal Conversion Express 37028 in decimal. Start by writing the column weights: 83 82 81 80 3 7 0 28 3(512) + 7(64) +0(8) +2(1) = 198610
Decimal to Octal Conversion n n Use repeated division E. g. : Convert the decimal number 1986 to octal 198610=37028 Solution:
Hexadecimal System The hexadecimal (hex) numbering system can be summarized as follows: Sixteen digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F Base: 16 Weights: 1, 16, 256, …(powers of base 16) The hex numbering system is used in PLCs because a word of data often consists of 16 data bits, or two 8 -bit bytes.
Hexadecimal System Decimal Hexadecimal Binary Hexadecimal uses sixteen characters to represent numbers: the numbers 0 through 9 and the alphabetic characters A through F. Large binary number can easily be converted to hexadecimal by grouping bits 4 at a time and writing the equivalent hexadecimal character. 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 0 1 2 3 4 5 6 7 8 9 A B C D E F 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Hexadecimal System Hexadecimal is a weighted number system. The column weights are powers of 16, which increase from right to left. Column weights 16 16. {4096 256 16 1. 3 2 1 0
Binary to Hexadecimal Conversion Express 1001 0110 0000 11102 in hexadecimal: Group the binary number by 4 -bits starting from the right. Thus, 960 E
Hexadecimal to Decimal Conversion Express 1 A 2 F 16 in decimal. Start by writing the column weights: 163 162 161 160 1 A 2 F 16 1(4096) + 10(256) +2(16) +15(1) = 670310
BCD Binary coded decimal (BCD) is a weighted code that is commonly used in digital systems when it is necessary to show decimal numbers such as in clock displays. The table illustrates the difference between straight binary and BCD represents each decimal digit with a 4 bit code. Notice that the codes 1010 through 1111 are not used in BCD. Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 0000 0001 0010 0001 0011 0001 0100 0001 0101
Exercise n n n Convert the following hexadecimal number to decimal: i) 1 C 16 ii) A 8516 Convert the following binary number to hexadecimal: i) 11001010111
BOOLEAN ALGEBRA
Boolean Algebra Types of functions: • AND • OR • NOT • NAND • NOR • XOR
AND Function The outcome or output is called Y and the input signals are called A, B, C, etc. Binary 1 represents the presence of a signal or the occurrence of some event, while binary 0 represents the absence of the signal or nonoccurrence of the event.
AND Gate Function Application – Example 1 Basic Rules The device has two or more inputs and one output If any input is 0, the output will be 0 If all inputs are 1, the output will be 1
AND Gate Function Application – Example 2 The AND gate operates like a series circuit. The light will be “on” only when both switch A and switch B are closed.
OR Function An OR gate can have any number of inputs but only one output. The OR gate output is 1 if one or more inputs are 1.
OR Gate Function Application – Example 1 Basic Rules If all inputs are 0, the output will be 0 If one or more inputs are 1, the output will be 1
OR Gate Function Application – Example 2 The OR gate operates like a parallel circuit. The light will be “on” if switch A or switch B is closed.
NOT Function The NOT function has only one input and one output. The NOT output is 1 if the input is 0. The NOT output is 0 if the input is 1. Since the output is always the reverse of the input it is called an inverter.
NAND Gate The NAND gate produces a LOW output when all inputs are HIGH; otherwise, the output is HIGH. For a 2 -input gate, the truth table is A B X 0 0 1 1 0 The NAND operation is shown with a dot between the variables and an overbar covering them. Thus, the NAND operation is written as X = A. B (Alternatively, X = AB. )
NOR Gate The NOR gate produces a LOW output if any input is HIGH; if all inputs are HIGH, the output is LOW. For a 2 -input gate, the truth table is A B X 0 0 1 1 0 0 0 The NOR operation is shown with a plus sign (+) between the variables and an overbar covering them. Thus, the NOR operation is written as X = A + B.
XOR Gate The XOR gate produces a HIGH output only when both inputs are at opposite logic levels. The truth table is A B X 0 0 1 1 0 1 0 1 1 0 The XOR operation is written as X = AB + AB. Alternatively, it can be written with a circled plus sign between the variables as X = A + B.
Exercise 1. The two binary states can be defined as: (a) “high” or “low” (b) “on” or “off” (c) 1” or “ 0” (d) all of these 2. A gate can have one or more outputs but only one input. (True/False)
Exercise 3. The ______ table shows the resulting output for each possible gate input conditions. a. input status c. data b. output status d. truth
Exercise 4. A light that is "off" or a switch that is "open" would normally be represented by a binary 1. (True/False) 5. The OR function, implemented using contacts, requires contacts connected in series. (True/False) 6. With an AND gate, if any input is 0, the output will be 0. (True/False)
Exercise 7. The symbol shown is that of a(an) _____. (a) AND gate (b) OR gate (c) NAND gate (d) inverter
Exercise 8. Which of the following gates is commonly used for the comparison of two binary numbers? (a) NAND (b) NOR (c) XOR (d) NOT
Exercise 9. The basic rule for an XOR function is that if one or the other, but not both, inputs are 1 the output is 1. (True/False) 10. A NAND gate is an AND gate with an inverter connected to the output. (True/False)
BOOLEAN EQUATION
Gate Boolean Equations Boolean Equation Gate A B A AND Y Y=AB OR Y Y=A+B NOT Y Y=A
Boolean Equation – Example 1 Each logic function can be expressed in terms of a Boolean expression
Boolean Equation – Example 2 Any combination of control can be expressed in terms of a Boolean equation AB Y = AB + C A+B Y = (A + B) C
Boolean Equation – Example 2 AB Y = AB + C A+B Y = (A + B) C
Producing A Boolean Expression From A Given Circuit – Example 1
Producing A Boolean Expression From A Given Circuit – Example 1
Producing A Boolean Expression From A Given Circuit – Example 2
HARD WIRED VERSUS PROGRAMMED LOGIC
The term hardwired logic refers to logic control functions that are determined by the way devices are interconnected. Hardwired logic can be implemented using relays and relay ladder schematics. Hardwired logic is fixed: it is changeable only by altering the way devices are connected.
Hardwired Stop/Start Motor Control Circuit Ladder rail Ladder rung Control scheme is drawn between two vertical supply lines.
Hard Wired versus Programmed Logic Example 4 -1
Hard Wired versus Programmed Logic Example 4 -2
Hard Wired versus Programmed Logic Example 4 -3
Hard Wired versus Programmed Logic Example 4 -4
Hard Wired versus Programmed Logic Example 4 -5
Hard Wired versus Programmed Logic Example 4 -6
Hard Wired versus Programmed Logic Example 4 -7
Hard Wired versus Programmed Logic Example 4 -8
Hard Wired versus Programmed Logic Example 4 -9
Exercise 11. Hardwired logic is changeable only by altering the way devices are connected. (True/False) 12. Each programmed rung is a combination of input conditions connected from left to right with the symbol that represents the output at the far right. (True/False)
13. Which gate logic shown represents the Boolean equation: ( A + B ) C = Y (a) (c) (b) (d)
14. The correct Boolean equation for the combination logic gate circuit shown is: a. Y = A B C D b. Y = ( AB ) + ( CD ) c. Y = ( A + B ) ( C + D ) d. Y = ( AB ) + ( CD )
15. The correct Boolean equation for the combination logic gate circuit shown is: a. Y = ( A + B + C ) D c. Y = ( AB + C ) D b. Y = ( A + B ) ( C + D ) d. Y = ( ABC ) D
16. The correct Boolean equation for the combination logic gate circuit shown is: a. Y = A B C c. Y = A + B + C b. Y = ( A B ) C d. Y = ( AB ) + ( BC )
17. The correct Boolean equation for the ladder logic program shown is: a. Y = (A B) + (CD) c. Y = A + B + C + D b. Y = (A+B ) (C+D) d. Y = ABCD
18. The correct Boolean equation for the ladder logic program shown is: a. Y = (A B) + (CD) c. Y = A + B + C + D b. Y = AB (C+D) d. Y = ABC + D
19. If you want to know when matching bits in two different words are both "on", you would use the _____ logic instruction. a. AND c. XOR b. OR d. NOT
20. If you want to reverse the state of bits in a word, you would use the ______ logic instruction. a. AND c. XOR b. OR d. NOT
- Slides: 70