Skip to content

Instantly share code, notes, and snippets.

@deepakkarki
Forked from alexanderhiam/botspeak-mapping.md
Created July 7, 2014 02:47
Show Gist options
  • Save deepakkarki/63b57c61ea93af6ea57f to your computer and use it in GitHub Desktop.
Save deepakkarki/63b57c61ea93af6ea57f to your computer and use it in GitHub Desktop.

SET

CMD   A     VALA     B     VALB  
0000 0000 0000 0000 0000 0000 0000 0000
\  / \  / \       / \  / \       / \  / 
SET  DIO      5     VAR      4   ignored
  • A,B are one of DIO, AO, PWM, TMR, user variable, value
  • VALA, VALB are numbers for indexes, or 0 if A,B are not arrays
  • If A,B are user variable, then we need one byte for which variable, so how to do user array?
  • Can't fit values greater than 1 byte, i.e. how to do SET DIO[1], 256 Could fit 12-bit variables by using extra byte for VALB

GET

CMD   A     VALA
0000 0000 0000 0000 0000 0000 0000 0000
\  / \  / \       / \                 /
GET  USR      5           ignored
  • USR meaning user variable

WAIT

CMD          VAL       
0000 0000 0000 0000 0000 0000 0000 0000
\  / \                 /
WAIT          5           

IF

CMD   A     VALA     B     VALB     OP
0000 0000 0000 0000 0000 0000 0000 0000
\  / \  / \       / \  / \       / \  / 
 IF  PWM      5     VAR      3      >
  • IF PWM[5] > var3
  • Or using 12 bits for VALB:
CMD   A     VALA     B        VALB  
0000 0000 0000 0000 0000 0000 0000 0000
\  / \  / \       / \  / \            / 
 OP  PWM      5     VAR        3
  • OP one of >, >=, ==, <=, <
  • If evaluates to True, execute next line (will be GOTO), otherwise skip it

GOTO

CMD          ADDR       
0000 0000 0000 0000 0000 0000 0000 0000
\  / \                 /
GOTO          3           
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment