When I run the code below I get an task error 20008 without the delay of 2 seconds.
Why do I need the delay and is there any way to reduce this ?
Chan_num is “Dev1/port4/line1”
Voltage is 25 or 0 or -25
int DAQ_set_voltage(int panelHandle,char *task_name, char *chan_num, unsigned long voltage)
{
if((status = DAQmxCreateTask("xyz",&VoutHandle)) == SUCCESS)
if((status = DAQmxCreateDOChan (VoutHandle,chan_num , "www", DAQmx_Val_ChanForAllLines))== SUCCESS);
Delay(2);
if ((status = DAQmxWriteDigitalU32(VoutHandle,1,1,10.0,DAQmx_Val_GroupByChannel,&voltage,&written,NULL)) == SUCCESS)
status = DAQmxStartTask(VoutHandle);