基于单片机设计的血压血氧电路以及源码,可供大家参考学习!
电路原理图如下: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)
|