Continue to Site

Welcome to

Welcome to our site! is an international Electronics 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.

How to make 31-days long delay using 16F84A?

Not open for further replies.


Full Member level 4
Jan 14, 2005
Reaction score
Trophy points
Activity points
How to make 31 days delay, using 16F84A?

Please Help me.

Re: Delay with 16F84a

you have real time chip (maxim)

Re: Delay with 16F84a

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.

Delay with 16F84a

you can use real time clock RTC (chip) such as DS1307 or PCF8583.
in this case your timer will work even when power lost.

Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to