Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Multi-Function-Synch AI AO rate

Solved!
Go to solution

Hi All,

 

I'm new to both Labview and these boards.

 

I am working through the Multi-Function-Synch AI-AO example as found through the NI Example Finder, and was wondering what difference the is between the 'Update Generation Rate' on the output 'Sample Clock' and the sampling rate found in the 'Sampling Information' of the 'Basic Function Generator'.

 

My initial thought was that first one controls the hardware and second one controls the software, but I'm finding that when the two are adjusted relative to each other, my sine wave frequency changes, even when the frequency parameter is left unchanged.

 

Thanks in advance.

0 Kudos
Message 1 of 6
(3,835 Views)
Solution
Accepted by currentenglish

Hi currentenglish,

 

The Update Generation Rate attached to the "Sample Clock" is the rate that the board is going to clock out samples.

 

The "Sampling Information" is used by the software to generate an appropriate waveform given the rate of the hardware.  If there is a mismatch between these two values you will have a frequency different than what you expected.  For example, if you generate the waveform thinking the sample clock is 1 kHz but it is really only 500 Hz, the generated waveform will be half the frequency you specify.

 

You should wire the Update Generation Rate into the Sampling Information to ensure that they are always the same.  I'm actually a bit surprised that this shipping example doesn't already have this.

 

 

Best Regards,

John Passiak
Message 2 of 6
(3,820 Views)

Thanks!

 

Is there any good reason why the input rate is set greater than the output rate? (Assuming the output is fed directly back into the input channel).

 

I will likely simply wire the input rate with the other two as well. It seems most logical to me. 

0 Kudos
Message 3 of 6
(3,795 Views)

Hi currentenglish,

 

Some users might want to generate and acquire at different rates but still keep the tasks synchronized (e.g. sample AI on every 4th sample of AO).  If you want the two rates to be the exact same rate you can do something like this:

 

2010-05-11_155915.png

The reason for wiring back the Actual Rate to the AO task is that AI and AO tasks by default will coerce differently if the desired rate is not an integer divide-down of the timebase.

 


Best Regards,

John Passiak
0 Kudos
Message 4 of 6
(3,792 Views)

Once again, thanks John.

 

I forgot to add a question in the previous post. I was playing with the rate settings, and I also found that the "Samples to Read" for the signal will affect the continuity of the waveform when the sample size ends and begins again.

 

If I want to ensure that it is continuous, should I be wiring the "actual rate" with the "samples to read" as well? How does labview handle it if the rate has a decimal value? For example, I have my rate set at 8192, and my actual rate is 8333.33. How would I keep my signal continuous?

 

Thanks. 

0 Kudos
Message 5 of 6
(3,788 Views)

The samples to read inside your loop isn't going to affect the continuity of the output signal, it just determines how many samples to read back per loop iteration.  With the 8333.333 sample rate you could read back 25,000 samples to get an even 3 seconds of data--in this case your loop would take 3 seconds to run.  If you wanted to do this you'd need to make sure to increase the buffer size since the default is only 10 kS for a sample rate of 8.3 kHz.

 

What is likely giving a discontinuous signal is if you do not write an integer number of periods to the output buffer.  The following equation must be true to output a continuous periodic signal with regeneration enabled (the default):

(Frequency of Signal / Sample Rate) * Number of Samples = any integer

 

The three above parameters are all inputs to the Basic Function Generator.  Ensuring an integer number of periods in the output buffer will mean that the first and last samples in the buffer are continuous and you won't have discontinuities when regenerating.

 

 

Allowing non-regeneration is another common way to get around this issue, but you would have to continuously write new data to the output buffer as the code runs.  There are examples for this as well.

 

 

Best Regards,

John Passiak
0 Kudos
Message 6 of 6
(3,783 Views)