By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

SerialPort Control in VC# Express 2005

P: n/a
Hello,

I have a problem with the SerialPort Control under VC# Express 2005.
In my application I have to read data from an external device through RS 232.
The process is built on a software-based handshaking which depends on the
device.

The process has been implemented by me and works but unfortunately only the
first time.
All data are donwloaded successfully as required.
The process is simple serialPort11.Open(), Handshaking, Data Download,
Handshaking, serialPort1.Close().

The problem occurs with the second run, when the same procedure is executed
again (using a button_onclick event), then the Port is opened again with
serialPort1.Open() and with the first serialPort1.readByte() a TimeOut Error
occurs.
Even if the Timeout is set to 10sec it does not help.

If the application is restarted and the process is again executed, then the
data are read perfectly from the device. Hence it does not depend on the
state of the external device, but on the PC (Soft and/or Hardware).

I have the feeling, that closing the SerialPort with serialPort1.Close()
does not free all resources and possibly the hardware RS232 is not fully
reset.

Has anyone had a similar problem and found a solution for it?
Can you rely on serialPort1.Close()? Are all resources freed?

I hope someone can help

Thanks a lot in advance
Best regards,

Carsten

Jul 18 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.