stc:stc-protocol-en
                Serial Turntable Communication Protocol
Protocol
| This part is for developers only. | 
|---|
Datagram
Length: 4…8 bytes
| device ID | command | nr. databytes | 0-4 databytes | checksum | 
The default device ID is 193.
Checksum
static byte __checksum(byte* datagram, int len) { int i = 0; byte chk = datagram[0]; for( i = 1; i < len; i++) { chk = chk ^ datagram[i]; } return chk % 128; }
Response
The response on every command is the same as the command with zero data bytes.
Commands
Start
Start accepting commands.
| ID | 1 | 0 | checksum | 
Stop
Stop accepting commands, and hold on bridge at next position in case of pending.
| ID | 2 | 0 | checksum | 
Motor Speed
| ID | 21 | 3 | Vmin% | Vmax% | accel% | checksum | 
Motor Kick Start
| ID | 22 | 3 | delay% | n * 8ms | on/off(1/0) | checksum | 
Motor Delay
| ID | 23 | 3 | start n * 100ms | end n * 100ms | off n * 100ms | checksum | 
Decelerate Start Position
| ID | 24 | 1 | nr positions before end (max 6) | checksum | 
Set Type
| ID | 26 | 2 | type: 1=48pos, 2=24pos, 3=24pos15° | sensor behaviour: 0=odd, 1=even | checksum | 
Goto Position
| ID | 5 | 3 | direction 1=CW, 2=CCW | position | nop | checksum | 
Bridge Polarisation
| ID | 4 | 1 | 0=standard, 1=inverted | checksum | 
Reset Emergency Break
| ID | 7 | 0 | checksum | 
Set Emergency Break
| ID | 8 | 1 | status 1=ebreak, 2=soft stop, 3=reset ebreak | checksum | 
Set Track Relais
| ID | 6 | 2 | on/off(1/0) | tracknr. | checksum | 
 
Queries
Status
| ID | 3 | 0 | checksum | 
Response:
| ID | 3 | 3 | status | position | nop | checksum | 
Status: 0 = end position reached, 1 = turning right, 2 = turning left, 3 = ebreak
Events
Position
| ID | 10 | 3 | status | position | relais | checksum | 
Status: 0 = end position reached, 1 = turning right, 2 = turning left, 3 = ebreak
Emergency Break
| ID | 7 | 0 | checksum | 
stc/stc-protocol-en.txt · Last modified: 2020/10/14 21:29 by 127.0.0.1
                
                

