The application includes many controls which can be assigned commands in a byte string format. Each byte is recorded in hexadecimals. One byte consists of 8 bits and therefore it holds values from 0 to 255. Two characters are thus needed to record one byte in a hexadecimal form.
For quick conversion between decimal, hexadecimal and binary systems use the following table:
Decimal | Binary | Hexadecimal |
---|---|---|
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 |
10 | 1010 | A |
11 | 1011 | B |
12 | 1100 | C |
13 | 1101 | D |
14 | 1110 | E |
15 | 1111 | F |
According to the conversion table number 10 is equal to the character A in the hexadecimal system. Because a byte consists of 8 bits, we need to fill the rest of the bits with zeros, i.e. the command will be 0A.
By gradually dividing number 439 by 16 we get:
439 / 16 = 27 and a remainder of 7
27 / 16 = 1 and a remainder of 11
1 / 16 = 0 and a remainder of 1
Then just order the final numbers from the end and convert them according to the conversion table. The result is:
1 | 11 | 7 |
---|---|---|
1 | B | 7 |
If the final number of characters is odd we need to add zeros to the beginning again, which results in a command 01B7.
If you do not want to lose time calculating you can use a Windows, Linux or Android Calculator program which offers conversion between systems when switched to an extended mode.
Very easily, of course :) We use ASCII table to convert each character to byte.
You can also use various online convertors available on the internet or you can download one of the free “hex editors”.
After substituting the values from the ASCII table we get:
H | e | l | l | o | W | o | r | l | d | |
---|---|---|---|---|---|---|---|---|---|---|
48 | 65 | 6C | 6C | 6F | 20 | 57 | 6F | 72 | 6C | 64 |
The command will look as follows: 48656C6C6F20576F726C64
If you want to use an extended character set e.g. UTF-8, the principle remains the same.