![]() |
||
![]() |
||
|
Learn quickly with our PLC Training DVD Series: on sale
Click here now for details! Number Systems Before we get too far ahead of ourselves, let's take a look at the various number systems used by PLCs. Many number systems are used by PLCs. Binary and Binary Coded Decimal are popular while octal and hexadecimal systems are also common. Let's
look at each: Nbase= Ddigit * R^unit + .... D1R^1 + D0R^0 where
D=the value of the digit and R= # of digit symbols used in the given
number system. This lets us convert from any number system back into decimal. Huh? Read on...
N10= D410^2 + D510^1 + D610^0
= 4*100 + 5*10 + 6*
= 400 + 50 + 6
= 456.
N10= D1 * 2^3 + D1 * 2^2 + D0 * 2^1 + D1 * 2^0
= 1*8 + 1*4 + 0*2 + 1*1
= 8 + 4 +0 +1
= 13
(if you don't see where the 8,4,2, and 1 came from, refer
to the table below).
Now we can see that binary 1101 is the same as decimal 13. Try translating binary 111. You should get decimal 7. Try binary 10111. You should get decimal 23. Here's a simple binary chart for reference. The top row shows powers of 2 while the bottom row shows their equivalent decimal value.
N10= D6 * 8^2 + D5 * 8^1 + D4 * 8^0
= 6*64 + 5*8 + 4*1
= 384 +40 +4
= 428
(if you don't see where the white 64,8 and 1 came from,
refer to the table below).
Now we can see that octal 321 is the same as decimal 209. Try translating octal 76. You should get decimal 62. Try octal 100. You should get decimal 64. Here's a simple octal chart for your reference. The top row shows powers of 8 while the bottom row shows their equivalent decimal value.
Lastly, the octal system is a convenient way for us to express or write binary numbers in plc systems. A binary number with a large number of digits can be conveniently written in an octal form with fewer digits. This is because 1 octal digit actually represents 3 binary digits. Believe me that when we start working with register data or address locations in the advanced chapters it becomes a great way of expressing data. The following chart shows what we're referring to:
From the chart we can see that binary 1110010011100101 is octal 162345. (decimal 58597) As we can see, when we think of registers, it's easier to think in octal than in binary. As you'll soon see though, hexadecimal is the best way to think. (really)
N10= D6 * 16^2 + DA * 16^1 + D4 * 16^0
= 6*256 + A(A=decimal10)*16 + 4*1
= 1536 +160 +4
= 1700
(if you don't see where the 256,16 and 1 came from,
refer to the table below)
Now we can see that hex FFF is the same as decimal 4095. Try translating hex 76. You should get decimal 118. Try hex 100. You should get decimal 256. Here's a simple hex chart for reference. The top row shows powers of 16 while the bottom row shows their equivalent decimal value. Notice that the numbers get large rather quickly!
Finally, the hex system is perhaps the most convenient way for us to express or write binary numbers in plc systems. A binary number with a large number of digits can be conveniently written in hex form with fewer digits than octal. This is because 1 hex digit actually represents 4 binary digits. Believe me that when we start working with register data or address locations in the advanced chapters it becomes the best way of expressing data. The following chart shows what we're referring to:
From the chart we can see that binary 0111010010100101 is hex 74A5. (decimal 29861) As we can see, when we think of registers, it's far easier to think in hex than in binary or octal. 4 digits go a long way after some practice! Learn quickly with our PLC Training DVD Series: on saleClick here now for details! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
copyright © 1996-2011, 2006, 2007 by Phil Melore.
All rights reserved. |