我对以下链接有类似的问题.如何在不关闭连接的情况下更改波特率?.但我使用 C# 而不是 java.我从波特率 300 开始.然后握手后我必须将波特率更改为 4800.我向设备发送命令来执行此操作.我改变了我的串口的波特率.之后,我永远无法继续与设备通信.(如果我保持在 300 波特并以 300 波特向设备发送命令,我可以继续通信)
I have a similar problem to the following link. How to change baud rate without closing the connection?. But i use C# in stead of java. I am beginning with baud rate 300. Then after a hand shake i have to change my baud rate to 4800. I send a command to the device to do this. And I change my serialport's baud rate. After that i can never continue the communication with the device. (If i stay in 300 baud and send command to the device for 300 baud i can continue the communication)
我有一个第三方软件也可以从这个设备读取数据.当该软件运行时,我正在监听端口.它发送与我发送到设备相同的命令.它向设备发送设置 4800 波特的命令,并可以从设备中获得答案.它不会在波特率更改期间关闭或重新打开端口.我必须做同样的事情.但是,当我发送命令更改为 4800 波特时,我从来没有得到设备的答复.
I have a third party software which also reads from this device. I am listening the port when that software is running. It sends the same commands that i am sending to the device. It sends command to set 4800 baud to the device and can get the answer from the device. It does not close or reopen the port during baud change. I have to do the same thing. But when i send command to change to 4800 baud i get no answer from the device ever.
我在等你的答案.谢谢,费尔达
I am waiting for your answers. Thank you, FERDA
这是串口监控程序的输出进程ReadY.vshost.exe"打开的端口(PID:2608)
This is the output from serial port monitoring program Port opened by process "ReadY.vshost.exe" (PID: 2608)
01 42 30 03 71 .B0.q
01 42 30 03 71 .B0.q
答案:09.08.2011 10:55:40.81864(+0.2656 秒)
Answer: 09.08.2011 10:55:40.81864 (+0.2656 seconds)
06.
请求:09.08.2011 10:55:41.06864(+1.2500 秒)
Request: 09.08.2011 10:55:41.06864 (+1.2500 seconds)
2F 3F 31 31 39 39 39 30 30 34 21 0D 0A/?11999004!..
2F 3F 31 31 39 39 39 30 30 34 21 0D 0A /?11999004!..
答案:09.08.2011 10:55:41.58464(+0.5156 秒)
Answer: 09.08.2011 10:55:41.58464 (+0.5156 seconds)
2F 53 54 52 34 5F 42 53 4D 31 33 31 0D 0A/STR4_BSM131..
2F 53 54 52 34 5F 42 53 4D 31 33 31 0D 0A /STR4_BSM131..
请求:09.08.2011 10:55:42.31864(+0.2969 秒)
Request: 09.08.2011 10:55:42.31864 (+0.2969 seconds)
06 30 34 31 0D 0A .041..
06 30 34 31 0D 0A .041..
根据我的经验,波特率开关需要关闭和重新打开串行端口硬件:我建议尝试一下.发送波特率切换命令然后关闭端口,设置波特率然后重新打开端口.打开/关闭端口应该对另一侧的设备是透明的(除非您使用 CTS/RTS/DTR/DSR 线路).
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).
这篇关于在不关闭连接的情况下更改 C# 中的波特率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!