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

PIC18LF46J50 setup_wdt(WDT_ON) not working

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



Joined: 08 Oct 2009
Posts: 73

View user's profile Send private message

PIC18LF46J50 setup_wdt(WDT_ON) not working
PostPosted: Fri Jul 20, 2012 12:03 pm     Reply with quote

Hi,

I'm using the PIC18LF46J50 and the setup_wdt(WDT_ON) and the restart_wdt(); within the loop is not working. I propably have something wrong in the fuses. Could you please help me. Second pair of eyes could help. Here below is my listing of fuses:
Code:

#include <18LF46J50.h>

#IFNDEF BL
   #device ICD=TRUE
#ENDIF

#OPT 10
#device adc=8                     
#device *=16
#DEVICE(WRITE_EEPROM=ASYNC)
#device HIGH_INTS=TRUE
#device NESTED_INTERRUPTS
#device PASS_STRINGS = IN_RAM
#define FASTER_BUT_MORE_ROM

#priority rtcc               
#ZERO_RAM

#IFDEF BL
   #define LOADER_SIZE                 (0x0FFF) ///
   #define LOADER_START                (0) ////
   #define LOADER_END                  (LOADER_SIZE) ////
#ENDIF

#define SAVING_AREA_START            (getenv("PROGRAM_MEMORY")-getenv("FLASH_ERASE_SIZE")+8)

#IFDEF BL
   #define APPLICATION_START           (LOADER_SIZE+1)////
   #build( reset=0x1000, interrupt=0x1008 ) ////                                             
   #org 0, LOADER_END {} ////
   #org default////
#ENDIF

#USE STANDARD_IO(B)

#FUSES HSPLL                          //High Speed Crystal/Resonator with PLL enabled
#FUSES PLL3
#FUSES NOCPUDIV
#FUSES FCMEN                          //Fail-safe clock monitor enabled
#FUSES IESO                           //Internal External Switch Over mode enabled
#FUSES WDT                           //Watch Dog Timer Enabled
#FUSES WDT16                         //Watch Dog Timer  setup                                                   
#FUSES NODEBUG                        //No Debug mode for ICD
#FUSES NOXINST                      //Extended set extension and Indexed Addressing mode disabled (Legacy mode)
#FUSES STVREN                         //Stack full/underflow will cause reset
#FUSES NOPROTECT                      //Code not protected from reading
#FUSES IOL1WAY                        //Allows only one reconfiguration of peripheral pins
#FUSES NOWPCFG                 
#FUSES WPEND                 
#FUSES WPDIS                 
#FUSES LPT1OSC                        //Timer1 configured for low-power operation
#FUSES T1DIG                 
#FUSES MSSPMSK7             
#FUSES DSWDT2     
#FUSES DSWDTOSC_INT             
#FUSES DSBOR                 
#FUSES RTCOSC_T1             
#FUSES WPFP
                                                                                                                           
#use delay(clock=48000000, crystal=12000000, RESTART_WDT)

#use rs232(uart1, baud=9600, parity=N, xmit=PIN_C6, rcv=PIN_C7, bits=8, ERRORS, STREAM=GSM)

//#PIN_SELECT U2TX=PIN_D4
//#use rs232(uart2, baud=9600, parity=N, xmit=PIN_D4, bits=8, ERRORS, STREAM=RS_2, RESTART_WDT)

#use i2c(Master,Fast, sda=PIN_B5, scl=PIN_B4, SMBUS, force_hw, RESTART_WDT)


Thank you so much for your help !!!!!!!

Best regards
micro_debugger
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jul 20, 2012 1:08 pm     Reply with quote

Quote:

#FUSES WDT //Watch Dog Timer Enabled

the setup_wdt(WDT_ON) is not working.

Download the 18F46J50 data sheet:
http://ww1.microchip.com/downloads/en/DeviceDoc/39931d.pdf
Look at the WDTCON bit description on page 424:
Quote:

REGISTER 26-11: WDTCON: WATCHDOG TIMER CONTROL REGISTER (ACCESS FC0h)

Read "Note 1" at the bottom and then look at your fuses (Config bits).
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