BS2 State Machine
KatyBri
Posts: 171
Is it possible to set up the code for a BS2 or BS2p24 to act like a state machine- idle until certain inputs are active. This would be analogous to using interupts at the processor level.
If one uses looping code to simply poll input pins, it is possible to miss an event on a pin, and the processor is running continuously. With code that responds to pins directly (as interupts), an event is less likely to be missed. Is this possible with the BS2 STAMPS- either with code only or with code plus input circuitry?
If one uses looping code to simply poll input pins, it is possible to miss an event on a pin, and the processor is running continuously. With code that responds to pins directly (as interupts), an event is less likely to be missed. Is this possible with the BS2 STAMPS- either with code only or with code plus input circuitry?
Comments
Another workaround uses a little extra hardware, an RC circuit and a diode perhaps, to stretch input pulses so that longer polling intervals are adequate.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com
or may be microseconds apart as well
As well as the RC circuit for extending input, a latching buffer circuit could also be used.
Another idea is to use a 20mHz or faster microcontroller chip like the SX that simply stores event triggers and feeds them to the basic stamp via serial interface as the stamp requests them. I am sure someone here could whip up an sx buffer chip that polls 15 input pins and stores changes of state in a buffer that a bs2 could read at it's own pace.