I am following in the footsteps of Prof. Chaos, and programming Arduino microcontrollers to autonomously control my layout, and am neck deep in trying to understand the intricacies of the Legacy command protocol. If you have studied this, would you kindly look at the example shown in the attached scan?
As far as I can tell, the first three bytes of two DIFFERENT Legacy commands are EXACTLY THE SAME -- so I can't understand how a Legacy locomotive would know if it was receiving a basic 3-byte command or an extended 9-byte (multi-word) command? That is my question.
In the first example, I want to send a command to Engine #1, to set absolute speed to 18 (decimal 18, where the range is 0..31.)
In the second example, I want to send the first three bytes of a multi-word command, which will tell Engine #1 that I am about to send it a Railsounds Dialog (0x02) command.
BOTH of these would seem to require sending the exact same three bytes: 0xF8, 0x03, 0x72. What the heck?
This came up because I noticed that the first three bytes of a multi-word command are ALWAYS the following:
0xF8 + A A A A A A A 1 + 0 1 1 1 N N N N
This can be seen in the second of the two examples above, and is described in the LCS Partner Documentation rev. 1.21 on page 10 (Word 1, Parameter Index.)
And I wondered, Hmmm, is there a "regular" 3-byte Legacy command that looks the same? Sure enough, there seems to be. It's the first of the two examples above, and is shown in the LCS Partner Documentation rev 1.21 on page 9 (Set Absolute Speed 32.)
0xF8 + A A A A A A A 1 + 0 1 1 D D D D D
It was easy enough to come up with a case where "1 N N N N" matched up bit-for-bit with "D D D D D."
Either I've misunderstood the bit sequence of one or both of these commands, or it really does send the same first three bytes from time to time, and somehow the locomotive has to wait and see if there are going to be six more bytes coming along reasonably quickly, beginning with "0xFB" and to the same address -- and just make a decision of which type of command it is based on that...which seems really weird.