|
|
View previous topic :: View next topic |
Author |
Message |
evandro
Joined: 01 Dec 2014 Posts: 2
|
Watchdog setting in pic18f25k22 |
Posted: Tue Nov 03, 2015 8:48 pm |
|
|
Hello friends,
I'm having trouble setting up the watchdog in pic18f25k22. I am using the following settings:
Code: |
#include <18F25K22.h>
#FUSES WDT // Watch Dog Timer
#FUSES WDT512 // Watch Dog Timer uses 1: 512 Postscale
| I am doing something very simple like turning on an LED when the program starts and is an infinite loop waiting for the watchdog burst your time. To my understanding, the LED should be flashing when the watchdog pops up time and reset the pic.
The LED should turn on for 1 second at startup, delete and then after 2 seconds the watchdog bursts your time and resets the program by turning the led.
Program example:
Code: |
void main {
LED = 1;
delay_ms (1000);
LED = 0;
while (1) {
}
} |
|
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
Re: Watchdog setting in pic18f25k22 |
Posted: Tue Nov 03, 2015 10:46 pm |
|
|
evandro wrote: | Hello friends,
I'm having trouble setting up the watchdog in pic18f25k22. I am using the following settings:
Code: |
#include <18F25K22.h>
#FUSES WDT // Watch Dog Timer
#FUSES WDT512 // Watch Dog Timer uses 1: 512 Postscale
| I am doing something very simple like turning on an LED when the program starts and is an infinite loop waiting for the watchdog burst your time. To my understanding, the LED should be flashing when the watchdog pops up time and reset the pic.
The LED should turn on for 1 second at startup, delete and then after 2 seconds the watchdog bursts your time and resets the program by turning the led.
Program example:
Code: |
void main {
LED = 1;
delay_ms (1000);
LED = 0;
while (1) {
}
} |
|
You did not show what clock you are using so I have no idea when the WDT will expire. My guess is the LED is being turned on, the WDT resets before 1000ms has elapsed and the PIC resets. The code executes again and the LED is turned on etc etc. If this is the case, the LED will appear to be continuously on. _________________ Regards, Andrew
http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!! |
|
|
evandro
Joined: 01 Dec 2014 Posts: 2
|
|
Posted: Wed Nov 04, 2015 11:43 am |
|
|
Hello Andrew, thank you for responding.
I am using the then 4MHZ clock with the setting:
Code: |
#FUSES WDT512 // Watch Dog Timer uses 1: 512 Postscale
#use delay (= internal 4MHz, restart_wdt) |
In this case I'm resetting the watchdog automatically in delay routines.
When I turn on the LED turns on and off as expected, then the infinite loop the program does nothing, then it would be expected the system to be reset by overflow of the watchdog time, but it is not happening.
Do you have any idea how to solve it? |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|