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 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:
Decimal
|
Hexadecimal
|
1 | 01 |
2 | 02 |
3 | 03 |
4 | 04 |
5 | 05 |
6 | 06 |
7 | 07 |
8 | 08 |
9 | 09 |
10 | 0a |
11 | 0b |
12 | 0c |
13 | 0d |
14 | 0e |
15 | 0f |
16 | 10 |
17 | 11 |
18 | 12 |
19 | 13 |
20 | 14 |
21 | 15 |
22 | 16 |
23 | 17 |
24 | 18 |
25 | 19 |
26 | 1a |
27 | 1b |
28 | 1c |
29 | 1d |
30 | 1e |
31 | 1f |
32 | 20 |
33 | 21 |
34 | 22 |
35 | 23 |
36 | 24 |
37 | 25 |
38 | 26 |
39 | 27 |
40 | 28 |
41 | 29 |
42 | 2a |
43 | 2b |
44 | 2c |
45 | 2d |
46 | 2e |
47 | 2f |
48 | 30 |
49 | 31 |
50 | 32 |
51 | 33 |
52 | 34 |
53 | 35 |
54 | 36 |
55 | 37 |
56 | 38 |
57 | 39 |
58 | 3a |
59 | 3b |
60 | 3c |
61 | 3d |
62 | 3e |
63 | 3f |
64 | 40 |
65 | 41 |
66 | 42 |
67 | 43 |
68 | 44 |
69 | 45 |
70 | 46 |
71 | 47 |
72 | 48 |
73 | 49 |
74 | 4a |
75 | 4b |
76 | 4c |
77 | 4d |
78 | 4e |
79 | 4f |
80 | 50 |
81 | 51 |
82 | 52 |
83 | 53 |
84 | 54 |
85 | 55 |
86 | 56 |
87 | 57 |
88 | 58 |
89 | 59 |
90 | 5a |
91 | 5b |
92 | 5c |
93 | 5d |
94 | 5e |
95 | 5f |
96 | 60 |
97 | 61 |
98 | 62 |
99 | 63 |
100 | 64 |
101 | 65 |
102 | 66 |
103 | 67 |
104 | 68 |
105 | 69 |
106 | 6a |
107 | 6b |
108 | 6c |
109 | 6d |
110 | 6e |
111 | 6f |
112 | 70 |
113 | 71 |
114 | 72 |
115 | 73 |
116 | 74 |
117 | 75 |
118 | 76 |
119 | 77 |