Address Range

Category: Multifunction Decoder
Category:Programming
Category:DCC
Category:Decoder
Multifunction decoders can be addressed by either Two or Four digit numbers. The digits in are Hexadecimal (base 16) numbers, not Decimal (base 10).
Two-digit addresses, ranging from 1 to 127, are possible. However, some legacy systems, like Lenz, may limit the maximum to 99. Four-digit addressing offers a potential range of addresses from 1 to 10239.
== Multifunction and Accessory Decoder Address Ranges ==
=== Select − And − Run ===
With Digital Command Control there is no need to worry about where the train is located, which cab you're using, or flip switches to get control a locomotive. To run a loco, you simply pick up a cab, select the loco address (number) you wish to run, and take control of it. This allows you to easily and quickly control the train's speed, direction, lights, and functions.
----
=== Read Me First ===
 This section explains the numbering systems and terms which will be used.
====NMRA Address Partitions====
While this is an Advanced Digital Command Control Topic, it is useful to know how Digital Command Control addresses are structured. 
 Numbering systems will be indicated using mathematical notation, where a subscript indicates the radix or base, where 1210 indicates a decimal (base 10) value, or C216 is Base 16 or Hexadecimal. In this article, Hex numbers may also be prefixed with a dollar sign ($). If there is no subscript indicating the base, the number has a decimal (0 - 9) value.
 The number of digits refers to a Hex Number, where a digit has a value from 0 to 15 ($0 - $F).
 A Multifunction Decoder can use one byte for the Primary Address, or two bytes for an Extended Address. 
 An Accessory Decoder may use three bytes for its address.
 NMRA DCC Standard defines the address partitions for 2- and 4-digit addresses, while the actual implementation is determined by the manufacturer of the system. Not all systems implement the addressing scheme in the same manner within their software, so there may be issues with two-digit addresses used by a your DCC system when operated on another DCC system. 
* For example, while Address "100" is a two digit ($64 in hex) Primary Address, a DCC manufacturer may have limited their primary address range to a maximum value of 99 or $63. 
Do not worry about hexadecimal too much, many DCC systems allow entry in decimal numbers and will do the conversion internally.
=== Should I Use Primary or Extended Addresses for Multifunction Decoders? ===
==== Notes Regarding Address Partitions and Multifunction Decoders ====
right|400px
 Primary Addresses range is from 1 to 127 . 
 Consist Addresses share the Primary Address partition. 
 Extended Addresses occupy a separate address partition, with valid addresses from 128 to 10,239. They do not overlap the Primary Address partition. 
 The NMRA has mandated that any DCC compatible product lacking support for features such as Extended Addressing, a reduced Primary Address space or 28/128 Speed Steps must state that on the package and within the instructions. 
==== Primary Versus Extended Addressing ====
The choice of addressing modes is a personal one. If operation with multiple unit consists are planned, Extended Address mode is a better choice. Using an Extended Address avoids conflicts with Consist Addresses which occupy the Primary Address partition. 
With fewer than 20 or 25 locomotives on the layout, Primary Addresses work great. For each locomotive, assign an address using the last two digits of the road number. If there are duplicate numbers, use the first two digits. If that doesn’t work, you might need to renumber one or more locomotives or switch to Extended Addressing. 
Mixing Primary and Extended Addressing can lead to an unintended problem with consisting. 
:Two locomotives with Extended Addresses are consisted and assigned Consist Address 126. A third locomotive exists with the Primary Address of 126, which will not be included in the consist. Commands sent to Address 126 will be acted on both Consist Address 126 and Primary Address 126. Despite the fact that locomotive #126 is not physically part of the consist, logically it is.
To use Extended Addresses, both the command station and decoders must support Extended Addresses, as well as the throttles. Typically, all decoders support both modes, and the majority of DCC systems support Extended Addressing. Research your choice of DCC systems and components for compatibility, as restrictions, such as limited Primary Address support, are required be stated on the packaging. 
Extended addressing makes it easy to use the road number of a locomotive as its address (Exception: Europe, where 5 digits may be used by the prototype).
=== Address Partitioning, Extended Packet Format (S−9.1.2) ===
The Address Partitioning allows the decoder to determine if the packet is a multifunctionMultifunction Digital Decoders are used for the purpose of controlling one or more motors and/or accessories. (S-9.2.1) or accessoryAccessory Digital Decoders are intended for control of a number of simple functions such as switch machine control or turning on and off lights. It is permissible to develop Digital Decoders that respond to multiple addresses so that more devices can be controlled by a single Digital Decoder. (S-9.2.1) decoder packet.
Address Partitions, Extended Packets, S−9.1.2	Address Partitions, Extended Packets, S−9.1.2	Address Partitions, Extended Packets, S−9.1.2	Address Partitions, Extended Packets, S−9.1.2 	Address Partitions, Extended Packets, S−9.1.2 	Address Partitions, Extended Packets, S−9.1.2
DCCWiki.com 	DCCWiki.com 	DCCWiki.com 	DCCWiki.com 	DCCWiki.com 	DCCWiki.com
Address 	Binary Value 	Hexadecimal Value 	 	 	
0 	0000 0000 	$00 	Broadcast Address, all Multifunction Decoders must obey 	 	
1 − 127 	0000 0001 − 0111 1111 	$01 − $7F 	Multifunction Decoder 7 bit address. 	CV1If the value of Configuration Variable #1 is "00000000" then the decoder will go out of NMRA digital mode and convert to the alternate power source as defined by Configuration Variable #12. This setting will not affect the Digital Decoder's ability to respond to service mode packets (see S 9.2.3). The default value for this Configuration Variable is 3, if the decoder is not installed in a locomotive or other unit when shipped from the manufacturer. (s-9.2.2) 	CV1If the value of Configuration Variable #1 is "00000000" then the decoder will go out of NMRA digital mode and convert to the alternate power source as defined by Configuration Variable #12. This setting will not affect the Digital Decoder's ability to respond to service mode packets (see S 9.2.3). The default value for this Configuration Variable is 3, if the decoder is not installed in a locomotive or other unit when shipped from the manufacturer. (s-9.2.2)
128 − 191 	1000 0000 − 1011 1111 	$80 − $BF 	Basic Accessory Decoder 9 Bit Address or Extended Accessory Decoder 11 Bit Address 	CV1/CV513 Contains the low-order address bits for Accessory Decoders. The high-order address bits are stored in CV9 [521]. Two types of Accessory Decoder addressing are supported: Decoder-Address and Output-Address. An accessory decoder must support one type, and optionally the other type. The type of decoder is specified in CV29 [541], bit 6. Decoders using either type of addressing will respond to the same Accessory Decoder Control Packet when CV1 [513] = 1 and CV9 [521] = 0. The factory default value is 1. The type(s) of addressing supported must be clearly documented in the manual and on the packaging. (S-9.2.2)	CV1/CV513 Contains the low-order address bits for Accessory Decoders. The high-order address bits are stored in CV9 [521]. Two types of Accessory Decoder addressing are supported: Decoder-Address and Output-Address. An accessory decoder must support one type, and optionally the other type. The type of decoder is specified in CV29 [541], bit 6. Decoders using either type of addressing will respond to the same Accessory Decoder Control Packet when CV1 [513] = 1 and CV9 [521] = 0. The factory default value is 1. The type(s) of addressing supported must be clearly documented in the manual and on the packaging. (S-9.2.2)
192 − 231 	1100 0000 − 1110 0111 	$C0 − $E7 	Multifunction Decoder 14 bit address. The primary address byte contains 8 bits of address information. If the most significant bits of the address are between 1100-0000 and 1110-0111 (192-231) (inclusive) then a second address byte must immediately follow. This second address byte will then contain an additional 8 bits of address data. (S-9.2.1)	CV17 The Extended Address is the locomotives address when the decoder is set up for extended addressing (indicated by a value of "1" in bit location 5 of CV#29). CV#17 contains the most significant bits of the two byte address and must have a value between 11000000 and 11100111, inclusive, in order for this two byte address to be valid. CV 18 contains the least significant bits of the address and may contain any value. 	CV17 The Extended Address is the locomotives address when the decoder is set up for extended addressing (indicated by a value of "1" in bit location 5 of CV#29). CV#17 contains the most significant bits of the two byte address and must have a value between 11000000 and 11100111, inclusive, in order for this two byte address to be valid. CV 18 contains the least significant bits of the address and may contain any value.
232 − 254 	1110 1000 − 1111 1110 	$E8 − $FE 	Reserved for Future Use 	 	
255 	1111 1111 	$FF 	Idle Packet 	 	
dccwiki.com/Address_Range 	dccwiki.com/Address_Range 	dccwiki.com/Address_Range 	dccwiki.com/Address_Range 	dccwiki.com/Address_Range 	dccwiki.com/Address_Range
By partitioning the addresses into distinct ranges, the decoder can examine the address byte and determine whether that packet is intended for it or not. The command station will generate that specific address byte based on the type of decoder it is addressing. An address of 100 ($64) is reserved for multifunction decoders, so a multifunction decoder with that address will respond to that packet. A packet with the address byte commencing with 128 ($80) to 191 ($BF) will be addressed to an Accessory decoder, while those commencing with 193 ($C0) to 231 ($E7) indicate a Multifunction Decoder Extended Addresses. Address $FF is reserved for the idle packet’s address.
If a Multifunction Decoder Extended Address is used, the address byte will have values between 192 and 231. Multifunction decoders set for Extended Address Mode (CV29) will respond to an address byte in that range, knowing that the second byte completes the address. 
# A Primary Address uses one byte to transmit 2 hexadecimal digits
# An Extended Address uses two bytes, transmitting 4 hexadecimal digits.
# The Primary Address is stored in the multifunction decoder’s CV1
# The Extended Address uses calculated values stored in CV17 and CV18
Determining what type of address is simple for a decoder:
# Check CV29 for addressing mode in use by decoder
# If all bits are zero, it is the Broadcast Address.
# If the Address Byte has a value between 1 and 127 ($01 – $7F), it is a 2-digit Primary Address for a multifunction decoder. (When Extended Address Mode is off, see CV29). The Most Significant Bit, A7, controls direction, values above 127 indicate the direction has reversed. Using bits A6 – A0 for the actual address, the maximum value is 127. A value of 128 is not permissible as that would be equivalent to a value of "– 0". These values are treated as negative numbers. A value of 129 is the equivalent of –1, or address 1, running in reverse. 
# A value between $80 – $BF, it is a Basic or Extended Accessory Decoder Address. Address modes are determined by CV29 
# A value between $C0 – $E7, it is a 2-byte, Extended Multifunction Decoder Address. The following byte completes the address. (When Extended Address Mode is on, see CV29)
# A value between $E8 – $FE is reserved for future use at this time.
# If all the bits are set to 1 ($FF), it is the Idle Packet.
=== Multifunction Decoder Addressing ===
Reference: Configuration Variables For Digital Command Control, All Scales, S-9.2.2
==== Multifunction Decoder Primary and Extended Address Ranges ====
As noted above, the NMRA Standard defines two ranges of addresses for multifunction decoders:
=====Primary Address Range=====
The first address range defined is 1 through 127. This is the Primary Address. It is a one-byte (eight bit) address which in Hexadecimal (see Binary) can have values of 0116 to 7F16 (1 to 127 in decimal)Format is DA6A5A4A3A2A1A0, where A0 to A6 represent the address. − hence it is sometimes called a Two Digit Address. Other terms used for the Primary address are Short, Baseline or 7−bit Address. It is called a 7−bit address because the first or most significant bit (MSB) in the address byte controls direction when addressing a multifunction decoder in primary address mode. Bits 0-6 contain an address with a value between 1 and 127. Bit seven may have a value of "0" or "1". If the value of Configuration Variable 1 is "X000 0000" then the decoder will go out of NMRA digital mode and convert to the alternate power source defined by Configuration Variable 12. This setting will not affect the Digital Decoder's ability to respond to service mode packets (see S 9.2.3). The default value for this Configuration Variable is 3, if the decoder is not installed in a locomotive or other unit when shipped from the manufacturer. 
 Some command stations may limit this range to a maximum address value of 99, such as those manufactured by Lenz.Lenz is also an OEM, supplying brands such as Atlas with rebranded DCC systems.
=====Extended Address Range=====
 Inaccurately referred to as a 4 – digit address, or a long address.
When entering an extended address on a throttle, that address becomes an alias. The command station calculates the correct values for the first and second address bytes, which are then transmitted to the decoders. 
The Extended Address range is 1 through 10239 (Hexadecimal values 1 – 27FF). Many systems begin extended addresses at 128, reserving addresses below that value for Primary Addresses only. The Address Partitioning results in 39 or 40 (depending on the command station's software) groups of 256 addresses, for 9983 or 10239 possible addresses in total. To use an Extended Address, the in CV29 must be set. Doing so tells the multifunction decoder's firmware to use the values stored in CV17 and 18. 
This address consists of two bytes, six bits in the first address byte (CV17) and eight in the second (CV18). CV17 must have a value between 11000000 and 11100111, inclusive, in order for this two-byte address to be valid. CV18 may contain any value. To reach $FFFF (Decimal: 65535) would require all 16 bits, meaning there would not be any bits left to indicate which addressing mode is in use. Most command stations calculate CV17 and CV18 automatically, setting CV29 appropriately in the process. Some command stations may permit 1 – 127 as an Extended Address, others prevent their use or that of leading zeros to pad an address (i.e. 0075). This can be an issue if a locomotive it taken to layout which uses another DCC system. 
All DCC Command Stations, Throttles, and Decoders support two−digit (Primary) addressing as per the NMRA standard. Even if your equipment supports Extended addressing, one does not have to use it. 
 Archaic terms for Extended Addresses are "14−bit" or "Long" Addresses. Sometimes called a 14−bit address as 6 address bits are transmitted in the first address byte of the DCC packet in extended address mode. The first two bits of the first byte are reserved and always set to 1. 
 Also see the article on Consisting, as the Consist Address (CV19) can be an issue when a locomotive is used on another layout. </p>
=== Broadcast Address / Address Zero ===
==== Multifunction Decoder ====
:Address Zero is reserved in the NMRA Standard S-9.2.1 for exclusive usage as a "Broadcast Address". Instructions addressed to "broadcast address" 00000000 must be executed by all Multifunction Decoders. 
Any DCC locomotive receiving a DCC command packet sent to this address must accept the DCC command without regard or consideration of its assigned address. NCE uses this feature in the Power Pro software to clear consists.
The value stored in CV1 does not need to be "0" for this feature to work. Therefore, this address is NOT a locomotive address that a user needs for the normal control of his trains. However, this is an address the DCC system itself may want to send. An example at the DCC system level is E-STOP command which will halt all trains immediately without disconnection of track power.
:See Braking District for more on using the broadcast packet to stop trains.
==== Note Regarding CV 1 ====
 Important: Never set CV1 to a value of Zero! CV1 acts with CV12 CV12 is optional. . Setting CV1 to zero causes the decoder to ignore the Alternate Power Source switch in CV29, enabling Power Source Conversion (CV12 Contains the identity of the alternate power source to which the decoder will be converted should CV1 contain all zeros. The NMRA allocates the modes on an "as needed" basis. ), which may result in a runaway locomotive. 
==== Accessory Decoder ====
A broadcast address for accessory decoders is also available.
=== NMRA Multifunction Decoder Address Range Summary ===
# Primary Addresses are the values from 1 to 127 (inclusive). These values are found in CV1 (Primary Address). 
# Extended Addresses are values from 128 to 10239. These values are stored in CVs 17 and 18 (Extended Address), and are only active if the Extended Address Mode flag in CV29 is set. 
# Advanced Consist Addresses use the Primary Address range.
# Address "0" can have a number of meanings. That address is not permitted in CV1 (Primary Address). 
# Manufacturers of DCC command stations are not required to implement the entire range of Primary and Extended addresses, such as limiting the Primary Addresses to 1 − 99.
# The terms "2 digit" and "4 digit" address are not technically correct for decimal numbers.
## Primary Address is limited to 127, as the MSB (most significant bit) indicates directional status. 
## Extended Addresses use the MSBs of the first byte to indicate Extended Addresses. 
## Two-digit address refers to a single byte binary or 2-digit hex number, four digit means a 2-byte address (Four Hex Digits). The actual decimal value can be more than 9999 in 4-digit mode.
=== Multifunction Decoder Address Compatibility Issues ===
 There is some overlap in addressing, different command stations handle that overlap differently. Some command stations do not allow addresses 1 − 99 or 1 − 127 to be used as an Extended Address. 
* The NMRA DCC Standard does not require the manufacturer to implement all the addresses possible in their command station software.
* Primary Addresses may be restricted to numbers between one and ninety-nine (0x63).Lenz uses this range for addresses. A locomotive programmed for 101 (0x65) will not run on a DCC system which restricts the maximum address to 99.
** Some systems may limit addresses to a small range, such as 1 to 10, often implemented for cost reasons. These restrictions must be clearly identified on the packaging and in the instructions for the DCC system in question.
* The Extended Address maximum value is 10,239 unique addresses. Some systems may limit this to 9,999 addresses or less. For most users this will not be an issue, as they still have 90% of the address space available.Digitrax allows a maximum of 9985 address, due to their interpretation of the DCC Standard. Fixing it would possibly break a number of LocoNet features, so it will remain limited to that range of addresses. 
*With an overlap between Primary and Extended Address values of 1 – 127, the decoder recognizes the difference, as the address byte will equal to or greater than 192.
* If the Primary Address in CV1 is set to a value of 0 or an invalid address, the decoder will, upon power up, switch to the Alternate Power Source defined in CV12, overriding CV29's APS flag. Any locomotive configured in this manner will immediately accelerate to full speed when the DCC track power comes on. 
** CV12 is an optional CV. If the decoder does not support an alternate command control system, CV12 will be omitted. In many multifunction decoders the only alternate mode available is Analog.
===Programming a Multifunction Decoder Address===
 Attempting to program an extended address using Program on the Main (POM) mode can cause problems. See the article on Decoder Programming for more details. 
* Most command stations handle all the needed calculations required to program addresses. Their software eliminates the need to calculate and enter values into CV29, CV17 and CV18. This is why there may be an overlap between manufacturers regarding Primary and Extended address implementation.
===DCC Systems and Addressing Ranges===
====NMRA Standard Addressing Schemes====
NMRA DCC Addressing Methods	NMRA DCC Addressing Methods	NMRA DCC Addressing Methods	NMRA DCC Addressing Methods
Address 	Decimal 	Hexadecimal 	Notes
Primary 	1 − 127 	$1 − $7F 	
Extended 	1 − 10239 	$1 − $27FF 	
Advanced Consist 	1 − 127 	$1 − $7F 	Address space shared with Primary Address
==== Digitrax ====
* 0 = Analog Mode
* 1-127: Primary Address
* 128-9983: Extended Address
* 9984 – 9999 available with JMRI or a WiThrottle
* 10000 – 10239 available via the JMRI throttle
* Advanced Consist Address: 1 - 127
The software in the Digitrax command stations support Primary addresses in the range of 1-127 only. An Extended Address of 0001 to 0128 is not supported and will not be recognized by the command station. 
</I> Do not attempt to program an Extended Address using Ops Mode as the programming operation will not succeed, and it is possible that a random address will be programmed instead.
 The Extended Address restriction of 9983 is only present in a LocoNet throttle. External throttles such as JMRI can address the entire NMRA Extended Address Range.
==== EasyDCC and Lenz ====
* 0 = Analog Mode 
** Not supported by EasyDCC
* 1-99: Primary Address
** Easy DCC deems these addresses to be Consist Addresses.
* 100-9999: Extended Address
** Addresses > 9999 are not available.
* 1-99: Advanced Consist Address
 To maintain compatibility with their older, pre-DCC Standard command control products, Lenz limited the Primary Addresses to 1 – 99.
==== ESU ====
* Zero Stretching (Address 0/00) not supported.
* 1 –127: Primary Adddress
* 128 – 9999: Extended Address
* Addresses > 9999 are not available
====Atlas====
Although Atlas DCC systems are supplied by Lenz, their software lacks support for Extended Addresses and Analog operations.
* Primary Address: 1 – 99
* Consist Address 1 – 99
====Bachman====
=====EXDCC and EZCommand =====
*The EZDCC/EZCommand system lacks support for Advanced Consisting 
*Analog operation uses another address.
*No Extended Addresses
*Primary Address Range limited to 1 – 9
===== Dynamis =====
* Zero Stretching (Address 0/00) not supported.
* 1 –127: Primary Adddress
* 128 – 9999: Extended Address
* Addresses > 9999 are not available
==== NCE ====
# PH5 Starter Set
# CS02
# Power House/PH Pro 
# Power Cab
* 0 = No locomotive selected
** Analog Mode not supported
* 1 − 127: Either Primary or Extended depending on how selected, a leading 0 (i.e. 0100) will make selection extended. See Consisting article for more details.
** If a Primary Address is padded with leading zeros, the command station will interpret it as an Extended Address, and calculate the correct value. During configuration of a multifunction decoder with the handheld throttle it will set CV29's Extended Address flag.
** Avoid using Primary (2 digit) Addresses, to prevent conflict with Advanced Consist Addresses.
* 0001 − 9999: Extended Address
** The command station will accept any address as an Extended Address. A two digit ‘’Extended address must be padded with leading zeros during entry. 
*** Example, Extended Address 55 is entered as 0055 or 055. The throttle will display an asterisk (*) before the address indicating an Extended Address.
* Addresses > 9999 are not available. 10000 – 10239 available with JMRI throttle. 
* Advanced Consist Address: 1 − 127. Consist Addresses begin at 127, decremented for each additional consist. 
:Current NCE products do not support analog (no decoder installed) locomotives, older NCE systems, including those built around NCE OEM parts and software, did allow analog operations using a home built (analog only) throttle.
====Zimo====
* Analog Mode = User assigned address
* 1 − 127: Primary Address
* 100 − 10239: Extended Address 
* 1 − 99: Advanced Consist Address
== Accessory Decoder Addressing ==
As noted above, Basic Accessory Decoder Packets have addresses in the range of 128 − 191 ($80 − $BF) which are reserved for Accessory or Stationary Decoders. They are differentiated from Multifunction Decoder addresses by the value first two bits being 10.
Accessory Decoders have 9- or 11-bit addresses. This is accomplished by the structure of the data packet, where the first byte contains six address bits.
Accessory Decoders can be designed for momentary or constant on devices, the duration of each output is controlled by CVs 515 – 518. Bit 3 of the second byte (C) activates or deactives the controlled device.
As most devices are paired, bit 0 of the second byte determines which pair of outputs are being activated/deactivated. Bits 1 and 2 indicates which of four pairs the packet controls. 
=== Accessory Decoder 9 Bit Address ===
Basic Accessory Packets
Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet
Preamble 	0 	10AAAAAA 	0 	1AAACDDD 	0 	EEEEEEEE 	1
Where: 
* A = Address bit, 
* C = Command and 
* D = Data.
C activates/deactivates the addressed decoder as needed. The three data bits allow control of up to 8 functions (0-7), split into 2 pairs of 4 outputs. 
By convention, the three address bits (bits 4-6) of the second byte are in One's Complement format. Bit 7 indicates the sign is negative.
=== Accessory Decoder Extended (Eleven Bit) Address ===
* Extended or Signal Accessory Decoder Packet
** Intended for use with Signal Systems. Sometimes called a Five Digit address, as it can be values up to 16,383. 
The Extended Address:
Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet	Basic Accessory Decoder Packet
Preamble 	0 	10AAAAAA 	0 	0AAA0AA1 	0 	000XXXXX 	0 	EEEEEEEE 	1
:Note that the four CDDD bits of the nine-bit address packet have been replaced with two additional address bits, 0AA1 to make an 11-bit address. The first 9 address bits are still present. Bit 7 (the leading bit) of the second byte is a 0, indicating bits 4-6 are a positive value. This allows the decoder to determine if the packet is for turnouts or signals
The XXXXX is for signal aspects. The five bits are for a single aspect, a value of 00000 indicates absolute stop. The five-bit values are determined by the signalling system and the prototype being modelled.
The following third byte contains 5 bits (XXXXX) which are for signalling applications. The third byte allows combinations up to $1F, or 32 possible signal aspects. A value of 00000 is the absolute stop indication. This allows for various signal aspects dependant on the prototype modelled.
=== Additional Commands ===
Additional commands are available for broadcast commands, configuration variable access, and Operations Mode programming. Some commands are unique to the basic and extended addressing modes.
See S-9.2.1, DCC Extended Packet Formats for more detail.
== Multifunction Decoder Packet Construction ==
This is an advanced topic. 
=== Primary Address ===
Preamble A digital decoder must not accept as a valid, any preamble that has less then 10 complete one bits, or require for proper reception of a packet with more than 12 complete one bits. A command station must send a minimum of 14 full preamble bits: S-9.2	Start Bit	Address Byte	Data Start Bit	Data Byte	Data Start Bit	Error Btye	Packet End Byte
111111111111 	0 	0AAAAAAA 	0 	01DCSSSS 	0 	EEEEEEEE 	1
==== Address Byte ====
All values are valid except for 0, 11111110 ($FE) and 11111111 ($FF).
* This byte can be used in special case for instructions, such as Service Mode Programming 
Bits 0 – 5 Bits are numbered from Right to Left can any value. If both bits 6 and 7 are set to value of 1, the decoder interprets that as an extended address and expects a second byte for address data. A multifunction decoder's primary address may have any value from 1 to 127. Maximum permissible value is 127, but the manufacturer may limit the address space. 
For the consist address, see CV19.
==== Data Byte ====
* Bits 6 and 7 are set to 01 indicating this byte is for speed and direction information. These bits can also be used for other types of instruction data, defined in the Extended Packet Format Recommended Practice (RP-9.2.1) 
* "D" is direction. When set to 1 the locomotive should move in the forward direction. Forward in this case is in the direction of the front of the locomotive, as observed from the engineer's position within the locomotive. 
* "C" is an additional speed bit, which enables the 28 speed step mode when combined with the S bits. For backward compatibility this bit may also be used to control the headlight. RP-9.2.1. A headlight which changes state with every change of the throttle indicates a mismatch in speed steps between the multifunction decoder and the command station.
* "S" is the speed instructions.
* The 14 Speed Step Mode is obsolete.
==== Error Byte ====
This byte is used to determine the presence of errors. It cannot be used to correct an error, only identify the presence of one. It is created by an Exclusive OR (XOR) operation on the Address and Instruction Bytes.
=== Extended Address Packet ===
Preamble 	Start Bit	Address Byte	Data Start Bit	Address Byte	Data Start Bit	Data Byte	Data Start Bit	Error Btye	Packet End Byte
111111111111	0 	AAAAAAAA 	0 	AAAAAAAA 	0 	CCCDDDDD 	0 	EEEEEEEE 	1
==== Address Bytes ====
The Primary Address byte contains seven address bits. If the EAM flag is set in CV29, the decoder will ignore any valid address in CV1, switching to the values stored in CVs 17 and 18.
When the most significant bits are between 1100 0000 and 1110 0111 (decimal values 192-231) inclusive, a second address byte must follow immediately after. These values in the first byte signal to the decoder that this packet is a multifunction decoder packet with an extended address. The two address bytes are separated with a 0 bit.
The most significant bit of the two-byte address is bit 5, bits 6 and 7 having a value of 1 in this case. As 14 of the sixteen available bytes are used, the archaic term 14 bit address may be seen in older documents. S-9.2.1, DCC Extended Packet Formats
==== Data Bytes ====
The data byte contains the instructions for the decoder. It can one to three bytes in length.
The instruction byte is defined as: 
* CCCDDDDD, 
* CCCDDDDD 0 DDDDDDDD, 
* CCCDDDDD 0 DDDDDDDD 0 DDDDDDDD
Each instruction consists of a three-bit instruction field (CCC) followed by a five-bit data field. The five-bit data field may contain instruction subtype or tertiary types as well as flags. See the DCC Extended Packet Formats, S-9.2.1 for further details.
Instruction Bits	Purpose
000 	Decoder and Consist Control S-9.2.1, 2.3.1 With the exception of the decoder acknowledgment function (00001111), only a single decoder and 
consist control instruction may be contained in a packet.
001 	Advanced Operation Instructions S-9.2.1, 2.3.1.1 The decoder control instructions are intended to set up or modify decoder configurations.
010 	Speed and Direction for Reverse Operation S-9.2.1, 2.3.3 A speed and direction instruction is used to send information to motors connected to MultiFunction Decoders
011 	Speed and Direction for Forward Operation S-9.2.1, 2.3.3 A speed and direction instruction is used to send information to motors connected to MultiFunction Decoders
100 	Function Group One Instructions S-9.2.1, 2.3.4 Up to 5 auxiliary functions (functions FL and F1-F4) can be controlled by the Function Group One 
instruction.
101 	Function Group Two Instructions S-9.2.1, 2.3.5 Up to 8 additional auxiliary functions (F5-F12) can be controlled by a Function Group Two 
instruction.
110 	Feature Expansion S-9.2.1, 2.3.6. Also see TN-3-05
111 	Configuration Variable Access Instruction S-9.2.1, 2.3.7 The Configuration Variable Access instructions are intended to set up or modify Configuration 
Variables either on the programming track or on the main line.
=== Example of Differences Between Two and Four Digit Addressing ===
Numbers in CVs 1, 17 and 18 in the table are expressed in Hexadecimal. The address is a decimal value. Note that changing the address from Primary to Extended mode changes the value in CV17.
The Extended Address begins with $C0, the next byte contains $63, or 99 in Decimal. The first byte of the Extended Address can only equal values from 192 ($C0) to 231 ($E7). Setting CV29 controls the addressing mode a multifunction decoder will accept. In some DCC systems the software will automatically set a multifunction decoder's CV29 to Extended Address mode when an address within the Primary Address range is padded with leading zeros. Values 128 to 191 indicate an Accessory Decoder or Extended Accessory Decoder address. See the section on Address Partitions above.
Type 	Address	CV1 	CV17	CV18
Primary 	99 	$63 	-- 	--
Extended	099 	Undefined	$C0 	$63
Extended	0099 	Undefined	$C0 	$63
 
== Additional Resources ==
=== Video: Long Addresses and CV29 ===
===Additional Reading===
* DCC Decoder Addressing at the TCS Website
# S-9.1 Electrical Standard
# S-9.2 Communications Standard (2004)
# NEM 671: Digital Control Signal DCC, 2004
</div>
</div>
==== NMRA Documents ====
===== Normative =====
* S-9.1 DCC Electrical Standard
* S-9.2 DCC Communication Standard
* S-9.2.1.1 DCC Advanced Extender Packet Formats
* S-9.3.2 DCC Bi-Directional Communication
===== Informative =====
* TN-3.05 Electrical Specifications for Digital Command Control Decoder Transmission
* TN-4.05 Electrical Specifications for Digital Command Control Decoder Transmission
* RCN-210 DCC Protocol Bit Transmission
* RCN-211 DCC Packet Structure
* RCN-212 DCC Operating Commands for vehicle decoders
* RCN-213 DCC Operating commands for accessory decoders
* RCN-214 DCC configuration commands
There has been a concentrated effort to harmonize the Standards and Rail Community Norms listed above.
==== External links ====
* Hexadecimal
=== References ===