Using CVs (configuration variables), you can adjust a range of parameters that define a decoder's behavior under certain circumstances and in specific areas. Even with so-called register programming, nothing more is changed than the respective CV. Direct CV programming (bit by bit or byte by byte) offers far more precise possibilities.
What is a CV?
Let’s imagine we know nothing and say, "a CV is first and foremost a filing card..."
The number of functional outputs of a decoder cannot be changed, as they are determined by the hardware. Similarly, for example, the maximum load capacity is a characteristic that cannot be altered.
However, there are a large number of characteristics that are not determined by the hardware of the decoder but by the software running on it. These characteristics can be widely modified. The most important ones for regular operation include the locomotive address, acceleration delay, and braking delay.
For each of these characteristics, there is a memory location inside the decoder where a number is stored. These memory locations can be compared to cards in a filing box. Each decoder contains such a, admittedly microscopic, "filing box." On each of the "cards" is written a property of the locomotive decoder, for example, the locomotive address on "card" number 1, the acceleration delay on "card" number 3. So, each property of the decoder corresponds to a card. Depending on the number of properties available in this decoder, the "filing box" is larger or slightly smaller.
Certain CVs must be present in every decoder to meet the NMRA standardisation criteria. These CVs are a prerequisite for obtaining the "Conformance Seal". Examples include CV1 (decoder address), CV7 (version identifier, immutable), CV8 (manufacturer identifier, immutable), and CV29 (decoder base configuration).
Other CVs may be used by a manufacturer in their decoder but are not mandatory. However, if these CVs are implemented, their function must comply with the standard. Lastly, there is a range of CVs whose purpose can be freely defined by the manufacturer.
Most modern decoders support more than the mandatory CVs, including all current Lenz decoders.
Different Representations of a Numerical Value: The "Bits" in the CVs
CV1 stores the base address of the locomotive decoder. This is straightforward, as you can simply enter this address as a numerical value. However, some CVs may control various properties. For instance, turning regulation or conventional operation on and off. It would be cumbersome to enter a unique numerical value for every possible combination.
It's easier to imagine the relevant CVs as having 8 switches that can be toggled on or off. These switches are called "bits". If a switch is on, we say "the bit is set" or "the bit is 1"; if off, "the bit is cleared" or "the bit is 0".
This is merely a different way of writing numbers, known as binary representation. Here, numbers are represented not in decimal (0-9) but using only 0 and 1—binary = two values.
Counting Bits
In technical contexts, counting bits typically starts at 0. Since this is not common in everyday language (e.g., would you count train cars as "0, 1, 2...?"), Lenz counts bits starting at 1. This counting method applies to all Digital plus devices and decoders. When programming decoders with devices from other manufacturers, you may need to use the 0-based numbering, indicated in parentheses next to the bit number.
Example:
Bit 2 (1): The number before the parentheses is the bit number in the "1-based" count, and the number in parentheses is the bit number in the "0-based" count.
Binary Representation
Let's illustrate binary representation with CV29:
In CV29, various settings are stored. Each of the 8 switches (bits) determines whether a particular setting is on or off. If the switch is on, the bit is set, so its value is "1". Conversely, if off, the bit is not set, and its value is "0".
Switch No
(Bit No) |
Switch ON =
Bit set "1" |
Switch OFF =
Bit cleared "0" |
|
1 (0)
|
Loco moves in reverse when the direction switch points 'up/forward'
|
Loco moves forward when the direction switch points 'up/forward'
|
|
2 (1)
|
Loco operates in
28/128-step mode
|
Loco operates in
14/27-step mode
|
|
3 (2)
|
Loco can also operate in analogue mode
|
Loco cannot operate in analogue mode
|
|
4 (3)
|
Not used
|
|
5 (4)
|
Decoder uses customised speed curve
|
Decoder uses default speed curve
|
|
6 (5)
|
Loco is controlled with extended address
from CV17 and CV18
|
Loco is controlled with base address
from CV1
|
|
7 (6)
|
Not used
|
|
8 (7)
|
Not used
|
Settings can therefore be turned on or off by simply setting or clearing a bit in the CV.
The LH100 (version 2 and above), LH200, and LH90 controllers make toggling individual bits convenient via a dedicated menu. For older LH100 controllers (pre-version 2) or devices like "compact", binary mode programming is not supported. In such cases, you must enter the corresponding decimal value (byte value) for the desired bit combination in the CV.
For users of the Digital plus system connected to a PC via Lenz components, a user-friendly CV editor is available on the screen to facilitate CV adjustments. Learn more at PC Connection.
Let’s Get Started!
Grab your decoder's manual and explore the extensive CV programming possibilities. Don’t worry, you can’t do much harm, as the decoder can always be reset to factory settings if needed:
Simply write the value 33 to CV8. Note that custom speed curve CVs are not reset, but CV29's bit 5 will be cleared, reverting the decoder to the factory speed curve. CVs of connected S.U.S.I. modules are also unaffected!
A quick tip:
A common beginner mistake is mismatched speed step settings between the command station and the targeted decoder (CV29). Mismatched settings can lead to issues such as:
- Unable to turn the locomotive's lights on
- Lights flickering during speed step changes (on-off-on-off...)
- Locomotive not responding to commands from the station
If something doesn’t work as expected, double-check CV29...