Change baud rate in C# without closing connection

喜欢而已 提交于 2019-12-02 00:47:44

In my experience baud rate switches require closing and reopening the serial port hardware: I would suggest trying that. Send the baud rate switch command then close the port, set the baud rate and then re-open the port. Opening/closing the port should be transparent to the device on the other side (unless you are using the CTS/RTS/DTR/DSR lines).

SeemaSR

To change baud rate of a device, follow these steps. eg: To Start communication with a baud rate of 1200.

  1. Send data command for changing the baud rate to 1200.
  2. Receive the acknowledgement from the device.
  3. If the ACK is proper, set the Port.BaudRate=1200.

Next you want to change the baud rate to 4800, then follow these steps

  1. Send data command for changing the baud rate to 4800.
  2. Receive the acknowledgement from the device.
  3. If the ACK is proper, set the Port.BaudRate=4800.

NOTE: Change the Port.BaudRate after receving the ACK from the controller device. The communciation will be started with the previously set BaudRate.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!