Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Question of NIDAQ(legacy) convert to NIDAQmx

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); 
 
My NIDAQmx code is:
 
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);
    }
 
Ignoring some Syntax error, I think these two code are similar. As I know, the DIG_Block_PG_Config do not act handshaking or trigger. Maybe because the action of DIG_Block_Out is different from DAQmxWriteDigitalU32? Or should I try other Function like DAQmxCfgBurstHandshaking. Also the digital pattern generation, which in DIG_Block_Out, does not appear in NIDAQmx C Function.
0 Kudos
Message 1 of 2
(276 Views)

the question OK

0 Kudos
Message 2 of 2
(78 Views)