This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

timer interrupt problem

hi,

i m facing one peculiar problem in timer 1 interrupt in Atmel 89c52.

Using interrupt, I am generating a pulse at regular intervals. If I watch the pulses continuously in oscilloscope,sometimes pulse width is varying.

Can anyone help me in this regards.

I attached the code here.


main()
{
/* Assume proper time settings here */
----
----
while(1)
{
P0=0;
overflow_count=0;
while(overflow_count <=4000);
P0=1;
overflow_count=0;
while(overflow_count <=4000);
}
}

void timer1 interrupt 3
{
overflow_count++;
}

Assume no syntax error or logical errors in the code.

regards,
sara

0