LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reserve loaded VIs in LabWindows

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

0 Kudos
Message 1 of 4
(2,860 Views)
Eric,

I would like further clarification as to why you want to move away from TestStand and into the CVI environment to do this. If you want to utilize a CVI GUI, you can still access the TestStand API from within CVI to make these calls to your LabVIEW VIs.

-Adri K.
Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 2 of 4
(2,835 Views)

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

0 Kudos
Message 3 of 4
(2,818 Views)

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.

 

Adri Kruger
National Instruments
LabVIEW Product Marketing
0 Kudos
Message 4 of 4
(2,808 Views)