Programming DCC Decoders by Stan Ames


NMRA DCC is unique in that it specifies a method for customizing your decoders to individual locomotives. In the most basic form this allows you to set the decoders address. For many decoders this technique can also be used to either set or read back such things as speed matching, customizing special effects and optimizing motor performance. Once set these values stay with the decoder until the user wishes to change them again. We call this concept if setting or reading decoder parameters as programming.

The NMRA has specified a Recommended Practice that defines how to program decoders (NMRA RP-9.2.3). While this recommended practice provides the precise packet formats a command station must transmit to program decoders, it does not specify the user interface provided to the model railroad operator who is using the system. This is left up to each manufacturer to provide.

To program a value into the decoder each system asks the user a value. The problem is there are several methods to represent this value, (Decimal, Hex, Binary and English explanation) and not all systems support all forms. Thus the user must often translate the numbering scheme provided by the decoder manufacturer to the numbering scheme requested by the Command Station/Programmer. The purpose of this page is to assist users in this conversion process.

Do I need to know any of this
Numbering Schemes
CV29
Conversion Tables

greyline.gif (777 bytes)

TTTrains' Home Page | Modeler's Corner | Large Scale | Links | World of DCC  | TTTrains Train Shops  | Lenz O Scale  


Do I need to Know any of this?

In most cases no. For the most part you can use the native instructions provided by the command station manufacturer to program any decoder (for exceptions to this rule see the DCC problems page). This is because for the most part the NMRA has defined and the Manufacturers have agreed to use common CVs (Configuration Variables) with common values. However, there are differences in preferred values and there are several manufacturer unique CVs. In this case an understanding on how to convert between the various styles makes programming much easier.

Return to Index | Return to The World of DCC


Numbering Schemes

Lets first start with the popular forms of representing values

Decimal

Decimal number has 10 numbers (0-9). This is perhaps the easiest form as we all know how to count using Decimal. Systems such as Lenz and the System One family commonly use Decimal for all values.

Hex

Hex is a computer form of counting which has 16 numbers (0-9 and A-F). Using Hex can be useful to the command station developer as 256 values can be expressed in just 2 positions (FF Hex = 255 Decimal). Digitrax uses hex for many values.

Binary

Binary uses just 2 numbers 1, and 0. This form may be the easiest from a DCC standpoint as DCC is a binary format. A DCC word has 8 binary bits or 255 different values in a data word. (11111111 = 255 Decimal). The NMRA RPs are written using the binary representation. Now just to confuse you a little more there are two common methods for numbering the bits in binary. Consider the Decimal number 3 which is represented by 00000011 in binary. Lenz counts the bits from 1 to 8.

bit 8bit 7bit 6 bit 5bit 4bit 3 bit 2bit 1
000 0001 1

The NMRA (which developed its numbering scheme after the Lenz system was on the market) counts the bits using the more common computer notation from 0 to 7

bit 7bit 6bit 5 bit 4bit 3bit 2 bit 1bit 0
000 0001 1

Notice that the NMRA numbering starts with 0 while the Lenz numbering starts with a 1. Translation is easy. Just add one to the NMRA bit positions to achieve the Lenz notation or subtract one from the Lenz bit numbers to achieve the NMRA notation.

English

Some systems use buttons, sliders, knobs, or menus to enter values. The positions of these buttons, sliders, or knobs are converted by the command station into the proper binary representation. To program other decoders on these systems it is best to understand what these various buttons, sliders, or Knobs actually do. Most entry systems (such as the Digitrax Challenger, and MRC Command 2000) use this form of programming. The System One family as well as most computer based programmers use menus to help guide the user in selecting the appropriate value.

Return to Index | Return to The World of DCC


Understanding CV 29

CV29 (The Basic Decoder Configuration), is used to set up the decoder's basic properties. This may be the hardest CV to understand as each bit means something completely different and many manufacturers try using words while others prefer HEX or Decimal or Binary.

The following table provides an explanation of this most basic decoder configuration CV as well as provides the translations into the various numbering schemes.

FunctionEnglish Description NMRA Bit meaningLenz Bit meaning DecimalHex Binary
Locomotive DirectionNormal Direction NMRA
Bit-0=0
Lenz
Bit-1=0
00000000000
Reverse DirectionNMRA
Bit-0=1
Lenz
Bit-1=1
101 00000001
Headlight Location14 Speed Step mode NMRA
Bit-1=0
Lenz
Bit-2=0
00000000000
28 Speed Step ModeNMRA
Bit-1=1
Lenz
Bit-2=1
202 00000010
Power Source ConversionNMRA Digital Mode Only NMRA
Bit-2=0
Lenz
Bit-3=0
00000000000
Analog Conversion Enabled NMRA
Bit-2=1
Lenz
Bit-3=1
40400000100
Speed TableUse Decoder Defined Speed Curve NMRA
Bit-4=0
Lenz
Bit-5=0
00000000000
Use User Defined Speed Table NMRA
Bit-4=1
Lenz
Bit-5=1
161000010000
Extended Addressing127 address mode NMRA
Bit-5=0
Lenz
Bit-6=0
00000000000
10,000 address modeNMRA
Bit-5=1
Lenz
Bit-6=1
32 2000100000

To achieve multiple effects just add the various properties desired. For example if you want the decoder to allow for analog conversion and operate in 28 speed step mode you provide the Decimal 6 (4+2). I suggest adding the decimal values and then looking up the appropriate value in the conversion table below as adding binary or Hex can be somewhat more complicated.

Return to Index | Return to The World of DCC


Conversion Table

Following is a table that converts the 256 DCC numbers between Decimal, Hex and Binary. This table is useful in converting between the different manufacturers preferred different programming methods.

DecimalHex Binary
00000000000
10100000001
20200000010
30300000011
40400000100
50500000101
60600000110
70700000111
80800001000
90900001001
100A00001010
110B00001011
120C00001100
130D00000101
140E00001110
150F00001111
161000010000
171100010001
181200010010
191300010011
201400010100
211500010101
221600010110
231700010111
241800011000
251900011001
261A00011010
271B00011011
281C00011100
291D00010101
301E00011110
311F00011111
322000100000
332100100001
342200100010
352300100011
362400100100
372500100101
382600100110
392700100111
402800101000
412900101001
422A00101010
432B00101011
442C00101100
452D00100101
462E00101110
472F00101111
483000110000
493100110001
503200110010
513300110011
523400110100
533500110101
543600110110
553700110111
563800111000
573900111001
583A00111010
593B00111011
603C00111100
613D00110101
623E00111110
633F00111111
644001000000
654101000001
664201000010
674301000011
684401000100
694501000101
704601000110
714701000111
724801001000
734901001001
744A01001010
754B01001011
764C01001100
774D01000101
784E01001110
794F01001111
805001010000
815101010001
825201010010
835301010011
845401010100
855501010101
865601010110
875701010111
885801011000
895901011001
905A01011010
915B01011011
925C01011100
935D01010101
945E01011110
955F01011111
966001100000
976101100001
986201100010
996301100011
1006401100100
1016501100101
1026601100110
1036701100111
1046801101000
1056901101001
1066A01101010
1076B01101011
1086C01101100
1096D01100101
1106E01101110
1116F01101111
1127001110000
1137101110001
1147201110010
1157301110011
1167401110100
1177501110101
1187601110110
1197701110111
1207801111000
1217901111001
1227A01111010
1237B01111011
1247C01111100
1257D01110101
1267E01111110
1277F01111111
1288010000000
1298110000001
1308210000010
1318310000011
1328410000100
1338510000101
1348610000110
1358710000111
1368810001000
1378910001001
1388A10001010
1398B10001011
1408C10001100
1418D10000101
1428E10001110
1438F10001111
1449010010000
1459110010001
1469210010010
1479310010011
1489410010100
1499510010101
1509610010110
1519710010111
1529810011000
1539910011001
1549A10011010
1559B10011011
1569C10011100
1579D10010101
1589E10011110
1599F10011111
160A010100000
161A110100001
162A210100010
163A310100011
164A410100100
165A510100101
166A610100110
167A710100111
168A810101000
169A910101001
170AA10101010
171AB10101011
172AC10101100
173AD10100101
174AE10101110
175AF10101111
176B010110000
177B110110001
178B210110010
179B310110011
180B410110100
181B510110101
182B610110110
183B710110111
184B810111000
185B910111001
186BA10111010
187BB10111011
188BC10111100
189BD10110101
190BE10111110
191BF10111111
192C011000000
193C111000001
194C211000010
195C311000011
196C411000100
197C511000101
198C611000110
199C711000111
200C811001000
201C911001001
202CA11001010
203CB11001011
204CC11001100
205CD11000101
206CE11001110
207CF11001111
208D011010000
209D111010001
210D211010010
211D311010011
212D411010100
213D511010101
214D611010110
215D711010111
216D811011000
217D911011001
218DA11011010
219DB11011011
220DC11011100
221DD11010101
222DE11011110
223DF11011111
224E011100000
225E111100001
226E211100010
227E311100011
228E411100100
229E511100101
230E611100110
231E711100111
232E811101000
233E911101001
234EA11101010
235EB11101011
236EC11101100
237ED11100101
238EE11101110
239EF11101111
240F011110000
241F111110001
242F211110010
243F311110011
244F411110100
245F511110101
246F611110110
247F711110111
248F811111000
249F911111001
250FA11111010
251FB11111011
252FC11111100
253FD11110101
254FE11111110
255FF11111111

Return to Index | Return to The World of DCC


Copyright 1997-2007 by Tried & True Trains, Inc.
This page is written and maintained by: Stan Ames
For more information contact Debbie Ames,  President tttrains