|
I am contemplating how to integrate control of a roundhouse roundtable with
control of trains using LDCC <http://home.surewest.net/markril/lego/dcc/>.
Currently the roundtable software is in NQC on an RCX and is controlled by IR
messages 1, 2 and 3, which can be generated by the LEGO remote or BrixCC.
However, LDCC also uses these messages to control the headlights on DCC locos.
How do I control the turntable without conflicting with LDCC control?
Fortunately, Mark Riley and Christopher Phillips have already provided a solution
to my dilemma. Mark Riley has developed LDCC IR, a LEGO IR messaging protocol.
Christopher Phillips has implemented this protocol in his Full Throttle LDCC
Windows-based "throttle" (which is DCC lingo for a control console). All I have
to do is enable my NQC program to respond to the LDCC IR protocol. From Full
Throttle's point of view, I can make my roundtable respond as a loco or as a
stationary decoder (i.e. a point switch). Simple!
There aren't many reasons why you would want to read further, but they include:
* you are bored and masochistic,
* you are a compulsive reader or a compulsive finisher,
* you *really* want to know how my brain works,
* you wrote LDCC or Full Throttle, and you can't wait to implement my wish list
for new features (I can dream, can't I?)
* you might want use the LDCC IR protocol yourself, and you want to avoid my mistakes
My turntable has two modes:
Calibrate and Operate
In calibration mode, it has 6 functions:
Set location of track 1
Set offset of track 2 from track 1
Set offset of track 3 from track 1
Set offset of track 4 from track 1
Set offset of track 5 from track 1
Rotate roundtable clockwise/counter-clockwise
In operation mode, it has 10 functions:
Seek track 1
Seek track 2
Seek track 3
Seek track 4
Seek track 5
Seek track 1, reverse orientation
Seek track 2, reverse orientation
Seek track 3, reverse orientation
Seek track 4, reverse orientation
Seek track 5, reverse orientation
[Note to IndyLUGers: I know the roundtable has 6 tracks coming in, not 5. But the
mainline track (call it track 0) is functionally the reverse of the track
opposite it, track 3.]
LDCC IR has the following commands (from the ldccdemo.nqc in ldcc105.zip at
http://home.surewest.net/markril/lego/dcc/beta.html):
LDCC_CMD_SPEED
LDCC_CMD_FN_OFF
LDCC_CMD_FN_ON
LDCC_CMD_STOP_ALL
LDCC_CMD_POWER_OFF
LDCC_CMD_POWER_ON
LDCC_CMD_SWITCH_CLOSED
LDCC_CMD_SWITCH_THROWN
Most of these commands take arguments and are addressable to a specific loco or
switch.
I think I'll make my RCX respond as a loco (i.e. mobile decoder), because in the
current LDCC IR protocol, all a switch (i.e. stationary decoder) can do is be
THROWN or CLOSED.
LDCC_CMD_SPEED is a natural candidate for rotation control. The format of this
command is
LDCC_CMD_SPEED [loco address] [speed]
Where speed can be -127 to +128. Normally this controls the speed and direction
of the loco, so it's a natural candidate for the rotate roundtable function of
calibration mode.
I can also use LDCC_CMD_SPEED for the "seek track #" and "seek track #, reverse
orientation" functions of operations mode. Speed 1 will be "seek track 1", speed
2 will "seek track 2" and so on up to track 5. Speed -1 will be "seek track 1,
reverse orientation". We'll ignore all other values for speed, or maybe beep in
mild distress. Full Throttle makes it simple to select discrete speed values by
using the up and down arrow buttons. (I'll have to rethink this if I plan to use
the Lego Remote to control the "seek track" function, because it tends to jump
about 3 to 5 speed steps per key press.)
That leaves one (implicit) function yet to map:
A way to toggle between calibration and operation mode.
LDCC_CMD_FN_ON and LDCC_CMD_FN_OFF are toggling commands, so they should do.
Specifically, the command is
LDCC_CMD_FN_ON [loco address] [function #]
or
LDCC_CMD_FN_OFF [loco address] [function #]
where function # can be 1 to 12. I don't want to accidently switch to calibration
mode, because I could easily reprogram the track offsets, potentially leading to
derailment and minifig death, so I'll use a relatively unused value like function
#8 (I'm saving #12 for something else). LDCC_CMD_FN_OFF will select calibration
mode and LDCC_CMD_FN_ON will select operations mode.
I have three LDCC IR commands left I haven't mentioned: LDCC_CMD_STOP_ALL,
LDCC_CMD_POWER_ON, and LDCC_CMD_POWER_OFF. None of them have arguments, which
means they are essentially broadcast to all decoders.
LDCC_CMD_POWER_OFF is supposed to remove power from the tracks. LDCC_CMD_POWER_ON
restores power. Powering off the roundtable RCX doesn't make much sense, because
there's no way to power it back on easily. To be a nicely behaved decoder,
however, I'll implement a new function "standby" which will FLOAT the motors
(that is, let them drift to a stop) and suspend operations until a POWER_ON
command is received.
LDCC_CMD_STOP_ALL is a panic button. It's like pulling the emergency stop on an
assembly line: all movement everywhere should cease immediately. To be a nicely
behaved decoder, I'll implement a new function, "stop". Which will BRAKE the
motors (that is, turn them OFF) and suspend operations until a new command comes
down the pipe. Who knows, it might be an impending roundtable disaster that
prompted the STOP_ALL in the first place!
I still need a way to assign my RCX a loco # (i.e. an address in the DCC mobile
decoder namespace). I'll set a default address of 1, because that's the
conventional thing to do in DCC. I'm lazy and tempted to hard code the address,
but well-behaved DCC peripherals never have hard-coded addresses. To do this on a
real DCC decoder, I would program configuration varible (CV) #1. As far as I can
tell, LDCC IR doesn't have a way to set arbitrary CVs (yet! Right, Mark?), so
I'll implement this as a CV-setting hack: i'll use "LDCC_CMD_FN_ON 10" to toggle
configuration mode, then set LDCC_CMD_SPEED to choose the CV, then
"LDCC_CMD_FN_ON 11" to toggle to setting the value, then set LDCC_CMD_SPEED to
choose the value, then "LDCC_CMD_FN_ON 12" to store the value.
What next? Well, first a question:
* What is the LDCC IR command for headlight control?
And here's a short wish list for LDCC IR:
* a way set arbitrary CVs
Here's a wish list for Full Throttle:
* A way to control more than 9 locos. On our layout, we could have 4 in the
roundhouse, 3 running the loops, 1 shunting stock, and the roundtable RCX LDCC IR
"decoder" for a total of 9. If the above works out, I can see us controlling the
whole amusement park this way, but we'll have hit the ceiling with Full Throttle.
* A way to control at least 25 switches (implementing
LDCC_CMD_SWITCH_THROWN/CLOSED). (We plan 23 switches on our layout, plus 2 level
crossings set up as switches).
* Implementation of the non-existant way to set CVs using LDCC IR.
Still awake? Not me. I'm going to bed.
-Brian
P.S. did I remember to thank Christopher Phillips and Mark Riley? Thanks, guys.
|
|
Message has 3 Replies: | | Re: LDCC and RCX gizmos (long)
|
| (...) Is there a way with the standard firmware to receive and process arbitrary packets, even those wrapped in the standard Lego IR protocol (as LDCCIRP is)? I'm thinking you may need to use BrickOS for this application. (...) include: (...) list (...) (21 years ago, 25-Aug-03, to lugnet.trains)
| | | Re: LDCC and RCX gizmos (long)
|
| (...) with (...) IR (...) locos. (...) Whoops, I meant to comment about this, too. LDCC responds to the message 1, 2 & 3 buttons from the remote. The remote uses LASM opcode 0xD2 to send these messages. However, there is another opcode, 0xF7, that (...) (21 years ago, 25-Aug-03, to lugnet.trains)
| | | Re: LDCC and RCX gizmos (long)
|
| (...) snip! (...) I believe that Mark is already working on a couple of different ways to control more than 9 DCC decoders on a layout. As he does, I will extend Full Throttle to support the new features. (No pressure, Mark!) The same thing goes for (...) (21 years ago, 26-Aug-03, to lugnet.trains)
|
5 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|