Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

PXI-6259 multiple AO's at different Frequencies

Hello everyone,

 

i am currently developing an application for a PXI system in C#. The first part is to generate four sine waveforms on PXI-6259 with independent controlable properties like frequency, phase, amplitude, etc.

The waveforms are the same for the lifetime of the task, so using buffer regeneration should be the best option.

(Another reason for buffer regeneration: The second part of the software will be analog data aquisition with a high speed digitizer at maximal possible rate, so i don't want wasting processing power with waveform calculation on the fly.)

 

The problem is: how do i generate four waveforms with different frequencies with buffer regeneration?

For one frequency it's easy: just get one period and sample it with a decent number of samples. Sadly, this can't be applied for multiple waveforms.

 

My idea for multiple waveforms:

1. Get the lowest frequency and calculate the cylce length of one period

2. Get the highest frequency and count how many times it's period fits into the period of the lowest frequency

3. Let's assume, we want to sample the highest frequency period with at least 10 samples.

    Calculate samplenumber: Multiply 10 with the result of (2.)

    Calculate sampleclockrate: Multiply highest frequency with samplenumber

 

Are there any simpler solutions to this problem, which i might have overlooked?

Any comments are welcome, thanks in advance!

 

Best Regards,

Paul

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

This will all come down to how willing you are to live with self-imposed constraints.

 

In the most general case, you can't be sure that there will even *exist* a reasonable-sized buffer that exactly fits an integer # of cycles for each of 4 waveform frequencies when you're further constrained by discrete possible sample rates (must be integer divisors of a timebase).

 

This kind of thing has been a sorta pet topic of mine since I first posted about it *very* long ago.  Including the constraints of discrete available sample rates and practical buffer size limits makes it non-trivial to set up an arbitrary-frequency waveform for regeneration.   The complication amplifies considerably for multiple waveforms at different frequencies.  (Just searched in vain for a related thread I was in where it was fairly tough to work with just 2 different waveform freqs.)

 

So I'm gonna boil down my advice to 1 of the following 2 options:

 

1. Make your tasks be non-regenerating.  Yes there's some CPU involved in re-calculating waveforms on the fly.  But you can support any arbitrary set of frequencies you might encounter.  You'll have to experiment to figure out whether the tradeoff is worthwhile.

 

2. Live with limited precision and accuracy for the waveform frequencies.  Allow for some tolerances.  See this thread for some related discussion and context.

    If you only allow *integer* frequency values, then a 1 second buffer will hold an integer # of cycles for all 4 waveforms.  This deals with the *precision* aspect.

    However, the actual AO sample rate might not divide evenly into an exact 1 second interval.  So the regeneration buffer that holds integer #'s of *cycles* for each waveform may take very slightly more or less than 1.0000000 sec to generate.  That deviation will mean that your waveform freq's are slightly different than requested.

 

 

-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 2 of 2
(1,466 Views)