OCTAL AND HEXADECIMAL IN PROGRAMMABLE LOGIC CONTROLLERS

Home Study Material OCTAL AND HEXADECIMAL IN PROGRAMMABLE LOGIC CONTROLLERS
Side Bar
Plc Scada
sidedigital-img
OCTAL AND HEXADECIMAL IN PROGRAMMABLE LOGIC CONTROLLERS

Binary numbers are used in computers because the two states represented by 0 and 1 areeasy to deal with in switching circuits, where they can represent off and on. A problem with binary numbers is that a comparatively small binary number requires a large number of digits. For example, the denary number 9, which involves just a single digit, requires four digits when written as the binary number 1001. The denary number 181, involving three digits, is 10110101 in binary form and requires eight digits. For this reason, octal or hexadecimal numbers are sometimes used to make numbers easier to handle and act as a “half way house”between denary numbers and the binary numbers with which computers work. Thus, for example, Allen-Bradley uses octal numbering in its PLCs for input and output addresses.

Octal System

The octal system is based on eight digits: 0, 1, 2, 3, 4, 5, 6, 7. When a number is represented by this system, the digit position in the number indicates the weight attached to each digit, the weighting increasing by a factor of 8 as we proceed from right to left. Thus we have:



To convert denary numbers to octal, we successively divide by 8 and note the remainders.

Thus the denary number 15 divided by 8 gives 1 with remainder 7; thus the denary number 15 is 17 in the octal system. To convert from octal to denary, we multiply the digits by the power of 8 appropriate to its position in the number. For example, the octal number 365 is3 Â 82 þ 6 Â 81 þ 5 Â 80 ¼ 245. To convert from binary into octal, the binary number is written in groups of three bits starting with the least significant bit.

For example, the binary number 11010110 would be written as: 11 010 110

Each group is then replaced by the corresponding digit from 0 to 7. For example, the 110 binary number is 6, the 010 is 2, and the 11 is 3. Thus the octal number is 326. As another example, the binary number 100111010 is:

100 111 010 Binary

4 7 2 Octal

Octal-to-binary conversion involves converting each octal digit into its 3-bit equivalent.

Thus, for the octal number 21, we have 1 as 001 and 2 as 010:

2 1 Octal number

010 001 Binary number and so the binary number is 010001.

Hexadecimal System

The hexadecimal system (hex) is based on 16 digits/symbols: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B,C, D, E, F. When a number is represented by this system, the digit position in the number indicates that the weight attached to each digit increases by a factor of 16 as we proceed from right to left. Thus we have:



For example, the decimal number 15 is F in the hexadecimal system. To convert from denary numbers into hex we successively divide by 16 and note the remainders. Thus the denary number 156, when divided by 16, gives 9 with remainder 12, and so in hex is 9C. To convert from hex to denary, we multiply the digits by the power of 16 appropriate to its position in the number. Thus hex 12 is 1 Â 161 þ 2 Â 160 ¼ 18. To convert binary numbers into hexadecimal numbers, we group the binary numbers into fours starting from the least significant number. Thus, for the binary number 1110100110 we have:

11 1010 0110 Binary number

3 A 6 Hex number

For conversion from hex to binary, each hex number is converted to its 4-bit equivalent.

Thus, for the hex number 1D we have 0001 for the 1 and 1101 for the D:

1 D Hex number

0001 1101 Binary number

Thus the binary number is 0001 1101.