Summary: In order for decoders to know what to do, you have to program them. This applies to Multifunction, Function and Accessory Decoders. Decoder programming is the action of entering suitable values into the configuration variables (CVs) in a DCC decoder to set their address, and other parameters so they operate with the characteristics you choose. You should check your owner's manual for complete descriptions on the configurations available and which programming methods it is compatible with.
Movement & speed
|DCC Core components|
|Track work components|
- 1 Decoder Programming
- 2 Programming Modes
- 3 Service Mode Programming
- 3.1 Service Mode Programming Environment
- 3.2 Service Mode Programming
- 3.3 Service Mode Programming Methods
- 4 Operations Mode
- 5 Notes
- 6 Further Reading
There are two primary modes of programming: Service Mode and Operations Mode.
- Service Mode Programming requires a programming track which is isolated electrically from the rest of the layout.
- Service Mode is also known as Broadcast Programming Mode
- Operations Mode Programming (OPS Mode) can occur anywhere on the layout since the programming instructions are directed to a specfic decoder's address. This method is sometimes referred to as Programming on the Main or POM.
As can be expected, all new vehicles2 equipped with multifunction decoders must be programmed using Service Mode on the programming track. They don't have an address yet (other than the default address of 031), which makes programming on the layout very dangerous. (See the section on Service Mode.)
Most DCC systems support all methods of programming, however some DCC multifunction decoders do not support all methods because of limited resources (amount of memory/features) available to the microcontroller.
- Some DCC systems may be limited by their software to CVs below 255. There may be additional steps required to program a CV greater than 255. Many multifunction decoders will not have this issue, but some of the more advanced multifunction decoders may.
Before programming, read the Address Range page for explanations about multifunction and accessory decoder address partitions.
The modes can be thought of in this manner:
- Operations Mode = Addressed
- Service Mode = Global
- Operations Mode sends programming instructions to a specified address.
- Service Mode does not use an address, therefore its instructions are acted on globally by all decoders. Service mode can be used accidentally, programming every decoder on the layout.
If the booster lacks a separate pair of connections for a programming track, both modes are present on the track. Boosters equipped with a programming track output should not transmit service mode packets to the track, this mode should activate the program track connections.
Operations Mode may be used while a vehicle is in motion, allowing for adjustments to motor and sound parameters. While you may change the Primary Address in this mode, altering the Extended Address is not possible.
Service Mode Programming
Service Mode Programming, also known as Broadcast Programming, occurs on a programming track that must be electrically isolated from your running track (see Programming Track for electrical isolation tips.)
Service Mode Programming Environment
Programming instructions are broadcast to all multifunction decoders on the track, and every decoder will accept the instructions. This method is dangerous as it will reprogram every multifunction decoder in every vehicle on the layout. It is very easy to make a mistake and set every locomotive to the same address.
This is the reason for the isolated programming track.
A programming track is either a dedicated length of track located off the layout, or a section of track on the layout which is electrically isolated from the rest of the layout. The booster's programming track outputs connect to it for Service Mode programming. Only the vehicle on the programming track will be programmed.
In this environment the broadcast packets only go to one decoder. The program track is supplied with a low current. This avoids the possibility of damaging a miswired decoder. Many decoder manufacturers will recommend programming on a programming track only to prevent damage.
Safe Mode Programming
Many DCC systems make further attempts to protect a decoder during programming.
To prevent damage should a decoder be wiring incorrectly, a regulated Low Current source is used for programming purposes. In addition, the programming track is only active during programming. At any other time it will have no power.
The purpose of Service Mode is to allow Customization and testing of decoders.
Service Mode Programming
Service Mode operations should be done on an isolated programming track.
- An isolated programming track is essential when using Service Mode programming, as the command station sends a broadcast message to all decoders on the track. If you did not use a programming track, you would essentially reprogram all your decoders, something you most likely do not want to do. By using a programming track, you isolate, or select, the decoder you want (re)program.
- External loads, such as constant lighting, smoke generators and other loads should be switched off. Decoders should shut down any loads connected to them when they enter service mode.
- Service mode operations should take place in a limited power environment. The NMRA specifies no more than 250mA for 100mS. The maximum current may be limited by the programmer using a resistor, but the manufacturer must state that it may not be 100% DCC compatible.
- Decoders equipped with capacitors, such as "keep-alive devices may pose problems. If possible they should be disconnected prior to programming operations.
- A programming track booster may be required for some sound decoders.
- A Program Track connection may or may not be part of the command station/booster. Boosters which don't have additional connections for the program track use Service Mode on the layout via the track power connection.
Entry and Exit from Service Mode
A decoder is required to enter the service mode when it receives a reset packet followed by a service mode packet. It cannot act on service mode packets when it is not in service mode.
The decoder will exit the service mode, but not enter operations mode if
- A non-service mode instruction packet is successfully received
- Twenty milliseconds have passed since the last valid reset or service mode instruction packet was received
After exiting service mode, the decoder will only re-enter operations mode when it receives a valid operations mode packet that is different from the previous service mode instruction packet. This is done to prevent execution of service mode packets as operations mode packets.
- Service Mode instruction packets have a short address in the range of decimal 112 to 127.
There is an acknowledgement (ACK) mechanism specified. This allows the decoder to act on instructions regardless of the ability of the programmer to detect the ACK signal.
There are two mechanisms defined:
This is defined by the decoder providing an increased load on the programming track, of at least 60mA for 6mS. One method is to apply power to the motor, or a similar load connected to the decoder. Many decoders apply a short burst of power to the motor, causing the locomotive to lurch forward.
The decoder should not send an ACK pulse until all the CV bits have been written into non-volatile memory.
The programmer should scan for the pulse after the end bit of the second service mode instruction packet, or as many packets as needed to send the instructions, as well as the specified decoder recovery time. The programmer must continue to send packets to the programming track (which turns supplies power to the decoder) until the end of the decoder recovery time.
Service Mode Programming Methods
There are three methods of service mode programming:
- Address Mode
- Register Mode
- Paged Mode
- Direct CV Mode
- Main article: Decoder Programming/Service Programming Modes
Service Mode also includes a CV Readback capability. The decoder can be read and its settings determined. Not all command stations support readback.
Service Mode Instruction Packets
- Bits are numbered right to left, Bit 0 is the rightmost bit and the Least Significant Bit.
- Long Preamble: The packet will have a preamble of at least 20 bits, to allow the decoder time to process the instructions.
- Power On Cycle: After applying power to the track, the programmer will send at least 20 valid packets before service mode operations commence. This allows the decoder to power up and stabilize.During this time a current draw greater than 250mA lasting more than 100mS after initialization of packet transmissions is considered a fault condition. A decoder should not draw more than 100mA of current, except when processing an acknowledgement.
Operations Mode Programming occurs anywhere on the layout. With Operations Mode programming, the programmer directs programming commands only to the decoder address you selected. Some command stations may allow programming while the locomotive is in operation.
Operations Mode should not be used as an alternative to Service Mode programming for basic decoder setup. It can be useful for adjusting sound parameters while the vehicle is moving, or customizing the momentum characteristics of a switcher.
During Operations Mode, the following conditions apply:
- Full DCC Power is on the track.
- This mode should not be used to test a decoder installation as it will be damaged if incorrectly wired.
- CV read back is not possible.
Operations Mode may be referred to as:
- Program on Main (POM)
- Ops Mode
This mode of programming is useful if you cannot program the locomotive's decoder on a programming track. Or adjusting CVs while the locomotive is in motion, such as tweaking sound operation or speed matching.
- You cannot change the decoder address in this mode. (See Below).
For Ops Mode programming to work, the decoder must be capable of this feature.
This programming mode is based on the Direct Mode to provide quick programming capability.
Many DCC systems will perform a blind write to the decoder in this mode. The system will respond indicating the write was successful, even if it failed.
Changing an Address in Operations Mode
Changing an address using Operations Mode is fraught with problems.
If the current active address is an Extended (two byte) Address, any attempt to change the address will fail.
The reason is that an Extended Address is stored across two CVs (CV17 and CV18) and that specific address is used to direct the Operations Mode commands to the correct locomotive. When the first CV (CV17) is altered, the extended address is now a new, unexpected result (until CV18 is changed), but the original extended address is still being transmitted to change the value in CV18, thus the change instruction fails.
Operations Mode has two forms of instructions: The short form and long form.
Short Form Instruction
This method is suited to set values the often change during train operation, such as acceleration/deceleration rates. This mode allows frequent and quick programming changes.
Long Form Instruction
Long Form instructions allow almost any CV to be altered on the mainline. To accomplish this, the decoder must receive two of these commands without any intervening commands. As the long form takes more time to transmit, and two identical commands must be received by the decoder before any changes will occur, this mode is best suited to making permanent CV changes.
- While the default address for a multifunction decoder is specified by the NMRA Standard as a primary address equalling 3 (three), this rule does not apply to a vehicle with a multifunction decoder installed at the factory. This exception allows the manufacturer to set the default address to any value they wish.
- A vehicle can be a locomotive or other form of rolling stock, such as a caboose or a sound equipped freight car.
JMRI Error Codes
- Main article: Decoder Programming/JMRI Error Codes
A basic list of error codes you may encounter when using JMRI
This is a device designed for NCE's Power Cab. It has one input from the Power Cab and two outputs, one to the track, the other to an isolated programming track. When the Power Cab is switched to programming mode, the service mode packets received by the Auto-SW cause it to change the output from the track to the programming track. When exiting programming mode it reverts to the default state of DCC power to track.
- A new decoder install should never be tested on full DCC Power!
This device can be used with other manufacturers boosters which lack a programming track output.
While it is possible to set the Primary Address using Operations Mode, some decoders may not allow this. Soundtraxx DSD decoders require use of Service Mode to set all addresses (Primary and Extended). If a decoder will not accept a change to its Primary address, verify the mode required by referring to the instructions for that decoder.
Older DCC System Notes
- Main article: Decoder Programming/Legacy DCC Notes