Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating dynamic front panel controls while executing buffered AO writes.

Hello,
 
I am writing some LV code for a Compact DAQmx unit containing switches, DO, AI and AO modules.  I am having trouble figuring out a way to make the front panel controls available while the DAQmx is outputing data.  I would like to have the program detect a front panel contol change then susequently stop, update and restart the AO write operation.  The user needs to be able to make changes to the output waveforms while the buffer is running and I need to stay with using buffered writes to maximize throughput.  The "Is Task Done.vi" is inside a while loop which of course locks out any input outside the loop.  Any help would be appreciated.  The code is attached.
 
Thanks in advance for your help.
 
Mike
0 Kudos
Message 1 of 4
(3,158 Views)
Hi Mike,

First off, I don't see your attachment.  You might try attaching it again.  In regards to your question, the Is task done.vi waits for the entire buffered output to finish (if you selected finite generation) before exitting the loop.  I've gone ahead and written a simple example that allows me to change the waveform being outputted on the fly.  Here is a picture of the example.  It was made modifying the Cont Gen Voltage Wfm-Int Clk.vi example (Help » Find Examples » Hardware Input and Output » DAQmx » Analog Generation » Voltage).  All you need to do is modify the example to place all the vi's shown below inside the loop and delete the is task done vi.  Also, make sure that you wire the true constant to auto start the task on the DAQmx write.


I do want to add that the only error I get is when I try to change the "samples per buffer" control.  It will actually update the number of samples, however you will get an error when stopping the program.  This is because the task cannot change the allocated buffer on the fly.

I hope this helps,
Paul C.


Message Edited by Paul C. on 11-30-2007 11:59 AM
0 Kudos
Message 2 of 4
(3,143 Views)

Hi Paul,

Thank you for your response.  I had tried your suggested solution however since I am using onboard memory the output signal would stop then start for every while loop iteration since the buffer is continually being reloaded.  I found a way around my problem this morning by inserting an event structure inside the while loop.  I set it up so a value change of the desired control causes the buffer to be updated with the new waveform and continue looping.  I am staying with IsTaskDone.vi inside the while loop for no other reason other than it's working.  When I have some time I'll clean it up.

I've run into another issue that is giving me fits now in that I can't seem to get the analog signal I'm monitoring to lock.  I basically stole the code from the Cont Acq&Graph Voltage-Ext.vi example.  When I use the example vi the monitored waveform stays locked however when I run it inside my program is slides across the graph.  I need to get this to stabilize because I want to use the measured value for some balancing calculations and I need it to be relatively stable.

I attached the pertinent code this time.  For some reason it didn't stick last time.

Thanks again for your help.

Mike

 

 

 

 

 

 

 

0 Kudos
Message 3 of 4
(3,131 Views)
Hi Mike,

I'm assuming your graph isn't maintaining a static picture and the graph appears to be moving.  This is typically due to where the first sample occurs in your waveform.  Have you tried removing the event structure from the loop and seeing if that is what is causing the interupt?  Are you reading in the analog output to the input or something else?  I'm assuming you used the same sample clock to keep them sampling at the same rate.  Is this true? In addition, you might want to double check the rate you're setting for the analog output / input.  I would give these a shot and let me know if you are still having problems.  If you have any more questions, it would be useful if you could provide the device numbers of the cards you are using, the labview version, and the scope of your application.

I hope this helps,
Paul C.
0 Kudos
Message 4 of 4
(3,097 Views)