Number Systems

Before we get too far ahead of ourselves, let's take a look at the various number systems used by plc's.
Many number systems are used by plc's. Many are actual addressed using binary code while octal and hexadecimal systems are also common. Let's look at each system:
As we do, consider the following formula(Math again!!):
Nbase= DdigitR^unit + .... D1R^1 + D0R^0 where D=the value of the digit and R= # of digit symbols used in the given number system. The "^" means "to the power of". As you'll recall any number raised to the power of 0 is 1. 10^1=10, 10^2 is 10x10=100, 10^3 is 10x10x10=1000, 10^4 is 10x10x10x10=10000... This let's us convert from any number system back into decimal. What??? Read on...

Here's a simple binary chart for your reference. The top row shows powers of 2 while the bottom row shows their equivalent decimal value.

Binary Number Conversions
2^15 2^14 2^13 2^12 2^11 2^10 2^9 2^8 2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
32768 16384 8192 4096 2048 1024 512 256 128 64 32 16 8 4 2 1

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.

Octal Number Conversions
8^8 8^7 8^6 8^5 8^4 8^3 8^2 8^1 8^0
16777216 2097152 262144 32768 4096 512 64 8 1

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 us 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:

Binary Number with its octal equivalent
1 1 1 0 0 1 0 0 1 1 1 0 0 1 0 1
1 6 2 3 4 5

From the chart we can see that binary 1110010011100101 is octal 162345.(decimal 58597) As we can see, when we think of registers, its easier to think in octal than in binary. As you'll soon see though, hexadecimal is the best way to think.(really)

Here's a simple hex chart for your 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!

Hex Number Conversions
16^8 16^7 16^6 16^5 16^4 16^3 16^2 16^1 16^0
4294967296 268435456 16777216 1048576 65536 4096 256 16 1

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 it 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:

Binary Number with its hex equivalent
0 1 1 1 0 1 0 0 1 0 1 0 0 1 0 1
7 4 A 5

From the chart we can see that binary 0111010010100101 is hex 74A5.(decimal 29861) As we can see, when we think of registers, its far easier to think in hex than in binary or octal. 4 digits goes a long way after some practice.

home contents back comments