Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com 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.

[HELP] PIC 18F 24 hr timer

Status
Not open for further replies.

Docdude75

Newbie level 1
Joined
Mar 1, 2012
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,289
Hey guys!

I am trying to design a code in assembly language to use my PIC18F to know if it has been 24 hrs since the last time it ran a certain sub routine.

It is going to be used for a system that will only make certain choices if it has or hasn't been 24 hours. So I was hoping someone could help me figure our how to utilize the PIC18 to keep track of this for me. I've looked for hours and have come up with some codes and examples demonstrating how to count at most 1 msec.

Any help would be greatly appreciated!
 

One option is the use of a RTC, either with I2C or SPI interface.

There are several possible techniques, the following is one possible option.

When the particular routine is called before exiting, it references the RTC and stores the current time in a table.

The table is reviewed periodically, during idle time, any entry which is older than 24 hours from the current time, also retrieved from the RTC, is removed. A routine examining the table can quick tell whether or not the particular routine has been called within the past 24 hours.

There are numerous RTCs available which would be appropriate for use with the PIC18F series and quite economical as well.

BigDog
 

Hi,

Depending on the complexity of the rest of your program you can also use a couple of internal methods.

Timer1 can be used as a timebase to an internal interrupt driven rtc.

Just add a 32khz crystal and caps to the Timer1 pins, example Assembler code and circuitry in the 18F datasheets, Timer1 section.


Timer0 can also be used, based on your main oscillator frequency, though that may not work out at exactly 24 hours, but probably close enough.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top