[英]Com ports get stuck or stop sending serial communication after working for 7-8 hours
I am working on a project for sending hex data continuously to serial com ports from my computer and then from com ports to LEDs (RGB lights) through RS232 USB cable. 我正在进行一个项目,该工作是将十六进制数据从计算机连续发送到串行com端口,然后再通过RS232 USB电缆从com端口发送到LED(RGB灯)。 Sometimes it works for 10 -15 hours and alternate days it gets stopped sending data to ports.
有时它会工作10 -15个小时,隔几天就会停止向端口发送数据。
I am using DMX 512 controller, RS232 USB cable with FTDI driver and c# language for coding to send data with SerialPort class. 我正在使用DMX 512控制器,带有FTDI驱动程序的RS232 USB电缆和c#语言进行编码,以使用SerialPort类发送数据。
Here is my code: 这是我的代码:
public static GO ()
{
try
{
dmx = new Dmx(2, 0);
Thread mTh1 = new Thread(() => dmx.Start(RGBdata1, RGBdata2, RGBdata3));
Global.tmrStarted = true; // test it,ok
mTh1.Start();
}
}
This is my start method where I send data to 3 ports 这是我将数据发送到3个端口的启动方法
while (Global.tmrStarted)
{
Break();
Thread.Sleep(500);
if (m_port == null || m_port.IsOpen == false) return;
m_port.Write(new byte[] { 0 }, 0, 1);
SendData();
Break1();
if (m_port1 == null || m_port1.IsOpen == false) return;
m_port1.Write(new byte[] { 0 }, 0, 1);
SendData1();
Break2();
if (m_port4 == null || m_port4.IsOpen == false) return;
m_port4.Write(new byte[] { 0 }, 0, 1);
SendData2();
Thread.Sleep(100);
}
When it gets stopped i try to send data through click on start button but data doesn't gets sent through those com ports till i don't remove my USB cable and plug in again which works after that. 当它停止时,我尝试通过单击“开始”按钮发送数据,但是直到我不拔掉USB电缆并再次插入后,这些数据才通过那些com端口发送。
Can anyone suggest me what's real problem with communication ports.Did they get disable by sending continuously data to them .Thanks in advance 任何人都可以建议我通信端口的真正问题。通过连续向其发送数据来禁用它们吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.