|
|
email: support@surveyor.com
Surveyor Corporation home page
Subscribe to a syndicated RSS feed.
Archives
November 2008
October 2008
September 2008
August 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
Februray 2006
January 2006
|
|
|
Tiny BASIC interpreter added to SRV-1 firmware (112706 test version)
Beyond the additions to the 112206 version of SRV-1 firmware, there's now a BASIC interpreter built in.
This is a limited version of BASIC, in that there are no arrays, variables are all single character 'A' - 'Z', and labels are numeric, but it does support branching and arithmetic/logic operations, plus we've extended the language for robot-specific commands.
All programs are executed out of flash memory. It takes some effort to load a program, as the only available method at the moment is the new "zw" command, so you need to know in advance how long your program is and transfer via a terminal program. Also, the robot has to be power-cycled after the flash is written (we're working on that), but you can check that the program loaded with the "zr" command. The "Q" command then launches the program that you stored. Note that there's no way to break out of an infinite loop at the moment besides restarting the robot, but if a program terminates normally, it returns to the core SRV-1 control loop.
We do plan to create a better method for program loading and editing, but at the moment, just want to find bugs and make certain we haven't broken any other functionality. This seems like it will have a lot of potential once we make it easier to use, and it adds less than 10kb of program memory usage.
Here are the download links -
| Command | Response | Description
|
|---|
| |
|
|---|
| BASIC Commands | |
|
|---|
| |
|
|---|
| 'Q' | | runs BASIC program stored in first sector of flash memory
| | ASSIGN | A = B / 20
|
|---|
| OPERATORS | + - * / ^ % = ; ( ) , > < & |
|
|---|
| VARIABLES | 32-bit signed integers - 'A' - 'Z'
|
|---|
| PRINT | prints strings, variables, constants
|
|---|
| PRINTX | same as PRINT, but with hex output
|
|---|
| INPUT | not yet activated
|
|---|
| IF ... THEN ... | IF H < 11 THEN GOTO 200
|
|---|
| FOR ... TO ... | FOR J = 1 TO 100
|
|---|
| NEXT | end of FOR loop
|
|---|
| GOTO | GOTO 100
|
|---|
| GOSUB | GOSUB 300
|
|---|
| TIME | save current time (milliseconds since startup) in 'T' variable
|
|---|
| DELAY | DELAY 500 delays 500 milliseconds
|
|---|
| MOTORS | MOTORS 50 50 or MOTORS A B - set left and right motor output
|
|---|
| IR | IR <1,2,3,4> - read sensor and save in 'X' variable. IR 1 = forward, 2 = left, 3 = back, 4 = right
|
|---|
| IMGCAP | not yet added
|
|---|
| GETCOLORS | not yet added
|
|---|
| SETCOLORS | not yet added
|
|---|
| SCAN | not yet added
|
|---|
| BLOB | not yet added
|
|---|
| DBITS | not yet added
|
|---|
| WBITS | not yet added
|
|---|
| RBITS | not yet added
|
|---|
| example | A = 50 ^M^J B = -50 ^M^J 100 IR 1 ^M^J IF X < 20 THEN MOTORS A A ^M^J IF X > 19 THEN MOTORS A B ^M^J DELAY 500 ^M^J GOTO 100 ^M^J END ^M^J^@
this program checks the front IR (IR 1) and returns the reading in 'X', moves forward if below a threshold or turns right if above the threshold. an easier way to code this would be MOTORS 50 50 and MOTORS 50 -50, but the MOTORS command can't yet handle negative values, so we put the negative value in B. available variables are 'A' through 'Z'. note the CR LF ^M^J at the end of each line
|
|---|
| |
|
|---|
| |
|
|---|
Posted Mon, 27 Nov 2006 18:24 |
HTML Link | see additional stories ...
|
|