Niek van der Steen
I've a lot of problems to disable the WDT (or at least clearing it, if disabling is really not possible).
I tried the stuff posted on the internet ( ' code at .. ' ) lines, but my pic16f688.h doesn't have that defines. So I can't use them. The PIC datasheet told me for clearing, I should use CLRWDT. And for disabling, unsetting bit 3 (?). But CLRWDT is Assembly, and as I am programming in C, i really have no idea how to implement ASM.
Any suggestions ?
Help would be appreciated :) Thanks !
Take a look at for example pic16f886.h and see how the _CONFIG Register are defined there. Then just copy the #defines to your code and change the addresses according to your processor. After that you should be able to set at least the bit mask in the config registers like
code char at __CONFIG1H _conf0 = 0xef;
Another way (not tested) is to set the config registers as follows:
__config 0x300001, 0xf8
__config 0x300002, 0xfd
__config 0x300003, 0xfe
If you are lucky you find a similar processor (i.e pic16f88.h) which has the the config register together with the bit masks allready defined. They you can just copy the stuff to a private .h file
was it just an example, or is the pic16f88 really similar .. ?
nope the pic16f88 is not similar. It has two config refs while the pic16f866 only has one. You could try to add
#define _CONFIG1 0x2007
__config _CONFIG1, 0x0000
The last value depends on your project needs. You just need to make sure that bit 3 is zero to have the wdt disabled.