开发者

what is the easiest way to read and process serial data for windows 32-bit systems?

hello and good day to you guys. I am running Windows XP which I am given to understand is a 32 bit windows system.

I have a microcontroller that continuously sends dat开发者_如何学JAVAa serially through a COM port. I want to process data in a C program. The options I'm looking at so far are:

  1. get serial data via python and pass to C
  2. read data serially and use in C

The first option seems too hard for me. I was trying to use swig and am stuck. any other suggestions?


You'll find it much easier just to receive the data straight via C, if you're going to process it there in the end anyway. Here's a quick overview of how to set things up. Essentially you call CreateFile on, eg, "COM1", then use GetCommState and SetCommState on the resulting handle to configure the port. If you need to do GUI interaction as well, have the reading code run on a different thread, and communicate the data it reads back to the GUI thread by posting custom (WM_USER, etc) messages to one of your windows.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜