Hexadecimal numbers

In addition to binary numbers you Will often find hexadecimal numbers in MIDI equipment manuals. In most cases you will not need to understand these, but it is possible that the numbers for controllers and programs will be given only in this numbering system. You may then need to convert them to decimal numbers in order to tie them in with other pieces of equipment. The hexadecimal numbering system is not too difficult to understand, and the general idea is to have a single digit to replace four binary bits. An 8 bit byte can therefore be represented by a two digit hexadecimal (or 'hex') number. This system works well with MIDI messages where many of the bytes are divided into two 4 bit nibbles, as each nibble can be represented by a single hexadecimal digit.
Each nibble covers a range of 0 to 16 in decimal numbering, and there are obviously too few single digit numbers in this system to accommodate the hexadecimal system. The solution to this problem is to augment the ten normal numbers with the first six letters of the alphabet (A to F). It is from this that the hexadecimal name is derived. The table shows the relationship between each of the hexadecimal digits and both decimal and binary numbers.
Converting binary numbers to hexadecimal is not difficult, and it is just a matter of looking up the corresponding hexadecimal digit for each nibble. For instance, the binary number 11110101 breaks down into the nibbles 1111 and 0101. These correspond to the hexadecimal digits F and 5, giving an answer of F5. Conversion in the opposite direction is just as simple, and it is just a matter of looking up the binary values for each of the hexadecimal digits, and then combining these to produce a single binary number. For example, A7 in hex corresponds to the binary numbers 1010 (A) and 0111 (7), giving an answer of 10100111. The conversion you are most likely to need is from hexadecimal to decimal.




0 0000 0
1 0001 1
2 0010 2
3 0011 3
4 0100 4
5 0101 5
6 0110 6
7 0111 7
8 1000 8
9 1001 9
A 1010 10
B 1011 11
C 1100 12
D 1101 13
E 1110 14
F 1111 15

This is again reasonably straightforward, and it is a matter of first looking up the corresponding decimal number for the most significant digit and then multiplying this by 16. Then look up the corresponding decimal number for the least significant digit, and add this to the value obtained for the most significant digit. As an example, to convert 4E in hexadecimal to decimal, first the most significant digit (4) is converted to decimal (still 4) and is then multiplied by 16, which gives an answer of 64. Then the least significant digit (E) is converted to decimal (14) and added to the previous answer. This gives 64 plus 14, which gives a final answer of 78.

Speaker Icon WAV  109K Speaker Icon WAV 69K





Chaos Quantum Logic Cosmos Conscious Belief Elect. Art Chem. Maths

File Info: Created 15/7/2000 Updated 20/3/2007 Page Address: http://members.fortunecity.com/templarseries/hexadec.html