I don't think the microcontroller freezing would be a problem. You can just have a watchdog timer set so that the program restarts in like 1 second if the microcontroller freezes up. Then the program just goes right back to its charging algorithm. I guess you would have to make sure that you start the charging algorithm sort of passively, to see if the battery is mostly charged already? So that if it hangs repeatedly and keeps starting over, it wouldn't be hard on a fully charged battery.
By the way, I never knew what watchdog was until like 1 month ago. The watchdog is a separate timer that keeps counting even if the microcontroller freezes up. If it ever reaches its max, it triggers a reset of the program. So, you put code in that makes sure the watchdog keeps starting over so it never reaches its max value (that you choose). That way, if the code stops running for some reason, the watchdog triggers a reset. It's awesome! ya!
|