串行通信(RTS)和Windows 7 [英] Serial Communication (RTS) and Windows 7

查看:184
本文介绍了串行通信(RTS)和Windows 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Windows 7下的Delphi 2010 XE RAD Studio上开发Delphi应用程序。我的应用程序在串口上不停的说话。我正在使用AsyncPro for Delphi 2010.串行通信和我开发的计算机上的其他一切工作非常好,没有任何问题。但是,当我的应用程序的发行版本在另一台Windows 7系统上运行时,串行通信完全失败。我们探测到串行通信本身的答案,发现发送请求(RTS)行在发送所有字节后不会丢弃,而在我的开发计算机RTS线被正确丢弃。



即使我明确地将RTS行降低到低或者低的状态,RTS线也不会立即丢弃,但在15毫秒之后。因此,我的发行版本上的串行通讯失败。



我忘了关于Windows 7和串行通信问题的重要信息?



更新:我刚刚发现我的Aysncpro 5.0 for Delphi XE的错误。真奇怪。当我的Delphi XE IDE开放或运行时,我的程序正在进行无瑕疵的沟通。当我的程序运行时关闭或关闭我的Delphi XE IDE时,相同的程序不能很好地沟通或超时。



如果你有任何想法为什么会发生。



任何帮助将不胜感激。



谢谢,

解决方案

听起来像定时器解析问题我。我遇到同样的问题,尝试使用基于事件的定时器写入USB FTDI驱动程序,时间为$ code> timeSetEvent() ...当Delphi加载时,它将定时器分辨率更改为小于20ms,这使我的应用程序工作正常。当IDE没有运行时,我无法让工作在20ms +/- 5ms以下(默认的Windows分辨率我相信)。



要解决这个问题,我在线程中调用 timeBeginPeriod(1)来设置最小系统定时器分辨率。



我相信这会影响解决其他基于时间的事件,因为我使用 timeBeginPeriod()在我的应用程序中的其他(非多媒体定时器)等待事件的+/- 5ms精度更好因此,我建议的是,AsyncPro代码中的某个地方使用了一些基于时间的事件或回调...这将受到Delphi的更改的影响定时器分辨率加载时。尝试在应用程序启动时调用 timeBeginPeriod(1),看看是否有变化。



哦,并且不要忘了在您的应用关闭时调用 timeEndPeriod(1)



N @ p>

I am developing Delphi application on Delphi 2010 XE RAD Studio under Windows 7. My application talks on the serial port non-stop. I am using AsyncPro for Delphi 2010. Serial communication and everything else on the computer I develop with works great without any problem. However, when my release version of my application is run on another Windows 7 system, serial communication completely fails. We probed the serial communication itself for an answer and found out that Request to Send (RTS) line is not dropped right after sending all the bytes, whereas on my development computer RTS line is dropped correctly.

Even when I explicitly drop the RTS line to low or false state, RTS line doesn't drop right away but after good 15 milliseconds. Thus, serial communication on my release version is failing.

Am I missing important information about Windows 7 and serial communication issues?

UPDATE: I just found the bug with my Aysncpro 5.0 for Delphi XE. It is weird. When my Delphi XE IDE is open or running, my program is communicating flawlessly. When I shutdown or close my Delphi XE IDE while my program is running, the same program doesn't communicate very well or it times out.

Chime in if you have any idea why it is happening.

Any help will be appreciated.

Thank you,

解决方案

Sounds like a timer resolution problem to me. I had the same problem trying to write to a USB FTDI driver using an event based timer with timeSetEvent()... When Delphi loads, it changes the timer resolution to less than 20ms, which made my app work fine. When the IDE wasn't running I couldn't get things to work below 20ms +/- 5ms (the default Windows resolution I believe).

To fix the problem, I call timeBeginPeriod(1) in the thread to set the minimum system wide timer resolution.

I believe this affects the resolution of other time based events, because I get better than +/-5ms accuracy on other (non-multimedia timer) wait events in my app when I use timeBeginPeriod().

So, what I'm suggesting is that somewhere in the AsyncPro code it's using some time based event or call back... That would be affected by Delphi's change to the timer resolution when it is loaded. Try calling timeBeginPeriod(1) somewhere in your app when it starts and see if there is a change.

Oh, and don't forget to call timeEndPeriod(1) when your app shuts down.

N@

这篇关于串行通信(RTS)和Windows 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆