04-02-2008 01:24 PM
Hi,
I'm having problems using DAQmxCreateTask. I want to use the same channel to read a signal using two different functions in CVI.
The first one uses the next function:
WRITE a signal from an array.
DAQmxErrChk(DAQmxCreateTask("VPSignal", &taskOut));
DAQmxErrChk(DAQmxCreateAOVoltageChan(taskOut, "DAQboard/ao1", "VoltageOut", -5, 5, DAQmx_Val_Volts, ""));
if (-1 != DAQmx_Val_Cfg_Default)
DAQmxErrChk(DAQmxSetChanAttribute(taskOut, "VoltageOut", DAQmx_AO_TermCfg, -1));
DAQmxErrChk(DAQmxCfgSampClkTiming(taskOut, "", 9960, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 166));
DAQmxWriteAnalogF64 (taskOut, 166, 1, 1.0, DAQmx_Val_GroupByChannel, sinewave, &sampleswriten, 0);
READ Tthe signal
DAQmxErrChk(DAQmxCreateTask("", &taskOut));
DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "DAQboard/ai3", "Input1", DAQmx_Val_RSE, -5, 5, DAQmx_Val_Volts, ""));
DAQmxErrChk(DAQmxCreateAIVoltageChan(taskOut, "DAQboard/ai4", "input2", DAQmx_Val_RSE, -5, 5, DAQmx_Val_Volts, ""));
DAQmxErrChk(DAQmxCfgSampClkTiming(taskOut, "", 9960, DAQmx_Val_Rising, DAQmx_Val_FiniteSamps, 166));
The other function uses the same port to read but the reading is for just one point at the time.
WRITE a value
DAQmxErrChk(DAQmxCreateTask("Vinput_Task", &taskOut_0));//Creacion de la Tarea para escritura
DAQmxErrChk(DAQmxCreateAOVoltageChan(taskOut_0, out_ch, "Vinput_Out", -10, 10, DAQmx_Val_Volts, ""));
if (-1 != DAQmx_Val_Cfg_Default)
DAQmxErrChk(DAQmxSetChanAttribute(taskOut_0, "Vinput_Out", DAQmx_AO_TermCfg, -1));
DAQmxStartTask(taskOut_0);//Inicia la tarea de generacion de voltaje
//*************
DAQmxErrChk(DAQmxCreateTask("VinputTask", &taskOut));
DAQmxErrChk(DAQmxCreateAOVoltageChan(taskOut, out_ch, "Vinput_Out", -5, 5, DAQmx_Val_Volts, ""));
DAQmxErrChk(DAQmxCfgSampClkTiming(taskOut, "", 99960, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1666));
if (-1 != DAQmx_Val_Cfg_Default)
DAQmxErrChk(DAQmxSetChanAttribute(taskOut, "Vinput_Out", DAQmx_AO_TermCfg, -1));
DAQmxWriteAnalogF64 (taskOut, numberOfPoints, 1, 1.0, DAQmx_Val_GroupByChannel, buffer, &sampleswriten, 0);
04-02-2008 02:24 PM
I’m having problems using DAQmxCreateTask. I am programming in LabWindows/CVI and I want to use the same channel to acquire a finite signal and just one point(not at the same time!), but using two different functions is causing me error codes:
-200089 Task name specified conflicts with an existent task name
-200088 Task specified is invalid or does not exist
The code I'm using is attached.
Can anyone tell me what I’m doing wrong?
Can I use the same channel to acquire a signal and just one measure using different functios without causing conflicts?
I think that using StopTask and ClearTask release memory and resources reserved for those Task, so I can create them again when I need them.
Thanks, I hope anyone can help me?