找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6697|回复: 2
收起左侧

瑞萨78K0S的血压测量仪电路+单片机源代码+设计文档

[复制链接]
ID:402025 发表于 2018-9-25 09:55 | 显示全部楼层 |阅读模式
基于单片机设计的血压血氧电路以及源码,可供大家参考学习!

电路原理图如下:3
0.png

0.png 0.png 0.png 0.png

血压计是用来测量人体血压的仪器,使用它可以给医生或者患者提供一定的诊断信息,当前使用的医用血压计大多都是使用水银来测量血压,这样会对环境造成一定的污染,本方案利用电子式的方法配合医用听诊器可以测量人体血压。

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.

0.jpg
系统采用2节1.5V的电池供电,但是压力检测单元需要使用4V左右的电源才能正常工作所以系统中使用了一棵升压芯片,并且在电源部分有控制信号,当需要升压时打开控制,不需要时关闭升压芯片,从而达到低功耗的目的。

压力传感器控制电路:
0.png

上阁是压力传感器部分的电路,放大器A1A将输入的信号放大,放大器A1C受信号控制产生一个锯齿波,放大器A1B用来产生参考电压,用来对信号进行调零操作,放大器AID搭输入的压力信号和锯齿波比较产生一个与压力信号成IF.比的方波信号。

第五章软件部分
5.1软件模块

在这个系统中,软件可以分成4个部分,它们分别是:主程序部分,驱动部分,1622驱动部分,显示部分

5.2主程序部分
主程序部分在文件niain.s中,它主要完成压力的监测,和零点的校准,程序如下:

  1. #include "drive.h"
  2. #include "ht1622.h"
  3. #include "display.h"
  4. #include "port.h"
  5. extrn HT1622_init
  6. public main_pro
  7. maind        DSEG        at 0fe00h
  8. Pbuff:                        DS        32
  9. maind2        DSEG        saddrp
  10. PbuffOPTR:        DS        2
  11. PbuffIPTR:        DS        2
  12. ZeroDat:                DS        2
  13. StartP:                        DS        2
  14. stopcount:        DS        2
  15. MaxP:                                DS        2
  16. MinP:                                DS        2
  17. timercount:        DS        2

  18. key:                                DS        1
  19. CheckMode:        DS        1
  20. count:                        DS        1
  21. temp1:                        DS        1
  22. mainc        cseg
  23. wait:
  24.                 b=#0
  25. wait1:
  26.                 dbnz b,$wait1
  27.                 ret

  28. main_pro:
  29.         stopcount=#0(ax)
  30.         call        !disp_close
  31.         while(forever)
  32.                 call        !sys_get_key
  33.                 switch(a)
  34.                 case KEY_ON_OFF:
  35.                         call        !open_test
  36.                         stopcount=#0(ax)
  37.                         call        !disp_close
  38.                 break
  39.                 case        KEY_CHECK:
  40.                         call        !open_check
  41.                         stopcount=#0(ax)
  42.                         call        !disp_close
  43.                 break
  44.                 default:
  45.                         call        !stop_mode
  46.                 break
  47.                 ends
  48.         endw
  49.         ret

  50. open_test:
  51.         set1        CE_P
  52.         call        !wait
  53.         call        !sys_open_sensor
  54.         call        !HT1622_init
  55.         call        !wait
  56. ;--------开机3秒钟
  57.         call        !disp_on
  58.         call        !disp_all_on
  59.         call        !disp_dat_to_hard
  60.         ZeroDat=#0(ax)
  61.         b=#50
  62.         count=#0
  63. open_test1:
  64.                 push        bc
  65.                 repeat
  66.                         call        !sys_get_sensor_dat
  67.                 until(!cy)
  68.                 call        !In_pbuff
  69.                 call        !pro_pbuff
  70.                 call        !wait_noc
  71.                 WDTE=#0ACH
  72.                 call        !sys_get_key
  73.                 pop        bc
  74.         dbnz b,$open_test1

  75. ;-------判断是否能正常工作
  76.         b=#25
  77.         temp1=#0
  78. open_test2:
  79.                 push        bc
  80.                 repeat
  81.                         call        !sys_get_sensor_dat
  82.                 until(!cy)
  83.                 call        !In_pbuff
  84.                 call        !pro_pbuff
  85.                 call        !wait_noc
  86.                 WDTE=#0ACH
  87.                 pop        bc
  88.         dbnz b,$open_test2

  89.         call        !disp_all_off
  90.         if_bit(temp1.0)
  91.                 a=#1
  92.                 call        !diap_map
  93.         endif
  94.         temp1++
  95.         call        !disp_dat_to_hard
  96.         if(temp1>#60)
  97.                 ret
  98.         endif
  99.        
  100.         ax=ZeroDat
  101.         if(ax>#700||ax<#350)
  102.                 b=#25
  103.                 goto open_test2
  104.         endif
  105. ;------开始显示       
  106.         timercount=#0(ax)
  107.         while(forever)
  108.                 call        !sys_get_sensor_dat
  109.                 if_bit(!cy)
  110. ;------进行压力显示       
  111.                         call        !In_pbuff
  112.                         call        !disp_all_off
  113.                         call        !pro_pbuff
  114. ;--------得到压力值
  115.                         push        ax
  116.                         bc=ZeroDat(ax)
  117.                         pop                ax
  118.                         call        !AXSubBC
  119.                         if_bit(cy)
  120.                                 ax=#0
  121.                         endif
  122. ;-------转换为贡柱
  123.                         CALL        !RORCW
  124.                         call        !AX_div8
  125.                         push        ax
  126.                         if(ax>#17)
  127.                                 ax-=#17
  128.                                 call        !disp_dat_to_map
  129.                         endif
  130.                         pop                ax
  131.                         call        !hex2_to_bcd
  132.                         ax=de
  133.                         call        !disp_dat_to_dat
  134.                         call        !sys_get_bat
  135.                         if(a>#110)
  136.                                 a=#0ffH
  137.                                 call        !diap_map
  138.                         endif
  139.                         call        !disp_dat_to_hard
  140.                         call        !get_max_min
  141.                         bc=MinP(ax)
  142.                         ax=MaxP
  143.                         call        !AXSubBC
  144.                         if(ax>#10)
  145.                                 timercount=#0(ax)
  146.                         else
  147.                                 ax=timercount
  148.                                 ax++
  149.                                 if(ax>#15000)
  150.                                         ret
  151.                                 endif
  152.                                 timercount=ax
  153.                         endif
  154.                 endif
  155.                 WDTE=#0ACH
  156.                 call        !sys_get_key
  157.                 if(a==#KEY_ON_OFF)
  158.                         ret
  159.                 endif
  160.         endw
  161.         ret

  162. open_check:
  163.         set1        CE_P
  164.         call        !wait
  165.         hl=#Pbuff
  166.         a=#0
  167.         b=#32
  168.         call        !WriteAll
  169.         call        !sys_open_sensor
  170.         call        !wait
  171.         call        !HT1622_init

  172.         call        !disp_on
  173.         call        !disp_all_off
  174.         call        !disp_dat_to_hard
  175.         count=#0
  176.         CheckMode=#0
  177.         key=#0
  178.         while(forever)
  179.                 call        !sys_get_sensor_dat
  180.                 if_bit(!cy)
  181.                         call        !In_pbuff
  182.                         call        !disp_all_off
  183.                         call        !pro_pbuff
  184.                         switch(CheckMode)
  185.                         case        0:
  186.                                 call        !check_mode0
  187.                         break
  188.                         case        1:
  189.                                 call        !check_mode1
  190.                         break
  191.                         default:
  192.                         break
  193.                         ends
  194.                         call        !hex2_to_bcd
  195.                         ax=de
  196.                         call        !disp_dat_to_dat
  197.                         if(CheckMode==#1)
  198.                                 a=#1
  199.                                 call        !diap_map
  200.                         endif
  201.                         call        !disp_dat_to_hard
  202.                 endif
  203.                 WDTE=#0ACH
  204.                 call        !sys_get_key
  205.                 if(a==#KEY_ON_OFF)
  206.                         key=#1
  207.                 elseif(a==#KEY_CHECK)
  208.                         ret
  209.                 endif
  210.         endw
  211.         ret
  212.        
  213. check_mode0:
  214.         if(ax>#400)
  215.                 push        ax
  216.                 call        !wait_noc
  217.                 pop                ax
  218.                 if_bit(cy)
  219.                         if(key==#1)
  220.                                 StartP=ax
  221.                                 CheckMode++
  222.                                 key=#0
  223.                         endif
  224.                 endif
  225.         endif
  226.         ret
  227. check_mode1:
  228.         push        ax
  229.         bc=StartP(ax)
  230.         pop                ax
  231.         call        !AXSubBC
  232.         if(key==#1)
  233.                                 CheckMode=#0
  234.                                 key=#0
  235.         endif
  236.         ret


  237.        
  238. ;input ax=输入压力值
  239. ;output cy=1稳定了 cy=0不稳定
  240. wait_noc:
  241.         push        bc
  242.         push        ax
  243.         bc=ZeroDat(ax)
  244.         pop                ax
  245.         push        ax
  246.         call        !AXSubBC
  247.         if_bit(cy)
  248.                 bc=ax
  249.                 ax=#0FFFFh
  250.                 call        !AXSubBC
  251.         endif
  252.         if(ax<#3)
  253.                 count++
  254.         else
  255.                 count=#0
  256.         endif
  257.         pop                ax
  258.         pop                bc
  259.         ZeroDat=ax
  260.         if(count>#50)
  261.                 set1        cy
  262.                 count=#0
  263.         else
  264.                 clr1        cy
  265.         endif
  266.         ret
  267. stop_mode:
  268.         WDTE=#0ACH
  269.         ax=stopcount
  270.         ax++
  271.         stopcount=ax
  272.         if(ax<#0ffffH)
  273.                 ret
  274.         endif
  275.         ei
  276.         call        !close_4ms
  277.         call        !sys_close_sensor
  278.         clr1        CE_P
  279.         clr1 PM3.0
  280.         set1        P3.0
  281.         stop
  282.         nop
  283.         nop
  284.         set1        PM3.0
  285.         set1        P3.0
  286.         call        !open_4ms
  287.         stopcount=#0(ax)
  288.         ret

  289. ;********************************
  290. ;功能:传感器的数据方入缓冲区中
  291. ;入口:hl=buff
  292. ;                         b=个数
  293. ;                         c=buff长度
  294. ;                         de=buff开始地址
  295. ;********************************
  296. get_senser_to_buff:
  297.         push        ax
  298. get_senser_to_buff1:
  299.         while(forever)
  300.                 call        !sys_get_sensor_dat
  301.                 if_bit(!cy)
  302.                         break
  303.                 endif
  304.         endw
  305.         [hl+1]=a
  306.         [hl]=x(a)
  307.         hl++
  308.         hl++
  309.         ;ax=buff结束地址
  310.         push        hl
  311.         hl=de(ax)
  312.         a=c
  313.         call        !AddAtoHL
  314.         ax=hl
  315.         pop        hl
  316.         ;比较hl是否越界
  317.         push        bc
  318.         bc=ax
  319.         ax=hl
  320.         ax<->bc
  321.         call        !CmpAXBC
  322.         if_bit(cy)
  323.                 hl=de(ax)
  324.         endif
  325.         pop                bc

  326.         dbnz        b,$get_senser_to_buff1
  327.         pop                ax
  328.         ret

  329. test_pbuff:
  330.         push        ax
  331.         if(PbuffIPTR==PbuffOPTR)(a)
  332.                 set1        cy
  333.         else
  334.                 clr1        cy
  335.         endif
  336.         pop                ax
  337.         ret
  338.        
  339. In_pbuff:
  340.         push        hl
  341.         push        ax
  342.         HL=#Pbuff
  343.         a=PbuffIPTR
  344.         call        !AddAtoHL

  345.         a=PbuffIPTR
  346.         a+=#2
  347.         a&=#0feH
  348.         if(a>#31)
  349.                 a=#0
  350.         endif
  351.         PbuffIPTR=a
  352.         pop                ax
  353.         [hl+1]=a
  354.         [hl]=x(a)
  355.         pop                hl
  356.         ret
  357.        
  358. Out_pbuff:
  359.         push        hl
  360.         HL=#Pbuff
  361.         a=PbuffOPTR
  362.         call        !AddAtoHL

  363.         a=PbuffOPTR
  364.         a+=#2
  365.         a&=#0feH
  366.         if(a>#31)
  367.                 a=#0
  368.         endif
  369.         PbuffOPTR=a

  370.         x=[hl](a)
  371.         a=[hl+1]
  372.         pop                hl
  373.         ret
  374. ;********************************
  375. ;功能:计算缓冲区中数据的平均值
  376. ;出口:ax
  377. ;********************************

  378. pro_pbuff:
  379.                 push        bc
  380.                 push        de
  381.                 push        hl
  382.                 hl=#Pbuff
  383.                 c=#0
  384.                 b=#16
  385.                 de=#0
  386. pro_pbuff1:
  387.                         a=[hl]
  388.                         add a,e
  389.                         e=a
  390.                         hl++
  391.                         a=[hl]
  392.                         addc a,d
  393.                         d=a
  394.                         a=#0
  395.                         addc a,c
  396.                         c=a
  397.                         hl++
  398.                 dbnz b,$pro_pbuff1
  399.                 b=#4
  400.                 ax=de
  401. pro_pbuff2:
  402.                 clr1        cy
  403.                 a<->c
  404.                 RORC        a,1
  405.                 a<->c
  406.                 RORC        a,1
  407.                 a<->x
  408.                 RORC        a,1
  409.                 a<->x
  410.                 dbnz b,$pro_pbuff2
  411.                 pop        hl
  412.                 pop        de
  413.                 pop        bc
  414.                 ret

  415. get_max_min:
  416.                 push        ax
  417.                 push        bc
  418.                 push        hl
  419.                 MaxP=#0(ax)
  420.                 MinP=#0ffffh(ax)
  421.                 hl=#Pbuff
  422.                 b=#16
  423. get_max_min1:
  424.                         push        bc
  425.                         x=[hl](a)
  426.                         hl++
  427.                         a=[hl]
  428.                         hl++
  429.                         push        ax
  430.                        
  431.                         bc=MinP(ax)
  432.                         pop                ax
  433.                         push        ax
  434.                         call        !CmpAXBC
  435.                         if_bit(cy)
  436.                                 pop                ax
  437.                                 MinP=ax
  438.                                 push        ax
  439.                         endif

  440.                         ax=MaxP
  441.                         pop                bc
  442.                         push        bc
  443.                         call        !CmpAXBC
  444.                         if_bit(cy)
  445.                                 pop                ax
  446.                                 MaxP=ax
  447.                                 push        ax
  448.                         endif
  449.                        
  450.                         pop                ax
  451.                         pop                bc
  452.                 dbnz b,$get_max_min1
  453.                 pop                hl
  454.                 pop                bc
  455.                 pop                ax
  456.                 ret
  457. end
复制代码

0.png

全部资料51hei下载地址:
基于瑞萨的血压测量仪电路 源代码 设计文档.rar (915.86 KB, 下载次数: 72)
回复

使用道具 举报

ID:374948 发表于 2019-9-11 15:51 | 显示全部楼层
资料好乱啊,重点没有突出
回复

使用道具 举报

ID:336378 发表于 2019-9-12 08:38 | 显示全部楼层
这个瑞萨官网上有,说的比较详细。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表