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

WDT for 16F874

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



Joined: 30 Jul 2007
Posts: 4

View user's profile Send private message MSN Messenger

WDT for 16F874
PostPosted: Mon Jul 30, 2007 8:08 am     Reply with quote

Has anyone used the WDT with the 16F874 with CCS? We have it setup in the code but the WDT does not seem to be running. We created a for loop to simulate it getting lost, but never resets. The prior assembly code had also used the WDT and it worked fine. Not sure if it is something related to CCS.

#fuses HS, WDT, NOLVP, NOPROTECT

Main ()
{

setup_wdt(WDT_2304MS);

}

the watchdog timer is reset via the code that runs the heartbeat every 200ms. I even comment out this line and still no reset. I looked at the example provided by CCS, but I see no difference in the code we use. I am going to try and load that example and give it a test.

Thanks!
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Mon Jul 30, 2007 1:56 pm     Reply with quote

Try the CCS example file for the WDT. Here's the file location.
Quote:
c:\Program Files\picc\Examples\Ex_wdt.c

Edit the file to change it from a 16F877 to a 16F874.
wwoodrow



Joined: 30 Jul 2007
Posts: 4

View user's profile Send private message MSN Messenger

WDT for 16F874
PostPosted: Wed Aug 01, 2007 9:11 am     Reply with quote

Well, I compiled the example WDT code and it worked fine.
So now I am not sure what the deal is. I compare the fuses and the setup_wdt and it all looks the same. The code we are actually putting the WDT in uses timer1 and timer2. Could those have any affect on the WDT? I guess I can start taking some code out and see if I can narrow down what might be causing it to not work in the code.

Thanks,
Walter
Ttelmah
Guest







PostPosted: Wed Aug 01, 2007 10:00 am     Reply with quote

Check you are not using Timer0 anywhere, or setting up the prescaler for this. The prescaler for this, is the WDT postscaler, and you can only use it for one or the other application, not both.

Best Wishes
wwoodrow



Joined: 30 Jul 2007
Posts: 4

View user's profile Send private message MSN Messenger

WDT for 16F874
PostPosted: Wed Aug 01, 2007 10:09 am     Reply with quote

I see not reference to timer0. What about global interrupts? Would setting that up have any affect on the WDT? Like I said before, might be best if I start striping out some of the code and see if I can isolate it.

Thanks,
Walter
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