Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int temp;
- void setup() {
- // put your setup code here, to run once:
- }
- void loop() {
- // put your main code here, to run repeatedly:
- temp = TIFR0; //TIFR0 "timer interrupt flag register 0". Bit 0 of which is TOV0
- temp = temp&&0xb00000001;
- temp = temp&(1<<TOV0);//Same as temp&0xb00000001;temp now contains either 1 or 0 depending on TOV0 flag.
- if (temp == 1) { //we have overflow
- }
- //maybe better is
- if ( TIFR0 & (1 << TOV0) ){
- // timer 0 overflowed
- //Write a 1 to TOV0 to push it down. Test.
- }
- TCNT1=0;
- TCCR1B = 5;// start timer with /1024 prescale
- if (TIFR1 & (1<< TOV1)) {
- //timer 1 has overflowed
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment