Digital Command Control (DCC) protocol decoding

Introduction

DCC (Digital Command Control) is a standard defined by the National Model Railroad Association (NMRA) DCC Working Group and is a standard for manufacturers to allow the independent control of multiple locomotives and accessories on a train set.

This approach overcomes the limitation of controlling multiple locomotives on the same track where, traditionally, voltage on track was used to control the speed and direction of a train.

The Digital Command Station sends DCC NMRA signals in a differential digital form, by periodically reversing the 15 V DC power supply to the track.

A Hornby Somerset Belle Train Set, which is supplied with a Hornby DCC Select Controller, was used as the source of DCC signals. The Select Controller sends the combined power and data through the Track to Controller Link Wire (actually a pair of wires) to the rails, and thus also sends information signals for the locomotive and accessories connected to the track.

The locomotive contains a DCC Decoder which has a unique address and decodes instructions sent to it. The Select Controller uses the Programming Track method to program decoders, and only instructions from packets with the matching address will be actioned by the decoder. Accessory decoders may also be connected to the track to control components such as motors to change the points.

The NMRA Communications Standards for Digital Command Control (S-9.2) states that the information sent by Digital Command Stations consists of a sequence of bits (called a packet) which is used to encode one of a set of instructions that the Digital Decoder will operate upon. The packets must be precisely defined to ensure the proper encoding and decoding of instructions.

An example of an acceptable command control packet consists of three data bytes which is preceded by a preamble and a start bit as shown in the table below:

Portion Number of bits Description
Example DCC packet structure
Preamble Typically 12 Indicates start of a packet, with all bits set to ‘1’.

Packet Start Bit

1 First bit with value ‘0’ that follows a valid preamble. Terminates preamble and indicates next bits are an address byte.
Address Data Byte 8 Eight bits of address information; used to indicate the address of the decoder that the packet is intended for.
Data Byte Start Bit 1 Precedes a data byte and has a value of ‘0’.
Instruction Data Byte 8 Data byte used to transmit commands to decoders.
Data Byte Start Bit 1 Precedes a data byte and has a value of ‘0’.
Error Detection Data Byte 8 Indicates that the packet is complete and can also be used to verify the validity of the packet.
Packet End Bit 1 Marks the termination of the packet – has a value of ‘1’.

Baseline packets are included in the S9.2 standard to ensure minimum operability between different systems. This packet format can used for simple instructions such as speed and direction for locomotives.

An Extended Packet Format is defined in the S-9.2.1 standard for support of different types of decoders, additional functions, addresses and speeds, and consists of a packet whose length is between 3 and 6 data bytes, each separated by a '0' bit.

Decoding with PicoScope 7

1. The first step is to acquire the DCC signal of interest using PicoScope. Here the signals have been captured from the Somerset Belle Digital Train Set using a PicoScope 5444B set to 12-bit resolution. We used a x10 oscilloscope probe, so the voltage range selected was ±50 V, in conjunction with a timebase of 5 ms/div.

2. Next, select Serial Decoding from the Tools menu.

PicoScope 7 Serial Decoding dialog

PicoScope 7 Serial Protocol Decoder selection

3. Click Create and select DCC from the list of available protocols.

Configuration dialog for PicoScope 7 Digital Command Control (DCC) decoding

PicoScope 7 DCC protocol decoder configuration dialog

Configuration dialog for PicoScope 7 Digital Command Control (DCC) decoding

PicoScope 7 DCC protocol decoder configuration dialog

4. In the DCC configuration dialog select the PicoScope Data input channel and set the Threshold as required. Set a Display Name and ensure that the packets will be displayed in the Graph and Table. Ensure that the data values are displayed as Binary in the Table, then click OK.

5. Click OK to see the decoded DCC messages in the PicoScope graph display and table.

Image showing PicoScope 7 display with zoom applied and Serial Decoding applied for DCC Protocol

A link file can be used to map the values to text strings enabling you to identify the train(s) that the packets were intended for and the instruction.

Image showing PicoScope 7 Link file for DCC protocol in Microsoft Excel

Example PicoScope 7 Link file for DCC protocol

The image below shows a packet that was sent to the Somerset Belle train with an instruction for direction and speed. The table shows the values that have been mapped where possible using the contents of the link file.

Image showing PicoScope 7 display with zoom applied and Serial Decoding applied for DCC Protocol

Hornby Logo

Acknowledgement

Pico Technology would like to thank Hornby for provision of the Somerset Belle Digital Train Set featured in this article.

References

NMRA DCC Working Group:

NMRA Standards and Recommended Practices:

For more information on PicoScope's serial decoding capabilities, see Serial bus decoding and protocol analysis - overview.