Command setting

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:

DecimalBinaryHexadecimal
000000
100011
200102
300113
401004
501015
601106
701117
810008
910019
101010A
111011B
121100C
131101D
141110E
151111F


Examples

A) How to create a command with the value of 10?

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.

B) How to create a command with a value not stated in the conversion table, e.g. a value of 439?

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:

1117
1B7

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.

C) How to create a command for sending a “Hello World” string in ASCII codes?

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:

HelloWorld
48656C6C6F20576F726C64

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.