【正文】
指導(dǎo)教師 胡建東 1 摘 要 隨著計(jì)算機(jī)技術(shù)尤其是單片微型機(jī)技術(shù)的發(fā)展,單片機(jī)被廣泛應(yīng)用在工業(yè)控制系統(tǒng)中 。 單片機(jī)具有 體積小、價(jià)格低廉、開發(fā)應(yīng)用方便、 可應(yīng)用于惡劣工業(yè)環(huán)境的特點(diǎn),在分布式控制系統(tǒng)中多采用單片機(jī)進(jìn)行數(shù)據(jù)采集和現(xiàn)場(chǎng)控制 。 因此如何實(shí)現(xiàn) PC 機(jī)與單片機(jī)之間的通信具有重要的現(xiàn)實(shí)意義。 在硬件設(shè) 計(jì)中,單片機(jī)系統(tǒng)與 PC 機(jī)系統(tǒng)通過 RS232 串行通信端口進(jìn)行互連,單片機(jī)系統(tǒng)將由 PC 機(jī)傳輸過來的數(shù)據(jù)信息動(dòng)態(tài)的顯示在 LED 數(shù)碼管上。 關(guān)鍵 詞 : 單片機(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。 。 LED 3 目 錄 1 引言 ................................................................................................................................... 1 單片機(jī)與 PC 機(jī)串行通信研究背景 ............................................................................. 1 單片機(jī)與 PC 機(jī)串行通信研究目的和意義 ................................................................. 1 論文研究?jī)?nèi)容 ................................................................................................................ 1 2 串口通信基礎(chǔ)理論 ........................................................................................................... 2 兩種常用接口方式 ........................................................................................................ 2 并行接口 ..................................................................................................................... 2 串行接口 ..................................................................................................................... 2 RS232 串行接口標(biāo)準(zhǔn) .................................................................................................... 2 MSComm 控件 ................................................................................................................ 3 MSComm 控件處理通信的方式 ................................................................................. 3 MSComm 控件的主要屬性 ......................................................................................... 4 3 系統(tǒng)總體設(shè)計(jì) ................................................................................................................... 5 系統(tǒng)指標(biāo)設(shè)計(jì) ................................................................................................................ 5 通信協(xié)議設(shè) ? ............................................................................................................... 5 系統(tǒng)功能設(shè)計(jì) ............................................................................................................. 5 總體方案設(shè)計(jì) ................................................................................................................ 5 4 硬件 jiekoudianlu 設(shè)計(jì) ..................................................................................................... 6 主要芯片 ........................................................................................................................ 6 AT89C51 簡(jiǎn)介 .............................................................................................................. 6 單電源轉(zhuǎn)換芯片 MAX232 ......................................................................................... 8 74LS245LED 驅(qū)動(dòng)芯片 ............................................................................................... 8 LED 顯示器 .................................................................................................................... 9 LED 顯示器工作原理 ................................................................................................. 9 LED 顯示器接口 ......................................................................................................... 9 系統(tǒng)設(shè)計(jì) ...................................................................................................................... 10 5 軟件設(shè)計(jì) ......................................................................................................................... 11 PC 機(jī)程序設(shè)計(jì) ............................................................................................................. 11 應(yīng)用界面設(shè)計(jì)流程 ................................................................................................... 11 4 代碼實(shí)現(xiàn) ................................................................................................................... 13 單片機(jī)軟件設(shè)計(jì) .......................................................................................................... 13 6 仿真調(diào)試及結(jié)果分析 .............