My project uses a PIC. I have a need to have a timer for longer periods. From minutes up to several hours. It does not need to be very accurate. Accuracy within a few minutes will be just fine.
What is the best way to do this?
I was thinking that I could set my clock to 1MHZ. I could set up an interrupt handler that increments microseconds, when microseconds reaches 1000, it increments milli seconds, when milliseconds reaches 1000, it updates seconds, when seconds reaches 60 it updates minutes etc.
Is there a better way to do this?
I was thinking of using a prescaler and maybe slowing down the clock but I can't figure out a combination that makes sense and is worth doing.
What is the best way to do this?
I was thinking that I could set my clock to 1MHZ. I could set up an interrupt handler that increments microseconds, when microseconds reaches 1000, it increments milli seconds, when milliseconds reaches 1000, it updates seconds, when seconds reaches 60 it updates minutes etc.
Is there a better way to do this?
I was thinking of using a prescaler and maybe slowing down the clock but I can't figure out a combination that makes sense and is worth doing.