WDT is handled automatically for you by PBP in background - you don't have to do anything. If you look at the Assembler listing of any of your compiled programs, you will see a liberal sprinkling of CLRWDT instructions throughout. PBP puts them there to keep resetting the WDT so you don't have to.

The Pause instruction compiles to have a CLRWDT within it, otherwise something like Pause 10000 would cause the WDT to restart the PIC.

You would have to try real hard to get the WDT to crash a PBP program through normal code execution... here is a program that blinks a LED only on Start-Up...

'
' PIC Defines
' -----------
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F628, WDT_ON
' Watchdog Timer
@ DEVICE pic16F628, PWRT_ON
' Power-On Timer
@ DEVICE pic16F628, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F628, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F628, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F628, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic16F628, PROTECT_OFF
' Program Code Protection

MyLED var PortB.1
' LED Connected between PIC pin and Vdd via Resistor
Start:
Low MyLED
Pause 1000
High MyLED
EndlessLoop:
Pause 1000
Goto EndlessLoop
End

Now the above program will blink the LED only once when you first power-on thereafter it'll sit there till doomsday doing nothing except executing the endless loop.

You can add the following define to stop PBP from automatically resetting the WDT (see PICBasic Pro Manual under CLEARWDT command)...

DEFINE NO_CLRWDT 1

Now we don't have to try so hard to get the WDT to kick us into Reset (using our original code example)...

'
' PIC Defines
' -----------
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F628, WDT_ON
' Watchdog Timer
@ DEVICE pic16F628, PWRT_ON
' Power-On Timer
@ DEVICE pic16F628, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F628, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F628, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F628, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic16F628, PROTECT_OFF
' Program Code Protection

DEFINE NO_CLRWDT 1 ' Don't automatically insert CLRWDT's

MyLED var PortB.1
' LED Connected between PIC pin and Vdd via Resistor
Start:
Low MyLED
Pause 1000
High MyLED
EndlessLoop:
Pause 1000
Goto EndlessLoop
End

So unless you start putting CLEARWDT instructions within your code, you should see that LED blink about once every couple of seconds or so...

We can also manually force the WDT to execute a restart by rewriting our program to perform the world's tightest loop (ie a 'goto' onto itself) like so...

'
' PIC Defines
' -----------
@ DEVICE pic16F628, INTRC_OSC_NOCLKOUT
' System Clock Options
@ DEVICE pic16F628, WDT_ON
' Watchdog Timer
@ DEVICE pic16F628, PWRT_ON
' Power-On Timer
@ DEVICE pic16F628, MCLR_OFF
' Master Clear Options (Internal)
@ DEVICE pic16F628, BOD_ON
' Brown-Out Detect
@ DEVICE pic16F628, LVP_OFF
' Low-Voltage Programming
@ DEVICE pic16F628, CPD_OFF
' Data Memory Code Protect
@ DEVICE pic16F628, PROTECT_OFF
' Program Code Protection

MyLED var PortB.1
' LED Connected between PIC pin and Vdd via Resistor
Start:
Low MyLED
Pause 1000
High MyLED
EndlessLoop:
@ goto $
End

So although here PBP has sprinkled CLRWDT throughout our code, there is however no CLRWDT instruction in that 'goto' loop at the end so the WDT will kick-in after a couple of seconds or so.

Remember finally that the WDT shares the prescaler with TMR0. By default the WDT has the prescaler. Assign the prescaler to TMR0 and the WDT timeout suddenly becomes about 18mS.

Melanie