Abstract:
An abnormal watching method for a microcomputer including a flow watching step for determining whether the flow of the microcomputer is normal or not, sending a normal signal when it is determined that the flow of the microcomputer is normal, and reading an internal register of the microcomputer, comparing the value of the internal register with an initial value of the internal register, and suspending the sending of the normal signal when the value of the internal register is not equal to the initial value, and an abnormal watching device for a microcomputer using this method.

Description:
FIELD OF THE INVENTION 
     This invention relates to an abnormal watching device and an abnormal watching method for a microcomputer, and more particularly to an abnormal watching device and method for a microcomputer which is provided with a safety system for determining an abnormal movement of the microcomputer. 
     BACKGROUND OF THE INVENTION 
     This kind of system is mentioned in a Japanese patent application No. 61(1986)-6061. This application discloses a system having a fail-safe means. The fail-safe means consists of a generation means which is included in a microcomputer as a program, and is operable for generating a pumping signal which has a constant frequency or duty ratio, and a driving means which judges whether the frequency or duty ratio of the pumping signal from the generation means is normal or not, and the driving means is operable for driving an actuator to a &#34;safety side&#34; in the abnormal case. 
     In a Japanese patent Laid-open application No. 60(1985)-205373, the same kind of system is mentioned. This application discloses a system having a fail-safe means in the same way. The fail-safe means consists of a generation means which is included in a microcomputer as a program and is operable for generating a pumping signal which has a constant frequency, and a resetting means which judges whether the frequency is normal or not, and the resetting means is operable for resetting the microcomputer in the abnormal case. 
     In these prior art systems, the generation means is included in a program of the microcomputer. For example, a step for setting a pumping flag as &#34;1&#34; is set to a place which is surely passed in a main routine of the microcomputer, and in a timer interrupt of the microcomputer, the pumping signal is turned over when the pumping flag is set as &#34;1&#34;. If the movement of the microcomputer is normal, then the pumping signal is turned over at a constant interval, and therefore the abnormality of the microcomputer can be detected. 
     SUMMARY OF THE INVENTION 
     However, the prior art systems are unable to consider that the main routine and timer interruption of the microcomputer are normal and the other part abnormal. For example, a microcomputer has a data direction register for setting a port whether input port or output port. If the value of the data direction register is changed from the initial predetermined value to another value by some reason, a port used as an input port is changed to an output port and a port used as an output port is changed to an input port. At this time, the control system is not normally actuated, and further it is possible to fail by a short circuit between the port of the microcomputer and the external circuit connected to the port of the microcomputer. However, the main routine of the microcomputer and the timer interruption are normally actuated so that the pumping signal shows that the microcomputer is normal. On the other hand, a microcomputer has some interruption functions. However, if the value of a masking register for determining the allowance and disallowance of the interruption is changed from the initial predetermined value to another value by some reason, a necessary interruption is not actuated or an unnecessary interruption is actuated so that the usual function cannot be satisfied. However, the main routine of the microcomputer and the timer interruption used for the pumping process is actuated as usual, so that the pumping signal shows that the microcomputer is normal. 
     Accordingly, the conventional system is not provided with a protect means against the fail of the microcomputer in which the value of the internal register of the microcomputer is replaced to another value. 
     An object of the invention is to provide an abnormal watching device and method for a microcomputer which has a protect means against the situation in which the value of the internal register of the microcomputer is replaced to another value. 
     Other and further objects of this invention will become apparent upon an understanding of the illustrative embodiments about to be described or will be indicated in the appended claims, and various advantages not referred to herein will occur to one skilled in the art upon employment of the invention in practice. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 shows a circuit diagram of an embodiment of the invention. 
     FIG. 2 shows a circuit diagram of a runaway resetting circuit in FIG. 1. 
     FIG. 3 shows a flow chart of a main routine of the microcomputer in FIG. 1. 
     FIG. 4 shows a flow chart of a timer interruption routine of the microcomputer in FIG. 1. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     In the exemplary embodiment of the invention as disclosed in the drawings, FIG. 1 illustrates a circuit diagram of a circuit that uses the abnormal watching device and resets the microcomputer at the abnormal state. An output port P0 of a microcomputer 1 is connected to an input port P1 of a runaway resetting circuit 2. An output port P2 of the runaway resetting circuit 2 is connected to an resetting terminal RESET of the microcomputer 1. A pumping signal is sent from the output port P0 to the input port P1. 
     FIG. 2 illustrates a circuit diagram of the runaway resetting circuit 2. The input port P1 is connected to an input of a frequency-voltage exchange circuit F/V and a duty ratio-voltage exchange circuit D/V, respectively. The duty ratio-voltage exchange circuit D/V may include a low pass filter or an integrated circuit. An output of the frequency-voltage exchange circuit F/V and a threshold voltage VFH are connected to two input terminals of a comparator COMP1, respectively. An output of the frequency-voltage exchange circuit F/V and a threshold voltage VFL are connected to two input terminals of a comparator COMP2, respectively. The threshold voltage VFH is set larger than the threshold voltage VFL. Each output port of the comparator COMP1 and COMP2 are connected to an input terminal of an AND circuit AND1. An output of the duty ratio-voltage exchange circuit D/V and a threshold voltage VDH are connected to two input terminals of a comparator COMP3, respectively. An output of the duty ratio-voltage exchange circuit D/V and a threshold voltage VDL are connected to two input terminal of a comparator COMP4, respectively. The threshold voltage VDH is set larger than the threshold voltage VDL. Each output port of the comparator COMP3 and COMP4 are connected to an input terminal of an AND circuit AND2. The output port of the AND circuits AND1 and AND2 are connected to two input terminals of an AND circuit AND3, respectively. The output terminal of the AND circuit AND3 is connected to the output port P2. 
     This runaway resetting circuit 2 acts as follows. When the output voltage of the frequency-voltage exchange circuit F/V is larger than the threshold voltage VFH or smaller than the threshold voltage VFL, the output of each of the comparators COMP1 or COMP2 is turned to a low level, and therefore the output of the AND circuit AND1 is turned to a low level. When the output voltage of the duty ratio-voltage exchange circuit D/V is larger than the threshold voltage VDH or smaller than the threshold voltage VDL, then the output of each of the comparators COMP3 or COMP4 is turned to a low level, and therefore the output of the AND circuit AND2 is turned to a low level. When the output of the AND circuit AND1 or AND2 is a low level, then the AND circuit AND3 outputs a low level signal. Accordingly, when the frequency or the duty ratio of the input port P1 is out of the area of frequency and duty ratio decided by threshold voltages VFL, VFH, VDL and VDH, the voltage of the output port P2 is turned to a low level. When the frequency or the duty ratio of the input port P1 is in the area of frequency and duty ratio decided by threshold voltages VFL, VFH, VDL and VDH, the voltage of the output port P2 is turned to a high level. The output port P2 is connected to the resetting terminal RESET of the microcomputer 1, and when the resetting terminal RESET is turned to a low level, the microcomputer 1 is reset. Accordingly, when the frequency or the duty ratio of the signal supplied from output P0 of microcomputer 1 to input port P1 is abnormal, then the microcomputer 1 is reset. 
     FIG. 3 and FIG. 4 illustrate flow charts of the microcomputer 1. After the microcomputer 1 starts, the value of the memory or internal register in the microcomputer 1 is initialized. The microcomputer 1 has a data direction register DDR, a timer control register TCR, a miscellaneous register MR, an SCI control register SCR and an SCI status register SSR. The data direction register DDR is a register for setting input-output common terminals to determine an input port or an output port, respectively. The timer control register TCR is a register for controlling a choice of clock source for prescaler, a choice of prescaler division ratio and a timer interrupt request. The miscellaneous register MR is a register for controlling external interrupts. The SCI control register SCR is a register for controlling a serial communication interface (SCI). The SCI status register SSR is a register for deciding the status of the SCI. In step 30, these registers are set to value D1, D2, D3, D4 and D5 which are initial values, respectively. 
     In step 31, a value &#34;1&#34; is set to a pumping flag which decides whether a pumping signal may be sent to the runaway resetting circuit 2 or not. After that, an original disposition of the device including the abnormal watching device is executed in step 32. 
     After the step 32, it is checked in steps 33 to 37 to determine whether the value of the inner register are the same as their initial values or not. When the value of the data direction register DDR, the timer control resister TCR, the miscellaneous register MR, the SCI control register SCR and SCI status register SSR are D1, D2, D3, D4 and D5, respectively, step 31 is executed. When at least one of the values of these registers is not equal to its respective value, then step 38 is executed. In step 38, the pumping flag is set to &#34;0&#34;, and an endless loop is executed. The microcomputer cannot leave the endless loop except by the resetting of the microcomputer 1. The above steps 33 to 38 consist of an internal register comparative means. 
     The microcomputer 1 has a timer interruption. A timer for the interruption is decreased by one whenever one machine cycle is passed. When the timer for the interruption is made equal to &#34;0&#34;, a timer interruption routine in FIG. 4 is executed. The steps 31, 40 and 48 consist of flow watching means and the steps 41 to 47 consist of a signal sending means. 
     In step 40, when the value of the pumping flag is &#34;1&#34;, step 41 is executed. When the value of the pumping flag is &#34;0&#34;, the timer interruption ends and directs the process back to the main routine. In step 41, a pumping direction flag is checked. The pumping direction flag is programmed to indicate the polarity of the pumping output. The pumping direction flag becomes &#34;1&#34; when the polarity of the output of the pumping is &#34;H&#34; (HIGH) and becomes &#34;0&#34; when the polarity of the output of the pumping is &#34;L&#34; (LOW). When the present polarity of the pumping output is &#34;L&#34;, a high level signal is sent from output port P0 in step 42 and the polarity of the pumping output is turned to &#34;H&#34;. After that, the pumping direction flag is turned to &#34;1&#34; and a time until the next timer interruption is set. When the present polarity of the pumping output is &#34;H&#34;, a low level signal is sent from output port P0 in step 45 and the polarity of the pumping output is turned to &#34;L&#34;. After that, the pumping direction flag is turned to &#34;0&#34; and a time until the next timer interruption is set. In step 48, the pumping flag is turned to &#34;1&#34; and the timer interruption is ended. 
     If the main routine is executed normally, then the step 31 is surely executed so that the pumping flag becomes &#34;1&#34; at the timer interruption. Accordingly, an On-Off signal is sent from output port P0 based on the timer set by step 44 and step 47. Accordingly the frequency and duty ratio of the signal is constant. If the main routine is abnormal and the step 31 is not executed, then the polarity of the output port P0 is not turned at the timer interruption so that the frequency and duty ratio of the signal from the output port P0 is disturbed. In this case, the microcomputer 1 is reset by the runaway resetting circuit 2. 
     Moreover, when the value of an internal register of the microcomputer 1 is changed from the initial value to another value, the polarity of the output port P0 is not turned at the timer interruption so that the frequency and duty ratio of the signal from the output port P0 is disturbed. Accordingly, the microcomputer 1 is reset by the runaway resetting circuit 2. 
     In this embodiment, the runaway resetting circuit 2 resets the microcomputer 1, however the runaway resetting circuit is able to initialize the other circuit, for example, the driving circuit of the load. 
     While I have shown and described particular embodiments of my invention, it will be obvious to those skilled in the art that various changes and modifications may be made without departing from my invention in its broader aspects and I, therefore, intend in the appended claims to cover all such changes and modifications as fall within the true spirit and scope of my invention.