Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
Simply create more "counters", that is file registers that get decremented.
For example, if your clock is 32.768kHz and if you use TMR0 with a prescaler of 32, then it will overflow in:32768/4/32/256= 1 second. That is, every time TMR0 overflows you know that a second has elapsed
Every time it overflows, you decrement a counter (initialized with a certain number). For instance, if you initialize that register to 60, then every time it reaches zero you know a minute has elapsed. Then, whenever this counter reaches zero, you decrement another counter, which counts minutes. When 60 minutes have elapsed, you have 1 hour.
And so on, up to 31 days.
For a different crystal frequency, you just need to adjust the first counters to obtain the second, if you wish.
Another way of doing it is to simply calculate the number of instruction cycles in the period you need and just use binary counters, if you do not care about seconds and minutes.