Decoder Programming

DCCWiki, a community DCC encyclopedia.
Decoder Features

Movement & speed
Back EMF
Decoder-Assisted Consisting
Dither
High Frequency
Kick Start
Loco Momentum
Loco Trim
Loco Momentum
MU consisting
Speed Steps
Speed Table
Switching Speed
Three Step Speed Table

Forward/Reverse Trim

Vstart
Vmid
Vhigh

Programming
Addressing
CV Reset
Programming
Programming Lock
User Identifier

Lighting & Effects
Directional Lights
Func Remap
FX Lighting
Master Switch

Misc
Short-Circuit
Thermal Protection
Transponding

DCC Core components

Intro
Booster
Command station
Decoder
Power supply
Throttle

Track work components

Track wiring
Track work

In order for decoders to know what to do, you have to program them. This applies to both mobile and stationary decoders. Decoder programming is the action of entering suitable values into configuration variables (CVs) in a DCC decoder to set their address, Speed Table, Functions 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.

Programming Modes

There are two primary modes of programming: Service Mode and Operations Mode. Service Mode programming requires a programming track which is isolated electrically.

Operations Mode Programming (OPS) can occur anywhere on the layout because the program instructions are directed to a decoder's address. This method is sometimes referred to as Programming on the Main or POM.

As can be expected, all new decoders must be programmed using Service Mode on the programming track. This because they don't have an address yet (other than the default address of 03), 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 decoders do not support all methods because of limited resources (amount of memory/features) available to the microprocessor.

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 decoders will not have this issue, but some of the more advanced decoders may.

Before programming, read Address Zero and the Address Range page for explanations about decoder addressing schemes.

Service Mode (Programming Track)

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.)

The NMRA Standard S 9.2.3 covers service mode.

The purpose of Service Mode is to allow Customization and testing of decoders.

Service Mode Environment

An isolated programming track is essential because when using Service Mode programming, 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 essentially 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 it must state that it may not be 100% DCC compatible.
A Program Track connection may or may not be part of the command station/booster. Boosters which don't have connections for the program track will use Service Mode on the layout.
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

  1. A non-service mode instruction packet is successfully received
  2. 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.

Decoder Acknowledgement

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:

  1. BASIC
  2. ADVANCED
BASIC

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.

ADVANCED

Covered by NMRA Standards S-9.3.1 and 9.3.2

Timing

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 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 off power to the decoder) until the end of the decoder recovery time.

Modes

There are three methods of service mode programming:

  • Paged Mode
This mode is the most commonly used programming mode and is the preferred method.
  • Direct Mode is another mode allowed by the NMRA DCC Recommended Practices.
Direct Mode is becoming more popular.
  • Physical Register Mode is an older, obsolete method of programming that is not used in current production decoders.
This mode allows you to program a decoder no matter what state it is in. You do not even need to know the address (hence the danger of programming all your decoders at once). It will also work if the decoder's memory has become corrupted.

Service Mode also includes a CV Readback capability. The decoder can be read and its settings determined. Not all command stations support readback.

Configuration Variable Read back

Paged Mode

Paged Mode introduced the term "CV" (Configuration Variable).

It is very slow when reading back the CVs.

  • To read a CV, a number is sent to the decoder. If the response is negative, the number is incremented by one, and the process repeats until a positive response is received from the decoder. This process can repeat up to 256 times.
  • Reading the complete CV set of a decoder will take a long time. Every CV will be tested sequentially in this manner.
Direct Mode

The popularity of Direct Mode is increasing all the time. It is a very fast mode of programming. The NMRA would like to replace Paged Mode programming with Direct Mode.

Faster Readback of CVs

Instead of asking "Is it 1?, Is it 2?", Direct Mode takes a different approach.

It asks if Bit 1 of the CV is set. Then "Is Bit 2 set?"

Instead of making up to 256 inquires to determine the value of a CV, it can do it with eight. It can read the entire decoder's CVs very quickly.

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

Operations Mode Programming occurs anywhere on the layout. With Operations Mode programming, the programmer directs programming commands only to the decoder address you selected.

Operations Mode can also 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 you are using must be capable of this feature.

If you are using a Digitrax system with transponding detectors, it's possible to read back CVs from mobile decoders. Otherwise it is not possible to read the CVs.

This programming mode is based on the Direct Mode to provide quick programming capability.

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 change instruction fails.

The best way to change addresses is your Program Track . Using Operations Mode, it can only change the non-active address safely.

See also

  1. Programming Track - Suggestions on using part of your running track as a programming track.
  2. DCC Software - Ways to program your decoders using software.