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

PIC18F2620 watchdog issue

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







PIC18F2620 watchdog issue
PostPosted: Tue Jan 17, 2006 3:46 pm     Reply with quote

Interesting problem. I set the fuses on the chip to WDT128 and then as I enter my code segment I say setup_wdt(WDT_OFF). In the simulator, this sets WDTCON to 0 in the watch window. When I call setup_wdt(WDT_ON) WDTCON shows a 01 implying that the WDT is on. However, when I download this same code to the target, the unit resets under a watchdog recovery condition as if the setup_wdt(WDT_OFF) was never called. Any suggestions? Seems as if this is a compilier issue and I may have to inline some assembler to resolve it.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 17, 2006 3:54 pm     Reply with quote

Post a small but complete test program and post your compiler version.
Seth
Guest







PostPosted: Tue Jan 17, 2006 5:18 pm     Reply with quote

I was just reading the 18F2620 spec and it says the following note about the WDTCON register :

bit 0 SWDTEN: Software Controlled Watchdog Timer Enable bit(1)
1 = Watchdog Timer is on
0 = Watchdog Timer is off
Note 1: This bit has no effect if the configuration bit, WDTEN, is enabled.

Notice Note 1. This seems to suggest to me that if you use the fuse WDT128 that the configuration bit will be set and software will have no control over this register. This implies to me that I would have to do NOWDT as my configuration setting and then somehow set the speed of the WDT elseswhere which is not possible with the way the CCS compiler is set up. I will keep looking.
Seth
Guest







another work around not working right
PostPosted: Tue Jan 17, 2006 6:08 pm     Reply with quote

So I'm manually trying to set the watchdog configuration bit so I can work around this watchdog issue. I turned to the write_configuration_memory function and did the following:

int addr[3];
addr[0] = 0x01; //XT osc
addr[1] = 0x19; // power up timer disabled brown out disabled
addr[2] = 0x0E; // disabled WDT 128
// set the configuration bytes
write_configuration_memory(addr, 3);

Problem is is that the target now stalls completely. Any suggestions?
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Jan 17, 2006 9:36 pm     Reply with quote

Quote:
Any suggestions ?


Post a small but complete test program that shows the problem
and post your compiler version.
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