Hello, I'm working on an application that requires constant reading and writing through the Serial Port, and the application needs to be running continuously. The issue that I come across is that the port get 'stuck' at random times. Sometimes it can run for minutes to 12 hours before the port freeze up. I am wondering if anyone has experience with this and have advise for this situation.
Possibly related to: 1) Best coding practice for this set up / handshaking 2) Time delays between reads functions or write functions or read/write 3) Asynchronous vs Synchronous settings for the VISA modes 4) Re-initializing port periodically? 5) Any other suggestions Thanks, Tim. I'm not sure I've ever seen a port freeze on my dev computer but I know I've heard of freezes in the field. I tell them to call IT. The only timing issue I've had is with flush and what happened was that flush was clearing data from a prior visa write.
Are you using NI serial ports? I'm guessing that's going to be more reliable or at least give you a better outlet for troubleshooting. I open the port at the beginning and close at the end. That's never been a problem. I use both sync and async read/writes.
Serial port C# wpf received data continuous Mar 18 2012 8:36 AM 've made a GUI in WPF to read data via RS232 and.The only problem is I have to keep pressing a button to send a 'Receive data' command to my controller via RS232 so it sends the data back.

Edited October 8, 2015 by infinitenothing. The issue that I come across is that the port get 'stuck' at random times. Sometimes it can run for minutes to 12 hours before the port freeze up. What exactly do you mean by getting stuck/freeze? Do you have any error message you could post?
Also, check if there is any other application or service running that could access the serial port. The MS printing service for example screwed me over a couple of times. Experience might also change depending on your serial device (USB to serial converter, on board controller or PCI(e) cards). Thanks for the replies! This application has been running for the last 18 hours now without issue, so it is confusing.
Currently I am using a 'cheap' USB to RS232 converter for development. I wonder if that has to do with the port getting stuck like a comment mentioned above. Does anyone have a recommendation on a reliable USB to RS232 converter? To answer a comment above, what I meant by the port freeze/stuck is that it will not respond anymore.
It doesn't seem to be timing out since I'm not seeing lags in the program. When write commands are sent nothing seems to be processing, and I won't be getting a feedback either.
When I exit the application, it will process through a VISA Clear and VISA Close vi, and they both error out. I will have to unplug the USB adapter and re-plug it in to get the port to reset.

Also does anyone know of a program that can monitor a serial port and possibly diagnose when the port gets stuck? Is this cheap USB also plugged into some kind of hub? I can't remember the details but I know I had some kind of issue where trying a different USB configuration helped on a few small setups using a laptop where we didn't have many options like adding a PCI RS-232 card. As for programs there are several on the net that basically monitor, and log data seen on a COM port. I haven't personally, but looking at the screenshot it looks similar to others. This is usually a higher level debug tool, just looking at the messages going back and forth, and probably won't tell you anything about a driver crap out situation.
Currently I am using a 'cheap' USB to RS232 converter for development. I wonder if that has to do with the port getting stuck like a comment mentioned above. Does anyone have a recommendation on a reliable USB to RS232 converter? RS232 is a very old standard, so even the cheapest devices are quite reliable. For long-term acquisitions however USB is a bad coice.
Rather go for on-board or PCI(e). If you really have to go with USB, try one of the NI interfaces. They are well made but quite expensive: In your case however I doubt any of the USB devices will solve the issue. To answer a comment above, what I meant by the port freeze/stuck is that it will not respond anymore. It doesn't seem to be timing out since I'm not seeing lags in the program. When write commands are sent nothing seems to be processing, and I won't be getting a feedback either. When I exit the application, it will process through a VISA Clear and VISA Close vi, and they both error out.