问题描述
大家好,我有一个GUI,经常通过串口与电机编码器对话。
有些情况下我必须手动杀死电机,但这也导致串口停止响应。
当发生这种情况时,我的GUI会挂在这一行上,整个表格都会冻结。
Hi guys I have a GUI that constantly talks to a motor encoder thru serial port.
There are cases where I have to manually kill the motor from running, but this also cause the serial port to stop responding.
And when this happens my GUI would hang on this line and the whole form would freeze.
strRead1 +=seriPort1.ReadLine()
就在这一行之前我用它来检查串口状态
Right before this line I use this to check serial port status
If seriportMotor.IsOpen = True Then
但显然它没有完成它的工作。
我想知道是否有串行端口类的某些功能或可以在尝试从串口读取并导致表单挂起之前检查状态的东西?
谢谢。
but obviously it doesn''t do its job.
I''m wondering whether there''s some feature of serialport class or something that can check the status before it tries to read from serial port and cause the form to hang??
Thank you.
推荐答案
这篇关于如何实时检测串口冻结? “如果seriportMotor.IsOpen”不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!