您的位置 首页 发布

单片机心率测量仪源代码

将你的食指轻轻地放在传感器上,就能看到LED指示灯随着你的心跳而闪动,人体指尖的动脉比较发达,当动脉血管随心脏周期性收缩与舒张时,血

将你的食指轻轻地放在传感器上,就能看到LEDadclass=0&app_id=0&c=news&cf=1001&ch=0&di=128&fv=17&is_app=0&jk=5d97316317e90784&k=%D6%B8%CA%BE%B5%C6&k0=%D6%B8%CA%BE%B5%C6&kdi0=0&luki=1&n=10&p=baidu&q=98059059_cpr&rb=0&rs=1&seller_id=1&sid=8407e9176331975d&ssp2=1&stid=0&t=tpclicked3_hc&tu=u1831118&u=http%3A%2F%2Fwww%2E51hei%2Ecom%2Fmcu%2F2078%2Ehtml&urlid=0″ id=”7_nwl” mpid=”7″ target=”_blank”>指示灯跟着你的心跳而闪烁,人体指尖的动脉比较发达,当动脉血管随心脏周期性缩短与舒张时,血管中的血液容积也会发生变化。

上面这个是收集部分的原理图全套的制造材料请到http://www.51hei.com/bbs/dpj-22525-1.html去下载,下面是心率测量仪的单片机部分源代码

/*
Project: Measuring heart rate through fingertip
Copyright @ Rajendra Bhatt
January 18, 2011
P%&&&&&%16F628A at 4.0 MHz external clock, MCLR enabled
*/

sbit IR_Tx at RA3_bit;
sbit DD0_Set at RA2_bit;
sbit DD1_Set at RA1_bit;
sbit DD2_Set at RA0_bit;
sbit start at RB7_bit;
unsigned short j, DD0, DD1, DD2, DD3;
unsigned short pulserate, pulsecount;
unsigned int i;
//————– Function to Return mask for common anode 7-seg. display
unsigned shortmask(unsigned short num) {
switch (num) {
case 0 : return 0xC0;
case 1 : return 0xF9;
case 2 : return 0xA4;
case 3 : return 0xB0;
case 4 : return 0x99;
case 5 : return 0x92;
case 6 : return 0x82;
case 7 : return 0xF8;
case 8 : return 0x80;
case 9 : return 0x90;
} //case end
}

void delay_debounce(){
Delay_ms(300);
}

void delay_refresh(){
Delay_ms(5);
}

void countpulse(){
IR_Tx = 1;
delay_debounce();
delay_debounce();
TMR0=0;
Delay_ms(15000); // Delay 1 Sec
IR_Tx = 0;
pulsecount = TMR0;
pulserate = pulsecount*4;
}

void display(){
DD0 = pulserate%10;
DD0 = mask(DD0);
DD1 = (pulserate/10)%10;
DD1 = mask(DD1);
DD2 = pulserate/100;
DD2 =mask(DD2);
for (i = 0; i<=180*j; i++) {
DD0_Set = 0;
DD1_Set = 1;
DD2_Set = 1;
PORTB = DD0;
delay_refresh();
DD0_Set = 1;
DD1_Set = 0;
DD2_Set = 1;
PORTB = DD1;
delay_refresh();
DD0_Set = 1;
DD1_Set = 1;
DD2_Set = 0;
PORTB = DD2;
delay_refresh();
}
DD2_Set = 1;
}

void main() {
CMCON = 0x07; // Disable Comparators
TRISA = 0b00110000; // RA4/T0CKI input, RA5 is I/P only
TRISB = 0b10000000; // RB7 input, rest output
OPTION_REG = 0b00101000; // Prescaler (1:1), TOCS =1 for counter mode
pulserate = 0;
j = 1;
display();
do {
if(!start){
delay_debounce();
countpulse();
j= 3;
display();
}
} while(1); // Infinite loop
}

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/changshang/fabu/318242.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部