03-07-2006 12:56 PM
03-07-2006 02:47 PM
Hi Paul-
Yes- several things take place each time any of the indicated lines change. First, the hardware physically samples all lines in the task and latches values into memory. In response, the software event fires and we read a single array of booleans that correspond to the new line states.
The easiest way to interpret the various control signals required for your app is to look at the value of the array and determine some state to execute. By doing this, you can dynamically choose which state to enter in response to the states on the lines, whatever they may be. So, you can just look at the binary value returned by the boolean array and execute a case in your state machine based on that value. This allows you to take advantage of event-driven programming (i.e. non-polling) for better efficiency, but you can still use the state machine-esque architecture you're already familiar with.
Let me know if I can offer any other tips-