sunuk
2008-02-10 12:10:05 UTC
Hello. I am currently using PCI-6534 and NIDAQmx to contol piezo scanner.
The piezo scanner hase three axsis and interfaces with PCI-6534 card using 16bit digital form.
My question is how to alleviate the delay when continously outputting diffent buffers.
When I output varying buffer continously, there is about 25ms delay.
To show this, I generate same output buffer(4032 number,sine curve), output that buffer and input corresponding piezo scanner output in a while loop.
See attached figure and source code.
Is there anybody to know this problem and solution?
int _tmain(int argc, _TCHAR* argv[]){ int32 error=0; TaskHandle taskHandle=0; TaskHandle taskHandle1=0; TaskHandle taskHandle2=0; TaskHandle InputTaskHandle=0;
uInt32 numChannels; bool32 done=0; char errBuff[2048]={'\0'}; char ch; int32 sampsRead,totalRead=0;
int outputBufferSize = num_point*6; signed short *outputBuffer = new signed short[outputBufferSize]; signed short *inputBuffer = new signed short[outputBufferSize];
//For real time position data output and input //Firstly setting input port for continuous data input DAQmxErrChk (Configure_ReadDigPortExtClk("Dev1/port2:3","/Dev1/PFI3",outputBufferSize+100000000,&InputTaskHandle, &numChannels, outputBufferSize+100000000)); DAQmxErrChk (Start_DigPortExtClk(InputTaskHandle)); //In while loop, position data can be out and in. while(1){ //When key in 's', then stop scanning if(kbhit()){ char ch = getch(); if(ch=='s'){ printf("Stop scanning\n"); break; } } //real-time output buffer generation and send data to the NPoint controller. generate_buffer(outputBuffer); DAQmxErrChk (Configure_WriteDigPortExtClk("Dev1/port0:1","/Dev1/PFI2",outputBufferSize,&taskHandle1, &numChannels, outputBufferSize)); DAQmxErrChk (Write_DigPortExtClk(taskHandle1,(uInt16*)outputBuffer,outputBufferSize)); DAQmxErrChk (Start_DigPortExtClk(taskHandle1)); DAQmxErrChk (Wait_DigPortExtClk(taskHandle1)); ///////////////////////////////////////////////////////////////////////////// //Continuous position data input DAQmxErrChk (Read_Cont_DigPortExtClk(InputTaskHandle, (uInt16*)inputBuffer, outputBufferSize, &sampsRead)); if( s
The piezo scanner hase three axsis and interfaces with PCI-6534 card using 16bit digital form.
My question is how to alleviate the delay when continously outputting diffent buffers.
When I output varying buffer continously, there is about 25ms delay.
To show this, I generate same output buffer(4032 number,sine curve), output that buffer and input corresponding piezo scanner output in a while loop.
See attached figure and source code.
Is there anybody to know this problem and solution?
int _tmain(int argc, _TCHAR* argv[]){ int32 error=0; TaskHandle taskHandle=0; TaskHandle taskHandle1=0; TaskHandle taskHandle2=0; TaskHandle InputTaskHandle=0;
uInt32 numChannels; bool32 done=0; char errBuff[2048]={'\0'}; char ch; int32 sampsRead,totalRead=0;
int outputBufferSize = num_point*6; signed short *outputBuffer = new signed short[outputBufferSize]; signed short *inputBuffer = new signed short[outputBufferSize];
//For real time position data output and input //Firstly setting input port for continuous data input DAQmxErrChk (Configure_ReadDigPortExtClk("Dev1/port2:3","/Dev1/PFI3",outputBufferSize+100000000,&InputTaskHandle, &numChannels, outputBufferSize+100000000)); DAQmxErrChk (Start_DigPortExtClk(InputTaskHandle)); //In while loop, position data can be out and in. while(1){ //When key in 's', then stop scanning if(kbhit()){ char ch = getch(); if(ch=='s'){ printf("Stop scanning\n"); break; } } //real-time output buffer generation and send data to the NPoint controller. generate_buffer(outputBuffer); DAQmxErrChk (Configure_WriteDigPortExtClk("Dev1/port0:1","/Dev1/PFI2",outputBufferSize,&taskHandle1, &numChannels, outputBufferSize)); DAQmxErrChk (Write_DigPortExtClk(taskHandle1,(uInt16*)outputBuffer,outputBufferSize)); DAQmxErrChk (Start_DigPortExtClk(taskHandle1)); DAQmxErrChk (Wait_DigPortExtClk(taskHandle1)); ///////////////////////////////////////////////////////////////////////////// //Continuous position data input DAQmxErrChk (Read_Cont_DigPortExtClk(InputTaskHandle, (uInt16*)inputBuffer, outputBufferSize, &sampsRead)); if( s