From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using the driver for the Agilent 54621A oscilloscope



@TongY wrote:
I know what "\n" is, what I was suggesting is that the instrument timeouts because it does not receive an acceptable termination and is waiting for more data. By taking the last byte off the write string, "\n" is not read by the instrument anymore.




You seemed to be suggesting that \n is two bytes long. It is not.

With this assumption, look closely at the command:
viWrite (io, "*ESR?\n", 7, VI_NULL));

There is only 6 bytes of meaninful data. Changing the count from 7 to 6 does not remove the trailing \n, or 'n', it removes the trailing \0.


The oscilloscope I am communicating does accept \n as a terminating character as evidenced by commands such as the identification query:
viPrintf (io, "*IDN?\n");

This does not cause a problem. Unless the viPrintf command avoids writing the newline character, I must assume the device does not have a problem recieving it. The important difference between viPrintf and viWrite is that viWrite can be forced to write more data than the string is meant to contain. In my case it was being asked to include the \0 character with certain queries.

My problem may also be solved by replacing the viWrite statement with
viPrintf (io, "*ESR?\n");

I have tested this and there are no problems.
0 Kudos
Message 11 of 11
(743 Views)