Page 1 of 1

clr_wdt compiler error

Posted: Wed Feb 12, 2014 11:31 am
by Rabbit
Hello experts,
I use:
- PIC16F877A
- Flowcode V5.5.2.1
- Compiler Version 7.04
- C-code-icon line: clr_wdt();

The C-compiler generates an error: error: unknown identifier 'clr_wdt()'
I don't know why.

I would be pleased about your help.

Rabbit

Re: clr_wdt compiler error

Posted: Wed Feb 12, 2014 7:05 pm
by medelec35
Hi Rabbit,
By far the best way to clear the watchdog timer is with:
MX_CLEAR_WATCHDOG;

Within a C code block.
Using that will mean it will work with both boostC and Ht-Tec compilers with no issues.

Martin

Re: clr_wdt compiler error

Posted: Tue Feb 18, 2014 10:47 am
by Rabbit
Hello Martin,
I tested your command and all is well.
Have many thanks
Rabbit

Re: clr_wdt compiler error

Posted: Tue Feb 18, 2014 6:16 pm
by medelec35
Hi Rabbit,
Glad it works for you.

Thanks for letting us know.

Martin

Re: clr_wdt compiler error

Posted: Wed Feb 19, 2014 7:03 am
by Rabbit
Hello everybody,
Please note: for correct working with the WatchDogTimer the OPTION_REG Register use 4 bit,
bit 2-0 (prescaler rate select bit) and
bit 3 (1 = presclaer is assigned to the WDT; 0 = presclaer is assigned to the Timer0 module)

The table is showing the bit assignments with the devision rates and the time for the WDT to time out including bit 3:

-Bit----Hex ----Rate---WDT-Time[ms]
1000---0x08----1:1-------18
1001---0x09----1:2-------36
1010---0x0A----1:4-------72
1011---0x0B----1:8------144
1100---0x0C----1:16----288
1101---0x0D----1:32----576
1110---0x0E----1:64----1100
1111---0x0F----1:128---2300

Remember these times are irrespective of the external clock frequency.
The C-Code for 1.1sec time out is e.g.
option_reg=0x0E

Rabbit