Very few modellers will ever need to modify or work with DCC Protocol / Decoder data directly, but when the need arises, finding any form of useful technical data on the subject will quickly lead to frustration.
This Document has been carefully prepared by cross referencing and verifying actual DCC Protocol Data against numerous technical specifications as well as restricted-access / confidential manufacturer manuals that are not typically made available to the public.
If you have no idea what “DCC Protocol” is, then start by reading this Technical Introduction to DCC, that forms part of the “DCC for Engineers” series.
Edited & Reviewed: Stéfan Stoltz
The term DCC is trademarked the National Model Railroad Association (NMRA)So while the term Digital Command Control is generally used to describe any digital model railway control system, strictly speaking it refers to NMRA DCC.Digital Command Control (DCC), was developed by Lenz, and is the original and most widely adapted standard for a system to operate model railways digitally.The DCC protocol is defined by two NMRA Standards:
It is important to note that the DCC protocol defines signal levels and timings on the track. DCC does not specify the protocol used between the DCC command station and other components such as additional throttles. A variety of proprietary standards exist, and in general, command stations from one vendor are not compatible with throttles from another vendor. |
1. The Decoder
Lets review the function of a Decoder:
- Each decoder is programmed with a unique address (duplicates addresses is a common problem)
- The decoder monitors the DCC data and listens for “commands”, embed in the DCC signal
- The decoders are programmable, allowing you to change the address, motor performance, and lighting and sound effects
- The decoder programming is stored in semi-permanent (non-volatile) memory that saves the information when there’s no power to the decoder
- Decoders can be re-programmed with new information as required
2. Decoders and Configuration Variables (CV)
“A Configuration Variable is a memory location in the decoder that controls the behavior of the decoder”
Just like any other computer, decoders must be programmed by the user to reach their full potential.
Decoders are commercially supplied with basic “factory default” settings, that determine the decoder address, motor control, lights, sound, and other functions.
In order to change/customize the “settings” of a decoder you need to edit the CVs, or Configuration Variables, in the decoder.
Some CVs use values ranging from 0 to 255, others use their space in the decoder’s memory as a bank of eight on/off switches.
- A CV can store raw data.
- A CV can store data as a binary number with a value between “00000000” (decimal 0) and “11111111” (decimal 255), as two binary numbers in high bits/low bits format “HHHHLLLL”, or some variant of these.
- Data can also be spread across multiple CVs if the necessary maximum value exceeds decimal 255.
- A CV can store information as a series of “bit switches”, each bit controlling the state of a specific function, turning it on or off.
3. Configuration Variables (CV) and their meaning
Keep in mind that the NMRA defines standards for specific functions and the associated CVs, but has made provision for manufacturers to add their own characteristic or proprietary functions.
The current NMRA standards for configuration variables cover only the NMRA specified CVs
3.1 NMRA Basic Configuration Variable Set
The NMRA has defined a basic set of CVs that all decoders support in order to ensure that interchange between various manufacturers is possible.
You can reference the “complete “NMRA Standard CV Definitions for Mobile Decoders” for additional info
PRIMARY ADDRESS | |
CV 1 | Mandatory |
Note:
- The Early on, decoders only had one byte of data (CV 1) for the address. It was decided that addresses from 00 to 127 would be defined by this byte of data. This leads to lots of confusion, like why is 120 a “two-digit” address? Because it is pseudo hexadecimal – now are you not sorry you asked? Do not worry about why, just know what. Best to call it a SHORT address.
- Different manufacturers define 2-digit (short) and 4-digit (long) differently, all within the NMRA standard. Lenz defines any number larger than 99 as a long. Digitrax defines numbers larger than 127 as long. NCE lets you decide (0120 is a long address, while 120 is short).
- So, if you are trying to address a loco with numbers between 100 and 127, you need to spend a bit of time thinking about it.
- If you only run on one system or only on NCE and Digitrax, fine – just program the loco address you want to use as a short address – CV01.
- If you are going with Lenz only, they handle it automatically.
- If however, you need to run on different systems which are numbered between 100 and 127, it quickly becomes messy! The best advise is to use the Long Address
DECODER ID | |
CV 7 | Mandatory: Manufacturers Software revision code |
CV 18 | Mandatory: NMRA Assigned Manufacturer code |
Notes:
- Reading the contents of these registers will let you determine what decoder is in the locomotive without having to open it up.
- Writing a value of 8 to CV8 will reset the entire decoder to factory defaults
- When 4-digit addressing (actually any address above 127) was implemented, the NMRA standard included some very complex calculations.
- It is not simply putting two digits in one CV and the other two in another. Setting these CVs manually can be very complex, so it is recommends that you use some program
MOTOR CONTROL | |
CV 02 | Mandatory |
CV 03 | |
CV 04 | |
CV 23 | |
CV 24 | |
CV 65 |
Notes: (CV 2)
- CV 2 is misnamed – it is frequently called “START VOLTAGE”, yet technically, the voltage on the motor is constant at about the track voltage. CV 02 adjusts the amount of time that the voltage is applied to the motor at speed step one.
- A Good Value for CV 2 it to set the value so that the loco just creeps (doesn’t apply to BEMF)
- BEMF decoders should auto adjust for this, so CV02 should be set to zero
- Tsunami decoders should have this CV set to zero unless BEMF is totally disabled
Tip:
Here’s how to set CV 02
1. Set the loco to speed step 01
2. Set CV 02 = 001
3. See if the loco moves. If so, stop
4. If not, add 1 to the value of CV 02, then go to step 3.
Notes: (CV 5)
- CV 05 sets the top speed the loco can run
- You can adjust this so that the loco runs no faster than your desired top speed.
- Scale speeds of 40 to 90 MPH are reasonable.
- Frequently setting this to zero will have the decoder run the loco as fast as it is physically capable of running.
Notes: (CV 6)
- CV 06 sets the midpoint speed the loco can run
- Once the maximum speed (CV05) has been set, set the speed of the loco at a midpoint throttle setting
- Frequently setting this to zero will have the decoder calculate the midpoint for you.
MODE CONTROL | |
CV 29 | Mandatory |
CV 29 Controls the Following:
Multifunction decoder, always reads 0 | |
Reserved for future use | |
EAM, Extended Address Mode enable,0 = Primary address in CV 1, 1 = Extended Address in CV 17/18To use extended addresses (14 bit), Bit 5 is set to “1”. When this bit is cleared (set to zero), the decoder reverts to the primary address in CV 1. | |
STE, Speed Table Enable, 0 = values in CVs 2, 4 and 6, 1 = Custom table selected by CV 25 | |
ACK, Advanced Acknowledge mode enabled if 1, disabled if 0 | |
APS, Alternate Power Source enable, 0 = NMRA Digital only, 1 = Alternate power source set by CV12 | |
F0 location: 0 = F0 controlled by bit 4 of speed direction instruction (14 speed steps). 1 = F0 controlled by bit4 of function group 1 (28 and 128 speed step modes). | |
DIR: 0 = normal, if 1 the direction bit in speed/direction instruction is inverted. |
Notes:
- When the DIR bit (o) is set, Locomotive and headlight will run in opposite direction, useful for long hood forward operation.
- The DIR bit (0) controls the NDOT (Normal Direction of Travel)
- With APS bit set, CV 12 must also be set to 1.
- CV 29 sets the overall personality of the loco: whether it runs on DC or not, is the normal direction of travel forward or reversed, etc.
- Setting this CV is very involved and it is recommended that you use some program to accomplish this task.
SPEED | |||
CV 66 | Speed Table | CV 81 | Speed Table |
CV 67 | Speed Table | CV 82 | Speed Table |
CV 68 | Speed Table | CV 83 | Speed Table |
CV 69 | Speed Table | CV 84 | Speed Table |
CV 70 | Speed Table | CV 85 | Speed Table |
CV 71 | Speed Table | CV 86 | Speed Table |
CV 72 | Speed Table | CV 87 | Speed Table |
CV 73 | Speed Table | CV 88 | Speed Table |
CV 74 | Speed Table | CV 89 | Speed Table |
CV 75 | Speed Table | CV 90 | Speed Table |
CV 76 | Speed Table | CV 91 | Speed Table |
CV 77 | Speed Table | CV 92 | Speed Table |
CV 78 | Speed Table | CV 93 | Speed Table |
CV 79 | Speed Table | CV 94 | Speed Table |
CV 80 | Speed Table | CV 95 | Speed Table |
ADDRESS | |
CV 17 | Mandatory |
CV 18 | Paired with CV 17 for “Long Address” |
Notes:
- The standard “Short Address” stored in CV 01 can be changed to a “Long Address”
- CV 17 and 18 are paired together, the resulting in each register holding one piece of data, which when combined results in the 14 bit extended address, or four digit address.
- CV 17 holds the MSB, the LSB is in CV 18. (Most Significant Bit and Least Significant Bit).
- CV 29 must have bit 5 set to a value of “1”. If this bit is not set, the four digit address will not work.
- Many systems automatically calculate the values needed for CV 17 and 18, and set CV 29 correctly to enable the four digit address.
ADVANCED CONSIST | |
CV 19 | Consist Address and Direction |
Notes:
- Consist address is stored in bits 0 to 6
- Bit 7 is the Consist Direction
- Consist address run from 1 to 127
- If set to 0, consist instructions are ignored then Instructions set to the primary or extended addresses are ignored
- Addresses set from 1 to 127 will assign the locomotive to that address, facing forward.
- Addresses from 129 to 255 result in the locomotive running backwards.
4. Programming Mode
Decoders support different modes of programming:
- reg……..NMRA Physical Register Mode
- pag…….NMRA Page Mode
- dir……..NMRA Direct Mode
- roc……..A non NMRA Register Mode version, used by ROCO
- rpg……..A non NMRA Page Mode version to use if Page Mode fails, but the decoder manual says Page Mode should work.
- old……..An old, obsolete NMRA Direct Mode version, used by ZTC
5. Service Mode
5. Binary numbers, decimal conversion and bit switches
There are several ways to store data in CVs.
The one that causes the most confusion is the “bitswitch”.
This system is far simpler that it might appear. Consider the table below:
Most Significant Bit |
Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | Least Significant Bit |
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
Think of the eight bits of the CV as a bank of eight simple on/off switches. Each switch is identified by the bold number above it. A value of “0” means the switch is off or in its default mode, a value of “1” turns it on. A decimal number between 0 and 255 identifies a unique setting of every switch in the bank of 8. This allows you to turn on or off any possible combination of these 8 switches by entering the appropriate decimal number into the CV. These software switches are the digital equivalent of the DIP switches, selector switches, or the jumpers that were often found on computer hardware.
Here is an example of the best-known CV that uses this technique, CV29:
CV 29 |
Loco/Acc Decoder |
Reserved | 2/4 Digit Addressing |
Speed Table |
Advanced Decoder Ack. |
Power Source Conversion |
F0 Control |
Loco Direction |
Decimal Value |
Bit 7 | Bit 6 | Bit 5 | Bit 4 | Bit 3 | Bit 2 | Bit 1 | Bit 0 | ||
128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 | ||
0 Off |
0 Off |
1 On |
0 Off |
0 Off |
1 On |
0 Off |
0 Off |
36 |
In the above example, 2 bits are on – bits 32 and 4. Add 32+4 and you get 36, the decimal value of the bitswitch settings shown. If you wanted to turn on the “speed tables”, then you would add 16 to that value, for a decimal value of 52.
Some times you need to work in reverse– you read the value of the CV from the decoder, then have to figure out what switches are on and which are off.
It’s simple, but tedious.
The binary equivalents of the switch positions (as shown in the table above) are 128 – 64 – 32 – 16 – 8 – 4 – 2 – 1.
- Start with the value you read from the CV, in this case 52.
- 52 is less than 64, so there are no 128s or 64s in the CV (ie those switches are off).
- 52 is greater than 32, so there is a 32 in the CV; that switch is on.
- Subtract 32 from 52 giving the remainder of 20.
- 20 is greater than 16, so there is a 16 in the CV; that switch is on.
- Subtract 16 from 20 giving the remainder of 4.
- 4 is less than 8, so that switch is off.
- 4 = 4, so that switch is on.
- Subtract 4 from 4 giving 0; all remaining switches (2 and 1) are off.
- Switches 32, 16, and 4 are on, the rest are off.
5. Service Mode
6. CV Numbers
SPEED | |||
CV 1 | Loco address | CV 51 | Manufacturer unique |
CV 2 | Vstart | CV 52 | Manufacturer unique |
CV 3 | Acceleration rate | CV 53 | Manufacturer unique |
CV 4 | Deceleration rate | CV 54 | Manufacturer unique |
CV 5 | Vhigh | CV 55 | Manufacturer unique |
CV 6 | Vmid | CV 56 | Manufacturer unique |
CV 7 | Manufacturer version | CV 57 | Manufacturer unique |
CV 8 | Manufacturer ID | CV 58 | Manufacturer unique |
CV 9 | Total PWM period | CV 59 | Manufacturer unique |
CV 10 | EMF feedback cutout | CV 60 | Manufacturer unique |
CV 11 | Packet timeout value | CV 61 | Manufacturer unique |
CV 12 | Power source conversion | CV 62 | Manufacturer unique |
CV 13 | Analog function status | CV 63 | Manufacturer unique |
CV 14 | CV 64 | Manufacturer unique | |
CV 15 | CV 65 | Kick start pulse time | |
CV 16 | CV 66 | Forward Trim | |
CV 17 | Extended Address | CV 67 | Speed Table |
CV 18 | Extended Address | CV 68 | Speed Table |
CV 19 | Consist Address | CV 69 | Speed Table |
CV 20 | CV 70 | Speed Table | |
CV 21 | Addr Active for F1 – F8 | CV 71 | Speed Table |
CV 22 | Addr Active for FL | CV 72 | Speed Table |
CV 23 | Acceleration adjustment | CV 73 | Speed Table |
CV 24 | Deceleration adjustment | CV 74 | Speed Table |
CV 25 | Mid-range cab speed step | CV 75 | Speed Table |
CV 26 | CV 76 | Speed Table | |
CV 27 | CV 77 | Speed Table | |
CV 28 | CV 78 | Speed Table | |
CV 29 | Configuration data #1 | CV 79 | Speed Table |
CV 30 | Error information | CV 80 | Speed Table |
CV 31 | Configuration Data #2 | CV 81 | Speed Table |
CV 32 | CV 82 | Speed Table | |
CV 33 | Output Loc FL(f) | CV 83 | Speed Table |
CV 34 | Output Loc FL(r) | CV 84 | Speed Table |
CV 35 | Addr Active for F1 | CV 85 | Speed Table |
CV 36 | Addr Active for F2 | CV 86 | Speed Table |
CV 37 | Addr Active for F3 | CV 87 | |
CV 38 | Addr Active for F4 | CV 88 | |
CV 39 | Addr Active for F5 | CV 89 | |
CV 40 | Addr Active for F6 | CV 90 | |
CV 41 | Addr Active for F7 | CV 91 | |
CV 42 | Addr Active for F8 | CV 92 | |
CV 43 | CV 93 | ||
CV 44 | CV 94 | ||
CV 45 | CV 95 | Reverse Trim | |
CV 46 | CV 96 | ||
CV 47 | CV 97 | ||
CV 48 | CV 98 | ||
CV 49 | Manufacturer unique | CV 99 | |
CV 50 | Manufacturer unique | CV 100 | |
CV 101 | CV 102 | ||
CV 103 | CV 104 | ||
CV 105 | User Identifier #1 | CV 106 | User Identifier #2 |
CV 107 | CV 108 | ||
CV 109 | CV 110 |