BS2 question - Starting a program from "idle" state?
Otaku1031
Posts: 34
Hi all,
I'm working on the BS2 code for a thermocouple testing program, and am trying to find out how to power up the BS2 OEM board without starting the program. I'd like to have the board power up in an "idle" state, and then start the TC test program when the reset button is pressed. I could just allow the program to run once when the system is powered up, but would prefer that the program be started only on demand. I can't find anything in the BS2 help topics that address this issue. All help and advice is appreciated!
Gary
I'm working on the BS2 code for a thermocouple testing program, and am trying to find out how to power up the BS2 OEM board without starting the program. I'd like to have the board power up in an "idle" state, and then start the TC test program when the reset button is pressed. I could just allow the program to run once when the system is powered up, but would prefer that the program be started only on demand. I can't find anything in the BS2 help topics that address this issue. All help and advice is appreciated!
Gary
Comments
I believe the inherant nature of the BS2 is to "power up and run".
So, to sorta get around that and meet your need of starting the progam when a button is pressed, why not have as the first few lines the code required to poll your "run" switch?
Then on power-up, the BS2 would immediately begin polling the run switch and execute the remaining code only when pressed.
Can you live a "start" pushbutton going to any other input pin? That's easily done and no trickery involved.
Hi James,
That sounds like a good solution, thanks very much. I'm a bit new to PBasic, so I'm gonna have a lot of questions.
A bit off-topic, but I'm wondering if there is a way to step through a PBasic program, executing one line of code at a time. I use this feature in VBA - it saves a ton a time trying to find out which line is returning a weird value. I'm using the code to turn on and off various relays and CMOS devices and it would be very helpful if I could step through the code and verify the state of the devices. Again, I couldn't find anything in the help file on this feature.
You're very welcome. This is the place to ask.
No, the basic stamp IDE does not provide stepping through the code as in VB.
The only thing that can come close to it is sprinking a bunch of "DEBUG" statements (read up on that subject in the reference guide) throughout the code and watch the resultant debug screen for results/actions.
Yeah, I was afraid of that. I've been adding a bunch of "STOP" and "DEBUG" commands to verify the states of the CMOS devices. It's messy, but it works. Thanks again!
I use a Basic Stamp Logic Analyzer (unfortunately a discontinued product :depressed::depressed::depressed:) for monitoring the BS2, and a USBee SX (~$170) for monitoring other devices in my projects.
I imagine there are other lower cost analyzers around. When I bought the SX last year it was ~$140.