Shop OBEX P1 Docs P2 Docs Learn Events
help bs2sx — Parallax Forums

help bs2sx

walkin79walkin79 Posts: 29
edited 2012-08-20 17:01 in BASIC Stamp
wondering if its possible to run a program and have the bs2sx respond to a button press at anytime during the program, for example, if i wated to run three servos and a ping senser (boebot program) and include a button press to change to a run instruction to jump to a new program , what i really want to do is run the say it modual in each program slot and have the boebot program or a program for ect activated by the say it modual. the button press is easier to read for the testing phase Im just wondering if this is possable and am in the planning stages of the programming.

Comments

  • walkin79walkin79 Posts: 29
    edited 2012-08-20 03:42
    was also wondering if anyone knows where i can find the info to change my bs2 programs to the bs2sx , there are alot of changes that have to be made to get them to work just wondering if there is a resource to cover this
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-20 07:29
    The Basic Stamp Syntax and Reference Manual has the information you need. Go to the main Parallax webpage and click on the Downloads button. The Downloads page has a Stamp Documentation button and you will find a link to the manual's PDF there. The information is also in the help files of the Stamp Editor. The main changes among Stamp modules have to do with timing. Most statements that time things like PULSIN and PULSOUT use the Stamp's internal clock for timing and this varies from model to model. The sections in the Manual that describe the individual commands have tables that show the timing units used for each Stamp model. The SERIN and SEROUT statements also use the internal clock for the Baud timing, so there are tables for each of these statements that give the proper value for each Stamp model for each of the commonly used Bauds.

    Because you have to specify which Stamp model you're using (with the $Stamp directive), you can use conditional compilation to adjust constant definitions for the different models. There's a section of the Manual that describes this and many of the Stamp examples use this facility.

    The only way your program can respond to a button press would be to have a test (IF or BUTTON statement) for the button in every loop in the program. In the BS2p/pe/px Stamp models, there is a special set of POLLxxx statements which allow a program to respond to a signal at the beginning of any statement being executed. This can force a GOTO to the beginning of a slot, but is limited in its usefulness because there's no way to return to the place in the program that was interrupted.
  • RDL2004RDL2004 Posts: 2,554
    edited 2012-08-20 08:59
    I think the post linked below might help a lot with conditional compilation for the Basic Stamp. There is a file attached to that post which is a template file that you can use as a starting point.

    http://forums.parallax.com/showthread.php?83135-One-Program-Any-BS2-family-Module-%28Conditional-Compilation%29

    Also, you might look into using a ServoPal to control your wheel servos. It takes a lot of the processing load off the Stamp, allowing it to do other things instead of constantly driving the servos.
  • walkin79walkin79 Posts: 29
    edited 2012-08-20 15:15
    thanks that saves me alot of time and frustration, my programs arnt very big so a button press in every loop will do the trick, just wondering can the propeller do this easier? also can you use the say it modual and bluetooth with the propeller?
  • Mike GreenMike Green Posts: 23,101
    edited 2012-08-20 17:01
    You can use the SayIt module and the Bluetooth module with the Propeller. As with most 5V devices, you'll need a 3.3K resistor in series with any output signal from the device (input signal to the Propeller) to protect the Propeller from the excess voltage.

    On the other hand, this is not a terribly difficult program for a Stamp as long as you use a pair of ServoPALs for the 3 servos.
Sign In or Register to comment.