Information SET-01 93
DIGITAL plus
17.9 Bits and bytes - Conversion calculation help
Setting and erasing bits in a CV
Many CVs in the decoders do not use numeric values, but individual
bits. If you want to program a decoder that does not support the bit-
mode changing of CVs, you must program the decimal value
corresponding to the bits that are to be set or erased. This leads to
the question:
Which decimal value must be entered to set or erase which bits?
Each set bit represents a number, a value. Simply write out the
value of all bits that are to be set in a CV below each other and add
them up. In doing so, the following table applies:
bit
0-7
bit
1-8
value
0 1 1
1 2 2
2 3 4
3 4 8
4 5 16
5 6 32
6 7 64
7 8 128
Each bit that is set has a value
of '1'. Each bit that is not set
has the value ‘0’. To determine
the correct decimal value, the
following rule applies:
Add up all the values of all bits
that are to be set.
Example
bit value
1 1
5 16
Bit 1 and bit 5 (using 1-8 mode) are to be
set, all other bits are to be erased. The
values of both set bits are added together.
The decimal value that you must program in
the CV is ‘17’.
Total: 17