Error Correction

DCCWiki, a community DCC encyclopedia.
Jump to: navigation, search

Summary: Error Correction is provided by the command station to allow decoders to determine the validity of a DCC packet.

Error Correction

The command station calculates a value using the address and data bytes which becomes the error correction byte seen in the DCC Packet. Error correction is provided using an XOR function (Exclusive OR), and should it be found to be correct, the decoder can act on the data bytes.

The error correction scheme cannot correct an error, it can only detect that the data is corrupt. Should the XOR operation fail, the packet is discarded and the decoder awaits a new one.

When a decoder sees the preamble, followed by a zero, it immediately takes note. If the address byte matches the decoder's address it then processes the address and instruction bytes and compares the result to the error correction byte. If the result matches the Error Correction Byte it then processes the commands it has received. By checking for errors in the DCC packet the decoder can reject a corrupt packet caused by electrical noise or dirty trackage. Should a packet be rejected, the decoder will wait for another packet addressed to it.

By doing this erratic operations caused by corrupt data can be eliminated. The likelihood of a corrupted DCC packet passing as valid by passing the error checking is extremely unlikely.