As I said before numbers preceeded by a $ are hexadecimal numbers and google or wikipedia will tell you more about those than you ever wanted to know.
Semantic level - terminal
As we already know, the terminal send data packets consisting of 9 data words with 8 bits each.
So each datpacket consits of 9 bytes. Of these 3 bytes have a fixed meaning.
The first byte ist always $55 and marks the start of a data packet.
The second byte specifies the kind of information provide, something like a command byte.
The following sich byte hold the information, data bytes so to say.
The last byte is a checksum over all bytes of the packet but the checksum.
SCX uses a variant of the standard 8-bit CRC with modified starting values. For controllers the algorithm using a table is best. The table is build normally, but the starting value is $31, The checksum is calculated over all bytes of the packet, but the checksum. After the CRC algorithm has been applied the result has to be xored with $BB.
There are many different data packets teh single most important being the ...
Controllerpacket: $55 $FF R0 R1 R2 R3 R4 R5 PS
sent approx. every 102 ms and whenever a change is registered. (See CONTROLLER Internas)
The data packet tells the car what speed to set and whether the lane change switch is pressed. The packet sends information for 6 controllers regardless of how many are really connected.
| $55 |
Start of data packet |
| $FF |
Id of Controllerpacket |
| R0 bis R5 |
One byte for controller. The terminals cont the controllers starting with 0. The byte representing a controller that is not connected has a value of $AA.
For connected controllers the structure of the byte is as follows:
| Bit 7 |
Always 1 |
| Bit 6 |
Always 1 |
| Bit 5 |
= 0 lights on; = 1 lights off |
| Bit 4 |
= 0 lane change switch pressed; = 1 not pressed |
| Bits 3 bis 0 |
Speed level 0 bis 15 |
|
| PS |
Checksum |
Idpacket: $55 $CC RG $FE $FF $FF $FF $FF PS
Send twice when a lane change button is pressed in program mode (after pressing the program key on the terminal)
The data packet initiates the setting of the id.
| $55 |
Start of data packet |
| $CC |
Id of idpacket |
| RG |
Id byte
| Bit 7 |
Always 1 |
| Bits 6 bis 3 |
Always 0 |
| Bits 2 bis 0 |
Id of the controller the cars shall be set to. |
|
| $FE $FF $FF $FF $FF |
Always teh same. |
| PS |
Checksum |
Busclearancepacket: $55 $AA CNT NN $F0 $F0 $F0 $F0 PS
When a car passes the reed switch of the pit stop or start track this packet will be sent twice 1,7 ms apart. The CNT value changes everytime the packet is sent.
After 100 ms the packets are sent again regardless whether a car answered by sending its id or not.
These packets tell the cars to stop motors and prepare for id transmission, if the car has registered a track magnet. More details of a crossing of the finishline can be found HERE.
| $55 |
Start of data packet |
| $AA |
Id of busclearancepacket |
| CNT NN |
Those two bytes form a quotient NN / CNT and I assume this gives the time how long it will take until the bus is free. The values sent by standard treminals are $06/$06 = 1 and $06/$06 = 0.33 and the values sent by the pit stop terminal are $6/$18 = .25 and $06/$0C = .5 |
| $F0 $F0 $F0 $F0 |
Always the same. |
| PS |
Checksum |
Finishlinepacket: $55 $EE R0 R1 R2 R3 R4 R5 PS
Whe at leas one car had sent its id, this packet will be sent twice to inform everybody.
The packets identify the cars which crossed the finish line.
| $55 |
Start of data packet |
| $EE |
Id of finishlinepacket |
| R0 bis R5 |
One byte for each controller/car. When $E7, the car crossed the finish line, all other values mean that the car did not cross. |
| PS |
Checksum |
Rankingpacket: $55 $D3 P0 P1 P2 P3 P4 P5 PS
After a crossing of the finish line and than every 300 ms.
This packet informs about the cars current ranking.
| $55 |
Start of data packet |
| $D3 |
Id of Rankingpacket |
| P0 bis P5 |
One byte for any position in the race, starting with the leader. A value of $FF tells you that there is no car on this rank, probably because not all cars have crossed the staring line or not all cars take part in the race.
| Bit 7 |
1 except if the car is more than 15 laps behind the leading car. |
| Bits 6 bis 3 |
Number of laps (0 - 15) the car is behind the leading car. 0 if the car is more than 15 laps behind. |
| Bits 2 bis 0 |
Car id (0-5) |
|
| PS |
Checksum |
Laptimepacket: $55 $D4 FN RU1 RU0 VS Z1 Z0 PS
After a crossing of the finish line and than every 300 ms.
This packet has the number of crossings of the finish line and the time for the last lap. Only packets for the last car(s) that passed the finish line are transmitted.
| $55 |
Start of data packet |
| $D4 |
Id of laptimepacket |
| FN |
Car id (0-5) |
| RU1 RU0 |
Those bytes plus bit 0 from VS result in the number of crossings.:
Crossings = 256 * RU1 + RU0 + Bit 0 of VS |
| VS |
Misc.
| Bits 7 bis 4 |
Always 0 |
| Bit 3 |
When set you have to add 256 to the time value. |
| Bit 2 |
? |
| Bit 1 |
? |
| Bit 0 |
Even (0) or odd (1) crossing |
|
| Z1 Z0 |
Those two bytes together with bit 3 of VS give the base value for the laptime.
basevalue = 256 * Z1 + Z0
If bit 3 of VS is 1 than add 256 to the basevalue.
The lap time is basevalue multiplied by 0,01024.
I'm not 100% sure about the factor, because I do not have an chronometer to verify. I compared the resuls to a stop watch. Whe I get my fingers on a chronometer I will catch up on that.
The first crossing (race start) gives a time of 0. |
| PS |
Checksum |
Lapcounterpacket: $55 $D5 RI RU2 RU1 RU0 $FF $FF PS
When you press the start key long enpugh this packet will be sent twice.
It informs about the startnumber of laps to run and the direction of lap counting.
| $55 |
Start of data packet |
| $D5 |
Id of lapcounterpacket. |
| RI |
Directiopn to count:
| 00 |
counting up |
| FF |
counting down |
|
| RU2 RU1 RU0 |
starting laps = 256 * RU2 + 16 * RU1 + RU0
The formula is correct, only the lower 4 bits of eac value are used. |
| $FF $FF |
Always teh same. |
| PS |
Checksum |
Qualifyingpacket: $55 $DB RU2 RU1 RU0 FZ $FF $FF PS
Marks a qualifing.
| $55 |
Start of data packet |
| $DB |
Id of qualifyingpacket. |
RU2 RU1 RU0 |
starting laps = 256 * RU2 + 16 * RU1 + RU0
The formula is correct, only the lower 4 bits of eac value are used. |
| FZ |
Number of cars taking part in the qualiying |
| $FF $FF |
Always the same. |
| PS |
Checksum |
Resetpacket: $55 $D0 §FF CNT NN $AA $AA $AA PS
When you press the start key long enpugh this packet will be sent twice.
This packet tells the devices that the start key has been pressed anf that lapcount, times and ranking have been reset.
| $55 |
Start of data packet |
| $D0 |
Id of resetpacket. |
| $FF |
Always $FF |
| CNT NN |
Those two bytes form a quotient NN / CNT |
| $AA $AA $AA |
Always the same. |
| PS |
Checksum |
Startpacket: $55 $DD $00 $AA $AA $AA $AA $AA PS
When you press the start key long enpugh this packet will be sent twice after the second resetpacket has been sent.
Das Packet marks the start of race.
| $55 |
Start of data packet |
| $DD |
Id of startpacket. |
| $00 $AA $AA $AA $AA $AA |
Always the same. |
| PS |
Checksum |
Endpacket: $55 $DC $FF $FF $FF $FF $FF $FF PS
Whwn the las cars crosses the finish line or the race is aborted, this packet will be sent twice.
| $55 |
Start of data packet |
| $DC |
Id of endpacket |
| $FF $FF $FF $FF $FF $FF |
Always the same. |
| PS |
Checksum |
Fuelpaket: $55 $D6 S0S1 S2S3 S4S5 $14 $50 $AA PS
Approx. every 500ms (sehr unregelmässig) the current fuel levels are sent.
| $55 |
Start of data packet |
| $D6 |
Id of fuelpacket |
S0S1
S2S3
S4S5 |
The bytes are divided in two nibbles (4 bit long data). The more significant nibble holds the fuel level of the car with the lower id.
The fuel level starts at 8 counting down. The number is equivalent to the number of green leds shown on the fuel display.e.
|
$14 $50 oder $00 $50 |
An other quotient.
| $14 $50 |
When fuel managment is active. Would be a decimal 4 |
| $00 $50 |
When fuel management is inactive. |
|
| $AA oder $FF |
Rarely $FF but I didn't see any pattern |
| PS |
Checksum |
Displaypacket: $55 $DE WE $FF $FF $FF $FF $FF PS
Send to devices to tell them to refresh their display. No details include just refresh.
The pit stop terminal generated the when you select rES.
On the first press of the select key no packet will be sent.
On the second press of the select key one packet with WE equal to 0 will be sent.
On the next press of the select key one packet with WE equal to 0 and one packet with WE equal to 1 will be sent.
On the next press of the select key one packet with WE equal to 1 and one packet with WE equal to 0 will be sent.
After that the last two procedures are alternatively repeated.
When you leave rES mode the procedure atrts at the beginning next time you enter rES mode.
| $55 |
Start of data packet |
| $DE |
Id of displaypacket. |
WE
|
0 oder 1.
|
| $FF $FF $FF $FF $FF |
Always the same. |
| PS |
Checksum |
|
Brakepacker: $55 $D7 RG BR $83 $93 $DB $FF PS
Will be only sent to cars on the pit stop track. is used to set the brake level.
| $55 |
Start of data packet |
| $D7 |
Id of brakepacket |
RG
|
Id of the car whose brake level to be set (0-5)
|
BR |
One of three values:
| $00 |
No brake. |
| $02 |
50% |
| $04 |
100% |
|
| $83 $93 $DB $FF |
No idea. |
| PS |
Checksum |