johnjameson
Junior Member level 3
- Joined
- Jan 30, 2012
- Messages
- 31
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Activity points
- 1,516
Hey guys,
I'm looking over some code here for a pulse sensor and are just looking for some clarification on some points,from I can see the interrupt of the mirco is being used to detect the pulse when a finger is placed on a sensor,I'm just gonna post the interrupts rather than post the whole code.
Variables used are all ints
so is bt or tick equal to the number of pulses the sensor reads when a finger is placed over it?
And resets back when the finger is removed?
Not sure on this one,is this a timing reference for the pulses? or something to work out a 1 second timer as it says in comment,I'm a bit lost here
I'm looking over some code here for a pulse sensor and are just looking for some clarification on some points,from I can see the interrupt of the mirco is being used to detect the pulse when a finger is placed on a sensor,I'm just gonna post the interrupts rather than post the whole code.
Variables used are all ints
Code:
void extrint (void) interrupt 0 // external Interrupt to detect the pulse
{
bt=tick; // number of ticks are picked
tick=0; // reset for next counting
}
And resets back when the finger is removed?
Code:
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;
}
}