ModelRailPro logo ModelRailPro NLENDE

CV programming explained

How to reliably program decoder settings (CVs): on the programming track or while the loco runs on the main, and which CVs you need most often.

What are CVs, and why program them?

A Configuration Variable (CV) is a memory location inside a DCC decoder that stores a setting: the loco's address, how gradually it accelerates and brakes, the top speed at full throttle, and dozens of function and lighting options. The NMRA standard S-9.2.2 defines which CVs a decoder must support at minimum and how they are numbered, so that decoders from different manufacturers work with the same basic CV set in principle. CV programming is nothing more than writing a value (0-255) to one of these memory locations, or reading back what is already stored there.

For most hobbyists, CV programming matters at three moments: giving a new loco an address, tuning acceleration and braking to match the rest of the roster, and enabling features such as RailCom or a custom speed table. In ModelRailPro you can send CVs straight from the software to the connected command station; the free calculators on the tools page help you with CV29 and long-address calculations.

Service Mode (programming track) versus POM (Programming on Main)

There are two fundamentally different ways to program a CV, and understanding the difference is essential before you start.

Service Mode uses a separate, electrically isolated section of track: the programming track. On this track the command station addresses decoders without an address according to NMRA S-9.2.3 — meaning every decoder standing on that track responds to the programming command. For that reason, never place more than one loco on the programming track. The command station knows a command has arrived because the decoder sends back a short current ACK pulse: roughly 60 mA of extra current draw for 6 ms (±1 ms), as defined in S-9.2.3. Without this pulse the command station reports that no decoder was found. The programming track is also deliberately current-limited ('limited energy', typically no more than about 250 mA sustained for longer than 100 ms) to protect the decoder during programming, and is kept separate from the far more powerful main track.

POM (Programming on Main) works differently: the decoder stays on the main running track and is addressed individually, just like a normal drive command. The advantage is that the loco does not have to leave the layout and other locos are not disturbed. The downside: without RailCom (NMRA S-9.3.2), POM is a 'blind' write — the command station sends the new value but receives no confirmation and cannot read the CV back. If both decoder and command station support RailCom, the decoder can return the current CV value over the RailCom channel, making POM just as reliable as Service Mode. to be confirmed on a layout How complete and reliable POM readback via RailCom is in practice depends on the specific command station and decoder combination.

Rule of thumb: use Service Mode for setting the address (CV1, CV17/18) and whenever you need certainty that a value was written correctly. Use POM for fine-tuning while the loco stays on the layout, such as adjusting acceleration and braking behaviour while running.

Service-mode methods: Direct Mode and legacy variants

Within Service Mode there are several programming methods. Direct Mode is the standard on virtually every decoder made in the last twenty years and the fastest method: the command station sends the CV number and new value in a single packet sequence and waits for the ACK pulse. Older decoders sometimes support only Paged Mode, Physical Register Mode, or address-only programming — slower, legacy methods that access CVs through intermediate registers. This rarely matters for modern hardware, but when programming very old decoders a command station may automatically fall back to these methods if Direct Mode fails to produce an ACK.

Commonly used CVs at a glance

The CVs below appear in virtually every decoder. CV1, CV7, CV8 and CV29 belong to the NMRA S-9.2.2 mandatory baseline set; the others are widespread but their exact behaviour can vary by manufacturer.

CVFunctionNotes
CV1Short addressValue 1-127. Active while CV29 bit 5 is off.
CV2VstartMinimum speed at speed step 1.
CV3Acceleration delayHow gradually the loco speeds up. Exact unit/curve is decoder-dependent, treat the value as a guideline.
CV4Deceleration delayHow gradually the loco slows down. Behaviour also varies by manufacturer.
CV5VmaxMaximum speed at full throttle.
CV6VmidSpeed at roughly the midpoint of the throttle, used to shape the speed curve.
CV7Decoder versionRead-only; identifies the firmware version.
CV8Manufacturer IDRead-only. See the 'reset' section below.
CV17 + CV18Long addressTwo bytes together; both must be written before the long address works correctly.
CV19Consist addressAddress used to run several locos together as one unit.
CV29Configuration byteA collection of individual bits; see the next section.

CV29 is a set of individual bits, each representing its own setting: bit 0 reverses direction, bit 1 determines whether the decoder uses an extended speed table, bit 2 turns analogue (DC) operation on or off, bit 3 turns RailCom on or off, bit 4 turns a custom speed table (CV67-94) on or off, and bit 5 chooses between the short address (CV1) and the long address (CV17/18). Note that bit 1 by itself does not distinguish between 28 and 128 speed steps — that is determined by the packet format the command station uses to send drive commands. The free CV29 calculator on ModelRailPro converts these bits into the correct decimal CV29 value for you.

Short address versus long address

A decoder uses either the short address (CV1, range 1-127) or the long address (CV17 and CV18 combined), depending on CV29 bit 5. Technically the CV17/18 bit pattern gives a range from 128 up to 9983 (40 × 256 combinations); many command stations display this as '128-9999' in their menus for simplicity, even though 9983 is the technically correct upper bound. For decoders with many functions, or when you want the address to match the real loco number, a long address is often more practical than the limited short range.

Use the free long-address calculator on the tools page to compute CV17 and CV18 correctly in one go, and combine it with the CV29 calculator to make sure bit 5 gets set at the right moment. For more background on decoder types and the addressing options they offer, see the loco decoders guide.

Resetting a decoder to factory defaults

CV8 holds the decoder's manufacturer ID and is read-only for identification purposes. Many manufacturers additionally use the convention that writing a specific value to CV8 — often the number 8 — resets the decoder to factory defaults. This is not an NMRA requirement, however, but a manufacturer choice: Zimo decoders, for example, use CV8=0 for a reset instead of CV8=8. to be confirmed on a layout Whether 'CV8=8' works as a reset therefore depends on the specific decoder brand and model; always check the decoder's manual before attempting a reset.

Common pitfalls

Sources: NMRA S-9.2.2 (Configuration Variables), NMRA S-9.2.3 (Service Mode / programming track), NMRA S-9.3.2 (RailCom).

Related guides

Frequently asked questions

What is the difference between Service Mode and POM?
Service Mode uses a separate, current-limited programming track where the decoder is addressed without an address; every decoder on that track responds, so only one loco may be on it. POM (Programming on Main) programs an addressed decoder while the loco stays on the regular running track, but without RailCom you cannot read the CV value back.
Why does CV programming sometimes fail?
The command station waits for a current ACK pulse from the decoder (roughly 60 mA extra for about 6 ms) as confirmation. Poor rail contact, too much voltage drop, or a decoder that does not deliver the pulse results in a 'no decoder found' message — that does not necessarily mean the CV value itself was wrong.
Should I set the long address or CV29 first?
Write CV17 and CV18 (the long address) completely first, then enable CV29 bit 5 to activate the long address. Doing it the other way round can leave the decoder running on a partially set long address. Use the free CV calculators on ModelRailPro to get this right every time.
Download ModelRailPro Try free for 30 days

← Back to hardware · DCC-tools