Click here to Skip to main content
15,888,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I have RS232 connection to a device and I used the SerialPort Wrapper in C#. I am able to establish connection and be able to access registers. What I need is to continuously monitor the connection and automatically indicate disconnect(button) in GUI whenever there is a reset on the hardware. The reset on the hardware doesnot affect the USB ports or voltage on the RS232 lines. The USB ports are all the time available. I implemented connection polling by reading a scratch register with a timer.

I am using IsOpen function and perform RS232 read to a register now and if I get the response, I proceed with the connection. Whenever the poll connection checkbox is selected, I start a timer and start the same above read continuously. Though this works, whenever i try to do a block read (starting from a particular address read 'n' datawords, just while the read starts the timer expires and i get disconnected. Also, this read value also gets added to my readblock values.

But I am not sure of the best way to implement the connection polling. I am not using the DataReceived Handler in my code, because I do read/write operations linear fashion. Please give a suggestion. Thanks,Venkat
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900