DCC support in Tcc

Tcc supports NCE DCC systems in the following way:

  1. Driving locos using the same throttle constructs as other types of loco (speed, direction, brake & momentum)

  2. Controlling functions F0 through F28

  3. Displaying text on suitably equipped hand-held cabs.

  4. Tcc connects to a PH-Pro or Power House command station or similar using a serial link, or to any NCE system including an SB3a smart booster using the NCE USB interface. Note that not all functions will work through the smart booster, notable omissions include all LCD related functions.

To setup such a system do the following:

  1. Create a TCL script that contains something like:

    DccCabs: dcc1, dcc2, dcc3
    Actions:
    WHEN initialised=0 DO dcc1.setLocoId (12) { substitute your real loco number of course }
    dcc1.function (0, 1) { turn on the headlight }
    dcc1.speed = 30 { start the train running slowly }
  2. Connect the computer Tcc runs on to the NCE command station using a serial cable.

  3. Start Tcc using your new script and open the Network Configuration window:

  4. Start the serial link running [Configure->Start network]

  5. Run the script and hopefully your train will move

If you open the DccCabs window then you can adjust the speed manually.

Note that each DccCab has a momentum value. This is handled by Tcc for consistency. If you set a non-zero momentum (values are 0 to 255) then any changes to speed (including use of brake and direction) take effect slowly - Tcc will change the speed sent to the DCC command station gradually.

Note that Tcc does not support DCC AIUs nor auxilliary outputs - such inputs and outputs are assumed to use CTI, QTU or RPC hardware.

The DccCab objects (dcc1, dcc2 and dcc3 in the above example script) are how your script controls your DCC trains. Each object has some methods (subroutine calls) and some instance variables (data you can control directly). These are defined below.

DccCab methods

function (function-number, value)

function (function-number)

Controls a function code. The function number parameter should be a number from 0 to 28. Values of 1 and 0 turn the function on and off respectively. Values over 1 turn the function on for that number of milliseconds but note that small values will not work because the serial link updates are too slow. This function returns the curent state of the specified function.

setLocoId (number)

setLocoId (number, size)

Sets which loco this DccCab is controlling. If number is over 127 or the size parameter is 1 then the loco number is 'long'. If locoId is set to zero (the default value) then no loco is controlled (the DccCab stops sending commands). If no DccCab is controlling any loco then the serial link will stop sending.

sendDccMsg (byte list)

Assemble a message from the parameters, one byte per parameter. That message is then sent to the command station. There is no checking or limits imposed upon the message you can send but if the command station doesn't like it then results may vary! Be aware that presently no results are extracted from command station replies.

dccLcd (hand-cab, line, message)

Put a message on the screen of an LCD-equipped hand-held cab. The hand-cab parameter is the same number as set for that hand-cab identity. The line number specified which line of the display to put the message string on. For NCE hand-cabs the line parameter should be 2, 3 or 4.

Note that this command will not work with the SB3 smart booster.

dccSetClock (hour, minute)

Set the clock in the command station and therefore displayed in all LCD-equipped hand-cabs.

dccClockSpeed (ratio)

If ratio is zero the clock is stopped. If ratio is between 1 and 25 then that number is used to control a fast clock. 255 means start the clock again at the last set ratio.

dccAssignLoco (hand-cab, loco)

dccAssignLoco (hand-cab)

Pass control of the specified loco to the hand-held cab.

Pass control of THIS loco (as set by setLocoId) to the hand-held cab. Also releases control of the loco (to avoid taking control back again). Note that if you simply want to stop driving a loco then just set locoId to zero (or to another loco).

DccCab instance variables

Speed

Sets the speed the loco should run at. Note that non-zero momentum values will cause the speed to change slowly.

Speed values are in the range 0 to 102 for all cab types. The value sent to the command station is scaled to 126 for the DCC interface but the script should use values 0..102

Dir

Direction. If non-zero the loco should travel in the reverse direction (perhaps after delays caused by momentum).

Brake

If non-zero the desired speed is zero regardless of the current speed setting. You can use the brake to stop the train while leaving the normal running speed set, then when the brake is removed (set to 0) the previous speed setting is resumed.

Mom

Momentum. This controls how quickly speed changes take effect. Momentum 0 means immediate and either any momentum or inertia set in your decoder will take effect or the train will change speed instantly. Momentum 255 (the maximum) simulates a heavily loaded goods train (accelerates and decelerates very slowly).

d

Message transmit rates.

The rate at which messages are sent out of the serial link is affected by four main factors:

  1. The baud rate of the serial link. This is fixed for most command stations so does not vary message rate.

  2. The length of the messages. Most messages are around 5 bytes long so again this does not vary the rate much.

  3. How many messages there are to send. If no changes are waiting to be sent then each active DccCab (locoId non zero) updates its speed once every five seconds so the message rate shown in the Tcc status bar could easily be zero even if everything is working fine. IT IS IMPORTANT TO UNDERSTAND THIS

  4. The desired message rate set in the Dcc throttles section of the network config window. This sets the maximum message transmit rate.

  5. Timeouts imposed by non-receipt of responses. If the command station fails to respond to a message then the timeout set in the serial interface sectioin of the network config window applies - a gap of that many milliseconds is inserted before the next message is sent.


Last updated 5 October 2011

© Howard Amos 2011