- 7
- 0
- 约2.64万字
- 约 39页
- 2017-08-26 发布于重庆
- 举报
基于软件平台下串口通讯设计与实现
摘 要
串行通信具有连接简单、使用灵活方便、数据传递可靠等优点,在工业监控、数据采集和实时控制系统中得到了广泛应用。通过基于线程和消息的多任务处理编程可以有效地解决串行通信实时性和可靠性都得不到保证的问题,且能提高数据传输的吞吐量和应用程序的可靠性。但由于Windows 对系统底层操作采取了屏蔽的策略,不允许用户对硬件I/O口进行直接操作,进行串行通信只能通过调用API函数来完成;同时Windows通过消息队列驱动管理程序,DOS中断服务例程在其下面也很难实现,且实时性和可靠性都得不到保证;通过基于线程和消息的多任务处理编程可以有效地解决这一问题,且能提高数据传输的吞吐量和应用程序的可靠性。
CSerialPort类是由Remon Spekreijse提供的免费串口类,CSerialPort类支持线连接(非MODEM)的串口编程操作,编写的程序能在windows环境下很好的运行。并且CSerialPort类能方便的利用windows API对其进行扩展和改进,不但可以方便的实现基本串行通信功能,而且可以随意进行功能扩展。
关键词:串行通信,串口通信参数,comm.jar,Eclipse,RS-232-CABSTRACT
Serial communication with the connection simple and easy to use, and reliable data transmission, in industrial control, data acquisition and real-time control system has been widely used. Threads and message-based multitasking program can effectively address the real-time serial communication and reliability are not guarantees, and can increase data transmission throughput and application reliability. However, the underlying operation of Windows on the system adopted a strategy of shielding does not allow the user to the hardware I / O port for direct action, to the serial communication can only call API function to perform; same Windows driver through message queue management procedures, DOS interrupt service routine is difficult to achieve in its following, and real-time and reliability are not ensured; threads and message-based multi-tasking programming can solve this problem, and can increase the throughput and data transfer application reliability.
CSerialPort class is provided free of charge by the Remon Spekreijse serial class, CSerialPort class support line connected (non-MODEM) in the serial programming operation, the procedures for the preparation of environment in windows good run. CSerialPort class and the use of windows API can easily be extended and improved, not only facilitate the realization of the basic serial communication function, but also free to extensions.
Keywords: Serialcommunication, serialcommunication parameters, comm.jar, Ecli
原创力文档

文档评论(0)