Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Sine generator / AI in USB-6211

LV 8.6.1, WinXP, USB-6211

The attached vi attempts to generate an AO sine wave of user-selectable frequency to power a vibration shaker table.  The AI reads accelerometer data.

 

The example vi's I've found don't seem to work or have the same (frequency) problem as mine. 

 

Two problems:  (1) The sine wave generated is roughly 2.3x faster than desired.  I put in 1Hz, for instance, and the waveform chart shows a 1Hz output, but the actual AO signal is 2.3Hz.

(2) I can't figure out how to get the same length data vectors in my output file without the crude method shown in the vi.

 

I've done a lot of LabVIEW programming before, but it was always single sample stuff -- if I wanted 100Hz data, I'd run a timed loop at 100Hz and get one sample per loop.  I'm really struggling to understand how this DAQmx sampling and buffering works.  Thanks for your patience.

 

David

0 Kudos
Message 1 of 3
(3,190 Views)

You aren't specifying any timing for the analog out. You are just passing a DBL array.

 

Look at the example called Cont Gen Voltage Wfm-Int Clk-Non Regeneration. There you will see a waveform data type being used. This contains timing information in the form of dt. It is also set for non-regeneration so that you can change the frequency.

0 Kudos
Message 2 of 3
(3,186 Views)

Hey David,

 

Check out this KB on the DAQmx Buffer. If you do not use a DAQmx timing VI (like you have on your analog task), the hardware will automatically allocate a space for your samples to go to. So, if you pass an array of samples, DAQmx will automatically handle how fast the AO updates with the new values.  If the HW buffer is full, the DAQmx Write VI will be a blocking call until enough samples have been written to make room for the new samples.  Hope this helps!

ColeR
Field Engineer
0 Kudos
Message 3 of 3
(3,164 Views)