CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Watchdog setting in pic18f25k22

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
evandro



Joined: 01 Dec 2014
Posts: 2

View user's profile Send private message

Watchdog setting in pic18f25k22
PostPosted: Tue Nov 03, 2015 8:48 pm     Reply with quote

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

View user's profile Send private message Send e-mail Visit poster's website

Re: Watchdog setting in pic18f25k22
PostPosted: Tue Nov 03, 2015 10:46 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Nov 04, 2015 11:43 am     Reply with quote

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?
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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