【正文】
3 目 錄 ???????????????????? ?????????? ……… ( 4) 信號發(fā)生器現(xiàn)狀 ????? ………………………………………………… ? …… ( 4) 單片機在低頻 信號發(fā)生器中的應用 ????? ????????????????( 4) ????? ????????? ????? ????????????( 5) 系統(tǒng)方案的比較 ????????? ????? ??????????????( 5) 芯片選擇模塊 ????????? ????? ???????????? ???( 5) 系統(tǒng)設計要求 ?????????????????????????????( 5) 3. 硬件電路的設計 ????????? ????? ??????????????( 6) 系統(tǒng)框圖 ??????????????????????????????? ( 6) 資源分配 ??????????????????????????????? ( 6) 最小 單片機 系統(tǒng)設計 ?????????????????????????? ( 6) 各部分電路原理 ???????????????????????????? ( 10) ??????????????????????????????? ( 13) 主程序流程圖 ????????????????????????????? ( 13) 方波程序流程圖 ???????????????????????????? ( 14) 三角波程序流程圖 ??????????????????????????? ( 14) 鋸齒波程序流程圖 ??????????? ???????????????? ( 15) 正弦波程序流程圖 ??????????????????????????? ( 15) ???????????????????????????????( 16) ????????????????????????????????( 18) ????????????????????????????????( 19) ???????????????????????????????( 20) ?????????????????????????????????( 21) 附錄 1 電 路原理圖 ????????????????????????????( 21) 附錄 2 PCB 圖 ??????????????????????????????( 22) 附錄 3 源程序 ??????????????????????????????( 23) 論 4 信號發(fā)生器現(xiàn)狀 信號發(fā)生器作為一種常見的應用電子儀器設備,傳統(tǒng)的可以完全由硬件電路搭接而成,如采用 555 振蕩電路發(fā) 生正弦波、三角波和方波的電路便是可取的路徑之一,不用依靠單片機。硬件電路簡單,軟件功能完善,控制系統(tǒng)可靠,性價比較高等特點,具有一定的使用和參考價值。 通過按鍵控制可產生方波、鋸齒波、三角波、正弦波等,同時用 LED 顯示燈指示對應的波形。電路采用 AT89S51單片機和一片 DAC0832數(shù)模轉換器組成數(shù)字式低頻信號發(fā)生器。在這種情況下,單片機以它優(yōu)越的控制功能、輕巧的體積,高可靠性和高性價比在智能化儀表系統(tǒng)、工控領域等日益顯示出強大的生命力,使傳統(tǒng)的電子技術產生了一場巨變,成為計算機發(fā)展史上一個新的里程碑。 智能儀器的出現(xiàn),極大地擴充了傳統(tǒng)儀器的應用范圍。函數(shù)信號發(fā)生器,它具有價格低、性能高和在低頻范圍內穩(wěn)定性好、操作方便、體積小、耗電少等特點。所產生的波形在一定頻率范圍可調 ,波形準確并且平滑。 【 關鍵詞 】 :AT89s51;低頻信號;發(fā)生器;運放器 【 Abstract】 :As we all know, digital technology and puter technology has perated into the industry, 2 agriculture, merce, education, medical, military, entertainment, and every area of life in every corner of the application of wide deep staggering! Despite the application of PC has been quite mon, but in the industrial field, in pursuit of a small but growing, thin and light automatic controller, automation instruments, household electrical appliances and so on, PC still not suitable for machine. In this case, the singlechip control of its superior functionality, the size of pact, high reliability and costeffective instrument in the intelligent system, the growing industrial areas show great vitality to the traditional electronic technology resulted in a change to bee the puter history of the development of a new milestone. The emergence of intelligent machines, which greatly expanded the scope of application of traditional instruments. Intelligent instrument, with its small size, powerful, lowpower advantages of home appliances quickly, research institutes and industrial enterprises has been widely used. The function generator used as a control core single chip AT89S51, external analog / digital converter circuit (DAC0832), operational amplifier circuit (LM324), button and LED indicator lights and other circuits. AT89S51 circuit and a singlechip digital DAC0832 Digital to Analog ponent of lowfrequency signal generator. Function signal generator, it has a low price, highperformance and lowfrequency range of good stability, convenient operation, small size, low power consumption and so on. As a result of the LM324 operational amplifier to the circuit more stable high performance, high performance. This circuit clear, easy to find failure error, simple and can be generated through control of square wave, sawtooth wave, triangle wave, sine wave and so on, at the same time with LED lights show the corresponding waveform instructions. Waveform generated frequency range of ~ , accurate and smooth waveform. The system is designed to be simple, excellent performance, with a certain degree of practicality. The main application of this design as a control core AT89S51. A simple hardware circuit, software functions, the control system reliable and costeffective features such as high, with a certain degree of use and reference value. 【 Antistop】 :AT89S51。但是這種電路存在波形質量差,控制難,可調范圍小,電路復雜和體積大等缺點。 單片機在低頻信號發(fā)生器中的應用 當今是科學技術及儀器 設備高度智能化飛速發(fā)展的信息社會,電子技術的進步,給人們帶來了根本性的轉變。 一塊單片機芯片就是一臺計算機。 具有優(yōu)異的性能價格比 單片機盡可能地把應用所需的存儲器 ,各種功能的 I/O 接口集成在一塊芯片內 ,因而其性能很高 ,而價格卻相對較低廉 ,即性能價格比很高。 集成度高、體積小、可靠性高 單片機把各種功能部件集成在一塊芯片上,因而集成度高,均為大規(guī)?;虺笠?guī)模集成電路。目前,許多單片機已可在 電壓下運行 ,有的已能在 或 下工作,功耗降至μ A 級 ,一粒鈕扣電 池就可長期使用。 這里介紹一種采用 AT89S51 單片機和一片 DAC0832 數(shù)模轉換器做成的數(shù)字式低頻信號發(fā)生器,它的特點是價格低、性能高,在低頻范圍穩(wěn)定性好、操作方便、體積小、耗電少等。之所以選單片雙極性是因為其精度高,濾波好,抗干擾效果好。因此我們設計中采用方案二。是一個強大易用的功能。 ⑹雙數(shù)據(jù)指示器。 方案選擇: 方案二中 C8051F005 芯片系統(tǒng)內部結構復雜,不易控制,芯片成本高,對于本系統(tǒng)而言利用率低, AT89S51 芯片簡單易控制,成本低,性能穩(wěn)定 ,因此采用方案一。 P2 口用來控制 DAC0832 的輸入寄存器選擇信號 CS、輸入寄存器寫選通信號 WR1 及 DAC 寄存器寫選通信 號 WR2 和數(shù)據(jù)傳送信號 XFER??臻e模式下, CPU暫停工作,而 RAM 定時計數(shù)器,串行口,外中斷 系統(tǒng)可繼續(xù)工作,掉電模式凍結振蕩器而保存 RAM的數(shù)據(jù),停止芯片其它功能直至外中斷激活或硬件復位??臻e模式下, CPU 暫停工作,而 RAM 定時計數(shù)器,串行口,外中斷系統(tǒng)可繼續(xù)工作,掉電模式凍結振蕩器而保存 RAM 的數(shù)據(jù),停止芯片其它功能直至外中斷激活或硬件復位。 P0 口: P0 口為一個 8 位漏級開路雙向 I/O 口,每腳可吸收 8TTL 門電流。 P1口: P1口是一個內部提供上拉電阻的 8 位雙向 I/O 口, P1口緩沖器能接收輸出 4TTL 門電流。并因此作為輸入時, P2 口的管腳被外部拉低,將輸出電流。 P2口在 FLASH編程和校驗時接收高八位地址信號和控制信號。 表 31 端口引腳圖 I/O口作為輸入口時有兩種工作方式即所謂的讀端口與讀引腳讀端口時實際上并不從外部讀入數(shù)據(jù)而是把端口鎖存器的內容讀入到內部總線經過某種運算或變換后再寫回到端口鎖存器只有讀端口時才真正地把外部的數(shù)據(jù)讀入到內部總線上面圖中的兩個 三角形表示的就是輸入緩沖器 CPU將根據(jù)不同的指令分別發(fā)出讀端口或讀引腳信號以完成不同的操作這是由硬件自動完成的不需要我們操心 1然后再實行讀引腳操作否則就可能讀入出錯為什么看上面的圖如果不對端口置 1端口鎖存器原來的狀態(tài)有可能為 0Q 端為 0Q^為 1 加到場效應管柵極的信號為 1 該場效應管就導通對地呈現(xiàn)低阻抗 ,此時即使引腳上輸入的信號為 1 也會因端口的低阻抗而使信號變低使得外加的 1 信號讀入后不一定是 1若先執(zhí)行置 1操作則可以使場效應管截止引腳信號直接加到三態(tài)緩沖器中實現(xiàn)正確的讀入由于在輸入操作時還必須附加一個準備動作所以這 類 I/O 口被稱為準雙向口 89C51 的P0/P1/P2/P3口作為輸入時都是準雙向口接下來讓我們再看另一個問題從圖中可以看出這四個端口還有一個差別除了 P1口外 P0P2P3 口都還有其他的功能 RST:復位輸入。在平時, ALE 端以不變的頻率周期輸出正脈沖信號,此頻率為振蕩器頻率的 1/6。此時, ALE 只有在執(zhí)行 MOVX, MOVC 指令是 ALE 才起作用。在由外部程序存儲器取指期間,每個機器周期兩