Robotic Sequencing Commands Setv1.0
Robotic Sequencing Commands Set use resquest-response frameword with fixed size request and response.
Command request are 4 bytes long and format is:
| byte 1 | byte 2 | byte 3 | byte 4 |
| Command | Sub-command | parameter 1 | parameter 2 |
Command response are 3 bytes and format is:
| byte 1 | byte 2 | byte 3 |
| Command successful | ||
| Command request | most significant byte | least significant byte |
| Command not successful | ||
| Command request + 128 | sub-command request | return code |
RS Commands Set table
Commands in italic can be used in a recorded script only
| byte 1 | byte 2 | byte 3 | byte 4 | comment |
| ‘a’nalog | ‘r’ead | pin | 0×00 | valid pins are 0 to 7 |
| ‘a’nalog | ‘v’ref | val | 0×00 | val is 0 = VCC, 1=VREF on pin P2, 2= Internal 1.1V reference |
| ‘a’nalog | ‘p’rescale | val | 0×00 | val is 2,4,8,16,32,64,128 default is 64 i.e.: 8mhz/64= 125kHz (AVR121 recommend 200khz-50khz for 10 bits precision) |
| ‘b’ranch | ‘i’mmediat | 0×00 | PC | Flow control command, can be used to restart to PC in single step mode |
| ‘b’ranch | ‘=’ | 0×00 | PC | Flow control command using last compare result |
| ‘b’ranch | ‘>’ | 0×00 | PC | Flow control command using last compare result |
| ‘b’ranch | ‘<' | 0×00 | PC | Flow control command using last compare result |
| ‘b’ranch | ‘!’ | 0×00 | PC | Flow control command using last compare result |
| ‘c’ounter | ‘p’ins | counter_pin1 | [counter_pin2|0xff] | in2 is at 0xff for a regular counter, quadratic counter use two pins, on rsi2cboardv1 can be only pin 1 can be used as counter_pin1 |
| ‘c’ounter | ‘t’rigger | [00=low,01=any,02=falling edge, 03=raising edge] | 0×00 | |
| ‘c’ounter | ‘z’ero | 0×00 | 0×00 | resetCount to zero |
| ‘c’ounter | read’h'igh | 0×00 | 0×00 | read hi part of a 32bits counter |
| ‘c’ounter | read’l'ow | 0×00 | 0×00 | read low part of a 32bits counter |
| ‘d’ictionnary | ‘d’elete key | key byte 1 | key byte 2 | |
| ‘d’ictionnary | ‘e’mpty Dictionnary | 0×00 | 0×00 | |
| ‘d’ictionnary | ‘r’ead key | key byte 1 | key byte 2 | |
| ‘d’ictionnary | ‘w’rite key | key byte 1 | key byte 2 | with $acc value see: load acc$ command |
| On a RSi2cBoard v1 rev2 the dictionnary can hold up to 40 entries including $b and $v defined at power On. Reserved keys are: $b = boardnameversion $i=i2caddress on startup $p = current Program Counter (readonly, use branch immediate to change) $r = return code of the last instruction $v = protocol version |
||||
| ‘i’nput | ‘r’ead | pin [0..7] | [debounceOn 0x01 | debounceOff 0x00] | you can still do output on a pin to enable pullup |
| ‘i’nput | ‘m’ode | pin [0..7] | [0=input] | |
| ‘k’ompute | operation ['+'|'-'|'&'|'|'|'^'|'>'|'<'|'!'|'r'|l'' | key1 | key2 | acc$ = acc$ operation with keyvalue, >: arithmetic shift right (1 padded if negative, u: logical right shift, r: rotate right, l:rotate left |
| 'l'oad $acc | 0x00 | val[15..8] | val[7..0] | Used to load accumulator |
| ‘m’ove | ‘h’igh distance | val[31..24] | val[23..16] | msi part of the int32 distance |
| ‘m’ove | ‘l’ow distance | val[15..8] | val[7..0] | lsi part of the int32 distance |
| ‘m’ove | ‘g’et distance Remaining high | ‘h’igh part integer | 0×00 | msi part of the int32 distance |
| ‘m’ove | ‘g’et distance Remaining low | ‘l’ow part integer | 0×00 | lsi part of the int32 distance |
| ‘m’ove | ‘p’ins | direction pin [0..7] | step pin [0..7] | example : dirstep pinout: step = P5, dir = P6, ena = P7 |
| ‘m’ove | ‘a’ccel low | valhi [15..8] | valhi [7..0] | (default value is 6400steps/s^2, maximum is 32000steps/s^^2) |
| ‘m’ove | ‘d’ecel low | valhi [15..8] | valhi [7..0] | (default value is 6400steps/s^2, maximum is 32000steps/s^^2) |
| ‘m’ove | speed ‘z’ero | valhi [15..8] | valhi [7..0] | initial speed in steps/s (default value is 800steps/s) |
| ‘m’ove | speed ‘m’aximum | valhi [15..8] | valhi [7..0] | maximum speed in steps/s (default value is 1600steps/s, max speed is 10000 steps/s) |
| ‘m’ove | ‘c’urrent profile | [0x00|0x01] | val[23..16] | use current profile 0 or 1, default 0 is accelerated, 1 is fixed speed. Change parameters to customize. |
| ‘o’utput | ‘w’rite | pin [0..7] | value | |
| ‘o’utput | ‘m’ode | pin [0..7] | 0=output | |
| ‘p’wm: | ‘w’rite | pin [0..7] | value | on rsi2cboardv1 upto 3 pins can be used: P1, P5 and one other pin |
| ‘p’wm: | ‘w’rite | ‘p’rescale [2,3,8,16,32,64,127] | 0×00 | default is 64 so 8mhz/64= 125kHz pwm counter / 256 = 488Hz per pwm cycle |
| ‘r’c servo | pin [0..7] | value hi [15..8] | value low [7..0] | on rsi2cboardv1 valid pins are P0 to P7 and if you need pwm you can only use P1 and P5. |
| ‘s’cript: | ‘r’ecord | ‘s’tart | 0×00 | record a startup script example: record a i2c address, pin on, pin off |
| ‘s’cript: | ‘r’ecord | ‘e’nd | 0×00 | stop recording |
| ‘s’cript: | e’x'ecution | ‘s’inglestep | 0×00 | pause the script and do a step |
| ‘s’cript: | e’x'ecution | ‘c’ontinue | 0×00 | exit single step mode |
| ‘s’cript: | ‘d’elay In Ms Between Commands | value high [15..8] | value low [7..0] | |
| ‘s’cript: | ‘p’arams In Next Command Are From | [0x00:0x01 byte pos from acc|0xff=litteral in command] | [0x00:0x01 byte pos from acc|0xff=litteral in command] | |
| ‘s’cript: | ‘s’ynchronous | ‘s’tore | 0×00 | Store upto 8 commands in RAM until e’x'ecute command is done |
| ‘s’cript: | ‘s’ynchronous | e’x'ecute | 0×00 | Execute previously stored commands, since all board listen to i2c broadcast address 0×00, this allow synchronous execution with multiple boards. |
| ‘t’est | ['i'mmediate,'k'ey] | [imm1|key1] | [imm2|key2] | test acc against ‘i’mmediate or ‘k’ey value => set <, >, = flags for branch instruction |
| ‘w’ait | value bits [23..16] | value bits [15..8] | value bits [7..0] | 24 bits wait period in ms |
Robotic Sequencing
Products