摘要
基于工厂单片机控制系统与上位机进行数据交换,设计一个采用异步串行通信方式的通信系统。文中给出了上位机RS-232接口和单片机TTL逻辑电平分析,利用三极管设计了一个简单实用的RS-232转TTL电平电路,并对该电路原理作了详细讨论。单片机程序用C语言编写,上位机程序采用Visual Basic 6.0开发。实验证明该系统可以很好地实现上位机和单片机之间的串行通信,并达到准确交换数据的目的。
A serial communication system is designed,because the MCU control system in factory needs exchange data with PC.It uses the approach of asynchronous serial communication.In the paper,the RS-232 interface and the TTL logical electrical level are discussed,and then the circuit that realizes the logical electrical level conversion between RS-232 and TTL is designed by using dynatron.At the same time,the principle of the circuit is discussed in detail.The C language is used in the single chip computer,while the Visual Basic 6.0 is adopted on PC.The experiment results indicate that the system could run successfully and the data could be exchanged correctly.
出处
《仪表技术》
2010年第7期45-47,共3页
Instrumentation Technology
关键词
上位机
单片机
异步串行口
三极管
通信
PC
single-chip microcomputer
UART
dynatron
communication