View previous topic :: View next topic |
Author |
Message |
wwoodrow
Joined: 30 Jul 2007 Posts: 4
|
WDT for 16F874 |
Posted: Mon Jul 30, 2007 8:08 am |
|
|
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
|
|
Posted: Mon Jul 30, 2007 1:56 pm |
|
|
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
|
WDT for 16F874 |
Posted: Wed Aug 01, 2007 9:11 am |
|
|
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
|
|
Posted: Wed Aug 01, 2007 10:00 am |
|
|
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
|
WDT for 16F874 |
Posted: Wed Aug 01, 2007 10:09 am |
|
|
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 |
|
|
|