Reference

DCC-EX Consolidated Command Summary

Engineer Hat

This is a summary, for a detailed command, see…

Command Reference

This page describes all the DCC-EX commands that the EX‑CommandStation supports.

Conventions used on this page

  • < and > - All DCC-EX commands are surrounded by these characters to indicate the beginning and end, these must always be included

  • First letter or number - These are called OPCODES, are case sensitive, and must be specified as directed, eg. 1, c, or -

  • CAPITALISED words - These are parameters referred to as keywords, and should be specified as directed, eg. MAIN (note these are not case sensitive, however capitalising makes them easier to distinguish from other parameters)

  • lowercase words - These are parameters that must be provided or are returned, with multiple parameters separated by a space ” “, eg. cab

  • Square brackets [] - Parameters within square brackets [] are optional and may be ommitted, and if specifying these parameters, do not include the square brackets themselves

  • | - Use of the | character means you need to provide one of the provided options only, for example <0|1 MAIN|PROG|JOIN> becomes either <0 MAIN> or <1 MAIN>

  • 0|1 DIRECTION: 1=forward, 0=reverse.

Commonly used Parameters (Arguments)

  • cab - DCC Address. i.e. a Loco. (eg. 3-9999)

  • speed - 0-127

  • dir direction - 1=forward 0=reverse

  • speedByte - 0=stopped 1-127=reverse 128-256=forward

  • funct function - function number related to a specific DCC decoder/ loco (e.g. 0-27)

  • functMap functionMap - individual bits of the returned number represent the state of the specific functions

  • slot - redundant parameter. This needs to be included but is ignored by the EX-CommandStation

  • reg register - redundant parameter. This needs to be included but is ignored by the EX-CommandStation

  • desc description -

  • byte -

  • track - ‘MAIN’=Main track ‘PROG’=Programming Track ‘JOIN’=Main and Programming tracks temporarily joined

Controlling the EX-CommandStation

Power management

Command

Description / Response

<onOff [track]>

<0|1 [MAIN|PROG|JOIN] >

Track Power
Turns power on and off to the MAIN and PROG tracks together or independently. Also allows joining the MAIN and PROG tracks together.
onOff: 1=on 0=off
track: <blank>= Both Main and Programming Tracks ‘MAIN’=Main track ‘PROG’=Programming Track ‘JOIN’=Join the Main and Programming tracks temporarily
 
Response: <pX [MAIN|PROG|JOIN]>
Where “X” is 1=on | 0=off. MAIN, PROG and JOIN are returned when you invoke commands on just one track.
e.g.
Response (Both Main and Prog on): <p1>
Response (Main on only): <p1 MAIN>
Response (Prog on only): <p1 PROG>
Response (Joined - Main and Prog on): <p1 JOIN>
Response (All off): <p0>

<D RESET>

Re-boot the command Station
 
Response: n/a

Cab (Loco) Commands

Command

Description / Response

<t reg cab speed dir>

Set the speed and direction of a Cab (Loco)
 
Response: <l cab reg speedByte functMap>
speed - 0-127
dir - 1=forward 0=reverse
Note: this starts a reminder process for any external updates to the cab’s (loco’s) status.
 
Legacy response: Deprecated
<T reg speed dir> - do not rely on this response

<t cab>

Requests a deliberate update on the cab speed/functions in the same format as the cab (loco) broadcast.
 
Response: <l cab reg speedByte functMap>
Note:
If the cab (loco) is not in the reminders table. The Command Station will not return a valid response until a speed is applied to the cab. In this case <l -1> will be returned.

<- [cab]>

Remove one or all locos from reminders
cab - <blank>= all locos No.= Cab (loco) to forget
 
Response: n/a

<!>

Emergency Stop

Response: <l cab reg speedByte functMap> (For each loco in the reminders list.)

<F cab funct 1|0>

Turns loco decoder functions ON and OFF
funct - 0-28 (F29-F68 (Support for the RCN-212 Functions)
NOTES:
- Setting requests are transmitted directly to mobile engine decoder.
- Current state of engine functions (as known by commands issued since power on) is stored by the CommandStation - All functions within a group get set all at once per NMRA DCC standards.
 
Response <l cab reg speedByte functMap>

<JR>

Request the list defined Roster Entry IDs
 
Response (roster exists): <jR id1 id2 id3 ...>
Response (no roster exists): <jR>
Returns the list of defined roster entry IDs

<JR id>

Request details of a specific Roster Entry
 
Response (id is in Roster): <jR id "desc" "funct1/funct2/funct3/...">
Response (id is not in Roster): <jR id "" "">
Returns the ID, description, and function map of the specified roster entry ID

<JT>

Request the list of Turnout/Point IDs
 
Response (has defined Turnouts/Points): <jT id1 id2 id3 ...>
Response (no defined Turnouts/Points): <jT>
Returns the list of defined turnout/Point IDs

<JT id>

Request details of a specific Turnout/Point
 
Response (id is defined): <jT id state "[desc]">
Response (id not defined): <jT id X>
Returns the ID, state, and description of the specified Turnout/Point ID

<JA>

Request the list of Automation and Route IDs
 
Response (has defined Automation/Routes): <jA id1 id2 id3 ...>
Response (no defined Automation/Routes): <jA>
Returns the defined automation and route IDs

<JA id>

Request details of a specific Automation or Route
 
Response (id is defined): <jA id type "[desc]">
Response (id not defined): <jA id X>
Returns the ID, type, and description of the specified automation/route ID
type: ‘A’=automation ‘R’=route

<t cabid>

Request a deliberate update of cab
 
Response: <l cab reg speedByte functMap>
Returns an update of cab speed, directions and functions in the same format as the cab broadcast

<f cab byte1 [byte2]]>

legacy function.
Deprecated, please use <W cv value> instead

System Information

Command

Description / Response

<s>

Request CommandStation Status
 
Response (single): <iDCCEX version / microprocessorType / MotorControllerType / buildNumber>
Response (for each defined Turnout/Point): <H id state>

<c>

Request Current on the MAIN Track
 
Response: <c "CurrentMAIN" current C "Milli" "0" max_ma "1" trip_ma>
c - the current response indicator
CurrentMAIN - Static text for software like JMRI
current - Current in MilliAmps
C - Designator to signify this is a current meter (V would be for voltage)
Milli - Unit of measure for external software with a meter like JMRI (Milli, Kilo, etc.)
0 - numbered parameter for external software (1,2,3, etc.)
max_ma - The maximum current handling of the motor controller in MilliAmps
1 - number parameter for external software (we use 2 parameters here, 0 and 1)
trip_ma - The overcurrent limit that will trip the software circuit breaker in mA

<#>

Show number of supported cabs
 
Response: Will return either <# 20>, <# 30>, or <# 50>

Writing CVs - Program on the main

Command

Description / Response

<M ignored hex1 hex2 [hex3 [hex4 [hex5]]]>

Write a DCC packet the MAIN track
 
Response:

<w cab cv value>

Write CV on main track
 
Response: N/A

<b cab cv bit value>

Write CV bit on main track
 
Response:

<W cv value callbacknum callbacksub>

Write CV
Deprecated, please use <w cv value> instead

<B cv bit value callbacknum callbacksub>

Write bit to CV
Deprecated, please use <W cv value> instead

Reading/Writing CVs - Programming track

Command

Description / Response

<R>

Read DCC decoder address
 
Response (successful): <r cab>
Response (fail): <r -1>

<W cab>

Write DCC address to cab (loco)
 
Response (successful): <w cab>
Response (fail): <w -1>

<W cv value >

Write CV
 
Response (successful): <r cv value>
Response (fail): <r cv -1>

<B cv bit 0|1>

Write bit to CV
 
Response (successful):
Response (fail):

<R cv>

Read CV
 
Response (successful): <r cv value>
Response (fail): <r cv -1>

<V cv guessedValue>

Verify/Read of CV with guessed value
 
Response (successful): <v cv actualValue>
Response (fail): <v id -1>

<V cv bit 0|1>

Verify/Read bit of CV with guessed value
 
Response (successful):
Response (fail):

<P ignored hex1 hex2 [hex3 [hex4 [hex5]]]>

Writes a DCC packet to the PROG track
 
Response (successful):
Response (fail):

Writing CVs - Programming track - Tuning

Command

Description / Response

<D ACK LIMIT mA>

Override ACK processing mA pulse size

Response (successful): N/A
Response (fail): N/A

<D ACK MIN uS>

Override ACK processing minimum pulse width

Response (successful): N/A
Response (fail): N/A

<D ACK MAX uS>

Override ACK processing max pulse width

Response (successful): N/A
Response (fail): N/A

<D ACK RETRY x>

Adjust ACK retries to number x (default is 2)

Response (successful):
Response (fail):

<D PROGBOOST>

Override 250mA prog track limit while idle

Response (successful): ?
Response (fail):

DCC Accessories

Command

Description / Response

<a linear_addr activate>

Control an Accessory Decoder
linear_addr is the linear address of the decoder controlling this turnout (1-2044)
activate 0=off, deactivate, straight or Closed 1=on, activate, turn or thrown

Response (successful): ?
Response (fail): ?

<a addr subaddr activate>

Control an Accessory Decoder
addr is the primary address of the decoder controlling this turnout (0-511)
subaddr is the subaddress of the decoder controlling this turnout (0-3)
activate 0=off, deactivate, straight or Closed 1=on, activate, turn or thrown

Response (successful): ?
Response (fail): ?

Turnouts/Points

Command

Description / Response

<T>

List all defined turnouts/Points

Repeated for each defined Turnout/Point
Response (DCC Accessories): <H id DCC address subaddress state>
Response (Servos): <H id SERVO vpin thrown_position closed_position profile state>
Response (VPIN): <H id VPIN vpin state>
Response (LCN): <H id LCN state>
Response (fail): ?
Response (no defined turnouts/points): ?

state - 0=closed 1=thrown

<T id 0|1|C|T>

Throw (1 or T) or close(0 or C) a defined turnout/point

Response (successful): <H id 0|1>
Response (fail): <X>

<T id>

Delete defined turnout/point

Response (successful): ?
Response (fail): ?

Routes/Automations

Command

Description / Response

<JA>

Returns a list of Automations/Routes

Response (successful): <jA id0 id1 id2 ..>
Response (fail):

<JA id>

Returns information for a route/automation

Response (successful): <jA id type "desc">
Response (fail - is not defined): <jA id X>
type ‘R’= Route ‘A’=Automation
“desc” Textual description of the route/automation always surrounded in quotes (“)

Sensors

Command

Description / Response

<Q>

Lists Status of all sensors

Response (successful) Repeat for each defined sensor: <q id>
Response (fail): N/A

<S>

Lists definition all defined sensors

Response (successful) Repeat for each defined sensor: <Q id ?? state>
Response (fail): <X>

<S id vpin pullup>

Create a new sensor ID
id numeric ID 0-32767 of the sensor
vpin pin number of the input to be controlled by the sensor object
pullup 1=Use pull-up resistor ACTIVE=LOW 0=don’t use pull-up resistor ACTIVE=HIGH

Response (successful): <O>
Response (fail): ?

<S id>

Delete defined sensor

Response (successful): <O>
Response (fail): <X>

WiFi Control

Command

Description / Response

<+command>

Sends AT+ commands to the WiFi board (ESP8266, ESP32, etc.)

Response (successful):
Response (fail): ?

<+X>

Force the Command Station into “WiFi Connected” mode

Response (successful):
Response (fail): ?

Track Manager (Formally DC-District)

Note: this is not available yet in the Production release of EX‑CommandStation

Command

Description / Response

<= trackletter mode [id]>

Configure Track Manager
trackletter is A through H and represents one of the outputs of the/a motor shield.
mode is one of MAIN, PROG, DC, DCX, or OFF (DCX is DC with reversed polarity)
id is the cab ID required when specifying DC or DCX

Response (successful): ?
Response (fail): ?

<=>

Display the current Track Manager configuration

Response : ?

TBA

Command

Description / Response

<D SPEED28|SPEED128>

Switch between 28 and 128 speed steps

Response (successful): ?
Response (fail): ?

Configuring the EX-CommandStation

Turnouts/Points - Configuration

Command

Description / Response

<T id DCC addr subaddr>

Define DCC turnout
Define turnout on a DCC Accessory Decoder with the specified address and subaddress.

Response (successful):
Response (fail):

<T id DCC linear_addr>

Define DCC turnout
Define turnout on a DCC Accessory Decoder with the specified linear address.

Response (successful):
Response (fail):

<T id SERVO vpin thrownPos closedPos profile>

Define servo turnout
Define turnout servo (PWM) on specified vpin. The active and inactive positions are defined in terms of the PWM parameter (0-4095 corresponds to 0-100% PWM). The limits for an SG90 servo are about 102 to 490. The standard range of 1ms to 2ms pulses correspond to values 205 to 409. Profile defines the speed and style of movement: 0=Instant, 1=Fast (0.5 sec), 2=Medium (1 sec), 3=Slow (2 sec) and 4=Bounce (subject to revision). Note: Servos are not supported on the minimal HAL (Uno or Nano target).

Response (successful):
Response (fail):

<T id VPIN vpin>

Define VPIN turnout
Define turnout output on specified vpin. This may be used for controlling Arduino digital output pins or pins on an I/O Extender.

Response (successful):
Response (fail):

<T id>

Delete turnout

Response (successful):
Response (fail):

<T id addr subaddr>

Deprecated
Legacy command format for defining a turnout on a DCC Accessory Decoder with the specified address and subaddress.

Response (successful):
Response (fail):

<T id vpin activePos inactivePos>

Deprecated
Legacy command format for defining a turnout servo on specified vpin. The positions are the same as for the turnout servo command above. Note: Servos are not supported on the minimal HAL (Uno or Nano target).

Response (successful):
Response (fail):

Once all turnout/points have been properly defined, you can use the <E> (upper case E) command to store their definitions to EEPROM.

Sensors - Configuration

Command

Description / Response

<S id pin 0|1>

Creates a new sensor ID, with specified PIN and PULLUP

Response (successful):
Response (fail):

<S id>

Deletes definition of sensor ID

Response (successful):
Response (fail):

Once all sensors have been properly defined, you can use the <E> (upper case E) command to store their definitions to EEPROM.

Outputs

Command

Description / Response

<Z>

Lists all defined output pins

Response (successful):
Response (fail):

<Z id pin iflag>

Creates a new output ID, with specified PIN and IFLAG values
IFLAG, bit 0:
0 = forward operation (ACTIVE=HIGH / INACTIVE=LOW)
1 = inverted operation (ACTIVE=LOW / INACTIVE=HIGH)

IFLAG, bit 1:
0 = state of pin restored on power-up to either ACTIVE or INACTIVE depending on state before power-down.
1 = state of pin set on power-up, or when first created, to either ACTIVE of INACTIVE depending on IFLAG, bit 2

IFLAG, bit 2: 0 = state of pin set to INACTIVE upon power-up or when first created
1 = state of pin set to ACTIVE upon power-up or when first created

Response (successful):
Response (fail):

<Z id 0|1> : Sets output ID to either INACTIVE or ACTIVE state

<Z id> : Deletes definition of output ID

EEPROM management

Command

Description / Response

<E>

Store definitions to EEPROM

Response (successful):
Response (fail):

<e>

Erase ALL (turnouts, sensors, and outputs) from EEPROM

Response (successful):
Response (fail):

<D EEPROM>

Diagnostic dump eeprom contents

Response (successful):
Response (fail):

Diagnostic traces

Command

Description / Response

<D CABS>

Shows cab numbers and speed in reminder table

Response (successful):
Response (fail / no cabs in table):

<D RAM>

Shows remaining RAM (Free Memory)

Response (successful):
Response (fail):

<D ACK ON|OFF>

Enables ACK diagnostics
This will turn ACK diagnostics ON and then try to read the appropriate CVs to determine your loco address.

Response (successful):
Response (fail):
Also see

<D CMD ON|OFF>

Enables Command Parser diagnostics

Response (successful):
Response (fail):

<D ETHERNET ON|OFF>

Enables Ethernet diagnostics

Response (successful):
Response (fail):

<D LCN ON|OFF>

Enables LCN interface diagnostics

Response (successful):
Response (fail):

<D WIFI ON|OFF>

Enables WiFi diagnostics

Response (successful):
Response (fail):

<D WIT ON|OFF>

Enables WiThrottle diagnostics

Response (successful):
Response (fail):

<D HAL SHOW>

Shows configured servo board and GPIO extender board config and used pins

Response (successful):
Response (fail):

Diagnostic programming commands

Command

Description / Response

<D ACK LIMIT mA>

Sets the ACK limit
The Ack current limit is set according to the DCC standard(s) of 60mA. Most decoders send a quick back and forth current pulse to the motor to generate this ACK. However, some modern motors (N and Z scales) may not be able to draw that amount of current. You can adjust down this limit. Or, if for some reasons your acks seem to be too “trigger happy” you can make it less sensitive by raising this limit.

Response (successful):
Response (fail):
Also see

<D ACK MIN µS>

Sets the ACK pulse minimum
The NMRA specifies that the ACK pulse duration should be 6 milliseconds, which is 6000 microseconds (µS), give or take 1000 µS. That means the minimum pulse duration is 5000 µS and the maximum is 7000 µS. There are many poorly designed decoders in existence so DCC-EX extends this range from 4000 to 8500 µS. If you have any decoders that still do not function within this range, you can adjust the ACK MIN and ACK MAX parameters.

Response (successful):
Response (fail):

<D ACK MAX µS>

Sets the ACK pulse maximum

Response (successful):
Response (fail):
Also see

<D ACK MIN µS>

Sets the ACK pulse maximum

Response (successful):
Response (fail):

<D PROGBOOST>

Override 250mA prog track limit while idle
When the programming track is switched on with <1> or <1 PROG> it will normally be restricted to 250mA according to NMRA standards. Some loco decoders require more than this, especially sound versions. <D PROGBOOST> temporarily removes this limit to allow the decoder to use more power. The normal limit will be re-imposed when the programming track is switched off with <0> or <0 PROG> or the Command Station is reset.

Response (successful):
Response (fail):
Also see

I/O (HAL) Diagnostics

Command

Description / Response

<D HAL SHOW>

List HAL devices and allocated VPINs

Response (successful):
Response (fail):

<D SERVO vpin value [profile]>

Set servo position to value on pin vpin.

Response (successful):
Response (fail):

<D ANOUT vpin value [param2]>

Write value to analogue pin vpin, supplying param2 to the driver.

Response (successful):
Response (fail):

<D ANIN vpin>

Read and display pin vpin’s analogue value.

Response (successful):
Response (fail):

Other

Command

Description / Response

<U ...>

Is reserved for user commands (through user filter)

Response (successful):
Response (fail):

More Information

For a detailed command reference, see…

Command Reference