Watchdog timer don't work on PIC18f67J94
Watchdog timer don't work on PIC18f67J94
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 (138.61 KiB) Viewed 1479 times
-
- wdt2.jpg (138.88 KiB) Viewed 1479 times
-
- wdt1.png (38.76 KiB) Viewed 1479 times
- darko.ilijevski
- Posts: 581
- Joined: 21 Mar 2017 16:57
Re: Watchdog timer don't work on PIC18f67J94
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:
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:
Please, let me know if you managed to solve your issue.
Best regards,
Darko
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:
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:
Please, let me know if you managed to solve your issue.
Best regards,
Darko
BR,
Darko
Darko
Re: Watchdog timer don't work on PIC18f67J94
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.
- darko.ilijevski
- Posts: 581
- Joined: 21 Mar 2017 16:57
Re: Watchdog timer don't work on PIC18f67J94
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
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
Darko