03-18-2010 10:48 AM
Hi all,
I want to understand how the time out error works in VISA. I am doing a simple serial communication using VISA. If you read/write, and you have a time out error, what triggers the time out error? Is there a flag of some sort that VISA is polling?
Yik
03-18-2010 11:11 AM
The majority of timeout errors with serial, occurs during a read. You specify x number of bytes to be read. The read will terminate when that number of bytes have been read, when the termination character is detected, or when the timeout is reached. The detection of a term character is the default setting and the default term character is a LF. If term character detection is off, the read will wait until the number of bytes have been read or the timeout is reached. The timer starts when the Read is first started. So, you could get a timeout if there is nothing in the serial recieve buffer (instrument has sent nothing), there are fewer bytes in the buffer but no termination character (or different than what is expected), or simply fewer bytes in the buffer.
Serial timeout errors can also occur when you use handshaking. These can happen on a read when the instrument on the other end does not assert the handshake lines.
03-18-2010 11:39 AM
Number of byte required is not read: the number of byte required is set by the VISA read, correct?
Termination character is not detected: I am looking at the driver manual. It doesn't say that it use a termination. Can I assume that it does?
If termination character is not used, I need to be exact with how many byte I need to read with VISA read, right?
Yik
03-18-2010 11:51 AM
The number of bytes to read is passed to the VISA Read. It is something you need to specify.
It's not often safe to assume anything. Some manuals are pretty bad and you can attach it here if you like. I also recomend testing all serial coms with Hyperterminal before writing any code. If the instrument is sending a termination character, you can often see it there (i.e. the cursor moves to a new line).
Yes, if there is no termination character, then you have to be exact. That is what the VISA Bytes at Serial Port is for.
03-18-2010 11:53 AM
Here is the driver manual. Please point out anything about the comm. Thanks!
Yik
03-18-2010 11:59 AM
03-18-2010 11:59 AM
Using the hyperterminal to test out the device sounds pretty cool. I tried to do that, but not sure what to do. After I connected to the device through hyperterminal, what do I type? It seems like whatever I type are just weird symbols.
Yik
03-18-2010 12:16 PM
After looking at the manual, you probably won't be able to use Hyperterminal. Hyperterminal uses ASCII and you need to send hex data. There are other terminal emulators available that will work but not sure whether it would be worth it to purchase something else.
03-18-2010 04:58 PM
Would MAX works? I tried it, and it seems like it is communication, but I am not getting the correct response. For a particular command, I am supposed to be reading back 51 byte, but it just gives me 8 byte that doesn't make sense.
Yik