the code sets up the wdt to wake the mcu up ever 160ms.
Once the mcu wakes up, it sets up the port / wdt, and then goes into the main while() loop.
in the main while loop, it checks to see if it is waking up. if it is, it increments a counter (wdt_counter). and then it outputs the wdt_counter on LED_PORT (GPIO here). after that, it goes into an infinite loop.
what you will see is that GPIO's pins will increment with each reset (every 160ms), with the exception that GPIO3 will not change as it is an input only pin on this mcu.
the code is compiler so that it does NOT clear data segments (bss Psects in Hi-Tech PICC talk).
Once the mcu wakes up, it sets up the port / wdt, and then goes into the main while() loop.
in the main while loop, it checks to see if it is waking up. if it is, it increments a counter (wdt_counter). and then it outputs the wdt_counter on LED_PORT (GPIO here). after that, it goes into an infinite loop.
what you will see is that GPIO's pins will increment with each reset (every 160ms), with the exception that GPIO3 will not change as it is an input only pin on this mcu.
the code is compiler so that it does NOT clear data segments (bss Psects in Hi-Tech PICC talk).
here is the sim.
hope it helps.
(原文件名:12f675 wdt.PNG)
一周热门 更多>