Microprocessor fault-monitoring circuit
BACKGROUND OF THE INVENTION 
     The present invention relates to a fault-monitoring circuit for a microprocessor. 
     DE-OS 29 46 081 discloses a microprocessor fault-monitoring circuit in which a clear signal is provided by the microprocessor after each complete program run of the microprocessor. An oscillator provides a clock signal of predetermined frequency which is fed to a count-down binary counter. At the end of each program cycle, the counted-down count of the counter is compared to a predetermined count to determine whether the program run was fault free. 
     Computer Module M74005-A 8810 (Siemens TELEPERM C System) includes a microprocessor having a test signal output connected to the trigger input of a monostable multivibrator. If the timing of the test signal provided by the microprocessor to the trigger input of the monostable multivibrator is not correct, the monostable multivibrator is not triggered and &#34;times out&#34;, thereby providing a level change at the output of the monostable multivibrator. The multivibrator output is coupled to the microprocessor reset input and the level change not only resets the microprocessor, but is also used as a fault indication to indicate that the program cycle of the microprocessor did not proceed correctly. 
     U.S. Pat. No. 4,072,852 discloses a computer monitoring system in which periodic test pulses are generated by the central processing unit of the computer at the same frequency as the clock signal of an oscillator. An additional address code of the central processing unit is however required in order to carry out a monitoring sequence and additional circuitry is required to decode the address. 
     OBJECTS AND SUMMARY OF THE INVENTION 
     It is an object of the present invention to provide a circuit for monitoring a microprocessor. 
     It is another object of the present invention to provide such a circuit with a minimum amount of circuitry. 
     It is another object of the present invention to provide a fault-monitoring circuit for a microprocessor which after detecting a fault can provide a reset to the microprocessor or inhibit the microprocessor if the fault persists. 
     The above and other objects are achieved by the invention disclosed herein according to which a reference signal is compared in frequency with a test signal provided by a microprocessor. A difference in the frequencies of the two signals is indicative of a fault in the microprocessor. In accordance with an aspect of the invention, the microprocessor can reset and continue to run if the fault persists for less than a predetermined time, otherwise the microprocessor will be inhibited and prevented from continuing. 
     According to a preferred embodiment, frequency comparison is provided by a counter to which the two signals are supplied. The reference signal is provided as a clock signal to the counting input of the counter and the microprocessor test signal is provided to the reset input of the counter. If the counter is not reset by the microprocessor test signal for each clock pulse supplied to the counting input, the counter is permitted to count and provides an output indicative of a fault. 
     In accordance with a preferred embodiment, a fault-monitoring circuit is provided in which a clock oscillator of predetermined frequency is coupled to the counting input of the counter and the microprocessor test output is coupled to the reset input of the counter. One output of the counter is coupled to the input of a first logic circiut and the output of the first logic circuit is coupled to an input of the microprocessor. Another counter output is coupled to another input of the first logic circuit and also preferably to a fault indicator. A second logic circuit is provided between the oscillator and the counter, the oscillator being coupled to one input of the second logic circuit, the second counter output being coupled to another input of the logic circuit, and the output of the logic circuit being coupled to the counting input of the counter. The first logic circuit provides a reset signal to the microprocessor in response to the one output of the counter and an inhibit or disable signal to the microprocessor in response to the other output of the counter. A fault indication is also given in response to the other output of the counter and the monitoring circuit is latched or locked. The test signal output of the microprocessor can be its synchronizing output. 
     In order to allow the microprocessor sufficient time to reset in the event of a temporary disturbance, the second counter output is selected to provide an output signal a predetermined time after the first counter output provides an output signal. Preferably, the two counter outputs are not from adjacent counting stages. 
     It is further preferred that a four bit binary counter be used and that the first and second outputs be the second and fourth bit outputs, respectively, although other outputs of the binary counter can be used. 
     To manually reset a latched circuit which continually provides a rest (inhibit) signal to the microprocessor, a switch is connected to the logic cirucit so that the reset input to the microprocessor can be reset. 
     One advantage of the invention is that a reset signal is provided to the microprocessor a short time after the test signal output of the microprocessor changes, indicative of a fault but without a fault indication being given. If proper operation is resumed within a predetermined time, i.e. if the test signal output of the microprocessor is restored to its proper condition, no fault indication is given and the microprocessor and the monitoring circuit continue to function. If the fault persists after the predetermined time, i.e. the microprocessor is not restarted or not restarted properly and the microprocessor test signal remains different from the oscillator signal, then a fault indication is given and the microprocessor is inhibited or disabled by an appropriate signal applied to its reset input. 
     Another advantage of the invention is that such monitoring operation is achieved with a relatively small amount of circuitry. 
     In the circuit according to the invention, the logic circuits may take different forms. However, an OR gate is preferred. 
     The above and other objects, features, aspects and advantages of the present invention will be more readily perceived from the following description of the preferred embodiments thereof when considered with the accompanying drawings and appended claims. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     The present invention is illustrated by way of example and not limitation in the figures of the accompanying drawings in which like references indicate similar parts or signals and in which: 
     FIG. 1 is a block diagram of a monitoring circuit according to the invention; 
     FIG. 2 is a timing diagram of signals a-i of the circuit of FIG. 1 for a fault-free microprocessor run; 
     FIG. 3 is a timing diagram of signals a-i of the circuit of FIG. 1 for a microprocessor run during which a correctable fault occurs; 
     FIG. 4 is a timing diagram of signals a-i of the circuit of FIG. 1 for a microprocessor run during which a non-correctable fault occurs. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENTS 
     Referring first to FIG. 1, the output 1, e.g. the synchronizing output, of a microprocessor 2 is coupled to the reset (or clear) input 5 of a binary counter 4 through a capacitor 3 to provide test signals to the counter. The output 7 of a logic circuit 8 is coupled to the counting input 6 of the counter 4. The logic circuit 8 in the illustrated embodiment is an OR gate. The output 10 of a clock oscillator 11 is coupled to the input 9 of the OR gate 8. In the illustrated embodiment, the counter 4 is a four bit binary counter and has four outputs 12, 13, 14 and 15. Output 12 can be a divide-by-two, output 13, a divide-by-four, output 14, a divide-by-eight, and output 15, a divide-by-16, although other divisions can be used. The counter output 13 corresponding to the second bit (divide-by-four) of the counter is connected to one input 16 of a further logic circiut 17. In the illustrated embodiment, logic circuit 17 is also an OR gate. The counter output 15 (divide-by-16) of the fourth bit of the counter is coupled to the other input 18 of the OR gate 17. In addition, counter output 15 is coupled to a signal generator designated 19 and to the other input 20 of OR gate 8. The output 21 of the OR gate 17 is coupled to the reset input 22 of the microprocessor 2. The signal generator 19, can be, for example, an LED coupled to ground through a limiting resistor. 
     Operation of the circuit illustrated in FIG. 1 will be described with reference to the timing diagrams of FIGS. 2-4. In FIGS. 2-4 &#34;a&#34; is the clock pulse output signal of oscillator 11; &#34;b&#34; is the test signal output from output 1 of microprocessor 2; &#34;c&#34; is the input signal to the input 5 of counter 4; &#34;d&#34;-&#34;g&#34; are the first to the fourth bit signals present at the first-fourth counter outputs 12-15, respectively; &#34;h&#34; is the signal at the reset input 22 of microprocessor 2; and &#34;i&#34; is the signal at the signal generator 19 output. 
     Referring first to FIGS. 1 and 2, the clock output pulses &#34;a&#34; of oscillator 11 are fed to the input 9 of OR gate 8. The frequency of the clock pulse output signal &#34;a&#34; of the oscillator 11 is chosen so that it corresponds to the frequency of the test signal &#34;b&#34; appearing at the output 1 of the microprocessor. For an error free program cycle, the pulse signal &#34;b&#34; (and the signal &#34;c&#34; derived from signal &#34;b&#34;) corresponds in frequency with the clock pulse signal &#34;a&#34; of the oscillator 11, as depicted in FIG. 2. With such a correspondence, the binary counter 4 cannot count beyond a &#34;0&#34; count because it is immediately reset by the signal &#34;c&#34; derived from the test signal &#34;b&#34;. As a result, the signal &#34;d&#34; appearing at the first bit output 12 of the binary counter 4 is a logical &#34;0&#34; and the signals &#34;e&#34;-&#34;f&#34; appearing at the other outputs 13 to 15, respectively, are also logical &#34;0&#34;&#39;s. Since the inputs to OR gate 17 are logical &#34;0&#34;&#39;s, its output (signal &#34;h&#34;) is a logical &#34;0&#34;. The signal generator 19 provides a logical &#34;0&#34; output (signal &#34;i&#34;) indicating that the program cycle is error-free. 
     If, on the other hand, as shown in FIG. 3, one or more pulses of the test signal &#34;b&#34; are not present, the binary counter 4 is not reset because the input signal &#34;c&#34; to the counter which correspondingly is missing pulses, does not reset the counter. Thus, the counter proceeds to count output clock pulses &#34;a&#34; from the oscillator 11 and the divide-by-two pulses &#34;d&#34; appear at the first bit output 12 of the counter 4. Pulses &#34;e&#34; and &#34;f&#34; also appear at the second and third bit outputs 13 and 14, respectively, of the counter 4 corresponding to the number of pulses missing from the test signal &#34;b&#34;. With pulse signals present at the inputs of the OR gate 17, a pulse is provided at the output of OR gate 17 as a reset signal &#34;h&#34; to the reset input 22 of the microprocessor. The microprocessor then resets and if it generates a signal &#34;b&#34; so that signal &#34;c&#34; again corresponds with the oscillator signal &#34;a&#34;, the binary counter 4 is reset by the singal &#34;c&#34; to bring all of the counter outputs back to their logical &#34;0&#34; starting state. In this case, the microprocessor is reset and properly restarted, i.e. the fault corrected, before the counter counted a number of oscillator pulses necessary to provide a pulse output at the fourth bit (divide-by-16) counter output 15. As a result, the signal generator 19 does not respond and its output signal &#34;i&#34; remains a logical &#34;0&#34;. 
     Referring to FIG. 4, the same error sequence described with respect to FIG. 3 occurs to the point that a reset signal &#34;h&#34; is fed to the reset input 22 of the microprocessor. However, if the microprocessor does not respond to this reset signal to restore the test signal &#34;b&#34;, as shown for example in FIG. 4, the binary counter 4 continues to count until the fourth bit counter output 15 is set to a logical &#34;1&#34; (&#34;g&#34; in FIG. 4). A logical &#34;1&#34; signal is accordingly fed to the reset input 22 of the microprocessor 2. In addition, the logical &#34;1&#34; output of counter output 15 causes the output of OR gate 8 to be a logical &#34;1&#34; so that oscillator pulses no longer appear at the input 6 of the counter, and the counter 4 stops counting. This causes the counter output 15 to remain at a constant logical &#34;1&#34; which causes a constant logicl &#34;1&#34; to be applied to the reset input 22 of the microprocessor. In this situation, the circuit is &#34;locked&#34; and the microprocessor 15 prevented from continuing any program. A constant logical &#34;1&#34; is also delivered to the signal generator 19 (e.g. the LED illuminates), which indicates a fault in the microprocessor 2 which cannot be corrected. 
     The circuit can be &#34;unlocked&#34;, for example, by connecting a switch, not shown in FIG. 1, to the output 15 of the counter to temporarily set the input 18 of OR gate 17 and the input 20 of OR gate 8 to a logical &#34;0&#34;, so that the microprocessor will be enabled and pulses &#34;a&#34; of the oscillator 11 will be gated through the OR gate 8 to the counter. The switch can be a single pole, two position switch having one terminal connected to output 15 of the counter and the other terminal connected to ground. 
     Certain changes and modifications of the embodiments of the invention disclosed herein will be readily apparent to those skilled in the art. It is the applicants&#39; intention to cover by their claims all those changes and modifications which could be made to the embodiments of the invention herein chosen for the purpose of disclosure without departing from the spirit and scope of the invention.