void extrint (void) interrupt 0 // external Interrupt to detect the heart pulse
{
bt = tick; // number of ticks are picked
tick = 0; // reset for next counting
}
void timer0 (void) interrupt 1 using 1 // Timer 0 for one second time
{
TH0 = 0xdc; // The value is taken for Ssc/100 at crystal 11.0592MHz
sec100++; // It is incremented every Ssc/100 at crystal 11.0592MHz
tick++; // This variable counts the time period of incoming pulse in Sec/100
if (tick >= 3500)
{tick = 0;} // tick are limited to less than 255 for valid calculation
if (sec100 >= 100) // 1 sec = sec100 * 100
{
sec++;
sec100=0;
}
}
有人可以解释一下上面代码的含义和作用。它是为8051微控制器编写的。
我从这里得到了它 http://www.zembedded.com/heart-rate-beats-meter-with-microcontroller-at89c51-based-heartbeat-monitor/