How to program a long (four-digit) DCC address
Give a loco a four-digit address such as its running number, either through your command station's address menu or by working out CV17 and CV18 yourself.
- Time
- 15 minutes
- Difficulty
- Easy
- Cost
- No extra cost
- Steps
- 6
- Checked
What you’ll need
- A command station with a programming track
- The loco on the programming track on its own
- Optional: the CV calculator on this site
Before you start
- Program with only one loco on the programming track – service mode reaches every decoder on it.
Step by step
-
Step 1: Decide the address
Long (extended) addresses can be up to 10239 (NMRA S-9.2.1/S-9.2.2). ESU states its LokPilot 5 decoders accept 128–10239. Many people use the loco's running number, or the last four digits of it.
Next: step 2 -
Step 2: Use the command station's address menu if it has one
ESU recommends this: most modern systems have a long-address menu that writes CV17, CV18 and sets CV29 bit 5 for you. Put the loco on the programming track and follow your system's manual.
Next: step 3 -
Step 3: Or calculate CV17 and CV18
If you need to do it by hand: - CV17 = 192 + (address ÷ 256, ignoring the remainder) - CV18 = the remainder (address mod 256)
Example from ESU's manual: address 4007 → 4007 ÷ 256 = 15 remainder 167, so CV17 = 192 + 15 = 207 and CV18 = 167.
Next: step 4 -
Step 4: Write CV17 then CV18
Write the two values on the programming track. ESU notes long addresses cannot be written with programming on the main on its decoders.
Next: step 5 -
Step 5: Turn on long addressing in CV29
Bit 5 of CV29 (value 32) selects the long address; with it at 0 the decoder uses the short address in CV1 (NMRA S-9.2.2). Read CV29, add 32 if bit 5 isn't set, and write it back. A decoder answers to only one address at a time (ESU).
Next: step 6 -
Step 6: Test on the main
Select the new address on your throttle and drive the loco. If nothing happens, read CV29 again and check bit 5.
Tips
- To read an address back: (CV17 − 192) × 256 + CV18. ESU's example: CV17 = 196, CV18 = 147 → 4 × 256 + 147 = 1171.
- CV17 must be between 192 and 231 for the long address to be valid (NMRA S-9.2.2).
Questions people ask
Can I use a long address below 128?
The NMRA arithmetic allows it, but support varies by system and decoder (ESU's range starts at 128). Check your command station manual.
What happens to the short address?
It stays in CV1. Clearing CV29 bit 5 switches the decoder back to it.
Sources
Checked 18 October 2026. We wrote this guide in our own words, using:
- NMRA S-9.2.2 Configuration Variables (July 2012) (nmra.org)
- NMRA S-9.2.1 DCC Extended Packet Formats (Jan 2025) (nmra.org)
- ESU LokPilot 5 instruction manual, Edition 7 (distributor copy) (intermountain-railway.com)
Was this guide helpful?
Report a problem with this guide
Printed from dcctrainautomation.uk/guides/program-a-long-address/ · Checked 18 October 2026 · General information only. Follow the maker’s instructions for your own equipment, and keep mains wiring inside properly made, enclosed power supplies.