LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using a 9263 and DAQmx to write long files

I have a 9263 in a cDAQ-9172 chassis. I have some very long waveforms (3 days worth of 250Hz sample rate signals) that I would like to play out. I have been fighting with this for some time and I run into one problem or another. I figure I should be able to loop through and send blocks of data as the buffer empties. I started with the DAQ Assistant, and used that to generate the code for continuous playback.

 

The code I am trying to write alternates indefinitely between a sine and a triangle wave. I figure if I can do this, then I can easily adapt this to my main code block.

 

The problem I am having is that the Write function blocks and my whole application locks up. I have the second status loop running in parallel, but it does not run while the program is is blocked in the Write function. So my front panel dies and is unresponsive to user input until the write completes and it loops back. I would like to have a graph display to display the waveform on the screen like the MAX test application, but that won't work if the program is tied up waiting for the Write function to return.

 

Is there any way to do this as a non-blocking operation and get notified when the buffer is getting close to being empty? I had an application like this working with the simulated device and I was checking the "SpaceAvail" property, but this does not work the same way with the real device.

 

Attached is some test code that I am working with. Any help is greatly appreciated.

 

--

Brian Rose
0 Kudos
Message 1 of 5
(2,481 Views)
Files
--

Brian Rose
0 Kudos
Message 2 of 5
(2,479 Views)

There is one thing I would recommend right now. Try to input a numeric constant to the Wait node in your DAQ loop. I am guessing that the wait doesn't allow the while loop to loop back; probably putting an indicator would help debug.

 

Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 3 of 5
(2,454 Views)
Hey Brian,

Thank you for posting your code.  I took a look at it and I think I found a program in the NI Example Finder that will help you with your application.  You
can find this by opening up LabVIEW and going to Help>>Find Examples...  Once the example finder opens you can go to Hardware Input and Output>>DAQmx>>Analog
Generation>>Voltage>>Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi.  You will notice that this code is very similar to yours, but it utilizes the while
loop differently.  The main thing is that your create channel, timing, and clear task VI’s should not be included inside the while loop.

You mentioned that this portion of code will be going into your main program, so what exactly is the entire program doing?  The reason I am asking is because
you said that you were running into a blocking issue on your DAQmx Write VI.  This is most likely occurring because of the large amount of data that you are
writing, so one way to get around this would be to put the while loop containing the DAQmx write VI outside of the while loop with the rest of your program. 
This is known as parallelism, and a nice example of this can be seen here.  Your code would be able to run side-by-side, thus allowing the rest of your
program to run uninterrupted from your DAQmx write VI.  Please let me know if I may have misunderstood your application, or if you have any further
questions.
0 Kudos
Message 4 of 5
(2,432 Views)
Here is the code that fixed the problems that I was having. It now alternates between a sine wave and a triangle wave. I did have to disable Regeneration.
--

Brian Rose
0 Kudos
Message 5 of 5
(2,428 Views)