Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

analog output generation with formula node

Hello

 

I´m new with Labview. I´m trying to generate a signal depending on some parameters given by the user. There user need to generate three kind of signals: Sine, triangle and steps, but not normal ones. After every half period of the signal the user can "insert" a wait time (wait up and wait down). This is by I´m using a formula node to generate the signal instead of using a vi.

The program works good but only with low frecuencies (2Hz). The problem is that I need to generate this signals at 5kHz, and (I don´t know if I´m right) the computer or program can not complete the code on time (between two samples) to give the card the next sample.

 

The card is a PCI 6321.

Labview 2013.

 

Thanks

0 Kudos
Message 1 of 8
(4,205 Views)

The computer can certainly calculate fast enough. I disabled the DAQ stuff and just ran the calculations. It runs ~ 100000 iterations per second.  I have never used the DAQ Wait for Next VI but I suspect that the combination of that and single sample writes may be limiting your loop rate.

 

I think you need to precalculate multiple samples and let the hardware generate the signals based on hardware timing. For any combination of the controls you can calculate one complete cycle (including the waits).  At 5 kHz you will get many cycles before a human operator can chnage the settings. So set up the AO for regeneration. Write one complete cycle every time a setting changes (think event structure). Let it run until the settings change again.

 

Also, consider that the user may want to change multiple settings at one time and may not care about the signal at intermediate states.  For example suppose the user wants to change both Amplitude and Wait Up. Creating a new signal with the new Amplitude and the old Wait Up may be undesirable (or even dangerous to the equipment). It might be better to add and Enter button. Only when the Enter button is pressed does the program read the values of all the parameters and change the signal.

 

Lynn

0 Kudos
Message 2 of 8
(4,196 Views)

Hello

 

Thanks for the answer. Now I know the computer is fast enought, and the problem is the DAQ Wait for next VI. I will program play and a stop buttons as you say. I also think that I should generate some signal cycles and then send it to the output. My problem now its that I don´t know how to do it.

I have use NI Max to test the card, and with 800000 as sample rate, and 100 samples I got a clear sine signal at 8kHz that its more than enouhgt.

I guess I have to use the DAQ Timing on Continuos mode and select an appropiate sample rate and samples per channel. And I guess that I should "pack" my signal on a array(?) to send it to the output. How can I do it, and how can I control the card´s buffer to avoid overflow?

 

Thanks.

 

0 Kudos
Message 3 of 8
(4,177 Views)

I do not have much experience with DAQmx.  Someone else will need to help with that.  You will want an array or waveform datatype (which includes an array) to hold all the samples for a cycle or more.

 

Lynn

0 Kudos
Message 4 of 8
(4,167 Views)

Hello,

 

like Lynn said you can store your samples for each cycle in an array or waveform. For automatic or manual buffer-memory allocation with DAQmx you can first have a look at this document, I hope this can help you out Smiley Happy

 

Regards,

  Michael

__________________________________
Certified LabVIEW Associate Developer
0 Kudos
Message 5 of 8
(4,155 Views)

Hello

 

Thanks for the answers. I "packed" the signals in an array like you said and seems to work good!. But now I have other problems.

 

I need to use to hole resolution of the card (if I am not wrong 20V/2**16=> aprox. 305 uV) with my "slow sine and triangle signals". That means that I have to use a hight sample rate and many samples. The problem is that when the period of the signal (period=samples/sample rate) is long I have to much samples, and I think that should be another way to solve the problem, but how?.

 

I know that I "miss" many samples on the wait periods where is not needed because I should only keep a value on the ouput, but like i said, I don´t know an other way to do it. Can I run continuosly a signal generated in four parts?.

 

My next question is about the memory. How can I know that the number of samples is so big that there is not enought memory on the computer, and how can avoid an error because of it?.

 

Again thanks. I know that my program is not so "beautiful", but should work first Smiley Wink.

 

 

0 Kudos
Message 6 of 8
(4,107 Views)

Some things I do not understand about what you are trying to do.

 

Why do you use different sample rates for different waveforms?

 

Why does the number of samples need to depend on the amplitude?

 

What are typical values and the range of values for the amplitude, speed, and wait inputs?

 

I suspect there is a simpler way to do what you want, but need to know more about the details of what you are want to do.

 

Lynn

0 Kudos
Message 7 of 8
(4,099 Views)

Hello again.

 

-I work with two ranges of frecuencies: 0,5-2hz, and 1-2 khz (fast sine). I need accuracy (maximal resolution) only when I work at low speed. I should calculate the waveform depending on the maximal wave speed (V/s), amplitude, and wait times. The maximal speed of a sine is different than the maximal speed of a triangle wave. I have made an aproximation for 2 hz with the maximal resolution of the card (305uV), and with a bit mathematics I calculated the sample rate needed to work with maximal accuracy at that frecuency.

 

-The number of samples depend of the amplitude because I calculate the period depending on the wave maximal speed. Same speed, different amplitude means diferent period and different number of samples (because I use a constant sample rate for each wave type).

 

-Amplitude +-10 (card), speed 1 to 100 V/s, and wait 0 to 5000ms.

 

I think its more complicated to explain the problem than the solution.

 

Thanks

0 Kudos
Message 8 of 8
(4,096 Views)