摘要 |
According to the method of the present invention for detecting errors in executing a program including a main routine and an interrupt routine in a microprocessor, execution errors can be detected irrespective of whether it occurred in a main routine or an interrupt routine. A cancel code for a watchdog timer is entered in the variable value data DT in the main routine, and a count value TC of a watchdog canceling timer is incremented by one in the interrupt routine. If the count value TC has reached a prescribed value, the value of the data DT is supplied to the watchdog timer, and both the count value TC and the data DT are set to zero. In case of an execution error preventing the program flow from advancing from the main routine to the interrupt routine, the data DT is not supplied to the watchdog timer, and the watchdog time is allowed to reset the microprocessor. In case of an execution error preventing the program flow from returning from the interrupt routine to the main routine, the data DT is may be supplied to the watchdog timer but because the data DT continues to hold the zero value, the watchdog time is again allowed to reset the microprocessor. Therefore, in either case, the watchdog timer is not canceled, and the microprocessor is reset by the watchdog timer circuit without fail.
|