【正文】
撰寫日期: 2020 年 5 月 17 日 河南農(nóng)業(yè)大學 本科生畢業(yè)論文(設計) 題 目 單片機與 PC機串行通信系統(tǒng)設計 學 院 機電工程學院 專業(yè)班級 電子信息工程 07 級 3 班 學生姓名 王衛(wèi)亮、高嵐 指導教師 胡建東 1 摘 要 隨著計算機技術尤其是單片微型機技術的發(fā)展,單片機被廣泛應用在工業(yè)控制系統(tǒng)中 。 單片機具有 體積小、價格低廉、開發(fā)應用方便、 可應用于惡劣工業(yè)環(huán)境的特點,在分布式控制系統(tǒng)中多采用單片機進行數(shù)據(jù)采集和現(xiàn)場控制 。由于單片機的計算能力有限,難以進行復雜的數(shù)據(jù)處理,因此在功能 復雜的控制系統(tǒng)中常采上位機下位機系統(tǒng) ,單片機用作下位機進行數(shù)據(jù)采集和設備控制,而 PC 機用做上位機進行復雜的數(shù)據(jù)處理和對單片機的控制。 因此如何實現(xiàn) PC 機與單片機之間的通信具有重要的現(xiàn)實意義。 論文 詳細介紹 了單片機與 PC 機 通信的軟硬件實現(xiàn)。 在硬件設 計中,單片機系統(tǒng)與 PC 機系統(tǒng)通過 RS232 串行通信端口進行互連,單片機系統(tǒng)將由 PC 機傳輸過來的數(shù)據(jù)信息動態(tài)的顯示在 LED 數(shù)碼管上。在軟件設計中, 采用 Visual Basic 中的MSComm 通信控件 設計 PC 上的串口通信程序, 在單片機編程上采用接近硬件系統(tǒng)的匯編語言編寫通信程序及數(shù)據(jù)處理程序。 關鍵 詞 : 單片機 ; 串行通信 ; ; RS485; LED 數(shù)碼管 2 Design of a serial Communication system between MCU and personal puter Abstract Along with the development of puter, especially the technology of MCU, MCU are widely used in the system of industry control. Small size, low price, the convenience of development and application and high adaptability are its peculiarities, respectiviely. It is usually used in distributed system to collect data and control on the scene. Owing to the limit of calculation, it is difficult to process plex data. Therefore, PC lower level puter system is often applied in functionally plex system. MCU collects data and control equipments as Downside machine, while PC makes plex data processing and the control of MCU. SO how to realize the munication between PC and MCU is practically meaningful. The essay introduces the munication between PC and MCU realized by soft and hard ware in details. IN design of hardware, MCU is connected with PC by the serial port of RS232 and display the data passed by PC on the LED dynamically. In design of software, program of serial port are designed by MSComm munication control in the language of Visual Basic , on the other hand, the program of munication and data processing are programmed by the language of assembly, which is more close to the hard system used by the MCU. Key Words: MCU。 Serial Communication。 。 RS485。 LED 3 目 錄 1 引言 ................................................................................................................................... 1 單片機與 PC 機串行通信研究背景 ............................................................................. 1 單片機與 PC 機串行通信研究目的和意義 ................................................................. 1 論文研究內容 ................................................................................................................ 1 2 串口通信基礎理論 ........................................................................................................... 2 兩種常用接口方式 ........................................................................................................ 2 并行接口 ..................................................................................................................... 2 串行接口 ..................................................................................................................... 2 RS232 串行接口標準 .................................................................................................... 2 MSComm 控件 ................................................................................................................ 3 MSComm 控件處理通信的方式 ................................................................................. 3 MSComm 控件的主要屬性 ......................................................................................... 4 3 系統(tǒng)總體設計 ................................................................................................................... 5 系統(tǒng)指標設計 ................................................................................................................ 5 通信協(xié)議設 ? ............................................................................................................... 5 系統(tǒng)功能設計 ............................................................................................................. 5 總體方案設計 ................................................................................................................ 5 4 硬件 jiekoudianlu 設計 ..................................................................................................... 6 主要芯片 ........................................................................................................................ 6 AT89C51 簡介 .............................................................................................................. 6 單電源轉換芯片 MAX232 ......................................................................................... 8 74LS245LED 驅動芯片 ............................................................................................... 8 LED 顯示器 .................................................................................................................... 9 LED 顯示器工作原理 ................................................................................................. 9 LED 顯示器接口 ......................................................................................................... 9 系統(tǒng)設計 ...................................................................................................................... 10 5 軟件設計 ......................................................................................................................... 1