简体   繁体   English

快速异步串行通讯

[英]Fast asynchronous serial communication

I have a controller design application where i get data from 3 USB devices (seen as virtual com port under windows), process it, and then send the action to a 4th USB device (also virtual com port). 我有一个控制器设计应用程序,在其中我从3个USB设备(在Windows下称为虚拟com端口)获取数据,进行处理,然后将动作发送到第4个USB设备(也为虚拟com端口)。 I need to process that data once i recieve it with a minimum latency. 一旦我以最小的延迟接收到数据,我就需要对其进行处理。 I decided to use C++ on windows embedded and do the serial communication using the .Net System::IO::Ports and DataReceived event. 我决定在嵌入式Windows上使用C ++,并使用.Net System :: IO :: Ports和DataReceived事件进行串行通信。 I tested my code performance using only one USB device where USB device sends one byte to the computer and then the computer sends it back. 我仅使用一个USB设备测试了代码性能,其中USB设备将一个字节发送到计算机,然后计算机将其发送回。 I measure the time difference and it was totally indeterministic. 我测量时差,这完全不确定。 Sometimes 2 ms and sometime 20 ms. 有时2毫秒,有时20毫秒。 Note: the process priority is set to be realtime. 注意:进程优先级设置为实时。

Is it a better way to get a deterministic latency where a max delay is guaranteed? 在确定最大延迟的情况下,获得确定性延迟的更好方法吗? may be another API suitable for realtime serial communication on windows embedded? 可能是另一个适用于嵌入式Windows上的实时串行通信的API?

Thanks in advance 提前致谢

In Windows, you cannot get a deterministic latency delay. 在Windows中,您无法获得确定性的延迟。 You cannot have any guarantee. 您无法保证。 Because it is not a real-time OS. 因为它不是实时操作系统。

If you want some guarantee that are mandatory for your project, you can either deport the real-time part into a smaller device like Arduino (open-source, some users made a Real Time OS with it ) or a Beck chip (commercial, delivered with a Real Time miniOS ); 如果您需要对项目强制执行的保证,则可以将实时部件驱逐到较小的设备中,例如Arduino (开源, 某些用户使用其制作了实时操作系统 )或Beck芯片 (商用,已交付)。带有实时miniOS ); or you can install a RealTime Linux , which brings in some guaranteed delay. 或者您可以安装RealTime Linux ,这会带来一定的保证延迟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM