Lokommander II Next18 ECU
User Manual firmware 5.10.306
Version 0.5.07
Page 114 of 118
If we know the bit configuration and we want to find out the decimal value, we use the following
calculation formula:
Dec = B7*128 + B6*64 + B5*32 + B4*16 + B3*8 + B2*4 + B1*2 + B0
where B0 ... B7 represents the value of the respective bit (
“
0
”
or
“
1
”
).
Example: if B7 =
“
1
”
, B5 =
“
1
”
, B2 =
“
1
”
, and the rest is
“
0
”
, we will have:
Dec
= 1*128 + 0*64 + 1*32 + 0*16 + 0*8 + 1*4 + 0*2 + 0 =
= 128 + 0 + 32 + 0 + 0 + 4 + 0 + 0 = 164
If we want to find the bits configuration from the decimal value, we do the opposite. We try to subtract
from the decimal value the bits value begins with MSB and we keep the difference for the next subtractions
until we get zero. For possible subtractions, with a positive result, the bit will have a value of 1. For the
impossible subtractions, when the difference is negative, we abandon the operation (the value of the bit will
be zero) and continue with the next decrease.