View previous topic :: View next topic |
Author |
Message |
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
18F66J60`s WDT adjustment |
Posted: Sat Mar 08, 2014 9:53 am |
|
|
Greetings! I can't change the time interval of the wdt! It's always around 32 seconds. I'm using MPlab v8.91, CCS v4.134.
Here is my code:
Code: |
#include <18F66J60.h>
#fuses HS
#fuses WDT,WDT512
#use delay(clock=10M)
void main()
{
SETUP_WDT(WDT_ON);
while(1)
{
delay_ms(32000);
}
}
|
No matter the setting I choose (WDT1, WDT2 and so on) the time for reset doesn't change - 32 seconds. How to deal with this problem?
Thanks! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sat Mar 08, 2014 10:20 am |
|
|
Is it actually resetting?.
If you are compiling through MPLAB, the default is to compile in 'debug' mode, and this turns off the watchdog...
Maybe the problem. |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Sat Mar 08, 2014 10:29 am |
|
|
I'm using the MPlab SIM and it returns wdt reset and resets the cpu! |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19504
|
|
Posted: Sat Mar 08, 2014 12:12 pm |
|
|
This may be a bug with the sim.
Compile for release mode, and try in a real chip.
Though MPLAB sim, is 99% 'right', it is not 100%.
However the other possibility is that you may be setting the time to 32 seconds with your setup_wdt line. I don't think this is needed (you are setting the watchdog to 'on' in the fuses), and on some chips this line can set the time as well. If there are time options in the .h file for this command, try these, if you want the line. (not near the compiler at present).
Best Wishes |
|
|
stoyanoff
Joined: 20 Jul 2011 Posts: 375
|
|
Posted: Sun Mar 09, 2014 11:08 am |
|
|
I changed the compiler with newer version and it works fine now!
Thanks! |
|
|
|