Scale-N

Scale-N
Arduino
Componenten
Rollend Materieel
Naslag
Onderdelen
Wissels
Basis Electronica
Symbols Electronica
Programming Arduino
DCC++
DR5000
Products
Link













































Engine Decoder (CAB) Operation Commands

THROTTLE
The CAB throttle format is < t REGISTER CAB SPEED DIRECTION>

Breakdown for this example <t 1 03 20 1> is:
"<" = Listen to me I am the beginning of a DCC++ command. (A space after < is not required but acceptable)
"t" = (lower case t) This command is for a Decoder installed in a engine or simply a "cab".
"1" = REGISTER: an internal register number, from 1 through MAX_MAIN_REGISTERS (Default is 12), to store the DCC packet used to control this throttle setting (Register "0" is for programming)
"03" = CAB: the short (1-127) or long (128-10293) address of the engine decoder (this has to be already programmed in the decoder) See Programming Commands bellow.
"20" = SPEED: throttle speed from 0-126, or -1 for emergency stop (resets SPEED to 0)
"1" = DIRECTION: 1=forward, 0=reverse. Setting direction when speed=0 or speed=-1 only effects directionality of cab lighting for a stopped train
">" = I am the end of this command

If the command was successful the serial monitor should reply with : <T 1 20 1> meaning :
"<" = Begin DCC++ command
"T" = (upper case T) DCC++ Cab command was sent from DCC++ BaseStation
"1" = register 1 was changed
"20" = set to speed 20
"1" = forward direction
">" = End DCC++ command


CAB FUNCTIONS

The CAB Functions format is <f CAB BYTE1 [BYTE2]>

This turns on and off engine decoder functions
F0-F28 (F0 is sometimes called FL)
NOTE: setting requests are transmitted directly to mobile engine decoder
current state of engine functions is not stored by the DCC++ BaseStation
All functions Groups get set all at once per NMRA DCC standards

#####To set functions F0-F4 on=(1) or off=(0): <f CAB BYTE1 [BYTE2]>#####

< = Begin DCC++ command
f = (lower case f) This command is for a CAB,s function ie: Lights, horn, bell
CAB: the short (1-127) or long (128-10293) address of the engine decoder
BYTE1: 128 + F1*1 + F2*2 + F3*4 + F4*8 + F0*16
ADD the ones you want ON together
Add 1 for F1 ON
Add 2 for F2 ON
Add 4 for F3 ON
Add 8 for F4 ON
Add 16 for F0 ON
128 Alone Turns OFF F0-F4
BYTE2: omitted
> = End DCC++ command


To make BYTE1 add the values of what you want ON together,
the ones that you want OFF do not get added to the base value of 128.
F0 (Light)=16, F1 (Bell)=1, F2 (Horn)=2, F3=4, F4=8
All off = 128
Light on 128 + 16 = 144
Light and bell on 128 + 16 + 1 = 145
Light and horn on 128 + 16 + 2 = 146
Just horn 128 + 2 = 130

If light is on (144), Then you turn on bell with light (145), Bell back off but light on (144)


Breakdown for this example <f 3265 144>
"<" = Begin DCC++ command
"f" = (lower case f) This command is for a CAB,s function ie: Lights, horn, bell
"3265" = CAB: the short (1-127) or long (128-10293) address of the engine decoder
"144" = Turn on headlight
">" = End DCC++ command


To set functions F5-F8 on=(1) or off=(0): <f CAB BYTE1 [BYTE2]>

< = Begin DCC++ command
f = (lower case f) This command is for a CAB,s function.
BYTE1: 176 + F5*1 + F6*2 + F7*4 + F8*8
ADD 176 + the ones you want ON together
Add 1 for F5 ON
Add 2 for F6 ON
Add 4 for F7 ON
Add 8 for F8 ON
176 Alone Turns OFF F5-F8
BYTE2: omitted
= End DCC++ command

To set functions F9-F12 on=(1) or off=(0): <f CAB BYTE1 [BYTE2>

< = Begin DCC++ command
f = (lower case f) This command is for a CAB,s function.
BYTE1: 160 + F9*1 +F10*2 + F11*4 + F12*8
ADD 160 + the ones you want ON together
Add 1 for F9 ON
Add 2 for F10 ON
Add 4 for F11 ON
Add 8 for F12 ON
160 Alone Turns OFF F9-F12
BYTE2: omitted
= End DCC++ command


To set functions F13-F20 on=(1) or off=(0): <f CAB BYTE1 [BYTE2]>

< = Begin DCC++ command
f = (lower case f) This command is for a CAB,s function.
BYTE1: 222
BYTE2: F13*1 + F14*2 + F15*4 + F16*8 + F17*16 + F18*32 + F19*64 + F20*128
ADD the ones you want ON together
Add 1 for F13 ON
Add 2 for F14 ON
Add 4 for F15 ON
Add 8 for F16 ON
Add 16 for F17 ON
Add 32 for F18 ON
Add 64 for F19 ON
Add 128 for F20 ON
0 Alone Turns OFF F13-F20
= End DCC++ command


To set functions F21-F28 on=(1) or off=(0): <f CAB BYTE1 [BYTE2]>

< = Begin DCC++ command
f = (lower case f) This command is for a CAB,s function.
BYTE1: 223
BYTE2: F21*1 + F22*2 + F23*4 + F24*8 + F25*16 + F26*32 + F27*64 + F28*128
ADD the ones you want ON together
Add 1 for F21 ON
Add 2 for F22 ON
Add 4 for F23 ON
Add 8 for F24 ON
Add 16 for F25 ON
Add 32 for F26 ON
Add 64 for F27 ON
Add 128 for F28 ON
0 Alone Turns OFF F21-F28
= End DCC++ command


Returns: NONE
CAB Functions do not have a Return
CAB Functions do not get stored in the DCC++ BaseStation
Each group does not effect the other groups. To turn on F0 and F22 you would need to send two separate commands to the DCC++ BaseStation. One for F0 on and another for F22 on.