## Octal? What the Hex?

"Do not worry about your problems with mathematics, I assure you mine are far greater." --- Albert Einstein

You're throbbing head is probably all ready telling you that binary numbers are not easy to read.  As a compromise between humans and computers the octal (base 8) and hexadecimal (base 16) are used.

### Octal

While octal is not as common as it's cousin hexadecimal it is still used in various PLCs so it's important to grasp the concept.  For instance, when programming an AutomationDirect PLC the memory addresses are in octal.  Octal, like an octopus' eight legs, means eight and therefore there are eight numbers to use from zero to seven.  The column weights are 1, 8, 64, 512, etc.  The weights are derived by taking the base number to the power of the column, 80=1, 81=8, 82=64, 83=512, etc.  Now we can do the same exercise as in the last chapter to convert an octal number to decimal. I know this isn't helpful so far.  Where it really comes in handy is coverting from binary to octal because all you have to do is break down the binary number into chunks of three.  This is because 8 is 23. Most programmable controllers have inputs and output cards grouped in 8 or 16 (and high density of 32 and 64).  The reason for this is the way computers like to have things in powers of 2, 4, 8, 16 and so on.  So if it is not in octal it is typically in hexadecimal.

Hexadecimal is a little more tricky because it is base 16 and therefore we need something beyond 0 through 9 for symbols and this is done by using the letters 'A' through 'F'.  Hexadecimal is used for the same reasons as octal so that we can represent binary in a condensed form and make it easier for conversion.  Where octal used 3 bits the hexadecimal system used 4 bits to represent one number. If you're going to be programming something like a Mitsubishi PLC then you better get used to hexadecimal.

### Conclusion

To wrap things up here's a table below showing the equivalents for each numbering system.

 Decimal Binary People: Learning your 1s and 0s.">Binary Octal Hex 0 00000 0 0 1 00001 1 1 2 00010 2 2 3 00011 3 3 4 00100 4 4 5 00101 5 5 6 00110 6 6 7 00111 7 7 8 01000 10 8 9 01001 11 9 10 01010 12 A 11 01011 13 B 12 01100 14 C 13 01101 15 D 14 01110 16 E 15 01111 17 F 16 10000 20 10 17 10001 21 11 18 10010 22 12 19 10011 23 13

and so on and so on . . .

### also BCD

You should also add info about BCD, since numeric displays and other I/O are interpreted in BCD.

the Geek