【正文】
( 2) SCLK 串行時鐘輸入; ( 3) CS 芯片選擇,低電平有效; ( 4) OUTA DACA模擬輸出; 8 ( 5) AGND 模擬地; ( 6) REFIN 基準電壓輸入; ( 7) OUTB DACB模擬輸出; ( 8) VDD 正電源。 系統(tǒng)的硬件詳細圖如圖 4所示: 4 TXD/ F 圖 4 系統(tǒng)硬件詳細設計圖 AT89S52 AT89S52是低功耗,高性能 CMOS 8位單片機,可反復擦寫 1000次的 Flash 只讀程序存儲器,兼容標準 MCS51 指令系統(tǒng)及 80C51引腳結構,其主要特點為: ( 1)、 40個引腳 DIP 40封裝, 8k Bytes Flash片內(nèi)程序存儲器; ( 2)、 256 bytes的隨機存取數(shù)據(jù)存儲器( RAM); ( 3)、 5個中斷優(yōu)先級 2層中斷嵌套中斷; ( 4)、 2個 16位可編程定時計數(shù)器 ,2個全雙工串行通信接口。 對比兩種設計方案,我選擇方案二來設計此系統(tǒng),因為方案二的硬件電路比方案一較簡單;方案二配上外部的采集電路和相應的軟件就可以實 現(xiàn)各種不同的功能,而方案一只能實現(xiàn)一種功能;方案二的軟件控制過程也比方案一的較為簡單和直觀,方案二的性能也比方案一的穩(wěn)定,所以選擇方案二來設計此系統(tǒng)。此方案的特點是:硬件電路的實現(xiàn)相當?shù)膹碗s,用到的元器件也較多;而且整個系統(tǒng)的控制過程用軟件實現(xiàn)起來也比較的困難。 該設計要求實現(xiàn): ( 1)、能夠進行 D/A轉換功能; ( 2)、能夠進行 A/D轉換功能; ( 3)、設計串行通信接口,實現(xiàn)與 PC機的通信; ( 4)、具有人機對話功能,可通過鍵盤進行輸入; ( 5)、 LED顯示器能夠根據(jù)按鍵的輸入進行相應的顯示; ( 6)、自制 +5V穩(wěn)壓電源。 LED numeral tube display iv 1緒論 自單片機出現(xiàn)至今,單片機技術已走過了近 20年的發(fā)展路程。 關鍵詞:單片機 AT89S52;串行通信; A/D轉換; D/A轉換; LED數(shù)碼管顯示 iii Abstract It adopts AT89S52 to control the Single Chip microputer system, the whole hardware system is posed of A/D and D/A transformation, LED display, keyboard, serial munication. The design has only pleted part of the exploitation design and has not designed the circuit of external collection and control. Because of having not finished the external collection circuit, the material function of measuring has not been finished, in order to finlsh the material function of measuring such as measuring the pressure, temperature or the moisture, and it should be equiped with external sensor collection circuit and the relevant software. If collection circuit and the relevant software are equiped, it can realize that the metrical results are displayed by numeral tube LED in term of decimal system, including A/D and D/A transformation, it also can be controlled by keystroke, makes the manmachine conversation. The system is mounted by five keystroke, one restoring key, another four keys which can be used to realize different functions under the control of program. The reason why the external collection circuit has not been designed is because that the function of it will be single if it is designed and it will not be convenient to spread the function of the system. Here the whole system can realize serial munication of Single Chip Micyoco and machine PC, the download of programming, the display of the clock which is designed by software. Key words: Microputer AT89S52。因為沒有外部采集電路,所以不能完成具體的測量功能,要完成具體的測量功能(如測量壓力、溫度、濕度)還要配上外部的各種傳感器采集電路和相應的軟件。本設計只完成了單片機部分的開發(fā)設計,沒有設計外部的采集和控制電路。該系統(tǒng)還能實現(xiàn)單片機與PC機的串行通信和編程的下載、軟件設計的時鐘顯示。 D/A tranformaiton。從目前單片機的發(fā)展趨勢來看,單片機控制技術已成為電子設計技術及計算機技術不可缺少的一個重 要部分,因此單片機系統(tǒng)在電子世界里有著較好的前景,進行單片機的系統(tǒng)開發(fā)設計在當今電子領域有著重大的意義。 方案一:設計的方框圖如圖 1所示: 圖 1 方案一設計方框圖 從方案一的方框圖中我們可以看出用此設計方案設計的系統(tǒng)由信號源即被測對象、傳感器、多路模擬開關、采樣保持電路、 A/D 轉換電路、控制電路、 PC機、 D/A轉換電路、低通濾波電路、功率放大電路、激勵裝置、電源電路等部分組成。此方案的特點是:硬件電路的實現(xiàn)較為簡單、所用元器件也較少、系統(tǒng)可以配上外部的各種傳感器采集電路作為系統(tǒng)的被測對象的模擬輸入信號來源,如壓力、溫度、濕度的采集等等;配上相應的模擬采集電路和軟件就可以實現(xiàn)各種不同的功能、還能用 LED 數(shù)碼管十進制顯示相應的測量數(shù)據(jù),如可以顯示測得的壓力、溫度、濕度;還可以實現(xiàn)和 PC機串行通信和 ISP編程下載功能,不需要編程器直接從 PC上下載程序。如圖 3所示: 圖 3 系統(tǒng)硬件設計框圖 本設計的主要硬件電路包括:電源電路、 A/D 轉換電路、 D/A轉換電路、單片機與 PC 機串行通信接口和 ISP 編程下載電路、單片機外圍電路、 LED顯示電路、鍵盤電路等部分。 D/A轉換芯片 TLC5618 TLC5618是可編程雙路 12位數(shù) /模轉換器, TLC5618的特點: ( 1)可編程至 ; ( 2) 3線串行接口; ( 4)高阻抗基準輸入; ( 5)電壓輸出范圍為基準電壓的兩倍。具體連線 9 如上圖 8 所示, AT89S52 的串行通信引腳的 TXD 和 RXD分別接到 MAX232 的 T1IN 和T1OUT上, MAX232的 R1OUT