基于單片機設計的血壓血氧電路以及源碼,可供大家參考學習!
電路原理圖如下:3
血壓計是用來測量人體血壓的儀器,使用它可以給醫生或者患者提供一定的診斷信息,當前使用的醫用血壓計大多都是使用水銀來測量血壓,這樣會對環境造成一定的污染,本方案利用電子式的方法配合醫用聽診器可以測量人體血壓。
1.2規格和主要技術參數
工作電壓:2.4V 3V
供電:電池AAAX2
功耗:9uA(靜態)
顯示:LCD,3V,l/3偏置,4分時
血壓測量范圍:
20-280mmHg(壓力線顯示):
20-320mmHg(數字顯示)
測量精度:血壓±3mmllg
顯示分辨率:
數字式:lmmllg:
指示線:2mmllg
操作環境:+丨0〇C至+40〇C
相對濕度:30%至85%
存放環境:-20〇C至+55oC.
系統采用2節1.5V的電池供電,但是壓力檢測單元需要使用4V左右的電源才能正常工作所以系統中使用了一棵升壓芯片,并且在電源部分有控制信號,當需要升壓時打開控制,不需要時關閉升壓芯片,從而達到低功耗的目的。
壓力傳感器控制電路:
上閣是壓力傳感器部分的電路,放大器A1A將輸入的信號放大,放大器A1C受信號控制產生一個鋸齒波,放大器A1B用來產生參考電壓,用來對信號進行調零操作,放大器AID搭輸入的壓力信號和鋸齒波比較產生一個與壓力信號成IF.比的方波信號。
第五章軟件部分
5.1軟件模塊
在這個系統中,軟件可以分成4個部分,它們分別是:主程序部分,驅動部分,1622驅動部分,顯示部分
5.2主程序部分
主程序部分在文件niain.s中,它主要完成壓力的監測,和零點的校準,程序如下:
- #include "drive.h"
- #include "ht1622.h"
- #include "display.h"
- #include "port.h"
- extrn HT1622_init
- public main_pro
- maind DSEG at 0fe00h
- Pbuff: DS 32
- maind2 DSEG saddrp
- PbuffOPTR: DS 2
- PbuffIPTR: DS 2
- ZeroDat: DS 2
- StartP: DS 2
- stopcount: DS 2
- MaxP: DS 2
- MinP: DS 2
- timercount: DS 2
- key: DS 1
- CheckMode: DS 1
- count: DS 1
- temp1: DS 1
- mainc cseg
- wait:
- b=#0
- wait1:
- dbnz b,$wait1
- ret
- main_pro:
- stopcount=#0(ax)
- call !disp_close
- while(forever)
- call !sys_get_key
- switch(a)
- case KEY_ON_OFF:
- call !open_test
- stopcount=#0(ax)
- call !disp_close
- break
- case KEY_CHECK:
- call !open_check
- stopcount=#0(ax)
- call !disp_close
- break
- default:
- call !stop_mode
- break
- ends
- endw
- ret
- open_test:
- set1 CE_P
- call !wait
- call !sys_open_sensor
- call !HT1622_init
- call !wait
- ;--------開機3秒鐘
- call !disp_on
- call !disp_all_on
- call !disp_dat_to_hard
- ZeroDat=#0(ax)
- b=#50
- count=#0
- open_test1:
- push bc
- repeat
- call !sys_get_sensor_dat
- until(!cy)
- call !In_pbuff
- call !pro_pbuff
- call !wait_noc
- WDTE=#0ACH
- call !sys_get_key
- pop bc
- dbnz b,$open_test1
- ;-------判斷是否能正常工作
- b=#25
- temp1=#0
- open_test2:
- push bc
- repeat
- call !sys_get_sensor_dat
- until(!cy)
- call !In_pbuff
- call !pro_pbuff
- call !wait_noc
- WDTE=#0ACH
- pop bc
- dbnz b,$open_test2
- call !disp_all_off
- if_bit(temp1.0)
- a=#1
- call !diap_map
- endif
- temp1++
- call !disp_dat_to_hard
- if(temp1>#60)
- ret
- endif
-
- ax=ZeroDat
- if(ax>#700||ax<#350)
- b=#25
- goto open_test2
- endif
- ;------開始顯示
- timercount=#0(ax)
- while(forever)
- call !sys_get_sensor_dat
- if_bit(!cy)
- ;------進行壓力顯示
- call !In_pbuff
- call !disp_all_off
- call !pro_pbuff
- ;--------得到壓力值
- push ax
- bc=ZeroDat(ax)
- pop ax
- call !AXSubBC
- if_bit(cy)
- ax=#0
- endif
- ;-------轉換為貢柱
- CALL !RORCW
- call !AX_div8
- push ax
- if(ax>#17)
- ax-=#17
- call !disp_dat_to_map
- endif
- pop ax
- call !hex2_to_bcd
- ax=de
- call !disp_dat_to_dat
- call !sys_get_bat
- if(a>#110)
- a=#0ffH
- call !diap_map
- endif
- call !disp_dat_to_hard
- call !get_max_min
- bc=MinP(ax)
- ax=MaxP
- call !AXSubBC
- if(ax>#10)
- timercount=#0(ax)
- else
- ax=timercount
- ax++
- if(ax>#15000)
- ret
- endif
- timercount=ax
- endif
- endif
- WDTE=#0ACH
- call !sys_get_key
- if(a==#KEY_ON_OFF)
- ret
- endif
- endw
- ret
- open_check:
- set1 CE_P
- call !wait
- hl=#Pbuff
- a=#0
- b=#32
- call !WriteAll
- call !sys_open_sensor
- call !wait
- call !HT1622_init
- call !disp_on
- call !disp_all_off
- call !disp_dat_to_hard
- count=#0
- CheckMode=#0
- key=#0
- while(forever)
- call !sys_get_sensor_dat
- if_bit(!cy)
- call !In_pbuff
- call !disp_all_off
- call !pro_pbuff
- switch(CheckMode)
- case 0:
- call !check_mode0
- break
- case 1:
- call !check_mode1
- break
- default:
- break
- ends
- call !hex2_to_bcd
- ax=de
- call !disp_dat_to_dat
- if(CheckMode==#1)
- a=#1
- call !diap_map
- endif
- call !disp_dat_to_hard
- endif
- WDTE=#0ACH
- call !sys_get_key
- if(a==#KEY_ON_OFF)
- key=#1
- elseif(a==#KEY_CHECK)
- ret
- endif
- endw
- ret
-
- check_mode0:
- if(ax>#400)
- push ax
- call !wait_noc
- pop ax
- if_bit(cy)
- if(key==#1)
- StartP=ax
- CheckMode++
- key=#0
- endif
- endif
- endif
- ret
- check_mode1:
- push ax
- bc=StartP(ax)
- pop ax
- call !AXSubBC
- if(key==#1)
- CheckMode=#0
- key=#0
- endif
- ret
-
- ;input ax=輸入壓力值
- ;output cy=1穩定了 cy=0不穩定
- wait_noc:
- push bc
- push ax
- bc=ZeroDat(ax)
- pop ax
- push ax
- call !AXSubBC
- if_bit(cy)
- bc=ax
- ax=#0FFFFh
- call !AXSubBC
- endif
- if(ax<#3)
- count++
- else
- count=#0
- endif
- pop ax
- pop bc
- ZeroDat=ax
- if(count>#50)
- set1 cy
- count=#0
- else
- clr1 cy
- endif
- ret
- stop_mode:
- WDTE=#0ACH
- ax=stopcount
- ax++
- stopcount=ax
- if(ax<#0ffffH)
- ret
- endif
- ei
- call !close_4ms
- call !sys_close_sensor
- clr1 CE_P
- clr1 PM3.0
- set1 P3.0
- stop
- nop
- nop
- set1 PM3.0
- set1 P3.0
- call !open_4ms
- stopcount=#0(ax)
- ret
- ;********************************
- ;功能:傳感器的數據方入緩沖區中
- ;入口:hl=buff
- ; b=個數
- ; c=buff長度
- ; de=buff開始地址
- ;********************************
- get_senser_to_buff:
- push ax
- get_senser_to_buff1:
- while(forever)
- call !sys_get_sensor_dat
- if_bit(!cy)
- break
- endif
- endw
- [hl+1]=a
- [hl]=x(a)
- hl++
- hl++
- ;ax=buff結束地址
- push hl
- hl=de(ax)
- a=c
- call !AddAtoHL
- ax=hl
- pop hl
- ;比較hl是否越界
- push bc
- bc=ax
- ax=hl
- ax<->bc
- call !CmpAXBC
- if_bit(cy)
- hl=de(ax)
- endif
- pop bc
- dbnz b,$get_senser_to_buff1
- pop ax
- ret
- test_pbuff:
- push ax
- if(PbuffIPTR==PbuffOPTR)(a)
- set1 cy
- else
- clr1 cy
- endif
- pop ax
- ret
-
- In_pbuff:
- push hl
- push ax
- HL=#Pbuff
- a=PbuffIPTR
- call !AddAtoHL
- a=PbuffIPTR
- a+=#2
- a&=#0feH
- if(a>#31)
- a=#0
- endif
- PbuffIPTR=a
- pop ax
- [hl+1]=a
- [hl]=x(a)
- pop hl
- ret
-
- Out_pbuff:
- push hl
- HL=#Pbuff
- a=PbuffOPTR
- call !AddAtoHL
- a=PbuffOPTR
- a+=#2
- a&=#0feH
- if(a>#31)
- a=#0
- endif
- PbuffOPTR=a
- x=[hl](a)
- a=[hl+1]
- pop hl
- ret
- ;********************************
- ;功能:計算緩沖區中數據的平均值
- ;出口:ax
- ;********************************
- pro_pbuff:
- push bc
- push de
- push hl
- hl=#Pbuff
- c=#0
- b=#16
- de=#0
- pro_pbuff1:
- a=[hl]
- add a,e
- e=a
- hl++
- a=[hl]
- addc a,d
- d=a
- a=#0
- addc a,c
- c=a
- hl++
- dbnz b,$pro_pbuff1
- b=#4
- ax=de
- pro_pbuff2:
- clr1 cy
- a<->c
- RORC a,1
- a<->c
- RORC a,1
- a<->x
- RORC a,1
- a<->x
- dbnz b,$pro_pbuff2
- pop hl
- pop de
- pop bc
- ret
- get_max_min:
- push ax
- push bc
- push hl
- MaxP=#0(ax)
- MinP=#0ffffh(ax)
- hl=#Pbuff
- b=#16
- get_max_min1:
- push bc
- x=[hl](a)
- hl++
- a=[hl]
- hl++
- push ax
-
- bc=MinP(ax)
- pop ax
- push ax
- call !CmpAXBC
- if_bit(cy)
- pop ax
- MinP=ax
- push ax
- endif
- ax=MaxP
- pop bc
- push bc
- call !CmpAXBC
- if_bit(cy)
- pop ax
- MaxP=ax
- push ax
- endif
-
- pop ax
- pop bc
- dbnz b,$get_max_min1
- pop hl
- pop bc
- pop ax
- ret
- end
復制代碼
全部資料51hei下載地址:
基于瑞薩的血壓測量儀電路 源代碼 設計文檔.rar
(915.86 KB, 下載次數: 76)
2018-9-25 09:54 上傳
點擊文件名下載附件
血氧血壓店里以及源碼
|