View previous topic :: View next topic |
Author |
Message |
Zaki
Joined: 30 Nov 2005 Posts: 8
|
WDT_2304MS ??!! |
Posted: Sat Dec 17, 2005 5:52 am |
|
|
I have this on a PIC16 code and i need to shift to a PIC18f code .. what is the translation of this on a standard header file for the 18F ??? |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sat Dec 17, 2005 8:45 am |
|
|
Generally you have to look in the data sheet to confirm this on any particular 18F processor (you didn't say which one you are using) but on the 18F6720 for example it has a separate free running WDT oscillator with an 18ms timeout. So, to get 2304, you have to set the WDT128 fuse for the 128 divider.
The WDT setup line is not required. |
|
|
Zaki
Joined: 30 Nov 2005 Posts: 8
|
|
Posted: Sun Dec 18, 2005 6:48 am |
|
|
Actually I am using a PIC 18F252 and i have really little information regarding the PIC ..I mean code wise how would i replace that command |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sun Dec 18, 2005 8:28 am |
|
|
Quote: |
Actually I am using a PIC 18F252 and i have really little information regarding the PIC ..I mean code wise how would i replace that command
|
The WDT in the 18F is setup at programming time. Add WDT128 to your fuses similar to the example below.
#fuses WDT128, PUT, BROWNOUT......
Then change the line setup_wdt(WDT_2308MS) to setup_wdt(WDT_ON)
This is all in the manual on page 198 under setup_wdt() and in the 18F252 header file.
Also, if you get the data sheet from www.microchip.com you will have virtually everything this is to know about the 18F252 hardware. |
|
|
aopg64
Joined: 17 Oct 2005 Posts: 28 Location: Hampshire, UK
|
|
Posted: Tue Jan 10, 2006 10:06 am |
|
|
Hi folks,
I too am porting some 16F code to 18F code. A while back we had problems with the silicon of the 16F876A WDT so we change our normal 2.3s WDT to 18ms via a serial command in a test mode and check that the PIC does indeed watchdog in 18ms.
I would like to port this feature, but as the 18F WDT is set in a programming fuse, I can't change it dynamically in the code.
I _know_ I probably don't need this feature anymore with the 18F, but if it is possible, it would be nice to be able to dynamically change the WDT to keep test procedures similar to the old ones.
Anyone know if it _can_ be done? It would be useful anyway as sometimes some code lock-ups are more time critical than others!
TIA,
Nigel _________________ No comment! (Can't think of anything interesting to say!) |
|
|
|