Decoder programming that actually matters
The handful of CVs worth understanding properly — addresses, speed curves, momentum and CV29 — and how to recover when a decoder stops responding.
A decoder has hundreds of configuration variables. You will use about eight of them. This page covers those, plus the one — CV29 — that causes more confusion than all the others combined.
Programming track versus main track
Programming track (service mode). An isolated piece of track holding one locomotive. The command station talks to whatever is on it without needing to know its address, and can read values back. Use this for setting addresses and for recovering a decoder whose address you have lost.
Main track (operations mode, “POM”). Programming a decoder in place, on the layout, by address. Convenient for tuning while you watch the loco respond. You generally cannot read values back this way, and you must already know the address.
Rule of thumb: addresses on the programming track, everything else on the main.
Addresses
Short addresses (1–127) live in CV1. Write the number, done.
Long addresses (128–10239) are split across two CVs, which is where people come unstuck:
CV17 = (address / 256) + 192 # integer division
CV18 = address % 256 # remainder
So address 2451:
2451 / 256 = 9 remainder 147
CV17 = 9 + 192 = 201
CV18 = 147
Setting CV17 and CV18 is not enough on its own — you must also tell the decoder to use the long address, by setting bit 5 of CV29. Most command stations, DCC-EX included, handle all three writes for you when you ask them to set a long address. Do it by hand and it is easy to set the number correctly and never enable it.
CV29 — the configuration byte
CV29 is eight independent settings packed into one number. You do not “set CV29 to enable long addresses”; you set the bit you want and add its value to whatever else is already on.
| Bit | Value | What it does |
|---|---|---|
| 0 | 1 | Reverse direction of travel |
| 1 | 2 | Use 28/128 speed steps instead of 14 |
| 2 | 4 | Allow running on analogue DC |
| 3 | 8 | Enable RailCom feedback |
| 4 | 16 | Use the custom speed table (CV67–94) instead of CV2/5/6 |
| 5 | 32 | Use the long address (CV17/18) instead of CV1 |
Working this out by hand is easy to get wrong when you’re stacking several settings — the CV29 calculator does the addition for you, in both directions.
Common values:
- 2 — short address, 28/128 speed steps. The sane default for most locos.
- 6 — as above, plus DC running allowed.
- 34 — long address, 28/128 speed steps (32 + 2).
- 50 — long address, 28/128 steps, custom speed table (32 + 16 + 2).
Analogue conversion means the decoder will start driving the motor if it sees DC on the rails. A layout with a dodgy connection or a booster fault can produce something the decoder reads as DC — and a loco setting off on its own is a memorable way to learn this.
Speed and momentum
- CV2 (Vstart) — power applied at the lowest throttle step. Raise it until the loco creeps reliably rather than sitting there buzzing.
- CV5 (Vhigh) — top speed. Lower it to make a shunter behave like a shunter, or to match two locos for double-heading.
- CV6 (Vmid) — mid-point, bending the curve between the two. Only meaningful on decoders that use the three-point curve.
- CV3 (acceleration) — how gradually it gets up to speed.
- CV4 (deceleration) — how gradually it stops.
CV3 and CV4 are what make a train feel like it has weight. They are also the settings most likely to make you think something is broken during automation: with a high CV4, a loco given a stop command carries on for a considerable distance before halting. That is momentum working as designed, not a missed command.
Start modest — single figures — and increase until it looks right.
Matching two locos
To double-head, the two need similar speed behaviour, not identical settings. Run each at the same throttle step and see which is faster, then bring the faster one down using CV5. Repeat at low speed with CV2. It is fiddly, and there is no shortcut.
When a decoder stops responding
Factory reset. Write 8 to CV8 on the programming track. Most manufacturers use this as the reset trigger. It returns the decoder to defaults, including address 3.
Check what you can read. CV7 (version) and CV8 (manufacturer) are read-only. If you can read those, the decoder is alive and communicating, and the problem is a setting rather than hardware.
If nothing reads at all, the decoder may be fine and your command station may be unable to detect the acknowledgement pulse. That is a hardware limitation of some motor driver boards rather than a decoder fault — see EX-MotorShield8874 vs the L298N.
Where to go next
- 128 vs 28 speed steps — the gotcha worth knowing about
- CV reference table — the full lookup list