04-03-2015 09:23 AM
Hi ,
i am using NI-MAX 14.01, with its visa driver, i want to read 75000 bytes data from an agilent instrument via hislip.
i have already allocated a 99999 bytes long buffer, suppose it is big enough to handle this data.
the code looks like:
unsigned char sendbuf[1000];
unsigned char recvBuffer[99999];
status = viOpenDefaultRM(&defaultRM);
status = viOpen(defaultRM, "TCPIP0::192.168.0.1::hislip1::INSTR", VI_NULL, VI_NULL, &instr);
sprintf_s(sendBuffer, "fetch:EVM?\n");
int len = _mbstrlen(sendBuffer);
status = viWrite(instr, (ViBuf)sendBuffer, len, &count); // this line can be executed successfully, and the instrument does truly received this command
status = viRead(instr, (ViBuf)recvBuffer, 99999, &count); // but at this line, i always get 3FFF0006 (MAX_CNT) warning, and the output count is always ZERO.
i think it does not makes, if the received data really exceeds the buffer, the output parameter "count" should not be ZERO.
I also did the follwing tests
1. change the hislip to vxi-11. replace hislip1 with inst1. the code works very well, the "count" is exactly 75000. the status = VI_SUCCESS.
2. use VISA-TEST pannel and send the same command to instrument. the VISA test pannel shows that status=VI_SUCCESS, but the output "count" is about 13000, not 75000 as i expected.
3, I also use Agilent IO library suite 17 provided VISA driver. my test code can also work correctly.
i don't know if i made any mistake in my test code. I do really appreciate for any suggestions correctons, and comments.
thanks
KEEHUA
04-03-2015 09:32 AM
you might want to read http://www.ni.com/pdf/manuals/370423a.pdf
04-03-2015 09:23 PM
04-04-2015 10:42 AM - edited 04-04-2015 10:44 AM
If you are able to get your code to work with Agilent VISA as you claim, then stick with Agilent VISA.
If you have NI-VISA and Agilent VISA both installed, read http://www.keysight.com/upload/cmc_upload/All/knowledge_code_02_dual_visa_readme.pdf?&cc=US&lc=eng