|
|
View previous topic :: View next topic |
Author |
Message |
overmindx
Joined: 06 Oct 2008 Posts: 43
|
watchdog problem (18f67k22) |
Posted: Mon Feb 04, 2013 4:32 am |
|
|
hi, can anybody look at this sample code?
Code: |
#include <18F67K22.h>
#FUSES NOWDT, INTRC_IO, NOPROTECT, NOIESO, BROWNOUT, PUT, NOCPD, STVREN, NODEBUG, NOWRT, NOWRTD, NOEBTR, NOCPB, NOEBTRB, NOWRTC, NOWRTB, FCMEN, NOXINST, MCLR, RTCOSC_INT
#use delay(clock=16000000)
#use rs232(force_sw,baud=57600, xmit=PIN_G1, rcv=PIN_G2, stream=PC)
#include <stdlib.h>
#include <string.h>
void main(){
delay_ms(2000);
fprintf(PC,"start\n");
setup_wdt(WDT_ON);
do{
}while(1);
}
|
the output i was hoping was the watchdog would be triggered and it would reset my program. however, it didnt. it just hangs in the while loop even if i have already placed the setup_wdt(WDT_ON). i tried it on a different chip (18f46k20) and it works. can anybody tell me what seems to be the problem here? thanks |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19498
|
|
Posted: Mon Feb 04, 2013 4:47 am |
|
|
Read the data sheet.
What does the NOWDT fuse do on this chip?.
Key is that on some chips, you have only two settings. Watchdog on, and watchdog off, but can be enabled in software. On this chip, 'NOWDT', means the watchdog is completely off, and cannot be enabled in software. You need to select 'WDT_SW', which on this chip means the watchdog can be controlled by software.
Best Wishes |
|
|
overmindx
Joined: 06 Oct 2008 Posts: 43
|
|
Posted: Mon Feb 04, 2013 5:32 am |
|
|
thanks for your help Ttelmah... :D |
|
|
|
|
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
|