From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

NIDAQmx DAQmxWaitUntilTaskDone never finishes after DO generation

Hi,

 

We are using DAQ Card (NI PCI DIO-32HS, Model PCI-6533), NIDAQmx 9.1.7 on 64 bit Win 7 machine.

 

After porting Digital input/output app code to new APIs from legacy, it doesn't work. DAQmxWaitUntilTaskDone never finished. DAQ APIs call snippet below.

I already referred all examples and help document. Could you please help what went wrong? Also, is there any way to see if DAQ is generating any signal or not after wrtting to DAQ buffer and starting task?

 

Simple program:

 

<Code snippet: NIDAQmx> DAQmxWaitUntilTaskDone never finished <Log output shown at the end>

 

//Clear DAQ
DAQmxStopTask(taskHandleTx);
DAQmxClearTask(taskHandleTx);
DAQmxResetDevice("Dev1");

//Config DAQ
DAQmxCreateTask("DAQTx", &taskHandleTx);
DAQmxCreateDOChan(taskHandleTx, "Dev1\port2_16", "DAQTxVchannel", DAQmx_Val_ChanForAllLines);
DAQmxCfgBurstHandshakingTimingExportClock(taskHandleTx,
                                          DAQmx_Val_FiniteSamps,
                                          TxBufSize,
                                          100000.0,
                                          "/Dev1/PFI5",
                                          DAQmx_Val_ActiveHigh,
                                          DAQmx_Val_Low,
                                          DAQmx_Val_ActiveHigh);

DAQmxSetWriteRegenMode(taskHandleTx, DAQmx_Val_DoNotAllowRegen);
DAQmxWriteDigitalU16(taskHandleTx,
                     TxBufSize,
                     0, //autostart task disabled
                     10.0, //timeout to write samples 10 secs
                     DAQmx_Val_GroupByChannel,
                     TxBufPtr,
                     &sampsPerChanWritten,
                     NULL);

DAQmxStartTask(taskHandleTx);

while(daq_status != 0)
{
  daq_status = DAQmxWaitUntilTaskDone(taskHandleTx, 18.0); //18 secs wait
}

//Clear

DAQDAQmxStopTask(taskHandleTx);
DAQmxClearTask(taskHandleTx);
DAQmxResetDevice("Dev1");

 

<Code snippet: Legacy DAQ driver> Working


#define DEVICE_NUM                         1
#define GROUP_1                               1
#define GROUP_2                               2
#define PORT4                                   4
#define ACK1_LINE                             2
#define GROUP_2_SIZE                      2
#define GROUP_2_PORT                    2
#define GROUP_2_DIR                       1
#define BURST_PROTOCOL               3
#define ACTIVE_LOW_REQ_POL        1
#define ACTIVE_LOW_ACK_POL        1


//Clear DAQ
DIG_Block_Clear(DEVICE_NUM, GROUP_1);
DIG_Block_Clear(DEVICE_NUM, GROUP_2);
DAQ_Clear (DEVICE_NUM);
DIG_Grp_Config(DEVICE_NUM, GROUP_1, 0, 0, 0);
DIG_Out_Line(DEVICE_NUM, PORT4, ACK1_LINE, 1);
DIG_Grp_Config(DEVICE_NUM, GROUP_2, 0, 0, 0);

//Digital output
DIG_Grp_Config(DEVICE_NUM, GROUP_2, GROUP_2_SIZE, GROUP_2_PORT, GROUP_2_DIR);
DIG_Grp_Mode(DEVICE_NUM, GROUP_2, BURST_PROTOCOL, 0, ACTIVE_LOW_REQ_POL, ACTIVE_LOW_ACK_POL, 0);
Set_DAQ_Device_Info(DEVICE_NUM, ND_CLOCK_REVERSE_MODE_GR2, ND_ON);
DIG_DB_Config(DEVICE_NUM, GROUP_2, DISABLE_DB, DISABLE_OLD_DATA, DISABLE_PARTIAL_TRANSFER);  
DIG_Block_Out(DEVICE_NUM, GROUP_2, TxBufPtr, TxBufSize);
while (remaining != 0)
{
  DIG_Block_Check(DEVICE_NUM, GROUP_2, &remaining);
}

//Clear DAQ
DIG_Block_Clear(DEVICE_NUM, GROUP_1);
DIG_Block_Clear(DEVICE_NUM, GROUP_2);
DAQ_Clear (DEVICE_NUM);
DIG_DB_Config(DEVICE_NUM, GROUP_2, DISABLE_DB, ENABLE_OLD_DATA, DISABLE_PARTIAL_TRANSFER);
DIG_Grp_Config(DEVICE_NUM, GROUP_1, 0, 0, 0);
DIG_Out_Line(DEVICE_NUM, PORT4, ACK1_LINE, 1);
DIG_Grp_Config(DEVICE_NUM, GROUP_2, 0, 0, 0);

 

 

//NIDAQmx output

DAQ operation = : ResetDeviceSuccessful
DAQ is reset.
Input file size : 3542208 (bytes).
Configuring DAQ device
DAQ operation = : CreateTaskTxSuccessful
DAQ operation = : CreateDigOUTChannelTxSuccessful
DAQ operation = : BurstHandshakeTimingIntCLKTxSuccessful
DAQ operation = : NotAllowRegenModeTxSuccessful
DAQ has started
Tx Buf Size is : 1771104
DAQ operation = : WriteDigTxSuccessful
Samples per channel written :  1771104
DAQ operation = : StartTaskTxSuccessful

Please wait...
DAQ operation = : WaitUntilTaskDoneTxreturned error code = :-200560
DAQ error code = : -200560Err string = Wait Until Done did not indicate that the
 task was done within the specified timeout.

Increase the timeout, check the program, and make sure connections for external
timing and triggering are in place.


DAQ operation = : StopTaskTxSuccessful
DAQ operation = : ClearTaskTxSuccessful
DAQ operation = : ResetDeviceSuccessful
DAQ is reset.

0 Kudos
Message 1 of 1
(3,108 Views)