Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

viRead() always get VI_SUCCESS_MAX_CNT(3FFF0006) even though the buf is big enough

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

 

 

 

 

0 Kudos
Message 1 of 4
(4,718 Views)
Thansk for your reply. i think i have read this manual before, but cannot find anything about this problem. my code works very well when the session is VXI-11 or GPIB. i also tried both async and sync write/read. but it doesn't help.
0 Kudos
Message 3 of 4
(4,684 Views)

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

 

0 Kudos
Message 4 of 4
(4,666 Views)