basic stamp in C
i am a C and java programmer and i happen to have a very old Basic Stamp 2 sumo-bot. i haven't had much experience with Basic Stamps but when i tried programming it i found i did not care for PBASIC very much. after doing a LOT of research i found that you can really only program this with 2 languages: PBASIC or Assembly. that is basically a choice between high level programming and bare bones low level programming. so this got me wondering, if the basic stamp can be programmed in assembly, can i use some kind of C compiler to compile the code into assembly and then upload it to the robot?
Comments
In theory, you could create a C compiler that would tokenize into a ready-to-download Pbasic token stream, but I don't see that it would be worth it.
There are some C compiler's available for the Propeller and a few for the SX (both of which can be programmed in Basic-like languages, assembly, and C with third-party compilers).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
the main reason i really wanted to switch it to C is because of the functions. the largest drawback from PBasic i see is the inability of making real functions. for instance, what if i want to make a function where you input a value and it outputs a value?in PBasic i would have to make two values beforehand and then i wouldn't be able to clear the memory when i'm. i also can't find any way to include multiple files in PBasic.
just curious though, has anyone tried to overwrite the interpreter?is there any public alternative to the PBasic interpreter for the basic stamp?
You could build a board like that for less than $6 or so and program it using a variety of compilers. Some users at the forums even sell PCBs for mounting Propellers or SXes on a Stamp-like footprint, with level-shifter circuitry and an EEPROM.
If you like your 'bot, but don't like the Stamp, you may want to pull the Stamp and use some other controller.
Lastly, I don't see how the 'bot is hard-coded in assembly, if it is indeed a Stamp, as you can not program a Stamp in assembly. Is it possible that there is a Pbasic program running on the Stamp already that handles yet more external commands? You said the only way to control the movements is pre-programmed constants? Or is is it possible the Stamp is programmed in Pbasic but that there is some slave board or micro on the 'bot that handles things like servo outs, etc., based on commands from the Stamp?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
The "interpreter" is what makes a Basic Stamp, a Basic Stamp. Without it, it would be an empty PIC microcontroller.
Programming in PBasic is a different world especially for those coming from higher level languages. There are certainly restrictions, but considering the Stamp's target market, it is really quite powerful and relatively easy to use.
To answer your last two questions, no - I haven't tried to overwrite the interpreter and no, I don't know of any other interpreter for the Basic Stamp.
Regards,
DJ
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
http://www.c-stamp.com/
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
therefore perhaps a better response to this problem is to bypass the PIC chip all together somehow. or else reprogram it, although i don't know how you would do either of those options.
the site for the robot is here: http://web.archive.org/web/20080702002546/http://www.tabrobotkit.com/
the schematics for it are here: http://web.archive.org/web/20070202034512/www.tabrobotkit.com/pdfs/MHR_RevF.pdf
http://www.parallax.com/dl/docs/prod/robo/sumobotman.pdf
The board seems to have a smd pbasic chip so it can't be easily replaced.
The manual contains programs to let the bot move.
More resources
http://www.parallax.com/tabid/768/txtSearch/sumo/List/0/SortField/4/Default.aspx
regards peter
Post Edited (Peter Verkaik) : 1/7/2010 5:30:33 PM GMT
the full schematics of
the robot are here:web.archive.org/web/20070202034512/www.tabrobotkit.com/pdfs/MHR_RevF.pdf
the problem is that the Basic stamp is not a module that can be removed from the board, it is part of the board
You could probably hack into the programming pins for the "Stamp" PIC, but again, what's the point? Even if you don't like Pbasic, you will fit way more actually useful code into the Stamp (2k of interpreted code) vs. 2k of PIC assembly, though it runs much slower and can't do RTCC rollovers, interrupts, etc.
Or just remove the whole circuit board and roll your own controller/motor-driver
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
When the going gets weird, the weird turn pro. -- HST
1uffakind.com/robots/povBitMapBuilder.php
1uffakind.com/robots/resistorLadder.php
I have a couple of the "other" style TAB robots from the "Build Your Own Robot" kit: http://www.amazon.com/TAB-Electronics-Build-Your-Robot/dp/0071387870 Cute·little robots. They are IR controlled and·have several sensors. There are several different selectable behaviors in ROM, but you can't program it as delivered.··There is an empty socket designed to accept a BS2, so you can add one and have a programmable robot.
I'm no fan of the exposed worm gears which pick up dirt and wear quickly, but for what it is, it's a good first robot for beginners. All powered by a single 9V battery, even the two motors. Never seen that anywhere else.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·"If you build it, they will come."
ps: this was a reply to the post above the post above the post above
Post Edited (ch2845) : 1/7/2010 6:48:33 PM GMT