Well someone had good intentions
here but missed the mark. The 68HC11E has a COP (Computer Operating
Properly) system. When this watchdog timer is properly armed any
problems in the code, or for that matter anything that may cause the operation
of the normal program flow to stop, will time out and jump to the specified
address (in this case the top of the code) that will re-start the MPU.
For more details on how this COP timer operates you can check out the information
contained in the 68HC11 E series manuals under the CONFIG
register and the COP Reset
sections. You can see from the information about the CONFIG register
that it is actually stored in internal EEPROM and transferred to read-only
latches at power up. Once the MPU starts operating there is no way to reset
this register without a system wide reset. To change anything in
this register you have to write to EEPROM and restart the MPU for the change
to take affect. Well it looks like this step was never performed
on the MPU so the NOCOP bit is always set, permanently disabling the COP
system from ever working. All the code is in place to re-arm the
system and it looks to have no other problems, it is just turned off.
I guess that says something about the code, it doesn't have any places
to get stuck in a loop because if it did the motor would just stop dead.
It probably is a good idea to enable this function if changes are made
to the code that you are not absolutely sure are going to work.
To get the COP operating again you will have to
clear bit 2 of the CONFIG register at $103F. Being this is a write
into EEPROM you should then change your code removing this bit clear.
A better way would be to test this bit and if it is set then clear it.
This would only write once to the CONFIG register for your MPU thus saving
wear and tear on the EEPROM.