ArdyNT
Full Member level 2
- Joined
- Nov 6, 2012
- Messages
- 126
- Helped
- 7
- Reputation
- 14
- Reaction score
- 7
- Trophy points
- 1,298
- Activity points
- 2,304
I build this code, I sue external interrupt to start the timer.
I get this first picture, and I want the second picture.
Help me please to fix my code.
Code:
// External Interrupt 0 service routine
interrupt [EXT_INT0] void ext_int0_isr(void)
{
// When interrupt occurs, start timer0
TCCR0 = 0x02;
}
// Timer 0 overflow interrupt service routine
interrupt [TIM0_OVF] void timer0_ovf_isr(void)
{
// Reinitializa timer
TCNT0 = 0xB5;
counter1++;
if(counter1 == 40)
{
PORTC.0 = 0;
counter1 = 0;
}
else
{
PORTC.0 = 1;
}
counter2++;
if(counter2 == 20)
{
PORTC.1 = 0;
counter2 = 0;
}
else
{
PORTC.1 = 1;
}
}
I get this first picture, and I want the second picture.
Help me please to fix my code.