Multifunction DAQ

Showing results for 
Search instead for 
Did you mean: 

Regenerating Analog Output Waveform buffer size



I am trying to output a sinusoidal analog output waveform using an analog output.  I am using the regeneration function.


DAQ Library.lvlib_Analog Output.lvclass_Set Regeneration_BD.png


This works very well.  However I need to change the frequency of my waveform.  I can do it however when I generate a new waveform with the new frequency I need to adjust the samples to generate the waveform so I start and stop at the same point so it generates the correct waveform. 


First Waveform 

DAQ Library.lvlib_Analog Output.lvclass_Test Regenerate Waveform_FP orig.png


Second waveform.  Note that more samples are needed so waveform starts and stops at same point.  This is needed for continuous regeneration


DAQ Library.lvlib_Analog Output.lvclass_Test Regenerate Waveform_FP.png


The problem I am having is the buffer gets set on my initial waveform( i.e. 1000 points)  when I write a new waveform (1136 points) the buffer isn't big enough to accommodate the new waveform.  To resize the buffer I need to start and stop my task which I don't want to do (creates other problems I won't go into).  So my question is can I create a buffer that is large say 2000 points.  Then give it a waveform of lets say 1000 points.  Will the regeneration mode only loop through the 1000 points or will it loop through the entire buffer of 2000 points?  I would try this but the customer has the hardware at a remote location.



Dan Shangraw, P.E.


0 Kudos
Message 1 of 3

It looks like the answer is no.  It generates all the points in the buffer.  In this case 0 for the points not specified.  Is there a way to resize the buffer while the task is running.  Is there another way to do this?





Dan Shangraw, P.E.


0 Kudos
Message 2 of 3

1. I was just in a thread where it *appeared* that regeneration occurred only over the 128 *written* samples in a task with a buffer size of 1000.  It was a Finite Sampling task however, so perhaps that's the key difference?


2. I don't think you can resize the buffer while the task continues running. 


3. Another sneaky trick you might consider is this: on most DAQ boards you actually *can* change the sample rate of an AO task on-the-fly without stopping it.  You won't get infinite granularity for your waveform frequencies, but you might get enough.


Example: suppose you put 100 samples in the buffer to define a sine wave cycle.  You want a ~200 Hz sine wave to start.  So you set a sample rate of 200*100 = 20 kHz.   

     Dunno your board, but I'll assume newer X-series with a 100 MHz master timebase.  So the sample clock is made by dividing the 100 MHz clock by 5000.  Here's where the granularity comes in.  The available sample rates will be integer divisors of 100 MHz.  So to speed up your sine wave by the smallest available increment, you'd need a divisor of 4999.   This sets a sample rate of (100 MHz / 4999) = 20.004 kHz and a sine wave frequency of (20.004kHz / 100) = 200.04 Hz.  That seems like a pretty small quantization effect.   It'll get bigger for higher waveform frequencies.



-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 3 of 3