Protocol of µC stepper2a <=> PC communication

!!! every byte is "echoed" by the µC !!!

PC  Address ("CR" not allowed)
PC  Motor No. (ranging from 0 to 8, number as ascii code)
PC  Direction & Mode (ranging from 0 to 7, number as ascii code)
PC  Steps Digit 5 (ranging from 0 to 6, number as ascii code)
PC  Steps Digit 4 (ranging from 0 to 9, number as ascii code)
...
PC        Digit 1 (ranging from 0 to 9, number as ascii code)
PC  Time  Digit 2 (ranging from 0 to 9, number as ascii code)
PC        Digit 1 (ranging from 0 to 9, number as ascii code)
PC  "CR"

Motor No. decode as follows
0   Motor 0
1   Motor 1
2   invalid
3   invalid
4   write GPIO
5   read GPIO
6   snapshot steps to do
7   set maximum steptime and acceleration
8   check motors running

Direction & Mode decode as follows
0   full step, clockwise
1   full step, counterclockwise
2   half step, clockwise
3   half step, counterclockwise
4   quarter step, clockwise
5   quarter step, counterclockwise
6   quarter step, clockwise
7   quarter step, counterclockwise

Example: "B040375412"
device address B; motor 0; quarterstep, clockwise; 3754 steps; steptime 12 ms

Please note:
The command end sign is not allowed to appear at any other position.
If motor no. is out of range the command is ignored.
Further characters following time digit 1 will be ignored. Commands with
more than 128 bytes will lead to an overflow. The length of command
lines for non µC control devices is not limited.
Disclaimer: No warranty at all!
Copyright by Martin Clausen, Germany.
Contact the author: mc AT rotgradpsi DOT de
Impressum