Pages: [1]   Go Down
Author Topic: Arduino BASIC?  (Read 5303 times)
0 Members and 1 Guest are viewing this topic.
Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I was thinking earlier today about making a small BASIC interpreter for the Arduino.  There's plenty of ROM space on a 328 to make something comparable to the old Microsoft BASIC that ran on the Altairs.  

RAM may be more of an issue.  Traditionally, the old micros would keep the program in a slightly compressed form in RAM and run from there.  I'd could see an Arduino BASIC starting with that approach, but it would be really interesting to try to actually store the program in the ATMega's Flash memory.  Alas, you can only write to Flash a page at a time, so maybe a byte-writable SPI Flash would be a better medium to modify.  You could write line-numbered statements out to Flash in a log-fashion, with an in-RAM line number table pointing to the data.  At startup, you'd just read lines, altering the table until you get to the end of the log.  The "NEW" command would just reset the log and erase the flash, and you could garbage collect by LISTing the program to the terminal, doing a NEW, then resending the program.

The nice thing about a BASIC on the Arduino would be the immediate feedback.  It could have extended commands for the various reads and writes.

Has anyone tried anything like this?
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6654
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Don't forget the EEPROM.  512 bytes (1024 in the newer arduninos) is not too bad, especially if you pre-tokenize things.

Someone has written an interpreter that would process basic-like statements from the serial port and such, but they called it something weird and I can't find it :-(

There have been a couple generic AVR projects along those lines that could be ported to Arduino:

http://www.avrfreaks.net/index.php?module=Freaks%20Academy&func=viewItem&item_id=688&item_type=project
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You might find this interesting - a Basic compiler for Arduino.

http://www.rhombus-tek.com/BC4Arduino.html

Andrew
Logged

Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

That's OK, but I think the real advantage of BASIC on the device is that you can run commands directly from the terminal.  You can play around with a few things without even going through the process of making a sketch and downloading.  Given that constraint, maybe only storing statements in EEPROM or RAM is OK... once you've scratched your itch, then you can do a proper sketch.
Logged

UK
Offline Offline
Sr. Member
****
Karma: 1
Posts: 491
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Someone has written an interpreter...

There's this one: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236358622/4 that understands these commands: "pinMode", "digiWrite", "digiRead", "analWrite", "analRead", "servoEnable", "servoAttach", "servoPos", "servoStat".

Then there's "Breakfast" and it's associated EggShell on the PC: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225355039 and http://inhocsignovinces.net/ (this may have been the one you meant westfw).

There's also "Bitlash": http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225455201

Hopefully these will give you some ideas.

Andrew
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6654
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks Andrew - "bitlash" is the one I was thinking of.
Logged

Brooklyn, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 92
Webduino / RGB LED Shield
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

bitlash looks pretty awesome and scratches the itch.  I've got to download it and try it out on a 328, possibly integrating it with the TLC5490 library to control my RGB LED shield.
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

FWIW, I just posted a Bitlash update to http://bitlash.net; you can read about it here: http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1243990789/0

Cheers,

-br
Logged

Pages: [1]   Go Up
Jump to: