|
Re: How do I use interrupts?
Adding to Ether's idea, you might encapsulate the Motor speed command in a subvi all by itself that everyone calls to set that motor speed. With an optional input for the emergency stop flag.
Then the interrupt handler calls it to set the emergency stop flag (& speed to zero), while the state machine calls it for normal operation. The subvi only allows one caller at a time, so you avoid the race condition of setting the speed in two different places near-simultaneously.
In the subvi if the emergency stop flag is set, only an explicit reset allows non-zero motor speeds.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
|