Programming instructions

41
4.3 Octal Numbers
Octal is a Base 8 numbering system, meaning there are 8 possible values. The
numbers for the octal system are 0 ~ 7.
In decimal, when the count passes 9, 19, etc. the count restarts at 0, but the tens
digit is incremented by one (i.e. after 9 comes 10, after 19 comes 20).
In the same way, when the count passes 7 in octal, the count restarts at 0 and
the tens digit is incremented. Thus after 7 comes 10, after 17 comes 20.
Octal is also a shorthand method of writing BINARY.
Each Octal digit represents 3 binary bits of data.
Putting the charts for hexadecimal and octal together, it becomes easy to convert
between hex and octal:
Convert 349AFh to Octal
Thus 349AFh is 644,657o
DECIMAL 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
OCTAL 0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17 20 21 22
BINARY 000 010 011 100 001 101 110 111
OCTAL 0 2 3 4 1 5 6 7
HEXADECIMAL 3 4 9 A F
BINARY 0011 0100 1001 1010 1111
(Regroup into 3s) 00 110 100 100 110 101 111
OCTAL 0 6 4 4 6 5 7