Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with BurstMode 32 bits in Nidaqmx

Hi:

 

I am working in a transfer by burst mode, i must to send a signal over the channel ACK2 (PFI5) for recieve data over the port0 (32 bits) at a 20Mhz frequency. For that i create two task, one for adquire the data by burst handshaking mode and one for write '1' digital over PFI5, the problem is that when i run tha program with port0_32 (32 bits), it says me " DAQmx ERROR End the program, press ENTER key to quit", but when i run with port0_16, it runs ok.

I'm working with a PCI 6534 and NIDAQmx library.

Here is my code. Thanks.

 

int main(void)

{

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

//CREATE TASK BurstMode

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

DAQmxErrChk (DAQmxCreateTask("",&taskHandle));

DAQmxErrChk (DAQmxCreateDIChan(taskHandle,channel,"",DAQmx_Val_ChanForAllLines));DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,

"/Dev1/PFI4",200000000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,SizeOfData));DAQmxErrChk (DAQmxCfgBurstHandshakingTimingExportClock(taskHandle,DAQmx_Val_ContSamps,SizeOfData,20000000.0,"/Dev1/PFI4",DAQmx_Val_ActiveHigh,DAQmx_Val_Low,DAQmx_Val_ActiveHigh));

DAQmxErrChk (DAQmxGetTaskAttribute(taskHandle,DAQmx_Task_NumChans,&numChannels));

DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,SizeOfData,0,NIDAQEvent,NULL));

DAQmxSetBufInputBufSize(taskHandle, SizeOfData);

data=malloc(SizeOfData*numChannels*
sizeof(uInt32));

if( data==NULL ) {printf (

"Error","Not enough memory\n"); goto Error2;

}

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

//CREATE TASK WRITE

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

DAQmxErrChk (DAQmxCreateTask("",&taskHandleWritten));DAQmxErrChk (DAQmxCreateDOChan(taskHandleWritten,"/Dev1/PFI5","",DAQmx_Val_ChanForAllLines));

 

 

/*/ Start BurstMode/*********************************************/

DAQmxErrChk(DAQmxStartTask(taskHandle));

Sleep(100);

 

/*/ Start TaskWrite/*********************************************/

DAQmxErrChk(DAQmxStartTask(taskHandleWritten));

DAQmxErrChk(DAQmxWriteDigitalLines(taskHandleWritten,1,1,10.0,DAQmx_Val_GroupByChannel,&DataACK2_1,NULL,NULL));

DAQmxStopTask(taskHandleWritten);

 

printf(
"Generating digital output continuously. Press any key to interrupt\n"); while( !_kbhit() ) {

 

Sleep(100);

}

_getch();

 

Error2:

if( DAQmxFailed(error) )

DAQmxGetExtendedErrorInfo(errBuff,2048); // informa el tipo de error

 if( taskHandle!=0 ) {

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

 /*/ DAQmx Stop Code

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

DAQmxStopTask(taskHandle);

DAQmxClearTask(taskHandle);

DAQmxClearTask(taskHandleWritten);

}

if (data)

free (data);

if( DAQmxFailed(error) )

printf("DAQmx Error: %s\n",errBuff);printf(

"End of program, press Enter key to quit\n");}

getchar();

return 0;

} 

 

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