Appendix
Hans Turck GmbH & Co. KG | T +49 208 4952-0 | F +49 208 4952-264 | more@turck.com | www.turck.com
512
Conversion of the decimal values into hexadecimal/ binary values
The conversion of negative decimal values into hexadecimal values is more complicated, because
the values have to be coded as a two’s complement. The following example explains the method of
conversion:
The 4-digit hexadecimal number for the voltage value -6 V is searched:
decimal value = 204.75 1/V × (- 6 V) = -1228.8
Some calculators can be used to convert negative decimal values directly in a hexadecimal value
coded as two’s complement.
Without such a calculator, convert the value as follows:
1 Convert the amount of the negative decimal value to a binary number:
|-1228,8| = 1228,8 100.1100.1100
2 Fill the 12 bit of the binary number with ”0”:
100.1100.1100 0100.1100.1100
3 Invert the 12-digit binary number:
0100.1100.1100 1011.0011.0011
4 Add ”1” to this inverted number:
1011.0011.0011
0000.0000.0001
1011.0011.0100
5 The number is now coded as a two’s complement and can be converted into a hexadecimal num-
ber.
1011.0011.0100
B34
6 As the number is represented as 16 bit left-justified, the hexadecimal value has to be completed
with a ”0” and the binary value with 4 ”0”.
B34
B340
(1011.0011.0100 1011.0011.0100.0000)
7 The result is:
-1228,8
B340