05-22-2007 10:46 PM
I am looking
for the best way to structure a VI that consists of data acquisition inside a
state machine. As the state machine changes states the DAQ reads analog
values into separate arrays (inrush, running, and stall currents in two
directions). I am using legacy AI reads because I have not yet updated
the program I am working on to use newer functions.
The problem I am running into is that I am using two analog inputs to detect if
two switches are closed or not. A greater than function is used to do
this. The data acquisition is not running until the state machine is
acquiring data so that the system does not get bogged down or suffer from a
buffer overflow/under-run. I would like the switches to be monitored
constantly.
I've considered creating a separate while loop for the acquisition that
monitors the switches. My concern here is that acquisition conflicting
with the state machine's acquisition.
I've also considered adding an acquisition to the "idle" state of my
state machine. If the switches aren't monitored while the current
acquisition is taking place that will be fine but in this case I would have to
ignore any buffer under-runs/overflows (they would otherwise occur as the
computer performed other tasks) and I might need to stop the acquisition just
before starting the current acquisition.
I'd like to eventually use a digital input for this- would this give me more
options ? Ideally I'd like to have two LED controls linked directly to
the digital inputs and not have them affect the rest of the program or analog
inputs (although they are used when making decisions to change states).
Thanks for any feedback,
David
05-23-2007 10:43 AM
It'll be a good idea to monitor the switches as Digital inputs rather than Analog. Most DAQ boards will only allow 1 hardware-timed AI sampling task at a time and that will need to be dedicated to your current measurements. I'm pretty sure that the newer DAQmx driver would allow you to have another simultaneous "on-demand" AI task where you poll the switch voltages in software at the same time your hardware is buffering the other hardware-timed samples. I'm not so sure that the legacy driver would support this.
It's sensible to switch to Digital anyway since you only care about binary On/Off state. And the legacy driver would surely allow you to poll digital inputs in software while analog samples are being buffered by the hardware.
-Kevin P.
05-23-2007 11:56 AM
05-23-2007 11:57 AM
05-23-2007 12:01 PM - edited 05-23-2007 12:01 PM
Message Edited by davey31415 on 05-23-2007 12:04 PM