【正文】
3233343536373839VCC40U1STC89C52Y112MC2 20C3 20VCCGNDR210KC1 10uFVCCS1單片主控電路LCD1602液晶接口GND1VCC2VO3RS4RW5E6DB07DB18DB29DB310DB411DB512DB613DB714BG/VCC15BG/GND16LCD1LCD1602GNDGNDVCCVCCR12KP00 P01 P02 P03 P04 P05 P06 P07P00P01P02P03P04P05P06P07P10 P11 P12P32VCC 26 附錄 B:系統(tǒng)源程序 include //調用單片機頭文件 define uchar unsigned char //無符號字符型 宏定義 變量范圍 0~255 define uint unsigned int //無符號整型 宏定義 變量范圍 0~65535 include sbit dq = P1^5。 unsigned int time[6]={0}。 28 * 輸入 : 無 * 輸出 : 無 ***********************************************************************/ void delay_uint(uint q) { while(q)。 e=0。 e=0。 p++。 33 write_data(0x30+date%10)。 //開總中斷 34 TMOD = 0X01。 //初始化定時器 init_int0()。//算出間隔時間 TH0 = 0x3c。 // 50ms 12M timecount++。 38 TL0 = 0xb0。 //測得 5 次開始顯示 ? } } } /*************定時器 0 中斷服務程序 ***************/ void time0_int() interrupt 1 { TH0 = 0x3c。//暫時關外部中斷 if(timecount8) //當連續(xù)兩次檢測時間間隔小于 8*50ms=400ms不處理 { TR0=1。 //外部中斷 0 負跳變中斷 } /****************主函數(shù) ***************/ void main() { init_1602()。 write_string(2,0, 000/min )。 write_data(0x30+date/100%10)。) break。 e=1。 e=1。j++)。 //寄存器選擇信號 H:數(shù)據寄存器 L:指令寄存器 sbit e =P1^2。俗話說:磨刀不誤砍柴功。使我順利圓滿的完成了此次課稱設計設計。 不足之處有: 進一步提高 。 , 但測量值不穩(wěn)定 主要是光電傳感器受到電磁波等干擾,其次是損壞或有虛焊?;叵脒@些問題只要認真多思考都是可以避免的,以下為主要的問題: 問題 1:最開始的時候以為單片機 IO 口直接可以驅動蜂鳴器發(fā)聲,后來調試的時候久久不能出聲音(見附錄 C)。最后經過多次的模塊子程序的修改,一步一步的完成,最終解決了軟件。首先根據系統(tǒng)功能和鍵盤設置選擇一種最適合的監(jiān)控程序結構。 首先先調用液晶自定義的字庫,設置好 DDRAM 地址后在第一行顯示,根據程序中的數(shù)據設置顯示數(shù)據的首地址并設置循環(huán)量,在循環(huán)過程中不斷的取字符代碼直到終止, 第二行的顯示過程同一行的顯示過程一樣,兩行顯示完畢后便結束子程序,如圖 所示 [15]。選擇電路:所選放大整形電路框圖如圖 所示。IR 用于寄存指令碼,只能寫入不能讀出, DR 用于寄存數(shù)據,數(shù)據由內部操作自動寫入 DDRAM 和 CGRAM,或者暫存從 DDRAM 和 CGRAM 讀出的數(shù)據, BF 13 為 1 時,液晶模塊處于內部模式,不響應外部操作指令和接受數(shù)據, DDTAM 用來存儲顯示的字符,能存儲 80 個字符碼, CGROM 由 8 位字符碼生成 5*7 點陣字符 160 中和 5*10 點陣字符 32 種 .8 位字符編碼和字符的對應關系, CGRAM是為用戶編寫特殊字符留用的,它的容量僅 64 字節(jié),可以自定義 8 個 5*7 點陣字符或者 4 個 5*10 點陣字符, AC 可以存儲 DDRAM 和 CGRAM 的地址,如果地址碼隨指令寫入 IR,則 IR 自動把地址碼裝入 AC,同時選擇 DDRAM 或CGRAM, LCD1602 液晶模塊的引腳圖如圖 所示。和 CRT 顯示器相比, LCD 的優(yōu)點是很明顯的。 STC89C52 單片機的中斷系統(tǒng) STC89C52 系列單片機的中斷系統(tǒng)有 5 個中斷源, 2 個優(yōu)先級,可以實現(xiàn)二級中斷服務嵌套。 P3 口與其它 I/O 端口有很大的區(qū)別,它的每個引腳都有第二功能,如下: : (RXD)串行數(shù)據接收。 P1 口 (~ , 1~8 腳 ): P1 口是一個帶內部上拉電阻的 8 位準雙向 I/O 口。對于無片內 ROM 的 8031 或 8032,需外擴 EPROM,此時必須將EA 引腳接地。此引肢接 EPROM 的 OE 端 (見后面幾章任何一個小系統(tǒng)硬件圖 )。 CPU 訪問片外存儲器時, ALE 輸出信號作為鎖存低 8 位地址的控制信號。 XTAL1(19 腳 ):接外部晶體和微調電容的另一端;在片內它是振蕩電路反相放大器的輸入端?,F(xiàn)在新推出的單片機都不只 5 個中斷源,例如 SST89E58RD 就有 9 個中斷源。 3. 片內程序存儲器 ROM(4KB),用以存放程序、一些原始數(shù)據和表格。 51 系列單片機最初是由 Intel 公司開發(fā)設計的,但后來 Intel 公司把 51 核的設計方案賣給了幾家大的電子設計生產商,譬如 SST、 Philip、 Atmel 等大公司。 所以本設計中方案三中的 LCD1602 液顯示屏作為顯示模塊。其內部集成了很多模擬電路、數(shù)字電路和微處理器,提供強大的功能。 其中光電式脈搏傳感器是根據光電容積法制成的脈搏傳感器,通過對手指末端透光度的監(jiān)測,間接檢測出脈搏信號。脈象探頭式樣很多,有單部、三部、單點、多點、剛性接觸式、軟性接觸式、氣壓式、硅杯式、液態(tài)汞、液態(tài)水、子母式等組成 ,脈象探頭的主要原件有應變片、壓電晶體、單晶硅、光 敏元件、 PVDF壓電薄 3 膜等,其中以單部單點應變片式為最廣泛,不過近年來正在向三部多點式方向設計 [2]。首先,切脈單憑醫(yī)生手指感覺辨別脈象的特征,受到感覺、經驗和表述的限制,并且難免存在許多主觀臆斷因素,影響了對脈象判斷的規(guī)范化;其次,這種用手指切脈的技巧很難掌握;再則,感知的脈象無法記錄和保存影響了對脈象機理的研究。系統(tǒng)運行中可以通過觀察指示燈閃爍,若均勻閃爍說明測量值準確。 關鍵詞: STC89C52;脈搏測量儀; LCD 顯示器;光電傳感器 II Design of pulse measuring instrument based on single chip Abstract: Pulse measurement apparatus has been widely used in our daily life. In order to improve the measurement apparatus is simple and accuracy, this paper designs a pulse measuring instrument based on 51 single chip microputer. System to STC89C52 microcontroller as the core, with photoelectric sensor, and calculates the internal timer SCM system, the signal from the photoelectric sensor, microcontroller based on the accumulated pulse beat frequency signal, by the time the timer. In the running of the system can be observed through the indicator lights out, if even flicker that accurate measuring value. The system stops running, can display the total pulse number and time. After testing, the system works normally, meet the design requirements. The design of the infrared photoelectric sensor generates a pulse signal, after plastic surgery to enlarge, the input of SCM within the corresponding control, which measured within a minute of the pulse beat frequency, fast and convenient. Through observing the pulse signal, can check the health of the body, usually used for health centres and hospitals. The system can be used for measuring the pulse number of users, but also can set the upper limit of the number of times and, when the range of the measurement range over the set of drive buzzer alarm, but users can also set the alarm clock to remind the daily measurement, time can be set, the results were finally able to pulse signal acquisition to display on the . Keywords: STC89C52。 XXXX 本 科 畢 業(yè) 論 文 基于單片機的脈搏測量儀設計 Design of Pulse Measuring Instrument Based on Single Chip 學院名稱: 電子信息與電氣工程學院 專業(yè)班級: 111111111111111111111111111 學生姓名: 11111 學 號: 11111111111111 指導 教師姓名: 11111111 指導教師職稱: 11111 20xx 年 05 月 目 錄 摘要 .............................................................................................................................. I Abstract ....................................................................................................................... II 引言 ............................................................................