Strategies for timer

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I wonder if anyone of you on this forum have been thinking about how to best use the timer/counter features on different AVR devices.

Do you use the timer as a wait state and do most in sequential code, or is it more common to perform most of the tasks after the timer wrap-around interrupt?

--
Bob

admin's test signature
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

HI Bob,
I tend to use timer 0 (8bit) in overflow interupt mode, to get 'housekeeping duties' done, such as regularly reading an adc or loading in muliplexed inputs/outputs. Usually reserve timer1 (16bits) for PWM control or for timing an external event. I use plain old nested loops for delays. However, there is nothing to stop you using them as delays or to increment a variable set up as a one second timer register ,or any other time increment that you need.
shaun

admin's test signature