What's All This Short And Long Addressing?
Originally published in the DCCUK Yahoo group as "CVs and Speed Steps For Beginners - Part 3".
DCC offers two ways of addressing locos, often referred to as short or 2-digit addressing and
long, extended or 4 digit addressing. To fully explain addressing I really need to start talking
in terms of binary bits and bytes and hexadecimal numbers. If you don't understand these terms
then a look at this page may help
(one of nearly 300,000 hits from a google search on "bits bytes hex").
The sequence of bytes sent by a command station to represent a given command is known as a
"packet". The first byte of every packet is always an address byte with a value from 0 to 255.
This range is subdivided into a number of address ranges or partitions. The partitions of
interest to us here are values from 1 to 127 (binary 00000001 to 01111111) and 192 to 231
(binary 11000000 to 11100111).
As a quick aside it's convenient to discuss address 0 here. The convention in DCC is that
selecting address 0 on your throttle means you wish to control an unchipped (analogue or DC)
loco on your system. This *does not* cause the command station to send packets with an address
byte of zero. Instead the command station modifies the DCC output waveform (known as zero
stretching) to give it a DC bias causing the loco to move either forwards or backwards. The
command station uses address zero as a "broadcast" address to send commands to all decoders at
once. A decoder must obey all broadcast commands which it supports regardless of its own
address. An example of the use of adress 0 is to broadcast an emergency stop command to all
locos.
Back to the main topic, our first address partition, 1 to 127, is the primary address range and
represents one byte, 2-digit or short addresses. A decoder that is setup for short addressing
will compare the first byte of a packet with the value in CV1, the primary address. Thus a short
address can be anything in the range 1 to 127. Half of you are now probably saying "hang on,
that's three digits" or "oh not it isn't, it's 1 to 99". More on that story later, as Kirsty
Wark would say (apologies to those who don't/can't watch Dead Ringers on the BBC).
Our second address partition of interest to us is where things get a little more complicated.
Any packet that has an address byte that falls within our second address partition (192 to 231)
will have a further address byte in the second byte of the packet. The second address byte can
take any value in the range 0 - 255. The two bytes together form a two byte or extended address
- almost. The two most significant bits (7 and 6) of the first byte must be removed since they
are used to distinguish the address partition and are not actually part of the address. So the
first address byte holds an address value in the range 000000 to 100111. Joining the two address
bytes together give us a 14-bit address range of 00000000000000 (both bytes zero) to
10011111111111 (both bytes at their maximum value). In hexadecimal this is 0 to 27FF and in
decimal it's 0 to 10239 (but that's 5 digits, you cry!).
CV17 and 18 are used to tell a decoder which address to use when it is setup for extended
addressing. The two most significant bytes must be included in CV17 even though they are not
really part of the address so CV17 takes legal values in the range 11000000 to 11100111 or C0 to
E7 (hex) or 192 to 231, exactly matching the first byte of the packet.
Still with me? That's the story as far as the DCC specifications are concerned and all decoders
should play by the above rules.
For command stations, however, DCC manufacturers have chosen to "differentiate" their products
(or should that be just confuse us mere users) by adopting different definitions of what
constitutes a short or long address. Quite common is the rigid 2-digit approach such that short
addresses are 1-99. That's easy, but are long addresses 0-9999 or 100-9999 or ...? Only you can
answer that by reading the manual for your system. Some systems even give you the flexibilty to
specify an address in the range 1-99 (or is it 1 - 127?) as either short or long when
programming a decoder or selecting a loco on a throttle. Nothing in life is simple these days!
How does a decoder know when to use extended addressing? That's where the dreaded CV29 comes in,
but CV29 deserves a chapter in itself.
More on that story later...
|