LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx read and write in loop

 

 

 

Hi all,

 

   I have changed the Multi Function Sync AI/AO program as shown in the attachment. I want to control
the amplitude of Analog output signal in real time just by changing the value on the Panel as shown in the
attachment.

 

       The problem which i am facing is that when i press the start button, the code inside the while loop
generates the error -200279. " Attempted to read samples which are no longer available." 

 

Can anyone please tell me how to use DAQmxReadAnalog64 and DAQmxWriteAnalog64 functions in a single loop so that
i can change the amplitude of analog output signal during running of the code? 

 

 

Any help will be greatly appreciated.

Download All
0 Kudos
Message 1 of 2
(2,984 Views)

It sounds like you are executing your DAQmx Read before the Write executes.  Step 1 is to create and start the task before the loop begins.  If you want to change the write amplitude while running, you will need to stop the task inside the loop based upon the user change, and then start the task again in the loop that will then have the new waveform amplitude.  Let me know how it goes!  

 

Regards, 

 

Ben

National Instruments

Regards,

Ben N.
Applications Engineering
ni.com/support
0 Kudos
Message 2 of 2
(2,960 Views)