摘要
设计了一种在MFC中实现与串口连续通信的简易方法,利用微软提供的MSComm控件,仿照MODBUSRTU协议,并根据数据包之间的时间间隔T,将间隔<T的数据作为一个数据包,在定时器中进行数据处理。通过调试发现,计算机的CPU速度越快,数据包越小,数据处理函数则越简单,而时间间隔T可设的值也越小,数据包连续串口通信的效果也就越好。
This paper designs a simple method for continuous packets transmission in serial port communication in MFC. This method applies MSComm control provided by Microsoft, models on MODBUS-RTU protocol, takes data whose time interval is less than T as a packet data, and processes the data in the timer. Debugging shows that the faster the CPU of computer, the smaller packets and the simpler data processing function are, and the smaller value of time interval can be set. This means the result of continuous packets transmission in serial port communica- tion will be better.
出处
《电子科技》
2014年第2期99-100,共2页
Electronic Science and Technology