Address Partitioning

DCCWiki, a community DCC encyclopedia.
(Redirected from Primary address)
Jump to: navigation, search


Summary: DCC Address Partitioning Explained

Short Definition

The range of addresses available on a Digital Command Control system.

This Digital Command Control topic deals with the address range used by Multifunction Decoders. For stationary decoders, see the article on Accessory Decoder Addressing.

Multifunction decoders can be addressed by either Two or Four digit numbers. The digits in are Hexadecimal (base 16) numbers, not ‘’Decimal (base 10).

With two digits addresses ranging from 1 to 127 (excluding 0 and 3) are possible. Four digit addressing increases that range 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.
Reminder: The number of digits refers to a Hex Number, where a digit has a value from 0 to 15 ($0 - $F).
The 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 hex digit ($64) (primary) address, a DCC manufacturer may have limited their two digit 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 Two or Four Digit Addresses?

Note Regarding Address Partitions

Remember:

Two Digit (Primary) addresses range from 1 to 127. Consist Addresses share the 2 digit address partition.
Four Digit (Extended) addresses occupy the address space from 1 to 10,000. They do not occupy the 2 digit address partition.

The NMRA has mandated that any DCC compatible product which does not support features such as 4 Digit Addressing or 28/128 Speed Steps must state that on the package and within the instructions.

CPR 8909 H-24-66 Train Master.JPG

Two versus Four Digit Addressing

The choice of Two or Four digit addressing is a personal one. If operation with multiple unit consists are planned, four digit (Extended Address) is the better choice. Using an Extended Address avoids conflicts with consist addresses which also occupy the Primary Address partition.

With less than 20 or 25 locos on the layout, two−digit addressing works. Give each loco an address using the last two digits of the road number on the side of the loco. If you have duplicate numbers, use the first two digits of the road number. If that doesn't work, you may have to renumber one or more locos − or switch to four−digit 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 30 will be acted on by 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 four−digit addressing, you must have a command station and decoders that support four−digit addressing, and throttles that can use it. Typically, all decoders support four−digit addressing, and the majority of DCC systems support four−digit addressing. You'll need to research your choice of system for compatibility. Four digit addressing makes it easy to use the road number of a locomotive as its address.

Address Partitioning, Extended Packet Format (S−9.1.2)

The Address Partitioning allows the decoder to determine if the packet is a multifunction or accessory decoder packet.

Address Partitions, Extended Packets, S−9.1.2
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, CV1. Note: This space is shared with Consist Addresses.
128−191 1000 0000 − 1011 1111 $80 − $BF Basic Accessory Decoder 9 Bit Address or Extended Accessory Decoder 11 Bit Address
192 − 231 1100 0000 − 1110 0111 $C0 − $E7 Extended Address Mode: Multifunction decoder, 14 bit address' First Byte, (CV17) which signals a second address byte to follow. This is a calculated value. Activated with EAM flag in CV29.
232 − 254 1110 1000 − 1111 1110 $E8 − $FE Reserved for Future Use
255 1111 1111 $FF Idle Packet

By partitioning the addresses into distinct ranges, the decoder can examine the address byte and determine if that packet is for it or not. The command station will generate that specific address byte depending on what the user wants to do. An address of 100 is reserved for multifunction decoders, so a multifunction decoder with that address will respond it that packet.

If an Extended (4 Digit) address is used, the first 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.

  1. A Primary Address uses one byte to transmit 2 digits
  2. An Extended Address uses two bytes, transmitting 4 digits.
  3. The Primary Address is stored in the multifunction decoder’s CV1
  4. The Extended Address uses calculated values stored in CV17 and CV18

Determining what type of address is simple:

  1. If the first bit is a 0, it is a 2 digit (one byte) address for a multi−function decoder
    1. If all bits are zero, it is the broadcast address.
  2. If the first bit is a 1, and the second is a zero, it is an Accessory decoder address
  3. If the first and second bits are 1, it is a 2 byte, Extended Multifunction Decoder address.
  4. If all the bits are 1, it is an idle packet.

Multifunction Decoder Addressing

Default Address

The NMRA Standard S−9.2.2 defines the default Primary Address as 3 (three) for retail decoders. If the multifunction decoder is installed by a manufacturer in a locomotive or other vehicle, it can be any value. See the page on Configuration Variables for more detail.

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 the value of 0116 to 7F16 (1 to 127 in decimal) − hence it is called a Two Digit Address. Other terms used for the Primary address are the Short, Baseline or 7−bit Address. It is called a 7−bit address because the first (most significant) bit in the first byte of a DCC packet is always a zero when it is addressing a multifunction decoder in primary address mode. The MSB of this byte can be used for other purposes.

Extended Address Range

The second range of addresses is from 1 through 10239 (116 to 27FF16). This is the Extended Address. To use the Extended Address Mode, the EAM flag 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 calculated values. Most command stations will do this automatically, and set CV29 appropriately in the process. During operation the command station will calculate and format the DCC packet for an extended address.

Other terms for the Extended addresses are "14−bit" or "Long" Addresses. It is called a 14−bit address because 6 bits are transmitted in the first byte of a DCC packet in extended mode. The first two bits of the first byte are reserved and always set to 1.To reach FFFF16 (or 6553510) would require all 16 bits, meaning there would not be any bits left to indicate which addressing mode is in use. All DCC Command Stations, Cabs, and Decoders support two−digit (Primary) addressing as per the NMRA standard. Even if your equipment has four−digit addressing, you don't have to use it.

It is permissible for command stations to restrict the available addresses, the NMRA DCC Standard mandates those limitations be identified on the package and in the instructions.

Broadcast Address / Address Zero

Multifunction Decoder

Address Zero is reserved in the NMRA Standard S9.2.1 for exclusive usage as a "Broadcast Address".

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.

Note Regarding CV 1

Important
Never set CV1 to a value of Zero!

CV1 acts with CV12. Setting CV1 to zero causes the decoder to ignore the Alternate Power Source switch in CV29 by enabling Power Source Conversion (CV12), which may result in a runaway locomotive.

  • CV12 is optional, your decoder may or may not include that CV.

Accessory Decoder

A broadcast address for accessory decoders is also available.

NMRA Multifunction Decoder Address Range Summary

  1. Primary Addresses are the values from 1 to 127. These values are found in CV1 (Primary Address)
  2. Extended Addresses are values from 1 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.
  3. Advanced Consist Addresses use the Primary Address range.
  4. Address "0" can have a number of meanings. That address is not permitted in CV1 (Primary Address).
  5. 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.
  6. The terms "2 digit" and "4 digit" address are not technically correct for decimal numbers.
    1. Primary Address is limited to 127, as the MSB (most significant bit) indicates headlight status.
    2. Extended Addresses use the MSBs of the first byte to indicate Extended Addresses.
    3. 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 of addresses, different command stations handle that overlap differently. Some command stations do not allow use of low addresses (1 − 99 or 1 − 127) in four-digit mode.
  • Primary Address Range may be restricted to numbers between one and ninety-nine (0x63). 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. This is often done 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 range is limited to a maximum value of 10,239. Some systems will limit this to 9,999. For most users this will not be an issue, as they still have 90% of the address space available.
  • 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, the decoder will upon power up switch to the Alternate Power Source defined in CV12. This will override CV29. 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.
  • The standard does not require the manufacturer to implement all the addresses possible in that range in their command station software.

Programming a Multifunction Decoder Address

Attempting to program an address using Program on the Main (POM) mode can cause problems if the current address is an Extended Address. 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

  • Primary Address: 1 - 127
    • Extended Address: 0 - 10239
  • Analog Operation: Allowed
  • Advanced Consist Address: 1 - 127
NMRA Addressing Method
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
  • Advanced Consist Address: 1 - 127

EasyDCC and Lenz

  • 0 = Analog Mode
    • Not supported by EasyDCC
  • 1-99: Primary Address
  • 100-9999: Extended Address
  • 1-99: Advanced Consist Address

Atlas

Although Atlas DCC systems are supplied by Lenz, their software lacks support for Extended Addresses and Analog operations.

Bachman EZDCC

  • The EZDCC system lacks support for Advanced Consisting
  • Analog operation uses another address.
  • No Extended Addresses
  • Primary Address Range limited to 1-9

NCE

  • 0 = No locomotive selected
  • 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.
  • 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, addresses in the range of 128 − 191 ($80 − $BF) are reserved for Accessory or Stationary Decoders. They are differentiated from Multifunction Decoder addresses by the value first two bits being 10.

Stationary 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 Decoder 9 Bit Address

{preamble} 0 11AAAAAA 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 (14 Bit) Address

Intended for use with Signal Systems. Sometimes called a Five Digit address, as it can be up to a value of 16,383.

The Extended Address:

{preamble} 0 11AAAAAA 0 0AAA0AA1 0 000XXXXX 0 EEEEEEEE 1

Note that the four CDDD bits have been replaced with two additional address bits, to make an 11 bit address. The first 9 address bits are still present.

Bit 7 of the second byte is a 0, indicating bits 4-6 are a positive value.

The following third byte contains 5 bits 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.

Packet Construction

This is an advanced topic.

Primary Address

Preamble 0 AAAAAAAA 0 CCCXDDDD 0 EEEEEEEE 1

"D" is direction "X" is an extra bit for speed steps, which may be used to headlight control to maintain compatibility. A Value of 0111 1111 is address 127: It will be transmitted like this:

LSB Bit Value MSB
7 6 5 4 3 2 1 0
1 1 1 1 1 1 1 0

If bits 0-5 are any value except 111111, and 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. The address byte can have any value from 1 to 127.

The Least Significant Bit is transmitted first, so it can be a little confusing. Data is sent in serial fashion and clocked into a shift register one bit at a time. As each bit of data arrives, the values in the shift register move to the right. After all eight bits have arrived the LSB will be in the correct place at Bit 0.

Extended Address Packet

DCC Packet for Extended Multifunction Decoder Addressing The First address byte is compared with CV17, the second address byte with CV18.
First Address Byte Second Address Byte Instruction Byte Error Byte
Preamble 0 AAAA 0A11 AAAA AAAA 0 CCCD DDDD 0 EEEE EEEE 1

In this example, the most significant bits of the first address byte are 6 and 7, set to "11", and if the others are not 111111, it indicates that another byte of address data will follow. Bit 5 forms part of the address partition value, with a valid value of 1 or 0. Bit 4 must be zero. Since bits 0-5 cannot equal 111111, this limits the available address range. The only valid decimal values for the first byte (CV17) are 192 to 231.

Shift Register Action on the Extended Address Byte The Shift Register shifts each digit to the right as they are received, resulting in the correct value after receiving all eight bits. This byte tells the decoder it is an extended address byte for a multi-function decoder.
Packet Value Value in Shift Register Hexadecimal Value Decimal Value
0000 0011 1100 0000 $C0 192
1110 0111 1110 0111 $E7 231

Example of Differences Between Two and Four Digit Addressing

Numbers in CV 17 and CV18 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 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

CV29 is often called the Master Variable because it controls how several other functions operate. This makes it very important to get it right. In this video I'll share with your what CV29 does, and give you a handy table that saves you the trouble of hand calculating the needed values.


Additional Reading

More information is available in the NMRA DCC Standards documents:

  1. Electrical Standard
  2. Communications Standard

External links