Hi,
I'm trying get 5 min timer with C8051F120 timer 2. 24 MHz clock is used and is there any way that i can create 5 min timer?
thanks
I'm just a beginner and trying to learn various function. I understand that the timer only able to count 65535 steps. With 24Mhz clock, there is no way that I can set the timer as long as 5 min. Just seek for a help if any have any idea to get 5 min delay timer with 24Mhz clock.
thanks,
"Just seek for a help if any have any idea to get 5 min delay timer with 24Mhz clock."
In the timer isr, keep track of the time passed since the last 5-min marker; Once the time reached 5 minutes, subtract the duration of the time passed and set a flag.
If the scope of your timer is only milliseconds you'll want to count off how many there are in 5 minutes.
ie a one millisecond tick timer will enter the interrupt 1000 times in one second, 60000 times in one minute, 300000 times in five minutes
More important than learning "functions" is to learn how to think - how to analyse a problem, and design solutions.
Hence the suggestion to think about how a mechanical clock works: it has a pendulum (or whatever) which "ticks" once per second (or whatever) - and uses that to time a second hand rotating once per minute (60 seconds), a minute hand rotating once per hour (60 minutes), etc.
Now compare that to what Mr Pier wrote about timers...