01-30-2024 06:02 AM
My Device is PCI-6534.
The NIDAQ(Legacy) code is:
i16 iStatus = DIG_Grp_Config(DeviceNr, /*grp*/1,/*GroupSize*/4,/*port*/0, /*out*/1);
i16 iRetVal = NIDAQErrorHandler(iStatus, help, /*IgnoreWarning*/0);
u16 TimebaseDivider=(u16)((1.0/Frequency)/(50E-9));
iStatus = DIG_Block_PG_Config(DeviceNr, /*Group*/1, /*enable pattern generation*/ 1, /*internal clock*/ 0, /*time base 50 nanosecond*/ -3, /*timebase divider*/ TimebaseDivider, /*no gate*/ 0);
iStatus = DIG_Block_Out(DeviceNr, /*group*/1,Data,/*count*/ Count);
u32 remaining=Count;
DWORD start=GetTickCount64();
while ((remaining>0) && ((GetTickCount64()-start)<TimeoutDuration)) {
i16 iStatus = DIG_Block_Check (DeviceNr, /*group*/1, &remaining);
strcpy_s(help,200,(LPCTSTR)(Error+" DIG_Block_Check"));
iRetVal = NIDAQErrorHandler(iStatus, help, /*IgnoreWarning*/0);
iStatus = DIG_Grp_Config(DeviceNr, /*group*/ 1, /*groupSize*/ 0, /*port*/ 0, /*dir out*/ 1);
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateDOChan(taskHandle,"Dev1/port0_32","",DAQmx_Val_ChanForAllLines));
DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle,"OnBoardClock",Frequency,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk(DAQmxWriteDigitalU32(taskHandle,Count,0,10.0,DAQmx_Val_GroupByChannel,&data,&written,NULL));
DAQmxErrChk (DAQmxStartTask(taskHandle));
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
04-02-2024 04:35 AM
the question OK