Flash an LED while Polling
Bob@RCH
Posts: 5
Hello All,
I'm looking for some assistance in trying to accomplish what may be quite simple but has me perplexed.· I'm polling·some Input pins on a BS2P40 and·turning a motor on or off and changing direction depending on their status.· When 2 of the pins are active, I need to flash an LED (among other things) at 1 second intervals until the condition is no longer true.· However, I need to know exactly when the condition is true or not true·so·I can not use the PAUSE command to hold the LED on or off due to·program execution stopping·during PAUSE.· I think I'll figure it out eventually but I could use a few pointers.
BTW, we're a manufacturer of Semiconductor processing tools.
I'm looking for some assistance in trying to accomplish what may be quite simple but has me perplexed.· I'm polling·some Input pins on a BS2P40 and·turning a motor on or off and changing direction depending on their status.· When 2 of the pins are active, I need to flash an LED (among other things) at 1 second intervals until the condition is no longer true.· However, I need to know exactly when the condition is true or not true·so·I can not use the PAUSE command to hold the LED on or off due to·program execution stopping·during PAUSE.· I think I'll figure it out eventually but I could use a few pointers.
BTW, we're a manufacturer of Semiconductor processing tools.
Comments
This allows you to check the status of the inputs, yet still keep approximate time. The time required to execute the input test and the other stuff in the loop will be a fraction of the 20ms and the 20ms (which is fairly accurate) will swamp the other statement's execution time.
Check out the "app-note" link at www.emesystems.com for a discussion of the execution time of various Basic statements.
Thanks again!
Another approach to this problem is to attach an parallel RC circuit between a free pin and Vss, and make the RC value around 1 second. Add that pin to your polling loop. PULSOUT the pin briefly high and then make it an input. When it goes low (C having discharged through R), toggle the state of the LED, and pulse the RC pin high again to charge the capacitor for the next round. It is like RCTIME, but DIY.
Are you using the BS2p's POLLing commands, or simply a polling loop?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Thanks,· Bob
·
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
Bob
FYI - You may not be interested but I'm attching the schematic and PCB layout we're using just so you know we're using the Stamp in a professional manner.··This board is an interface between a PLC and a·Cool Muscle Smart Motor (www.coolmuscle.com).