khangzing
Full Member level 2
- Joined
- Feb 22, 2013
- Messages
- 123
- Helped
- 3
- Reputation
- 6
- Reaction score
- 3
- Trophy points
- 1,298
- Activity points
- 2,148
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 //Timer0 //Prescaler 1:1; TMR0 Preload = 46; Actual Interrupt Time : 26.375 us //Place/Copy this part in declaration section void InitTimer0(){ OPTION_REG = 0x88; TMR0 = 46; INTCON = 0xA0; } void Interrupt(){ if (TMR0IF_bit){ TMR0IF_bit = 0; TMR0 = 46; PORTB.F0 = ~PORTB.F0 } }
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 //Timer0 //Prescaler 1:4; TMR0 Preload = 122; Actual Interrupt Time : 26.3 us //Place/Copy this part in declaration section void InitTimer0(){ OPTION_REG = 0x81; TMR0 = 122; INTCON = 0xA0; } void interrupt(){ if (INTCONbits.TMR0IF){ INTCONbits.TMR0IF = 0; TMR0 = 122; PORTBbits.RB0 = ~PORTBbits.RB0 } }
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?