BACKGROUND OF THE INVENTION
1. Field of the Invention
This invention relates to a runaway detecting system for a CPU for detecting the runaway of the CPU to prevent in advance a motor or a circuit from damaging due to the runaway of the CPU in a software.
2. Description of the Prior Art
Generally, a specific program for detecting the runaway of a CPU has not yet presented. Thus, an operator has observed the runaway of the CPU after the process has become improper so that the motor or the circuit has already been damaged.
SUMMARY OF THE INVENTION
Accordingly, an object of this invention is to provide a runaway detecting system for a CPU which can overcome the above-mentioned drawbacks and which can detect the runaway of the CPU in a software to prevent in advance the motor or the circuit from damaging due to the runaway of the CPU.
In order to achieve the above object, there is provided according to the present invention a runaway detecting system for a CPU comprising a resetter circuit started by the ON of a power source ON or the output of the CPU for outputting a reset signal to the system including the CPU, and first and second runaway detecting programs, the first runaway detecting program for incrementally or decrementally counting an error by a periodic timer interrupt and overflowing the timer when the error count coincides with a predetermined value, the second runaway detecting program for processing when a timer of the second runaway detecting program is restarted in a short period and outputting a drive signal of the resetter circuit.
(Operation)
Since the runaway of the CPU is always managed by the runaway detecting system for the CPU with the construction as described above to detect the runaway of the CPU, the set counter is not cleared even when the interrupts of certain times are executed by the interrupt of the timer, and when it arrives at the set value, it is regarded as being that a malfunction (runaway) occurs in the processing state of the CPU to process an initialization. Or, when the output phases of the motor are fully outputted or the same phases are excited for a predetermined time or longer, the process is executed similarly to be regarded as being that the runaway of the CPU similarly occurs. Thus, it can prevent in advance the motor or the circuit from being damaging due to the runaway of the CPU in a software.
The above and other related objects and features of the invention will be apparent from a reading of the following description of the disclosure found in the accompanying drawings and the novelty thereof pointed out in the appended claims.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of the construction of a hardware to execute a runaway detecting system for a CPU according to the present invention;
FIG. 2 is a flowchart for indicating the main process; and
FIG. 3 is a flowchart for indicating the runaway detecting process.
DESCRIPTION OF THE PREFERRED EMBODIMENTS
An embodiment of a runaway detecting system for a CPU according to the present invention will be described in detail with reference to FIGS. 1 to 3.
FIG. 1 is a block diagram of the hardware for executing the runaway detecting system for the CPU according to the invention. In FIG. 1, reference numeral 1 designates a CPU. Reference numeral 2 denotes a resetter circuit. The resetter 2 is connected to a power switch 3 and the CPU 1, and is started by the ON of the power switch 3 or the output of the CPU 1 to output a reset signal to the CPU 1 and other system units.
FIG. 2 is a flowchart for indicating the main process of the runaway detecting system for the CPU according to the invention. The runaway detecting system starts the first runaway detecting program after turning OFF the runaway detection output from the initialized state of the CPU 1. When the first runaway detecting program is started, it flows a loop while receiving a periodic interrupt signal of a timer during resetting of the error counting.
Further, FIG. 3 shows a flowchart for indicating the process for detecting the runaway of the CPU. The first runaway detecting program which receives the periodic interrupt by the timer incrementally or decrementally counts the error by the interrupt. Then, decision whether the error count coincides with the preset predetermined value or not is made. If not coincident, the timer of the second runaway detecting program is restarted (reset) so that the second runaway detecting program is not processed by the overflowing interrupt of the timer, and is returned to a main loop. In this case, before returning to the main loop, decision for comparing the value of the timer of the second runaway detecting program with a predetermined value is made, and the process is returned only when the value of the timer is smaller than the predetermined value. The decision for comparing the value of the second timer with the predetermined value concretely checks whether the timer of the second runaway detecting program is restarted or not in a short period (predetermined time). When arriving at the predetermined value, a malfunction occurs in the program so that a reason, such as no passage of a normal loop, exists. Accordingly, the second runaway detecting program is processed irrespective of the error count by the first runaway detecting program, i.e., the resetter 2 is driven to output a reset signal and to initialize the CPU 1.
When the error count coincides with the predetermined value by the first runaway detecting program, the timer of the second runaway detecting program is not started (reset), but the overflow of the timer occurs to drive the resetter 2. In other words, in FIG. 3, the flowing lines (1) or (2) is conducted only when the CPU 1 is regarded as being run away.
The runaway detecting system for the CPU according to the invention as described above automatically processes (carries out) the second runaway detecting program by the overflow of the timer when the first runaway detecting program is stopped by the runaway, and when the second runaway detecting program is stopped by the runaway, it is automatically restarted by the first runaway detecting program. Even when the second runaway detecting program does not pass the normal loop or the interrupt of the timer is executed within a predetermined time due to a cause, such as a malfunction in addressing, the resetter 2 is driven to process the resetting.
According to the runaway detecting system for the CPU in accordance with the present invention as described above, the process, such as an initialization is immediately executed when the CPU is regarded as being run away to prevent in advance the motor or the circuit from being damaging due to the runaway of the CPU in a software.