LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6259 Labview 2013: high rate Analog input sync with analog output

Hi, 

 I'd like to send two analog waveforms at 1 kHz and acquire an analog signal at 1 MHz, possibly acquiring 1000 samples immediately after each waveforms' update.

I'd need to write the acquired signals into an array strictly preserving their order then.

 

If possible, I'd like to have the VI execution lasting for  the time the waveforms need to be written (e.g. 4 s with 4000 samples at 1 kHz).

 

How can I do that ?

 

Cheers

Filippo 

0 Kudos
Message 1 of 2
(1,231 Views)

Filippo,

 

What you are trying to do doesn't sound too complex. Effectively you will need to create two DAQmx tasks. One will be an analogue input and one will be an analogue output. The articles at the link below should help you get started with the basics.

 

It sounds like you will need finite acquisition/generation tasks. You can create these using the DAQmx Timing VI to select the sampling rate (1k for your outputs and 1M for your input). You can then set the acquisition mode to be finite and set a total number of samples to acquire.

 

You will then use a DAQmx Triggering function for one of tasks so that it can be triggered when the other starts. You must then set the trigger source to be the start trigger of the other task (ie. when my first task starts, I want this task to start as well.

 

Once the tasks are configured you can use DAQmx Start task functions to push the configuration down to hardware. Finally, you will need to use DAQmx Read and Write functions to pull the data in and output your waveform.

 

 

Finite Acquisition.PNG

 

Getting Started with DAQmx

 

Alternatively, you can set up your acquisition task to be continuous by setting the timing mode of the DAQmx Timing VI to be continuous. In this mode, the 'number of samples to aquire' input of the DAQmx Timing VI sets the size of the internal buffer on the hardware. You must then call the DAQmx Read VI in a loop in order to acquire samples from the buffer. You can use this set up to remove 1000 samples from your buffer at a time and update your graph/chart as you described in your post. You will then need to program how the acquisition is stopped yourself.

 

continuous.PNG

 

With regards to storing your acquired points in an array, I would recommend saving them to a file so that the points don't have to be stored in memory. If it is essential that the points are kept in an array in memory you should initialise the array at the start using the 'Initialise Array' function. You should make the size of the array equal to the maximum size you need, eg 4 million elements and then replace these elements as you aquire. This means that LabVIEW has prior knowledge of the amount of memory to allocate.

 

intialised array.PNG

 

Finally, you may want to consider using a producer consumer architecture for your system so that you can offload any processing and file I/O to a different processor core. See here.

 

Feel free to let me know if you need further assistance but the above should get you started.

 

Best Regards,

 

Chris

National Instruments - Tech Support
0 Kudos
Message 2 of 2
(1,184 Views)