English 中文(简体)
同步序列通信读物
原标题:Asynchronous serial communication thread options
  • 时间:2012-01-11 11:45:55
  •  标签:
  • c#

我与我希望定期监测的频率为1至1/10 Hz(尚未决定)的装置有序列链接。

我希望来文不要锁定,因此,我决定把来文放在某种意义上的边缘,让主要申请通过从深线发射的事件获得数据。

I was thinking about making a thread at application start that sends and receives data continuously. The thread empties a queue containing commands to send to the device, and then listen for response firing an event when a response is complete. The thread is put to sleep when no commands are in the queue, and woken when commands enter the queue.

Is this a good way of doing it? I was thinking about maybe using some of established features of the framework, like BackgroundWorker or Task, since these might have advantages over what I m doing. Maybe there are other and better ways of accomplishing this?

最佳回答

这很常见,不足以证明像透镜那样燃烧昂贵的资源是合理的。 使用系统:时间仪或系统。 相反,时间(优等)。 在警示中撰写设备查询指令。 使用Serial Port。 收到回复和焚烧事件的数据。 现在,所有东西都在廉价的pool子上。

问题回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签