LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I generate 2 waveforms (at Ao0, Ao1) simultaneously using DAQ6259?

Hello,
 
I am using winXP, CVI8.5.1, DAQ6259 and a modified waveform generation sample code which comes with CVI. 
I have two different tasks. Task1 generates 50Hz sine wave at Ao0. Task2 generates 30Hz triangle waveform at Ao1. The two tasks work well independently. However, I want to generate both waveforms simultaneously.
a)   When I execute Task0 first, it generates the 50Hz sine wave.
b)   Then, when I execute Task1, I get   "Non Fatal run-time error, ...  Task Name: _<unamed Task<1> ...  resources reserved ... Status code -50103."
in the same way
a)   When I execute Task1 first, it generates the 30Hz triangular wave.
b)   Then, when I execute Task0, I get   "Non Fatal run-time error, ...  Task Name: _<unamed Task<1> ...  resources reserved ... Status code -50103."
I use two different tasks and two different functions(with differerent variable names)in my code to make sure I do not use the same resources. My questions are:
1)   Does DAQ card 6259 have the capability to generate two waveforms simultaneously?
2)   If  1)  is yes, how do you implement it? 
3)   Is there a sample code somewhere which demonstrates this?
 
Thank you.
Robert.
0 Kudos
Message 1 of 5
(3,843 Views)
Hello Robert,

yes, you can generate two waveforms from one DAQ card. You have to do so in one task, however. Because if one task reserves the AO channels for use, then the second task that tries to use AO channels will fail (as you saw from your error messages).

You can generate two waveforms into one buffer (either interleaved or not), you can create two AO channels in one task, then you can write the buffer and the two waveforms will be generated on the two channels that you chose.

You can modify the existing example that you're using. Simply change the channel name from the default "Dev1/ao0" to e.g. "Dev1/ao0:1".

Hope this helps.
LDP
0 Kudos
Message 2 of 5
(3,830 Views)

hi ,

I use DAQ assitant in CVi and create code for your refenrence :

DAQmxErrChk(DAQmxCreateTask("DAQTaskInProject", &taskOut));

 DAQmxErrChk(DAQmxCreateAOVoltageChan(taskOut, "Dev1/ao0",
  "VoltageOut0", -10, 10,
  DAQmx_Val_Volts, ""));
 if (-1 != DAQmx_Val_Cfg_Default)
  DAQmxErrChk(DAQmxSetChanAttribute(taskOut, "VoltageOut0", DAQmx_AO_TermCfg,
   -1));

 DAQmxErrChk(DAQmxCreateAOVoltageChan(taskOut, "Dev1/ao1",
  "VoltageOut1", -10, 10,
  DAQmx_Val_Volts, ""));
 if (-1 != DAQmx_Val_Cfg_Default)
  DAQmxErrChk(DAQmxSetChanAttribute(taskOut, "VoltageOut1", DAQmx_AO_TermCfg,
   -1));

 DAQmxErrChk(DAQmxCfgSampClkTiming(taskOut, "",
  1000, DAQmx_Val_Rising,
  DAQmx_Val_FiniteSamps, 100));

    *taskOut1 = taskOut;

Sonic

Diffrent Strokes for Different Folks
0 Kudos
Message 3 of 5
(3,804 Views)

Hello LDP,

Your suggestion of using "Dev1/Ao0:1" works. However, it produces the same waveform and same frequency at both Ao0 and Ao1.  What do I do to get 50Hz sine at Ao0 and 30Hz triangle waveform at Ao1?

Thank you in advance.

Robert.

0 Kudos
Message 4 of 5
(3,781 Views)
Robert,

for different timing on the two waveforms, I would ask a question in the Multifunction DAQ forum, I bet they'd have a good answer for you there.

Hope this helps.
LDP
0 Kudos
Message 5 of 5
(3,774 Views)