【正文】
RAM, timer/counters, serial port and interrupt system to continue functioning. The Powerdown Mode saves the RAM contents but freezes the oscillator disabling all other chip functions until the next hardware reset. Pin Description VCC: Supply voltage. GND: Ground. Port 0 Port 0 is an 8bit opendrain bidirectional I/O port. As an output port, each pin can sink eight TTL inputs. When 1s are written to port 0 pins, the pins can be used as highimpedance inputs. Port 0 may also be configured to be the multiplexed address/data bus during accesses to external program and data memory. In this mode P0 has internal Pullup resistor. Port 0 also receives the code bytes during Flash programming, and outputs the code bytes during Program verification. External Pullup resistors are required during Program verification. Port 1 Port 1 is an 8bit bidirectional I/O port with internal Pullup resistors. The Port 1 output buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are pulled high by the internal Pullup resistors and can be used as inputs. As inputs, Port 1 pins that are externally being pulled low will source current (IIL) because of the internal Pullup resistors. Port 1 also receives the loworder address bytes during Flash programming and verification. Port 2 Port 2 is an 8bit bidirectional I/O port with internal Pullup resistor. The Port 2 output buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are pulled high by the internal Pullup resistor and can be used as inputs. As inputs, Port 2 pins that are externally 陜西理工學(xué)院畢業(yè)設(shè)計(jì) 第 19 頁共 39 頁 being pulled low will source current, because of the internal Pullup resistor. Port 2 emits the highorder address byte during fetches from external program memory and during accesses to external data memory that use 16bit addresses. In this application, it uses strong internal Pullup resistor when emitting 1s. During accesses to external data memory that use 8bit addresses, Port 2 emits the contents of the P2 Special Function Register. Port 2 also receives the highorder address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8bit bidirectional I/O port with internal Pullup resistor. The Port 3 output buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are pulled high by the internal Pullup resistor and can be used as inputs. As inputs, Port 3 pins that are externally being pulled low will source current (IIL) because of the Pullup resistor. Port 3 also serves the functions of various special features of the AT89C51 as listed below: Port 3 also receives some control signals for Flash programming and verification. RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. ALE/PROG Address Latch Enable output pulse for latching the low byte of the address during accesses to external memory. This pin is also the program pulse input (PROG) during Flash programming. In normal operat。 盡管這次的設(shè)計(jì)達(dá)到了畢設(shè)的要求,但覺得這些還是不夠人性化,因?yàn)闀r(shí)間關(guān)系只能做這么多,如果可以讓這個(gè)設(shè)計(jì)更加完善, 應(yīng)該讓其在工作的時(shí)候若在一定范圍內(nèi)感應(yīng)不到人的情況下自動停止計(jì)時(shí),當(dāng)再次感應(yīng)到人的時(shí)候能夠自動開始計(jì)時(shí)。 本文探索并實(shí)現(xiàn)了 多功能視力保護(hù)器 設(shè)計(jì)的完整過程。 然后加入超聲波測距程序,并調(diào)整超聲波的來達(dá)到預(yù)期的效果。在焊接過程中,要保證每個(gè)焊點(diǎn)的連續(xù)焊接時(shí)間不超過 10S,因?yàn)闀r(shí)間過長會導(dǎo)致元器件過熱而損壞,在焊接電路板的時(shí)候,從單片機(jī)開始,一部分一部分地焊接并且一定要隨時(shí)檢測電路是不是導(dǎo)通的。 開 始發(fā) 送 超 聲 波等 待 發(fā) 射 超 聲 波計(jì) 算 避 障系 統(tǒng) 初 始 化顯 示 結(jié) 果 圖 超聲波測距子程序流程圖 陜西理工學(xué)院畢業(yè)設(shè)計(jì) 第 15 頁共 39 頁 3 系統(tǒng)的安裝與調(diào)試 安裝步驟 檢查硬件: 一個(gè)完整的電路圖所需要的元器件有很多,當(dāng)然,質(zhì)量也有所不同,所以得先檢查元器件的好壞,用適當(dāng)?shù)臋z測方法一一檢測,期間必須仔細(xì)認(rèn)真,以防因元器件過差導(dǎo)致的電路運(yùn)行不了。 開 始定 時(shí) 器 初 始 化開 中 斷 , 啟 動 定 時(shí) 器檢 測 P 1 . 0 是 否 為 高 電平 , 等 T 0 、 T 1 中 斷 請 求P 1 . 0 是 高 電 平 ?向 P 1 . 1 發(fā) 送 2 秒 的 高 電 平 脈沖 , 進(jìn) 行 報(bào) 警是否開 始定 時(shí) 器 T 0 初 始 化開 中 斷 , 啟 動 定 時(shí) 器 T 0硬 件 定 時(shí) 等 中 斷 T F 0定 時(shí) 1 0 0 m s 到 ?到 0 0 0 B H 執(zhí) 行 中 斷 服 務(wù) 程 序是否T 0 賦 初 值 , 向 T 1 的 計(jì)數(shù) 端 P 3 . 5 發(fā) 送 脈 沖 圖 定時(shí)器程序流程圖 圖 T0 中斷程序流程圖 開 始定 時(shí) 器 T 1 初 始 化開 中 斷 , 啟 動 定 時(shí) 器 T 1硬 件 計(jì) 數(shù) 等 中 斷 T F 1計(jì) 數(shù) 3 0 0 0 0 次 是 否 到到 0 0 1 3 H 執(zhí) 行 中 斷 服 務(wù) 程 序是否P 3 . 3 發(fā) 出 一 個(gè) 脈 沖 觸 發(fā)報(bào) 警 電 路 圖 T1 中斷程序流程圖 T0 和 T1 分別是定時(shí)器和 計(jì)數(shù)器,定時(shí)器 T0 定時(shí) 100ms 時(shí) , T1 計(jì)數(shù)器計(jì)數(shù)一次,此陜西理工學(xué)院畢業(yè)設(shè)計(jì) 第 14 頁共 39 頁 時(shí),定時(shí)器 T0 中斷服務(wù)程序 ZDT0 定時(shí)器 T0 定時(shí)循環(huán)到下一個(gè)定時(shí),當(dāng)再次滿 100ms 定時(shí)的時(shí)候 , T1 計(jì)數(shù)器 再 計(jì)數(shù)一次,以此類推直到 T1 計(jì)數(shù)器 滿足 計(jì)數(shù) 30000,計(jì)數(shù)器 T1 到中斷 服務(wù) 程序 ZDT1,它的功能是 從 單片機(jī) 引腳 發(fā)送一個(gè)脈沖觸發(fā)定時(shí)報(bào)警電路, 由 報(bào)警電路 發(fā)出 定時(shí)報(bào)警聲音,使學(xué)生意識到學(xué)習(xí)有 50 分鐘的時(shí)間,需要休息一下,然后保護(hù)學(xué)生視力的目的。因?yàn)榱鞒虉D不能反映概念 的同時(shí),所以距離、光和時(shí)間的三個(gè)確定沒有順 序。 本次設(shè)計(jì)思路 是 先 確定主程序,然后根據(jù)硬件電路的功能設(shè)計(jì)子程序模塊,最后將模塊中的主要模塊嵌入到主程序中。又由于在開發(fā)與測試匯編的這一過程中所需要的時(shí)間很多也很辛苦,因此這就要求我們必須選擇好每一部分需要用什么匯編方式,這樣就可以提高效率。 陜西理工學(xué)院畢業(yè)設(shè)計(jì) 第 12 頁共 39 頁 2 軟件設(shè)計(jì) 由于簡單的程序可以用匯編明顯提高執(zhí)行速度,但 在大型程序開發(fā)時(shí),需要考慮多方面因素,工程開發(fā)周期等需要合理選擇編程語言,所以本文主要采用單片機(jī) C 語言來完成軟件設(shè)計(jì)和程序代碼的編寫,程序簡單易懂,可執(zhí)行性強(qiáng)。 第 6腳:使能端 EN,當(dāng) EN 端由 1至 0時(shí),液晶模塊中的命令開始被運(yùn)行。 第 4腳: RS是寄存器選擇,高電平表示數(shù)據(jù)寄存器,低電平表示指令寄存器。 1234567891 01 11 21 31 41 51 6G N DV C CR SR WE NP 0 0P 0 1P 0 2P 0 3P 0 4P 0 5P 0 6P 0 7V C CG N DKAD 7D 6D 5D 4D 3D 2D 1D 0E NR WR SV OV C CV S SL C D1 6 0 2 圖 液晶模塊連接圖 1602引腳 1602的引腳如表 。第 5腳是液晶的讀寫控制腳, 接到了單片機(jī)的 P14腳上。 1602LCD 主要技術(shù)參數(shù): 1)顯示容量: 16 2 個(gè)字符 2)芯片工作電壓: ~ 3)工作電流: () 4)模塊最佳工作電壓: 5)字符尺寸: (W H)mm 本液晶模塊的電路的連接圖如圖 所示。當(dāng)在內(nèi)部沒有適合的漢字庫的液晶類型顯示器想要表達(dá)漢字的時(shí)候,第一步就是要獲得想要的漢文或者圖形的子模數(shù)據(jù)。 陜西理工學(xué)院畢業(yè)設(shè)計(jì) 第 10 頁共 39 頁 開 始使 能 芯 片將 值 送 入 指 定 寄 存 器輸 入 通 道 控 制 字產(chǎn) 生 時(shí) 鐘 信 號讀 取 2 字 節(jié) 數(shù) 據(jù)結(jié) 束字 節(jié) 數(shù) 據(jù) 校 驗(yàn) 圖 ADC0832 數(shù)據(jù) 的 讀取程序流程 1602 液晶顯示器是一種顯示器件,具有體積小、輕重量和低功耗等特點(diǎn)。 ADC0832 讀取數(shù)據(jù)的程序流程圖 。 當(dāng) ADC0832 沒有 工作 時(shí) 的 CS 輸入 是高電平,這時(shí)芯片不能使用 , CLK 和 DO/DI 電平可以是任意的。 4) GND 芯片參考 0 電位(地)。C to +85176。學(xué)習(xí)和使用 ADC0832 可以讓 我們了解到 A/D 轉(zhuǎn)換器的原理,有助于提高供應(yīng)鏈管理的技術(shù)水平。 如圖 所示,晶體管主要用于驅(qū)動。當(dāng)定時(shí)器使用時(shí),輸入端的輸入端的脈沖數(shù)是固定的,并且可以計(jì)算出固定時(shí)間的長度。如果一臺機(jī) 器周期采樣值為 1,下一臺機(jī)器周期采樣值為 0,則計(jì)數(shù)器加 1。很明顯,定時(shí)器的定時(shí)與系統(tǒng)的振蕩頻率有關(guān)。 89C52 單片機(jī)的有兩個(gè)可編程定時(shí)器 /計(jì)數(shù)器。 若有