【正文】
r masterslave multimachine munication system. This paper focuses on a number of single chip multimachine munication affirmative, so that the MCU has the same permissions. The paper machine from the multilevel munication protocol of the right to start with, first, the specific munication protocol. Host Communication button control, the practical application of simulation in the trigger signal input. For the No. 1 microcontroller, but also through the LCD display working status, the initial for the host. No other single chip set in the case of the host, the multimachine munication system can be used as masterslave multimachine munication system. Communication mode from the machine through the serial port interrupt triggering, munication before the end of the recovery from the machine state. Communication process, the host sends the address number from the machine until the response from the plane after munications. After munication, the host sends its own host number, informed from the machines. And then distributed to the host from the machine check bytes of data, the host test error, test and proved correct response, 1 single chip LCD displays, 2 and 3, after the MCU will send and receive data correct LED light is on. Besides, this paper, bidirectional switch implementation of the interface methods. Through the use of microputer control of a microcontroller pin serial port connection, to work in master mode or slave mode. This study has been simulated by the real feasible. Have some error detection capability, the bit rate of serial munication 9600bit / s, munication speed, and reliability. In this study, the hardware circuit through the munication process to resolve the contention over the host microcontroller over the issue. Key words: : SCM; Multimachine munication; Equal rights; AT89S52鹽城工學(xué)院本科生畢業(yè)設(shè)計(jì)說明書 ( 2021) III 目錄 1 緒論 ..................................................................... 1 論文研究的背景與意義 .................................................... 1 單片機(jī)多機(jī)通信領(lǐng)域的歷史及 國內(nèi)外發(fā)展現(xiàn)狀 ................................ 1 本論文的研究內(nèi)容 ....................................................... 2 2 單片機(jī)多機(jī)通信理論及方案選擇 .............................................. 3 單片機(jī)串口通信 ......................................................... 3 單片機(jī)多機(jī)通信方案選擇 .................................................. 5 微處理器的選擇 ......................................................... 5 液晶 LCD1602介紹 ....................................................... 9 3 單片機(jī)多機(jī)通信協(xié)議設(shè)計(jì) ................................................... 16 4 硬件電路設(shè)計(jì) ............................................................ 17 單片機(jī)最小系統(tǒng)的設(shè)計(jì) ................................................... 17 矩陣鍵盤電路設(shè)計(jì) ...................................................... 18 液晶顯示電路設(shè)計(jì) ...................................................... 18 可切換接口電路設(shè)計(jì) ..................................................... 19 2號與 3號單片機(jī)按鍵電路設(shè)計(jì) .......................................... 23 LED顯示電路設(shè)計(jì) ...................................................... 23 主機(jī)權(quán)分配電路設(shè)計(jì) .................................................... 24 電源電路設(shè)計(jì) ......................................................... 28 5 軟件設(shè)計(jì) ................................................................ 29 多機(jī)通信協(xié)議的算法設(shè)計(jì) ................................................ 29 鍵盤程序設(shè)計(jì) ......................................................... 32 系統(tǒng)初始化程序設(shè)計(jì) .................................................... 35 6 結(jié)論 .................................................................... 35 參考文獻(xiàn) .................................................................. 36 致謝 ...................................................................... 37 附錄 1: 1號單片機(jī)電路原理圖 ................................................ 38 附錄 2: 2號單片機(jī)電路原理圖 ................................................ 39 附錄 3: 3號單片機(jī)電路原理圖 ................................. 錯(cuò)誤 !未定義書簽。具有一定的檢錯(cuò)能力,串行通信的比特率是 9600bit/s,通信速度較快,且可靠性高。通過用單片機(jī)的一個(gè)引腳控制單片機(jī)的串口的連接方式,使其工作在主機(jī)模式或從機(jī)模式。然后從機(jī)發(fā)給主機(jī)校驗(yàn)字節(jié)數(shù)據(jù),主機(jī)檢驗(yàn)錯(cuò)誤,檢驗(yàn)無誤后,作出響應(yīng), 1號單片機(jī)液晶會顯示, 2 號和 3號單片機(jī)收發(fā)數(shù)據(jù)無誤后會使 LED指示燈亮起。通信過程中,主機(jī)先發(fā)送尋址的從機(jī)號,待從機(jī)響應(yīng)后 開始通信。在不需置其他單片機(jī)為主機(jī)的情形下,本多機(jī)通信系統(tǒng)可以作為主從式多機(jī)通信系統(tǒng)。主機(jī)通信用按鍵控制,模擬實(shí)際應(yīng)用中的觸發(fā)信號輸入。本文重點(diǎn)研究了多單片機(jī)的平權(quán)式多機(jī)通信,使各單片機(jī)有相同的權(quán)限。 畢業(yè)設(shè)計(jì)說明書 單片機(jī)多機(jī)通信實(shí)現(xiàn) 專 業(yè) 電子信息工程 學(xué)生姓名 杜運(yùn)福 班 級 B 電子 062 學(xué) 號 0610620224 指導(dǎo)教師 張春永 完成日期 2021 年 6 月 10 日 鹽城工學(xué)院本科生畢業(yè)設(shè)計(jì)說明書 ( 2021) I 單片機(jī)多機(jī)通信實(shí)現(xiàn) 摘要: 目前,單片機(jī)在多機(jī)通 信領(lǐng)域應(yīng)用很廣。但研究最多的是上位機(jī)與下位機(jī)的通信及多單片機(jī)構(gòu)成的主從式多機(jī)通信系統(tǒng)。 本文從平權(quán)式多機(jī)通信協(xié)議入手,首先設(shè)計(jì)了具體平權(quán)式多機(jī)通信協(xié)議 。對于 1號單片機(jī),還可通過液晶實(shí)時(shí)顯示工作狀態(tài),初始為主機(jī)。從機(jī)通信模式通過串口中斷觸發(fā)啟動,通信結(jié)束即恢復(fù)之前的從機(jī)狀態(tài)。通信結(jié)束后,主機(jī)發(fā)送自己的主機(jī)號,告知從機(jī)。其外,本文研究了可切換雙向接口的實(shí)現(xiàn)方法。 本研究已經(jīng)仿真通過,真實(shí)可行。本研究通過硬件電路解決了通信過程中多單片機(jī)爭用主機(jī)權(quán)的問題。 附錄 4:仿真電路圖 ......................................................... 42 附錄 5:源程序: ........................................................... 43 鹽城工學(xué)院本科生畢業(yè)設(shè)計(jì)說明書 ( 2021) 1 單片機(jī)多機(jī)通信實(shí)現(xiàn) 1 緒論 課題研究的背景與意義 目前單片機(jī)滲透到我們生活的各個(gè)領(lǐng)域,幾乎很難找到哪個(gè)領(lǐng)域沒有單片機(jī)的蹤跡。更不用說自動控制領(lǐng)域的機(jī)器人、智能儀表、醫(yī)療器械了。串行通信作為單片機(jī)之間常用的通信方法之一 , 由于其通信編程靈活、硬件簡潔并遵循統(tǒng)一的標(biāo)準(zhǔn) , 因此其在工業(yè)控制領(lǐng)域得到了廣泛的應(yīng)用。 Mcs一 51系列單片機(jī)為實(shí)現(xiàn)多機(jī)通信聯(lián)網(wǎng)設(shè)計(jì)了方便的串行通信接口功能 。這種多機(jī)系統(tǒng)結(jié)構(gòu)簡單,應(yīng)用廣泛,但它只能實(shí)現(xiàn)由主機(jī)呼叫分機(jī),然后實(shí)現(xiàn)主機(jī)與分機(jī)之間的全雙工串行通信。 多機(jī)協(xié)同工作已是單片機(jī)發(fā)展的一個(gè)重要趨勢,目前單片機(jī)多機(jī)通信的主要方式仍然是主從式多機(jī)通信系統(tǒng)。 隨著科技的發(fā)展,單片機(jī)已不是一個(gè)陌生的名詞,它的出現(xiàn)是近代計(jì)算機(jī)技術(shù)發(fā)展史上的一個(gè)重要里程碑,因?yàn)閱纹瑱C(jī)的誕生 標(biāo)志著計(jì)算機(jī)正式形成了通用單片機(jī)多機(jī)通信實(shí)現(xiàn) 2 計(jì)算機(jī)系統(tǒng)和嵌入式計(jì)算機(jī)系統(tǒng)兩大分支。 所涉及的市場占有率最高的是 MCS— 51 系列,因?yàn)槭澜缟虾芏嘀?IC 生產(chǎn)廠家都生產(chǎn) 51兼容的芯片。到目前為止, MCS— 51單片機(jī)已有數(shù)百個(gè)品種,還在不斷推出功能更強(qiáng)的新產(chǎn)品。 單片機(jī)的通信領(lǐng)域應(yīng)用首先從兩片單片機(jī)之間的通信發(fā)展起來,后來有了主從式多機(jī)通信 并得到了廣泛的應(yīng)用,又出現(xiàn)了以單片機(jī)作為下位機(jī)與以 PC 機(jī)作為上位機(jī)的通信應(yīng)用,上位機(jī)用 VB或 VC++等面向?qū)ο蟮某绦蛟O(shè)計(jì)語言編寫通信收發(fā)程序,也得到了廣泛的應(yīng)用。 本課題的研究內(nèi)容 本文在研究傳統(tǒng)的多機(jī)通信系統(tǒng)的基礎(chǔ)上,設(shè)計(jì)了一種基于 MCS- 51 系列單片機(jī) AT89S52 的多機(jī)通信系統(tǒng)。主機(jī)通過串口向從單片機(jī)發(fā)送指定格式的數(shù)據(jù),從單片機(jī)收數(shù)據(jù)并作出響應(yīng),主機(jī)通過液晶屏顯示通信信息,從機(jī)通過 LED 顯示通信狀態(tài)。 1號單片機(jī)通過矩陣鍵盤控制通信過程與顯示, 2 與 3 號單片機(jī)通過獨(dú)立按鍵控制通信狀態(tài)與主從機(jī)切換。僅在初始時(shí), 1號單片機(jī)被默認(rèn)置為主機(jī),