Originally posted by ispyyy:
u need to find out how fast is the processor --> how long per clock cycle ???
Assuming interrupt from hardware change processor flag...
Assuming it takes minimium 650 ms per heartbeart for a human being
1) Write a delay procedure for 50ss
2) Write a delay procedure for 600ms
3) Write a counter to count the number of loop
4) Put some delay if u want
5) if flag not tigger, loop back to 3
6) Save data +delay = 50ms
7) Loop to 2
The number of clock cycle used in 3,4,5 can be used to calculate the time taken... So for example, if the # of cycle used in 3,4,5 takes 1ms. Thus, the total time taken for 2 heartbeat is (600+counter x 1 )ms
The rest should be easy...
Wah... so chim... My processor is running at 2Mhz --> 0.03s to overflow, isit too fast? For a normal heartbeat, it takes about 1BPS... I'm thinking of using a 12khz crystal which will gives me 1ms per tick... But where can i find such a crystal in the market? I tried searching on the internet, the lowest i can find is 32khz...