tarpn_logo
 home      FAQs

Hexadecimal Numbers

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 = 164fhex. The first 8 bits is 16hex, and the second 8 bits is 4fhex. 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. Who knows?

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 TNC-PI. 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:
Decimal Hexadecimal
101
202
303
404
505
606
707
808
909
100a
110b
120c
130d
140e
150f
1610
1711
1812
1913
2014
2115
2216
2317
2418
2519
261a
271b
281c
291d
301e
311f
3220
3321
3422
3523
3624
3725
3826
3927
4028
4129
422a
432b
442c
452d
462e
472f
4830
4931
5032
5133
5234
5335
5436
5537
5638
5739
583a
593b
603c
613d
623e
633f
6440
6541
6642
6743
6844
6945
7046
7147
7248
7349
744a
754b
764c
774d
784e
794f
8050
8151
8252
8353
8454
8555
8656
8757
8858
8959
905a
915b
925c
935d
945e
955f
9660
9761
9862
9963
10064
10165
10266
10367
10468
10569
1066a
1076b
1086c
1096d
1106e
1116f
11270
11371
11472
11573
11674
11775
11876
11977
© Tadd Torborg, 2014↝2017 -- all rights reserved