0

I have a similar question in the forum. Change baud rate in C# without closing connection . In that question i asked how to change the baud rate without closing the port. Someone suggested me to close and reopen the port but i already tried that before asking that question, it also didn't work. Closing and reopening the port is not important to me ( the third party software which is also talking with the same meter, was not closing the port when i monitor it so i asked that question thinking that it maybe a clue) important thing is changing baud rate of the device. I am waiting for help. Thank you for your time.. Ferda Ozdemir

Community
  • 1
  • 1
Ferda-Ozdemir-Sonmez
  • 674
  • 2
  • 13
  • 38
  • Can you give specifics about the device you are connecting to please? – dbasnett Aug 16 '11 at 12:21
  • Hi Dbasnett, I am connecting to a electronic electric meter. It starts with 300 Baud then it goes to 4800 Baud. There is another software for that device. I run that software and monitor the port. I see that it send ACK command to the meter to change the baud rate to 4800 and it continues to read. But in my software i send the same command to the meter and i can not communicate with it any more. – Ferda-Ozdemir-Sonmez Aug 16 '11 at 12:31
  • Have you tried just running your program at 4800? – dbasnett Aug 18 '11 at 10:43
  • Yes I tried it. In that way i couldn't get any response from meter. – Ferda-Ozdemir-Sonmez Aug 18 '11 at 11:05

1 Answers1

0

My serialport object was defined in my main form. I was sending to my reading function as a parameter. And do everything there like opening port, setting baud rate, writing data, closing port etc. But I was running this function in another thread. When i try to change baud rate i think there exists a delay or something so i can not change baudrate properly. Then i changed my code and now i can change the baud rate and go on with other things. Thank you for all your help.

Ferda-Ozdemir-Sonmez
  • 674
  • 2
  • 13
  • 38
  • You have to wait until the driver had a chance to empty the write buffer. At 300 baud that takes a while, it only writes 30 bytes per second. – Hans Passant Oct 14 '11 at 12:44