Watchdog timer don't work on PIC18f67J94

mikroC, mikroBasic and mikroPascal PRO for Microchip’s 8-bit PIC MCUs.
Post Reply
Author
Message
brankobr
Posts: 2
Joined: 22 Dec 2021 07:11

Watchdog timer don't work on PIC18f67J94

#1 Post by brankobr » 22 Dec 2021 07:29

I configured PIC18F67J94-I/PT as in pictures in attachment, nowhere in code didn't put CLRWDT instruction, and I expect that PIC reset after some time, but reset never happens. Can someone help me, please?
Attachments
wdt3.jpg
wdt3.jpg (138.61 KiB) Viewed 1471 times
wdt2.jpg
wdt2.jpg (138.88 KiB) Viewed 1471 times
wdt1.png
wdt1.png (38.76 KiB) Viewed 1471 times

User avatar
darko.ilijevski
Posts: 581
Joined: 21 Mar 2017 16:57

Re: Watchdog timer don't work on PIC18f67J94

#2 Post by darko.ilijevski » 23 Dec 2021 18:28

Hello,

Have you checked the config/status registers, making sure the related bits are not set property? Meanwhile, I will go through the datasheet and check if I can find a solution since we do not currently have that MCU at hand, so I can't test myself. I had doubts previously if the clock source has to be manually enabled, but the selected LPRC clock should be always ON if WDT is enabled.

EDIT: I did compare the registers with the datasheet (page 554) and think I found the problem: the parameter is named a bit counterintuitive. 'Enabled' setting actually enables software-controlled WDT by using the SWDTEN bit:

WDT.jpg
WDT.jpg (24.11 KiB) Viewed 1423 times

The highlighted parameter is called "Watch Dog Timer Enable > Enabled" in mikroC PRO. This will set the WDT bits of the CONFIG6H register to 10. You can see in the screenshot above what it actually means.
I don't know if this was the intended use, but if you want WDT to operate autonomously of the software, you should set the configuration parameter as on the image below:

WDT_cfg.jpg
WDT_cfg.jpg (7.9 KiB) Viewed 1429 times

Please, let me know if you managed to solve your issue.

Best regards,
Darko
BR,
Darko

brankobr
Posts: 2
Joined: 22 Dec 2021 07:11

Re: Watchdog timer don't work on PIC18f67J94

#3 Post by brankobr » 24 Dec 2021 07:34

I tried to do this, and now all works as expected. I supposed that there is a bug in compiler because it's very unlikely that the watchdog system in a PIC does not work.

User avatar
darko.ilijevski
Posts: 581
Joined: 21 Mar 2017 16:57

Re: Watchdog timer don't work on PIC18f67J94

#4 Post by darko.ilijevski » 24 Dec 2021 10:38

Great, I am happy it works.
My originally wrong assumption about the internal clock led me to check the config registers, just in case.

In either case, I wish you success with your project.

Happy holidays and best regards,
Darko
BR,
Darko

Post Reply

Return to “PIC PRO Compilers”