i use VISA for PXI Card , and use viMapAddress to R/W IO 64k Times
My Code as below:
But total time divide by 64k is about 2.5uS ( when it read 64M data total need 160s very slow)
have any method to improve performance?
thanks.
ViStatus status = VI_SUCCESS - 1;
ViSession deviceRM = 0;
status = viOpenDefaultRM(&deviceRM);
ViSession instr = 0;
int timeOut = 5;
status = viOpen(deviceRM, "PXI9::15::INSTR", VI_NULL, timeOut, &instr);
ViAddr memptr = nullptr;
status = viMapAddress(instr, VI_PXI_BAR0_SPACE, 0, 0x1000, VI_FALSE, VI_NULL, &memptr);
unsigned int* pt = (unsigned int*)memptr;
ViUInt32 rtn = 0;
LARGE_INTEGER m_Freq = {0};
QueryPerformanceFrequency(&m_Freq);
LARGE_INTEGER m_St = {0};
QueryPerformanceCounter(&m_St);
for(int ii=0;ii<64*1000;ii++)
{
unsigned int val = pt[10];
//viPeek32(instr,pt+10,&rtn);
}
LARGE_INTEGER m_Sp = {0};
QueryPerformanceCounter(&m_Sp);
long time = (m_Sp.QuadPart - m_St.QuadPart)*1000/m_Freq.QuadPart;
printf("NI VISA Time = %d ms\n",time);
status = viClose(instr);
status = viClose(deviceRM);