Question about using a PIC microcontroller

Thread Starter

RFBeginner

Joined Mar 16, 2007
9
Hi,

I will like my PIC microcontroller to wake up from sleep every 12hrs, executing instructions from where it left off before going to sleep.
I know the PIC has some timers (watchdog, power up), but I am having a hard time understanding how exactly they work.

Can someone please give me some information that can help.

Thansk.
 

Papabravo

Joined Feb 24, 2006
21,159
You probably can't get 12 hours on a single wakeup. What you can get is a wakeup every so many milliseconds or seconds. On most of the wakeups you do nothing except go back to sleep. When a suitable number of intervals have elapsed then you go and do your 12 hour tasks.

In some designs there is a single sleep instruction that you go to whenever processing is finished. You wake up at the next instruction and not at some arbitrary place. In other designs each task terminates with a sleep instruction. Whenever you wake up you goto a common routine which determines what to do next.

The way the sleep process works is that the main system clock is stopped, but an internal low power oscillator continues to run timing out the sleep interval.

According to the datasheet the WDT timebase is the LFINTOSC at 31 kHz., The default for the 16 bit prescaler is divide by 512 which gives a WDT Timeout Interval of about 16.5 milliseconds.
 

Thread Starter

RFBeginner

Joined Mar 16, 2007
9
thanks for the info.

I should have made it clear that I wanted the PIC to wake up once every 12hrs, for about 10mins.

Do you think the WDT will be the most practical way to do this? Or should I wake up from sleep using an interrupt-on-change function?
 
Top