
Tsunami Diesel Sound User’s Guide Page 7
there are only two bit values, it takes more digits to represent a number using
binary. The decimal number 127, for example, is written as 01111111 in binary
notation. A ‘byte’ is a binary number made up of eight bits. And a ‘nibble’ is
one-half of one byte or four bits. Really! We didn’t make that up.
Each CV is made up of one byte (i.e., eight bits) and can store any number
from 0 to 255. Most of the CVs contain a single piece of data that can be
easily represented in any of the three formats described above. For example,
CV 3 (Baseline Acceleration Rate) can be loaded with any value from 0 to
255 and it will always and only affect one thing -- the acceleration rate.
Some CVs use individual bits to control different features This allows up to
eight distinct features to be controlled by a single CV and keeps the number
of CVs more manageable. As the bit variables can take on only one of two
values (0 and 1), they are usually used for simple variables that are either ON
or OFF, enabled or disabled, or something similar. Unfortunately, bit variables
are difcult to represent in any form other than binary and still preserve
any meaning. Because most DCC system user interfaces don’t use binary
representation, these numbers are the most difcult to work with and require
a tedious series of additions to convert to the decimal or hex form used by
most systems.
We have tried to use the decimal number system in this manual when
describing the proper values to program into a given CV; however, you will
occasionally nd values listed in the Technical Reference in binary, hex and
decimal values. Hex numbers can be distinguished from a decimal number
by noting a “0x” prex. Thus 0x10 is the hex version of 16 and not 10 as one
might guess. Binary numbers are represented using a ‘b’ sufx. 100b is really
the number four and not 100. To further assist the math-impaired, we have
provided a handy-dandy conversion table in Appendix A that allows one to
quickly convert between decimal, hex and binary.
When working with individual bits, such as in CV 29, we suggest the following
procedure for determining the correct value to program. Referring to the CV
description, write down the value desired for each individual bit. For example,
would like to set CV 29 so that speed tables and 28 speed-step mode are
enabled. Referring to the Technical Reference, we see that bits 1 and 4
should both be set to 1 to enable the desired features, with all other bits
cleared to 0. Write down the individual bit values as shown below:
We then look up the binary value 00010010 in Appendix A and see that it
corresponds to the decimal value 18 (0x12 in hex). This is the value to use
when programming the CV.
Basics of Programming
bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0