LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx get task status

I would like to get info if the particular task was already started.

I have functions

CreateTask

CreateWave

StartTask

They should be started in this order at 1st time. Afterwards I can call CreateWave to generate new waveform without calling function StartTask.

Problem: I don't know how to check if user started task already so i'm always stoping and starting task before i call CreateWave and that is a time wasting.

You can see part of my code bellow.

 

Thanks Michal

 

int CVICALLBACK CreateTask (int panel, int control, int event,

void *callbackData, int eventData1, int eventData2)

{

int32 error=0;

float64 freq=0;

char errBuff[2048]={'\0'};

freq=1000000; //1000Hz

switch (event)

{

case EVENT_COMMIT:

/*********************************************/

// DAQmx Configure Code

/*********************************************/

DAQmxCreateTask("",&taskHandle);

DAQmxCreateAOVoltageChan(taskHandle,"Dev4/ao0","",-10.0,10.0,DAQmx_Val_Volts,NULL);

DAQmxCfgSampClkTiming(taskHandle,"",freq,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);

break;

}

return 0;

}

int CVICALLBACK StartTask (int panel, int control, int event,

void *callbackData, int eventData1, int eventData2)

{

switch (event)

{

case EVENT_COMMIT:

DAQmxStartTask(taskHandle);

break;

}

return 0;

}

int CreateWave(float64 data[])

{

DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,1000,0,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));

return 0;

}

0 Kudos
Message 1 of 3
(4,087 Views)

I think i found the answear.

DAQmxIsTaskDone (taskHandle, &isTaskDone);

returns me always 1 if the task is not running and 0 if is running.

 

0 Kudos
Message 2 of 3
(4,086 Views)
Hello Michal,

For future inquiries, the NI-DAQmx C Reference Help can be very useful. More information about the NI-DAQmx documentation can be found here.


Matt Anderson

Hardware Services Marketing Manager
National Instruments
0 Kudos
Message 3 of 3
(4,061 Views)