Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about the basic of RS-232

Dear all,

Recently, I have worked RS-232 communication with a commercial instrument from Inficon.
During the work, I have several problems which had resoved but didn't understood the solution.

1. In reading a responsed data, I got to know the very correct size of data byte should be written in VISA Read function.
If the byte was less than the correct value, there is a flow of data stream.
(In this case, I thought there remained some unread data in the commnuication.)
In the case of writting a higher value, the response time was very slow (about 1 sec. delay for the next command).
Why the response time was so slow even if the correct data could be read?

2. In my instrument, the termination character is , ascii code #6, Positive Acknowledgement.
But, as you may know well, the character could be changed, like \r or \r\n, depending on a instrument.
Is there some universal termination character which could be used in every insturment?

3. In writing RS-232 program, could you explain me when I can use other speicial characters, like :#2, :#21, or :#10.

Thank you in advance.

Lee
0 Kudos
Message 1 of 2
(2,826 Views)
I always use VISA Bytes at Serial Port to determine exactly how many bytes are available. Using a fixedcount, you run the risk of not reading the entire buffer and missing data, or requesting too many bytes and if that number is not there, you will get a VISA timeout if you don't have a termination character. There are a couple of approaches with using VISA Bytes at Serial Port. One is to do a write, a wait for the instrument to respond, VISA Bytes at Serial Port, and then a read. The other way to is to do a write, wait until VISA Bytes is greater than 0, read until VISA Bytes is zero. Both of these approaches will work if the instrument doesn't send a termination character or if you want to read the term character. If you have a term character, then setting the number of bytes to read to some high number should work. The VISA read will terminate whenever the term character is read.

Unfortunately, there is no standard for RS-232 communication. The standard only defines the hardware - signaling levels and handshaking.
Message 2 of 2
(2,817 Views)