02-19-2013 12:02 AM
Hi everyone,
I am have developed some code to control the output from a muscle stimulator... The code works fine and allows me to set the stimulus frequency and number of pulses to be delivered from the stimulator when the user pushes the front panel button (boolean).
Could some please take a look at the code and provide me with some comments regarding the "correctness" of the code? I havce not included a wait/timing inside the loop as I want instantaneous output when the button is pushed (I believe I could use a wait of 0ms and still reduce CPU usage?). I have seen the "non-regeneration" AO example shipped with LabVIEW and the AO channel vi, start vi etc are all located outside the loop?
Any comments would be greatly appreciated.
02-19-2013 02:32 AM
02-19-2013 03:47 PM - edited 02-19-2013 03:52 PM
Hi Dennis,
This makes sense in general... But I am not sure how to wire the waveform, which should be inside the loop for pulse control purposes, to the timing vi would be outside the loop?
Additionally, should I include a "wait" of some value inside the AO loop to control timing and CPU usuage? If I do will that mean there will be up to a Xms delay until the boolean registers and the AO is triggered? Or does an event structure always execute immediately when the control is active regsardless of the wait? I need an instantaneous AO response, or as fast as possible anyway.
Regards,
Jack
02-19-2013 04:17 PM
I would try putting the timing function in it's own event with a value change of the frequency control. You would be passing the task and waveform to the DAQmx Write event with a shift register.
No wait is necessary. Since there is no polling with an event structure, you don't need a wait to control CPU hogging.