Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

continuous output triangular wave

Hi,
I want to continuous generate a triangular wave with an external trigger in ansi C. I have a NIDAQ 6115 and i have traditional nidaq drivers.
I try to run the examples of NI for analog output but they output a sine wave and the wave is not continuous but it stops after some iterations.
I put the number of iterations to 0 and i see nothing on the analog output channel,
Can anybody help me?
Thanks,
0 Kudos
Message 1 of 9
(4,675 Views)

Hi eugenia,

If you are just starting out with National Instruments Data Acquisition I would highly recommend you use the NI-DAQmx driver instead of the Traditional NI-DAQ driver.

If you download and install the driver you will be able to install support of ANSI C. Once you do that you will have to open the example is the following folder: C:\Program Files\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog Out\Generate Voltage\Cont Gen Volt Wfm-Int Clk

This writes a waveform to your Analog Output and then repeats that same output. In order to output a triangle waveform you will have to change the data being written to the DAQmxWriteAnalogF64 function. The data input to this is an array of values that will be written out to the analog output channel at every edge of the sample clock. You will need to write some C code to create an array of values that ramp up to create the triangular waveform you require.

You will also have to add DAQmxCfgDigEdgeStartTrig to configure your external trigger. Please refer to the NI-DAQmx C Reference Help for more information on NI-DAQmx functions.

Please let me know if this helps.

 
Abhinav T.
Applications Engineering
National Instruments India

LabVIEW Introduction Course - Six Hours
Getting Started with NI-DAQmx
Measurement Fundamentals
Message 2 of 9
(4,668 Views)

Hi Abhinav,

I don't want to change my drivers to nidaqmx because i have a lot of other applications in my computer written in traditional nidaq and i don't want to change them. Also in daqmx,(in labview) is it able to do continuous analog output without using while loop? I want to use a subvi that does continuous analog output inside another vi, and if i use daqmx, i can't do it without while loop, so my program stacks in the while loop. I have a program in labview that does simultaneously continuous analog input continuous analog output, and continuous pulse generation.Can i do all of those in one Vi simultaneously with daqmx? i have tried it before but i think we can't generate continuous signals or pulses without using while loop.This is the main reason that i don't want to use Daqmx. How can i do continuous analog output with traditional nidaq and in C language?

Thank you,

Eugenia

 

0 Kudos
Message 3 of 9
(4,658 Views)
I can't help with your c code but your comment about continuous analog out and DAQmx is not correct. It does not require a while loop anymore than the traditional NI-DAQ. The same is true of pulse generation if you are using a counter. There are several shipping examples of both. The only while loops in the examples are a loop to see if the stop button has been pressed.
Message 4 of 9
(4,638 Views)

Hi Eugenia,

You mentioned "I don't want to change my drivers to nidaqmx because i have a lot of other applications in my computer written in traditional nidaq and i don't want to change them.".  I just wanted to point out that it is quite possible to have both NI-DAQmx and Traditional NI-DAQ installed on the same computer, and to use the two drivers interchangably with the same device (assuming the device is supported in both drivers, which yours is).  So, you could make new programs with NI-DAQmx and still use your old Traditional NI-DAQ programs as well.

I really agree with Abhinav and highly recommend that you use NI-DAQmx.  DAQmx can do everything that Traditional NI-DAQ can do, and it's much easier to use.  Trust me, once you get used to the newer API, you will be glad you switched! Smiley Happy

0 Kudos
Message 5 of 9
(4,624 Views)
Ok, can you send me a labview example for continuous analog output withoout using while loop with nidaqmx?
0 Kudos
Message 6 of 9
(4,620 Views)
Open the example finder and go to Hardware Input and Output>DAQmx>Analog Generation>Voltage. There are several there. A simple one to start with is Cont Gen Voltage Wfm-Int Clk. There are several others. The only loop there is to check for the stop button being pressed. Generation starts as soon as the Start Task function is executed.
0 Kudos
Message 7 of 9
(4,618 Views)

Hi Dennis,

This example is not what i want to do,

I want for example the the waveform to continue ganarating while the vi has stopped( is not executing). This is possible with traditional nidaq, i i start the task i i dont use the Stop AO.vi. In nidaqmx this is not possible becouse if i dont use the AOStop.vi, the generation stops automaticaly when the VI stops executing.

0 Kudos
Message 8 of 9
(4,603 Views)
You don't understand. The example starts generating a waveform as soon as the start task is executed. The task stops with the stop task fucntion (that's kinda of simple). If you don't want the waveform to stop, don't run the stop task.
0 Kudos
Message 9 of 9
(4,600 Views)