You need to log in to create posts and topics.

Support for Watch Dog Timer ?

Hi All,

First of all, thanks for providing SimulIDE . Its very useful and awesome simulator!

I am using it for a circuit that uses PIC16F72 (Though this uC is not supported, I was able to use p16F873-2). I am stuck at simulating Sleep and wakeup by Watch Dog Timer (WDT) on any PIC in SimulIDE. 

Note : On the physical uC PIC16F72 WDT is working fine.

I have written small program (Attached) to try WDT with p16F627-10 (As it has Enable WD in its Properties->config) But as soon as I start the simulation, following message is show repeatedly in the console and nothing works.

McuWdt::runEvent - Watchdog Reset

But the same program is working as expected in MPLAB X IDE 6.25's Simulator.

Any suggestion would be highly appreciated.

Thanks in Advance.

-Guru

Uploaded files:

Hi, thanks for reporting.
Can you share the hex file to test it?

Hi @arcachofo,

Thanks for the reply. Please find the attached hex file for the same.

Regards,

-Guru

Uploaded files:

Thank you.
Fixed and re-uploaded files at rev 2061:
https://simulide.com/p/testers/ 

Gururaj has reacted to this post.
Gururaj

Hi @arcachofo,

Wow, that was pretty quick. Thank you so much. Working absolutely fine. Apologies if I am calling with a wrong name.

I need a suggestion. Since 16F72 was missing I used 16F873 for my simulation. But 16F873 is missing Watch Dog Timer in Config window. Hence just for simulating WDT I am using PIC16F627 as it has Enable WDT in config window as shown in the attached image. Is there a way to enable WDT for 16F873? Please suggest. 

Thanks and Regards,

Guru

Uploaded files:
Quote from Gururaj on April 18, 2025, 4:35 pm

Hi @arcachofo,

Wow, that was pretty quick. Thank you so much. Working absolutely fine. Apologies if I am calling with a wrong name.

I need a suggestion. Since 16F72 was missing I used 16F873 for my simulation. But 16F873 is missing Watch Dog Timer in Config window. Hence just for simulating WDT I am using PIC16F627 as it has Enable WDT in config window as shown in the attached image. Is there a way to enable WDT for 16F873? Please suggest. 

You can fix 16F873 Watchdog.
Open file in Editor: data/PIC/p16F87x/p16F87x_perif.xml

 

And add these lines before configwords and save:

  <wdt name="WDT" configregsA="OPTION"
                  prescalers="1,2,4,8,16,32,64,128"/>

The end of the file should look like this:

    <spi name="SPI"  configregsA="SSPCON" 
                     dataregs="SSPBUF" 
                     statusreg="SSPSTAT"
                     interrupt="SSP" 
                     prescalers="4,16,64,0"
                     pins="PORTC5,PORTC4,PORTC3,PORTA5"/><!-- "SD0,SDI,SCK,SS" -->
  </msspunit>

  <wdt name="WDT" configregsA="OPTION"
                  prescalers="1,2,4,8,16,32,64,128"/>
  
  <configwords name="cfgWord" type="02">
    <word name="COINFIG1" address="0x2007" value="0xFF" />
    <word name="COINFIG2" address="0x2008" value="0xFF" />
  </configwords>
  
</parts>

 

Gururaj has reacted to this post.
Gururaj

Thanks for the suggestion. That got me the WDT for 16F873.

But CLRWDT() or __asm("clrwdt") is not honored and as per the configuration every 2.3 seconds 16F873 is getting reset (

McuWdt::runEvent - Watchdog Reset) even if CLRWDT() or __asm("clrwdt") is called within 100 msecs.

Its not the issue with only 16F873. But even in PIC16F627 same issue is happening. I have attached a Blink.c, Blink.Hex and Blink.sim1 files for your reference. If CLRWDT() or __asm("clrwdt") is honored, LED should blink 5 times with a delay of 500 msec. Almost at 1.5 Secs, uC is reset with WDT. Can CLRWDT() be considered in any way? Please suggest.

Thanks and Regards,

Gururaj

 

Uploaded files:

But CLRWDT() or __asm("clrwdt") is not honored and as per the configuration every 2.3 seconds 16F873 is getting reset (

Yes, it would be good that we could clear the watchdog...

I think it is solved, but I'm not going to build for all OS.
Here you have Windows 64 version to test it: SimulIDE_1.1.0-16F72.zip

BTW: I added PIC16F72, but I didn't test it at all, feel free to give it a try.

Gururaj has reacted to this post.
Gururaj

Its working absolutely fine now. I used Pic16F72 and working as expected along with WDT. Thank you so much.

Regards,

Gururaj