Hexadecimal, or simply known as ‘hex’ in the computing world, is arguably the most widely used number system in firmware programming and control algorithms for various parts of robotic systems. The base used in this number system is 16, which means we calculate the decimal equivalent of hex numbers using powers of 16. {Note: Familiarity with exponents and powers of 16 (at least up to 16^5) is expected from those who wish to understand and practice this number system.} Whenever you see a hex file for some application or software, it is the file having everything written in it in the hexadecimal format.
“Hexadecimal” means 16, meaning “hex” refers to 6 and “decimal” refers to 10, hence the name. We use 16 characters in this number system (in computation, we call the punctuation marks, numbers, letters, symbols, etc. “characters”). We use the decimal numbers 0 to 9, constituting 10 characters, and the remaining six characters are the first six letters of the alphabet (A, B, C, D, E, F).
Therefore, the hexadecimal character set is as follows: {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
In this article, we will see how to convert hex numbers into binary and decimal equivalents.
We will now see the conversion of hex numbers into binary equivalents:
| Character | Decimal Value | Binary Value |
| 0 | 0 | 0000 |
| 1 | 1 | 0001 |
| 2 | 2 | 0010 |
| 3 | 3 | 0011 |
| 4 | 4 | 0100 |
| 5 | 5 | 0101 |
| 6 | 6 | 0110 |
| 7 | 7 | 0111 |
| 8 | 8 | 1000 |
| 9 | 9 | 1001 |
| A | 10 | 1010 |
| B | 11 | 1011 |
| C | 12 | 1100 |
| D | 13 | 1101 |
| E | 14 | 1110 |
| F | 15 | 1111 |
Let’s take an example of a character to break down the values in the table and justify why 4 bits are required.
1. F is the last character in the hexadecimal system, and its decimal value is 15 (although it is the 16th character, since 0 is the first character).
2. We know from the article about binary numbers how to convert 15 into binary. It comes to be 1111.
3. Therefore, the convention is set such that each character, whether they need 4 bits to describe their decimal equivalent or not, must be written in 4 bits (also called a nibble or half a byte).
4. As we know, 8 bits is one byte. So the smallest possible number is , and the largest possible number is
. (Verify this for yourself).
5. If we break the above bytes into nibbles, then it will look like this: and
. You can refer to the table above and compare the values to confirm that these are true.
Now, we will understand how to convert hexadecimal numbers into decimal numbers:
Example 1: Convert into a decimal number.
Example 2: Convert into a decimal number.
Example 3: Convert into a hex number.
- Divide 46656 by 16.
- Record the remainder (it will be between 0 and 15, including both).
- Assign the remainder value its respective hex equivalent (refer to the table above).
- Take the quotient (the result of the division) and divide it by 16 again.
- Repeat until the quotient is 0.
| Step | Division | Quotient | Remainder | Hex symbol for remainder |
|---|---|---|---|---|
| 1 | 46656 ÷ 16 | 2916 | 0 | 0 |
| 2 | 2916 ÷ 16 | 182 | 4 | 4 |
| 3 | 182 ÷ 16 | 11 | 6 | 6 |
| 4 | 11 ÷ 16 | 0 | 11 | B |
Now, read the remainders from the bottom to the top (from the last remainder to the first).
Bottom to top: $$ {(46656)_{10} = (B640)_{16}} $$
Example 4: Convert into a hex number.
- Divide 64020 by 16.
- Record the remainder (it will be between 0 and 15, including both).
- Assign the remainder value its respective hex equivalent (refer to the table above).
- Take the quotient (the result of the division) and divide it by 16 again.
- Repeat until the quotient is 0.
| Step | Division | Quotient | Remainder | Hex symbol for remainder |
|---|---|---|---|---|
| 1 | 64020 ÷ 16 | 4001 | 4 | 4 |
| 2 | 4001 ÷ 16 | 250 | 1 | 1 |
| 3 | 250 ÷ 16 | 15 | 10 | A |
| 4 | 15 ÷ 16 | 0 | 15 | F |
Now, read the remainders from the bottom to the top (from the last remainder to the first).
Bottom to top: $$ {(64020)_{10} = (FA14)_{16}} $$
By using this, we can apply various logical operations in motor control and robotics and also in data science and low-level programming languages like C and assembly. With these conversion techniques under your belt (whether transforming F3D4 into decimal or converting 64020 into a hex number), you now have a fundamental tool used in firmware development, debugging, and embedded systems. Practice these conversions until they become second nature. In the next part, we will explore this concept further and its detailed applications. Until then, keep learning and stay curious!
Discover more from universeunlocks.in
Subscribe to get the latest posts sent to your email.


