Decoder Programming/Service Programming Modes
Service Mode Programming supports a number of modes. As these are advanced programming topics, there is no need to completely understand them. They are here to provide a historical background and explanation regarding the modes and the reasons they exist and are used, or not used, to program decoders.
Many command stations support all these modes to maintain backward compatibility. Be sure to use the proper mode for your decoder.
This is the most basic Service Mode programming technique, where the decoder is instructed to change its own address.
Being able to specify the decoder's address allows even the most basic of command stations to control the most complex decoders. Really basic DCC systems may ask you to specify which throttle you want to use, and set the decoder accordingly.
A sophisticated DCC system will ask you what number you want to use as the address, and write that to the decoder. Most modellers use the locomotive's number as the address to simplify selecting a locomotive.
Address Mode can only read, or verify one register or CV, such as the ones holding the Primary and Extended Address bytes.
Physical Register Mode
Physical Register Mode is an obsolete method of programming that is not used in current production decoders. Some decoders still support this mode for legacy reasons.
Early DCC decoders only had a limited number of registers available to configure the decoder.
- 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 is corrupted.
Register Mode expands on the Address Mode, allowing another seven memory locations (registers) to be accessed. It is an early mode which only allows limited decoder programming.
For a multifunction decoder:
|Register Mode Programming - DCCWiki.com|
|5||Basic Configuration: Speed steps, Direction of travel|
|6||Offset, Reserved for use during Paged Mode|
As multifunction decoders became more sophisticated, the number of registers expanded to a full set of 1024 registers. A method was required to to address these additional registers. Paged Mode is the most commonly used programming mode and is the preferred method.
Paged Mode introduced the term "CV" (Configuration Variable).
When Paged Mode is used, Register 6 becomes an offset pointer.
Should register 6 be set to a value of 1, there will be no offset, and registers 1 through 4 remain as is. If the offset pointer is set to a value of 2, registers 1 through 4 will now point to registers 5 through 8. As the offset is increased, the pointers will change accordingly. Not all decoders support this mode, avoid using Paged Mode unless the decoder supports it. The command station should be able to determine if the decoder will support Paged Mode.
To avoid this complex scenario, the software in most command stations hides this from the user. The command station asks for a CV number and performs the complex offset calculations to complete the programming process. While Paged Mode is similar to the Direct CV Mode, it is really a modified form of Register Mode, which is slower.
- Do not remove the locomotive from the programming track until the programming process has completed. Doing so may prevent older command stations from being able to reprogram the decoder later.
Reading a Decoder in Paged Mode
Paged Mode queries the decoder with "Does CVxx have a value of Y?" It continues to increment the value of Y until the decoder acknowledges the value matches the contents of the specified CV. There are only two states: NACK (Not Acknowledge), where the command station times out waiting for a response, or ACK (acknowledge), where the decoder responds. This method can take a long time to read the CV settings of a decoder, as it must step through up to 256 (0,1, 2, 3, 4..... 255) possible combinations.
- Paged Mode can be problematic with some DCC Systems. Direct Mode is a better choice, especially with modern decoders.
Direct CV Programming Mode
- Direct Mode is another mode allowed by the NMRA DCC Recommended Practices.
- Direct Mode is the fastest and most recent mode of programming. Most, if not all decoders made in the past 20 years support this mode.
Direct Mode allows writing of individual bits. A CV has up to 256 possible states. In the early days of DCC, with the limited number of registers and their possible values, reading the value of a register was slow, but acceptable. As the number of possible values increased, the time required increased.
Reading CVs in Direct Mode
Direct Mode is similar to Paged Mode, except when querying a decoder Direct mode asks "Does Bit 'X' of CVx = 1?" It is faster, as it can read an eight bit CV with 8 queries (1, 2, 4, 8, 16, 32, 64,128) instead of a possible 255 reads required by Paged Mode. It can then calculate from those responses what the content of CVx is. In the worst case the command station will have to wait for 8 timeouts to occur, or 9 to determine no reply.
The command station will then follow up with a full byte verification to ensure no mistakes occurred. This mode can be 50 times faster than the other methods available. With modern decoders, such as the ESU LokSound's 100,000 plus CVs, this makes a difference.