I have some questions:
James Harrison
Posts: 4
Hello all,
I am new to the Parallax products and this forum, but so far have really enjoyed the controller I purchased. I have a Revision D Basic Stamp 2, which was purchased from Radio Shack.
I have some questions:
1.
I saw on the main Parallax web site that there are LCD displays available to connect to the Basic Stamp controllers. Can I connect an LCD display to my controller and if yes, which one will work? I saw some of the LCD monitors use serial or I2C communications and strangely enough there are Basic commands for these. Some kind of Accessory computability matrix would be useful.
2.
Am I limited to Basic? Is there an assembly language IDE and compiler. I am sure the basic is compiled into machine code somewhere along the way.
3.
Am I limited to the 2K EEPROM? Has anyone tried to compile Linux on this? Would it even work?
4.
From the examples in the manual, I am only able to make the stepper motor rotate a fraction of the way around. How would you make the stepper motor rotate 360 deg?
5.
I know on most CPUs there is the idea of an interrupt that runs runs some code along side of the main program. My only experience of such a thing was with the Commodore 64 and its IRQ interrupt. Its function was to run periodically and maintain the up keep of the machine, read the keyboard etc. Is there anything line this with Basic Stamp systems?
Thanks for any help.
Regards,
James Harrison
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:13:47 AM GMT
I am new to the Parallax products and this forum, but so far have really enjoyed the controller I purchased. I have a Revision D Basic Stamp 2, which was purchased from Radio Shack.
I have some questions:
1.
I saw on the main Parallax web site that there are LCD displays available to connect to the Basic Stamp controllers. Can I connect an LCD display to my controller and if yes, which one will work? I saw some of the LCD monitors use serial or I2C communications and strangely enough there are Basic commands for these. Some kind of Accessory computability matrix would be useful.
2.
Am I limited to Basic? Is there an assembly language IDE and compiler. I am sure the basic is compiled into machine code somewhere along the way.
3.
Am I limited to the 2K EEPROM? Has anyone tried to compile Linux on this? Would it even work?
4.
From the examples in the manual, I am only able to make the stepper motor rotate a fraction of the way around. How would you make the stepper motor rotate 360 deg?
5.
I know on most CPUs there is the idea of an interrupt that runs runs some code along side of the main program. My only experience of such a thing was with the Commodore 64 and its IRQ interrupt. Its function was to run periodically and maintain the up keep of the machine, read the keyboard etc. Is there anything line this with Basic Stamp systems?
Thanks for any help.
Regards,
James Harrison
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:13:47 AM GMT
Comments
Parallax's basic stamp forum is one of the best sources for information on getting started with microcontrollers there are. In addition, the people are friendly and helpful.
Now... your questions:
1: All the displays on the Parallax site except "Mini LCD A/V Color Display" are usable by a BS2.
2: Yes, your limited to Basic due to the way Stamps are designed (see below)
3: Your stuck with the 2k EEPROM limit unless you upgrade to a better stamp. You also can't use most of the EEPROM due to the program space taking up a great deal (see below)
It would be impossible to put Linux on a Stamp.
4: I've never used steppers, someone else will have to help you.
5: Basic stamps don't have interrupts at all. They are "single task" microprocessors.
Here's a quick breakdown of how a BS2 works:
You write your code in a custom Basic Parallax created called PBASIC. This has all the features of normal Basic plus a lot of others (the I2C stuff and the like). Please note that not all commands
work on all stamps. You most likely have the "normal BS2" like me. I don't believe I2C works with these, but I could be wrong.
After you write your code, the compiler translates the Basic into "Tokens". These Tokens can be thought of as lower level than assembly, but not quite binary. They are not english-readable and
aren't meant to be so.
The Token language is then uploaded to the stamp's EEPROM. There it resides until called for.
The Basic stamp then has an Interpreter chip that reads the code off the EEPROM and then executes it. This interpreter chip has onboard RAM and like to be able to actually run your program.
Because the BS2 has to access EEPROM with every task it performs, it is slower than most microprocessors... but the upside is that it is FAR easier to learn than pretty much everything out there.
Most of the time, the Interpreter chip is a SX microcontroller (another Parallax product), although the normal BS2 has a PIC instead. These are preprogrammed and you cannot replace or
directly program them.
Think of a BS2 as a "front end" for a more advanced chip.
If you are comfortable with the BS2, I'd suggest sticking with it. If you want more power, I'd suggest either getting a more advanced BS2 or going for SX. The SX can also be programmed in
Basic (SX/B) but it can also be programmed in assembly or C. There is far less support for an SX, but there's still enough to get you started. Especially if you want to learn assembly.
If your budget allows and you feel up to the challenge, the Propeller is also an option... it has audio-video capabilities and can be programmed in a couple different langauges as well (not Basic
I believe). Personally, I always recommend going to the SX next (especially since each SX chip is less than $4 USD so you can have many projects with them)
The SX also has interrupts.
Please note that I am, myself, a newbie to a lot of this stuff. I just read a lot and thought I'd pass on the information. Some of it may not be correct.
Like Ugha stated This is the best forum going that I now of.And I have tried a lot
Did You Say You got Your BS2 At Radio Shack?
If so this is great news
James: If You have some problems, just send a Post Reply to this thread and We will help You get started.
______________$WMc%________________
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The Truth is out there············································ BoogerWoods, FL. USA
Thanks Ugha and $WMc% for your help.
I am still unsure how to get the stepper motor to rotate 360 deg. Is it possible?
Thanks
James
I have been using stepper motor instead of servo. Can I make the supplied servo rotate 360 deg?
Thanks
James Harrison
Here is one:
http://www.sharemation.com/Jrobota/Robot vehicle with Elektor Electronics version of BoE installed on top..pdf?uniq=-m2xnax
Here is another link to some info on stepper motors:
http://www.maelabs.ucsd.edu/mae_ds/stamp/how/hardware/motor_stepper/stepper-workshop.pdf
Rick
For your BASIC Stamp projects where the processor doesn't implement a way to inform you of these events happening while your program is running, you must go and check them on your own. So your PBASIC code comprises of a loop that works like this:
1) do some painting
2) go see if the oven timer has gone off
3) check to see if the phone is ringing
4) go back to step one and repeat.
When the loop is small and the processes within each step are fast, this can work depending on your application. Faster processors naturally do this better. Where you get in trouble is if you flat out miss an event by taking too long to get back to check for that event or the event was so critical that missing it is failure. Let's say for example that some attached circuit activates a pulse and you are looping around checking for that. A true interrupt could see this event and immediately get the attention of the processor. But if your code got bogged down by the time it cycled around to check for this event, it may miss it. Now let's say your attached circuit activates a switch. When your code loops around to check for this, it will successfully see this event and can deal with it, and perhaps turn the switch back off. So it all depends on what you are trying to achieve with the interrupt concept.
Rick
rixter,
imagine this scenario. I have a button and an LED. The button and LED are connected to the IO ports of the Stamp. If my main program is to turn the LED on and off continuously, I have to pause (at least for 500) so it can be accurately interpreted by a human (pressing a button does only last about a half to a second long); so during the sleep I press the button, I cannot interrupt the pause or set a program flag to indicate the button press. I need a way to tell my program the button was pressed during the pause.
I see the POLL commands could do something like what I want to do, but how do you put programs into specific slots.
James Harrison
You are dealing with a few issues there.
The part about accurately interpreting the human action of pressing a button and typical durations of how long this is are what the BUTTON command attempts to handle. Again though, you still have to monitor the button by having the BUTTON command in your programming loop.
The Poll commands are only available in the BS2P series of BASIC Stamps. You will note though when studying this command that it polls inputs between instructions. While this polling will occur faster and more often than you would be able to do with a PBASIC programming loop, it still isn't a true interrupt.
Having programs run in a different program slot is a feature available in the BS2e BASIC Stamp and higher. With these Stamps you can utilize multiple 2K memory slots for programs and data. Check out the RUN and STORE commands to see how this works. While a bit unnatural to grasp at first, I've found this feature very useful. You won't be able to have one giant continuous program across these slots, but you can break your program up into segments with some craftiness.
Rick
You'd actually need a bit less than 500 loops due to the fact that checking the user input and executing the loop eats up some processor time.
You can do this with a normal BS2