LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6251 voltage output delay

im using the vi attached below to generate an analog output voltage to test the vi im using an oscilliscope to read the signal the signal generated is a square signal with duty 100% which is essentially a dc offset and i only change the amplitude while the code is running, however there awlays seems to be a delay between the new writting of the amplitude and the change in the oscilliscope reading, this delay seems to be related to the sampling rate and the number of samples the problem is for example using 10k sampling rate and 1k number of samples produces a delay that can even be noticed by the eye, going to the extremes like 50k rate and 20 samples will lead to problems with buffer.

so basically i need some help on how to chose the sampling rate and number of samples in order to get the least delay possible and avoid problems with buffer

0 Kudos
Message 1 of 5
(3,029 Views)

Hi,

 

I don't know if it works but maybe you can use regeneration  of the analog signal. Instead of writing continuously yo the buffer, it uses the same buffer and regenerates from the same buffer. If you change the signal, then you write to the buffer. Again, not sure if this improves or works, just a thought. I adjusted an example, I know it looks awfull, but my lunch break is almost at the end, so just an example so you can see what I mean. 

 

Good luck!

Martijn

0 Kudos
Message 2 of 5
(2,988 Views)

do you mean by what you said that signal regeneration mode if i allow regenration the vi will not write to the buffer unless the signal changes? becuase as far as i understand singal regenration means that when and underflow occurs it generates the last signal that was in the buffer. or do you mean that i should add some logic that makes the vi only write when the signal changes

0 Kudos
Message 3 of 5
(2,980 Views)

I first configured the chart to not Autoscale the Y-Axis. The delay is due to how fast the data is ready to be output, given by the ratio of samples/rate. The rate means how often fast we generate samples, and the number of samples means how many points we write at that rate. Once the samples are done updating, the chart will look for the next set of points to output. In order to minimize the delay, you will need a lower number of samples compared to the rate. A 1K samples to 100K rate will be as fast as 100 Samples at 10K rate.

 

Keep in mind that the rate can be limited by software or hardware. So, you may choose to decrease the number of samples per channel. However, the lower the number of samples, the less information that you are able to generate.  

 

If you are just updating the same amplitude for periods of time, you may even try writing one sample per channel.

Sal H.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 5
(2,956 Views)

Hello PeterFRA,

 

I meant indeed that with a underflow it generates the last signal from buffer. Please notice that when you write a new signal to the buffer a phase shift will occur: because the buffer can be written at any given time. If this is acceptable you then rewrite the buffer only when an amplitude change in your signal is needed. Please notice the example from my earlier post.

 

Best regards,

0 Kudos
Message 5 of 5
(2,922 Views)