View previous topic :: View next topic |
Author |
Message |
Fabri
Joined: 22 Aug 2005 Posts: 275
|
PIC16F630 and wake-up from sleep |
Posted: Mon Mar 31, 2008 2:12 am |
|
|
Hi to all,
I use PIC16F630 with it's internal oscillator in remote controller. I wake-up PIC with interrupt on change of RA port and all work fine. In this first step WDT isn't enabled. I need now to introduce a function were I need to wake up PIC every fix time, for example 3 seconds. I understand I cannot use timer because I don't use external oscillator but can I enable and disable WDT during execution of program ?
Have you got any suggestion to solve problem ?
Regards,
Fabri |
|
|
Matro Guest
|
|
Posted: Mon Mar 31, 2008 2:48 am |
|
|
You can enable your watchdog just before sleep instruction. In that way the PIC will wake-up when watchdog will overflow.
After wake-up you can turn off the watchdog for the rest of the code.
But be aware that teh watchdog frequency is very very variable according to temperature and some other parameters.
Matro. |
|
|
Fabri
Joined: 22 Aug 2005 Posts: 275
|
|
Posted: Mon Mar 31, 2008 3:39 am |
|
|
Hi,
Which way can I use to write config register in normal flow of program ?
I read in datasheet and Microchip says:
"Address 2007h is beyond the user program memory space. It belongs to the special configuration memory space (2000h - 3FFFh),
which can be accessed only during programming."
Regards,
Fabri |
|
|
Ttelmah Guest
|
|
Posted: Mon Mar 31, 2008 4:35 am |
|
|
You don't.
You enable the watchdog, in the configuration bits, then just ensure that it is reset regularly in your code, till you get to where you want to sleep. Reset it immediately before you go to sleep, and the chip will wake up, when it triggers.
On these chips, there is no separate watchdog enable. Once it is enabled in the configuration, it is 'on'.
Best Wishes |
|
|
Matro Guest
|
|
Posted: Mon Mar 31, 2008 5:12 am |
|
|
Since the chip you have chosen has no soft En/Dis-able bit for watchdog, the only way is to make it run every time. And to clear it regularly in your code to avoid a time-out reset.
I thought a sof bit was available. That's why i wrote that you can stop it.
But actually you can't.
Matro. |
|
|
|