Hexadecimal, which means 6 more than 10
, is a way of representing 16 values using a single character, much like
decimal is a way of representing a 10 values in a single character.
Where‐as decimal has the symbols 0123456789, hexadecimal has 0123456789abcdef
In the computer world, data is stored in bits and is dealt with in 8, 16, 32 or 64 bits at a time.
If you are asking for the first 8 bits in a 64 bit value, and then the second 8 bits, it is confusing to get different digits than if you grabbed 16 bits.
Decimal numbers are hard to deal with when talking about parts of a longer digital piece.
For instance, if the 16 bits are 0001011001001111binary, that = 5711decimal.
But if you took the first 8 bits, 00010110, that = 22decimal and the second 8 bits 01001111, that = 79decimal.
So how does 22 and 79 make 5711? Well,
22*256 + 79 does = 5711, but that is really hard to work with.
On the other hand, if you use hexadecimal numbers to relate to the same binary, 0001011001001111binary = 164f
The first 8 bits is 16
hex, and the second 8 bits is 4f
It then becomes much easier to understand that the 16 bit number is a combination of the two 8 bit numbers.
The ease of dealing with long binary numbers, in hexadecimal, is why computer output is sometimes represented that way.
The reason numbers are not always represented in hexadecimal is that it is uncomfortable for people who aren't stuck using computers all of the time.
There are many weird things about people and computers and the choices that were made in industry.
In at least one place, hexadecimal numbers do show up in our lives right along side decimal numbers.
Ethernet addresses, also called MAC addresses, are represented in hexadecimal.
Yet TCP/IP addresses which are generated for the same machines as the MAC addresses, are always represented in decimal, with the dots in between.
I think that's just an odd choice.
I'm sure it is historical, like the width of a railroad track.
Hexadecimal and TARPN nodes
In our TARPN equipment, with support utilities scrounged from many sources and vendors, we run into Hexadecimal and Decimal numbers used to represent the same item, namely the I2C address of the I2C TNCs.
G8BPQ NODE software refers to the I2C address in decimal, yet the I2C Detection program refers to the I2C addresses in Hexadecimal.
We must look out for this and convert the numbers back and forth ourselves until our project gets enough talent and interest to write programs that are more consistant.
Converting from Hexadecimal to Decimal and back
The easiest way for me to convert is to list all of the possible I2C addresses in both Decimal and Hexadecimal.
Note that until you get to 10, the numbers are the same.
That's why I recommend beginners number their TNC-PIs starting with 3 which is the lowest address supported by the TNC-PI.
Here's the list: