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

I need a timer interrupt at periodic intervals.

I understand that the timer will count from 0x000 to 0xFFFF before it overflows and activate the timer interrupt.

However, if I need to have a longer count ie longer periodic interval. How can it be done since the count value is only 2 bytes?

Besides that, if I need to specific periodic interval does it mean I have to reload the timer value with a specifc number each time the interrupt comes in?

  • "I understand that the timer will count from 0x000 to 0xFFFF before it overflows and activate the timer interrupt."

    The timer will count from whatever value you initialise it to.

    "However, if I need to have a longer count ie longer periodic interval. How can it be done since the count value is only 2 bytes?"

    The only way you can reduce the frequency of interrupt further is to reduce your clock speed.

    "Besides that, if I need to specific periodic interval does it mean I have to reload the timer value with a specifc number each time the interrupt comes in?"

    Yes, unless you are using a timer that supports auto-reload.

    Stefan

  • You can not get a longer interval between the interrupts, but you can get a longer interval between the interrupt actions. Just add a counter in a variable that count up or down in your timer ISR and that way you can get an interval as long as you want.

    Erik

  • Thank you for your replies.