Shop OBEX P1 Docs P2 Docs Learn Events
BS2 capabilities/framework — Parallax Forums

BS2 capabilities/framework

Joshua SiegelJoshua Siegel Posts: 51
edited 2007-12-27 00:21 in BASIC Stamp
Hi everyone! Merry christmas/happy holidays.
I just ordered a BS2 and had a few questions about programming it since I haven't touched one in a few years.
I want to use the BS2 as a coprocessor for an autonomous vehicle and need a few suggestions. First off, I intend to have the following connected as inputs:

TTL from a 5Hz GPS unit with NMEA output
HM55 compass
3-axis accelerometer with analog voltage output
2 potentiometers
RS232 from the PC (to give output to the servos)

and the following as outputs:
2 servos
RS232 to PC (so I can use the data from the processor in programs on my PC)

I know I can handle all the inputs individually... SERIN/SEROUT for the PC and GPS, POT for the potentiometers and accelerometer, and PWM for the servos (unless anyone knows a better way).

My issue, however, is managing time efficiently. I want to update my GPS strings as soon as I can (at 5Hz) and would like to update my other values at least at 10Hz if possible (if not, 5Hz will work, but that is the minimum I'd like to go as this is a relatively high-speed application). I also want to send to PC as soon as I have a new GPS result, and move the servos as soon as I get a string from the PC.

Is there any way to use interrupts for this? Or threading? On other microcontrollers, that is how I would likely approach the problem. Unfortunately, I dont think waiting 21ms is a reliable enough way to get the GPS data and it doesn't process the servo movement quickly enough for my needs.

Thanks!

Josh

Comments

  • Desy2820Desy2820 Posts: 138
    edited 2007-12-26 09:54
    I'm not an expert, but I think any Stamp will be hard-pressed to keep·up with everything you'd like to do.· Since the Stamps are single-task processors, it can't do anything else while listening/parsing GPS input, talking to/from the PC or outputting servo pulses.· With that said, I'd consider a BS2PX and a co-processor, such as an SX or the SERVOPAL.···By off-loading the servo pulses, analog conversion, or GPS parsing tasks, it may give the Stamp enough time to process everything else.· http://www.parallax.com/Default.aspx?tabid=270
    SEROVPAL:· http://www.parallax.com/Store/Accessories/MotorServoControllers/tabid/160/ProductID/481/List/1/Default.aspx?SortField=ProductName,ProductName

    The MoBo Stamp may also be able to do this and is based on the BS-2p series, it also·has two on-board co-processors, which·are re-programible.· http://www.parallax.com/ProductInfo/Microcontrollers/BASICStamp2peMotherboard/tabid/528/Default.aspx

    For this design though, I would go with the·Propeller.· With eight cores, the Propeller should be able to easily handle all the tasks listed, in real-time.· Downside, a little harder to use than the Stamp.
    http://www.parallax.com/ProductInfo/Microcontrollers/PropellerGeneralInformation/tabid/407/Default.aspx

    I hope this helped!

    Post Edited (Desy2820) : 12/26/2007 9:59:08 AM GMT
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2007-12-26 21:29
    Josh--

    Have you read about Parallax's SX Controller Board?·The literature certainly makes it sound great, short of learning Propeller Spin and/or Propeller assember. And, at 50 MIPS with an interrupt structure, plus the ability to run SX Basic, the SX Controller Board could be a solution.

    I have a tracked 'bot--Ugly Buster--that is currently driven by five Stamps; a BS2p40 and four OEM BS2s. I am contemplaing replacing all of these with a single SX Controller Board. I might use two SX Controller Boards, not for the I/O but the interrupts and CPU speed. I am nowhere close to using the available potential of my current setup, but I want to expand and I believe the SX Controller Board(s) will allow me to do that much easier. (The interrupts are certainly appealing.)

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
  • Joshua SiegelJoshua Siegel Posts: 51
    edited 2007-12-26 21:45
    Thanks guys,
    I actually have an SX board but have never been able to figure out the processor enough to get serial strings in and out, and believe me I tried a lot! So, you both think that the BS2 can't handle this? If thats really the case, maybe I'll just get a MAX232 and let my computer process strings from two serial devices instead of through the BS2; still, it would be nice to have an all in one board. Any other thoughts?
  • Bill ChennaultBill Chennault Posts: 1,198
    edited 2007-12-27 00:21
    Josh--

    I only know enough about the SX Controller Board to understand that it seems to have all the features I need to replace my five-Stamp breadboard environment with a one or two SX Controller Board setup. The fastest Stamp runs at 19,000 instructions per second. The BS2 executes 4,000 instructions per second. The SX will execute 50 MILLION instructions per second. (Maybe more, I don't know.)

    Plus, the SX is blessed with an interrupt system. It is my opinion that an interrupt system is practically INDESPENIBLE in a real-time environment. (That is the very reason I implemented five Stamps on my 'bot; I wanted to make SURE I didn't miss anything that should not be missed. Plus, my connection scheme is unique and it is, quite frankly, fun.)

    You might keep watching this thread and ALSO jump over to the SX forum and start asking questions.

    --Bill

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You are what you write.
Sign In or Register to comment.