01-28-2009 09:27 AM
I'm trying to call several LabView VIs from LabWindows. I'm using the method demonstrated in LabWindows example: C:\Program Files\National Instruments\CVI80\samples\activex\labview.What the first VI does is to Create a DAQ task and assign channels and parameters to the task for data reading. And the second VI is to read the data from the DAQ card by calling the task created by the first step. I have been successfully calling the VIs in TestStand in 2 steps and the value returned were just what I need. But when I tried to call the VIs in LabWindows, the second VI returned an error -200428, I figure this is probably because the task that was created in last step has been cleaned up even I didn't close all the VIs. Does anybody know how to reserve the loaded VIs in labWindows like what we do in TestStand?
Thanks,
Eric
01-29-2009 09:44 AM
01-30-2009 10:26 AM
Thanks for your suggestion. I don't want my application to be running across CVI+TestStand+LabView. I have resolved this problem by calling DAQmx API to create and execute the task. Now is running well.
Another question I have is how to generate a sine waveform at the frequency that I'm expected in DAQmx.
I want to generate a sine wave at 1000Hz, here is how I did but it's not working as what I was expacted.
TaskHandle taskHandle=0;
float64 data[4000];
char errBuff[1000]={'\0'};
SinePattern (4000, 1.0, 0.0, 1, data);
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",1000,DAQmx_Val_Rising,DAQmx_Val_ContSamps,4000));
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,4000,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));
DAQmxErrChk (DAQmxStartTask(taskHandle));
How can I configure the sample rate in DAQmxCfgSampClkTiming() and cycles in SinePattern() to generate the frequency at 1000Hz?
Eric
01-30-2009 03:43 PM
Hi Eric,
I am glad to hear the application is working more like what you had anticipated. There is a ContGen-IntClk.prj example built into the LabWIndows/CVI environment that does exactly what you are wanting. You can open the LabWindows/CVI Example Finder by going to Help»Find Examples. You can find this example under Hardware Input and Output»DAQmx»Analog Generation»Voltage» Cont Gen Volt Wfm-IntClk.prj. Take a look at the ContGen-IntClk.c file and notice the DAQmx configuration code that starts on line 136. This configuration does exacly what you are wanting.
-Adri K.