ArdyNT
Full Member level 2
![Full Member level 2](/styles/images/ranks/elevel2.gif)
I build this code, I sue external interrupt to start the timer.
I get this first picture, and I want the second picture.
![dd.png dd.png](https://www.edaboard.com/data/attachments/27/27916-f988585990f3ce5bc3d3c5b246f13a15.jpg)
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.
![dd.png dd.png](https://www.edaboard.com/data/attachments/27/27916-f988585990f3ce5bc3d3c5b246f13a15.jpg)
Help me please to fix my code.