enable the external interrupt pin on which sensor is supposed to attached and write subroutine to increase the "count" at that interrupt's vector address..
regards.
enable the external interrupt pin on which sensor is supposed to attached and write subroutine to increase the "count" at that interrupt's vector address..
regards.
you have posted a part of code this doesn't make any sense e.g timer is loaded why?? flag is set high and low... in short I don't get it completely...
better you explain your idea and earn the suggestion from others.
Regards.
Inside the interrupt routine you increment the counter and after required interrupt count has reached then you set a flag. You then execute some code in the while(1) loop of the main() function when the flag in the interrupt routine is set and you clear the flag in the while(1) loop.
Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
ISR(){
If interrupt_flag_bit_of_mcu true
count++
If count ==1000
flag =1}void main(){while(1){if(flag ==1){
flag =0;//do something}}}