Hexadecimal
Hexadecimal
• For the first ten digits from 0 to 9, it uses the same numbers.
• It follows the same rule as binary and denary numbers with base 16x.
• 16 equals 24 meaning that, a hex number can be represented in binary using four bits.
Example:
• A byte contains 8-bits and represents values 0000 0000 to 1111 1111 (0 to 255).
• The 8-bits of a byte are divided into two groups i.e. top 4 bits and low 4 bits.
• The 4 bits of a byte can give values from 0 to 15 therefore, a base 16 number system was introduced.
• Using the base 16 representation, a byte can be represented by 2 hex digits instead of 8-bits.
• E.g. If you have AF, you can determine its value by simple multiplication (10 x 161 + 15 x 160) = 75 or 0100 1011.
• Starting from right to left, group it into sets of 4 bits. _ _10 0001 1111 1101
• If the last set doesn’t make 4 bits, add 0s that will make it, 0010 0001 1111 1101
• Now find out the values of each set individually and then combine the digits.
• Combine the converted hex digits together i.e. 21FD.
• Add these numbers together to get the denary value of the hex number i.e. 3072 + 128 + 15 = 3215.
• Try to place hex digits below 162, 161 and 160 and to find the hex representation.
• As compared to denary to binary, denary to hex ‘try & error’ method is much more complex.
• This table show, the denary number 2004 is 7 lots of 256 (1792), 13 lots of 16 (208) plus an extra 4.
Memory Dumps:
• A hex number system is often used when new software is developed to trace errors.
• Memory dump can be represented as the memory content that is the output to a monitor or a printer.
• The figure above shows the memory location on the far-left side and hex codes against these memory locations.
• Developers can determine errors from these hex codes to find out where in the memory the fault occurs.
• Tracing errors using hex numbers is very efficient compared to the binary numbers.
• A hex number system is a powerful tool for fault and error tracing, but it requires computer architect knowledge.
• It uses to bracket pieces of codes. E.g. marks the start of the code cell and ends it.
• The hex value for any color can be generated and there are some websites available that allow the user to
generate HTML code for any color.
• The first of this number represents the manufacturer ID and the second half represent the device’s serial number.
• Sometimes lower-case hex numbers are also used in the MAC address.
Web Addresses:
• The ASCII codes of the characters typed through a keyboard can also be represented using the hex values.
• One example of the use of ASCII code is the URL or web address
• E.g. MOV AX, 03 where AX represents the register and 03 is the value that will be moved to the register.