The design of the whole communication system mainly includes the design of the level conversion interface circuit, the writing of the asynchronous serial communication program of the single chip computer, and the development of the serial communication interface of the upper computer. The overall realization of the system is that the communication data between PC and MCU must be transformed by level conversion circuit before they can reach each other correctly. That is to say, level conversion circuit plays a bridge role in the whole system. For circuit design, the level conversion circuit in the system is constructed by separate components. MCU communicates with PC by means of interruption, which is enabled by setting the interruption control bit of UART interruption control register. The upper computer program is developed in Visual Basic 6.0 (VB) environment. This system uses the powerful communication control provided by VB. The control system has perfect functions of sending and receiving serial data, and can set the state of serial port and the information format and protocol of serial communication.
【技术实现步骤摘要】
一种实现上位机和单片机准确串行通信的系统所属
本专利技术涉及工厂单片机控制系统与上位机进行数据交换的通信系统,采用异步串行通信方式能实现准确交换数据的目的。
技术介绍
目前计算机系统的广泛应用以及网络的飞速发展,各种控制设备间的通信功能显得越来越重要。随着微电子技术的不断发展,单片机已逐渐成为一种智能型、综合型控制器,用它来进行数据采集、存储及实时控制。工程实际中,一般还要实现单片机与上位机的串行通信,使上位机能对现场数据进行汇集、整理和分析。对于单片机和上位机之间的通信,单片机提供了一个通信端口ULRT,该接口采用异步串行传输模式。上位机主板一般具有COM异步串行通信端口,采用RS-232标准设计,因此单片机系统与上位机的通信可以借助这两个端口来实现,使用三线制(收、发、地)进行数据传递。
技术实现思路
本专利技术提供一种单片机和上位机之间的串行通信系统设计,对实现计算机网络间的通信具有重要意义。本专利技术解决其技术问题所采用的技术方案是:整个通信系统的设计主要包括电平转换接口电路设计,单片机异步串行通信程序编写,以及上位机串口通信界面开发等。系统的总体实现是上位机(PC)和单片机的通信数据都要经过电平转换电路进行变换后才能正确到达对方,也就是说电平转换电路在整个系统中起到了桥梁作用。对于电路设计,单片机SPCE061A通用异步串行口模块(UART)提供了一个全双工标准接口,其接收引脚RX和发送引脚TX分别与IOB7和IOB10共用,借助于IOB口的特殊功能和UARTIRQ中断实现SPCE061A与外设的串行通信。鉴于SPCE061A单片机的串口采用TTL电 ...
【技术保护点】
1.一种实现上位机和单片机准确串行通信的系统,采用异步串行通信方式能实现准确交换数据的目的。
【技术特征摘要】
1.一种实现上位机和单片机准确串行通信的系统,采用异步串行通信方式能实现准确交换数据的目的。2.根据权利要求1所述一种实现上位机和单片机准确串行通信的系统,其特征在于,所述的通信系统的设计主要包括电平转换接口电路设计,单片机异步串行通信程序编写,以及上位机串口通信界面开发等。3.根据权利要求1所述的单片机采用中断的方式与PC通信,通过设置UART中断控制寄存器的中断控制位...
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。