Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

serial port error

I'm having trouble communicating with the serial port. I'm trying to talk to flow control valves that send out their current flow rate every 0.5 seconds. I'm communicating with 6 of them using a USB -> serial port converter.

I have a routine that mostly sort of works as expected. When I test it, I can request the valves reply with their configuration and they do. I can then read the buffer at the port and get the data I need.

However, when I put this into practice, about 5% of the time I get an error (usually -1703807339 Timeout expired before operation complete). Once any valve has an error, it generally stays in error mode until I re-start the program.

I have tried a routine that closes the serial port, then uses "VISA configure serial port" to reset the connection... this is sometimes successful, but not always.

The upshot is that the program works for a couple of hours, but eventually isn't getting data from the valves.

I'd greatly appreciate any suggestions. I've attached the main routine and the two subroutines that actually talk to the valves.

cheers,
mike
0 Kudos
Message 1 of 2
(3,152 Views)
Hello Mooseo,

A timeout error occurs, for example, when a read operation does not complete before the specified timeout period. The read operation can fail to complete for the following reasons:


1. you did not receive the termination character you expected, nor the specified number of bytes to read in the timeout period specified. You may try increasing the timeout period, changing the termination character to one being used by the "sender" or decreasing the number of bytes you specify for your read operation

2. you are communicating at a sufficiently high baud rate without using termination and/or over a sufficiently long distance and/or in a sufficiently noisy environment that the actual frames which are being sent are not being received correctly. You may try using so-called "proper" termination and/or biasing on the network (see link below), decreasing the baud rate (at both ends since it must match for both communicating ports), decreasing the distance you are connecting over (unless this is very long, this is likely NOT the issue).
Link


Since it seems that you do not care about receiving this error, you could try using the clear error.vi. This should fix the error problem and allow your system to run without the hiccup you are experiencing.
Thanks again and have a great day!
Regards,

Nicholas K
National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(3,115 Views)