(1) Field of the Invention
The present invention generally relates to programmable controllers and more specifically to correcting delay time errors caused by temperature and voltage changes.
(2) Description of the Prior Art
Electronic systems derive their functionality from programmable controllers such as microprocessors, FPGAs, CPLDs, or ASICs. The heart of any programmable system is the clock or oscillator because it tells the system when to execute its instructions.
Most oscillators exhibit non-uniform frequencies throughout their temperature range. This means that the speed in which an electronic system operates will vary depending on its temperature. This is an undesirable condition which causes synchronization and/or other timing errors. FIG. 1A shows the frequency excursion from the normal operating frequency versus temperature. Curve 10 shows the excursion when the temperature is declining, and curve 12 shows the excursion when the temperature is increasing. As evident from FIG. 1A, these oscillators not only exhibit frequency variability with respect to temperature, they also display hysteresis when subjected to ascending or descending temperatures.
These curves were obtained utilizing a temperature controlled oscillator (TCXO) such as the 566Y4995 oscillator manufactured by Vectron International whose nominal operating frequency is stated to be 27 MHz plus or minus 5 parts per million (ppm). The temperature data was gathered from a Dallas Semiconductor temperature chip mounted next to the oscillator on a printed circuit board (PCB). FIG. 1B shows the temperature versus time profile giving these results.
It is also well known that oscillators exhibit timing variance based on input voltage. Similar graphs could be obtained by subjecting an oscillator to a time varying input voltage.
Therefore, any electronic system using this oscillator would exhibit timing variance depending on its environment. This variance is compounded as timing offsets tend to be cumulative. For example, if a system designed to be synchronized to a referenced one second time period is off by one millisecond per second, after ten seconds, the synchronization will be off by ten milliseconds, and after one minute the synchronization will be off by 60 milliseconds.
Processors and programmable controllers use loops and/or timers to create delays in electronic systems. A loop is simply a large number of instruction cycles that the controller must execute before moving on to its next portion of code. A timer can also be used to achieve this by counting to certain preset number before moving on. If the clock or oscillator is not operating at the correct frequency, these delays will either be too long or too short.
To solve this problem, instruction cycles can be added or subtracted from the delays depending on the temperature of the oscillator. For example, if the clock frequency is 10 hertz too slow at some temperature, a calculated number of instruction cycles can be subtracted from the current code so as to speed up the execution time by 10 hertz. The net frequency difference would therefore be 0 hertz resulting in no error. The number of instruction cycles needed to remove the frequency error can be calculated from the following:Adjustment—Val(temp)=[fCLK(temp)×delay(s)]−[Number of cycles in delay]  (1)                where fCLK is the frequency of the oscillator,        temp is the temperature of the oscillator,        delay is the desired time delay of the software loop, and        Number of cycles in delay is the calculated number of instruction cycles needed to create the delay (assuming perfect clock frequency).        
The prior art acknowledges that oscillators and clock chips have problems with maintaining a stable frequency under changing temperature conditions. Richards et al., U.S. Pat. No. 4,684,897 teach a frequency correction apparatus having a delay line fed by an input signal, the frequency of such signal being corrected a predetermined amount, Δf. The delay line has a plurality of output taps regularly disposed along the line. The output taps produce a plurality of successively time-delayed signals each one having the frequency of the input signal. A switching network is included for successively coupling each one of the plurality of time-delayed signals to an output terminal of a predetermined coupling change rate related to Δf, to produce, at such output terminal, an output signal having a frequency shifted from the frequency of the input signal the predetermined amount required for the desired frequency correction. When the taps are successively coupled to the output terminal in a direction along the delay line away from the input to such line, the frequency of the output signal is equal to the frequency of the input shift shifted lower in frequency the amount Δf. On the other hand, when the taps are successively coupled in a direction towards the line input, the frequency of the output signal is shifted higher in frequency the amount Δf.
Moller et al., U.S. Pat. No. 5,644,271 teach a temperature compensation system includes a first oscillator to generate a number of pulses which vary from a desired frequency as a function of temperature of the first oscillator. The system also includes a second oscillator to generate digital pulses at a corrective frequency which is greater than the desired frequency. A sensor provides a temperature signal for the first oscillator. A digital memory has a digital error table addressable by a signal corresponding to the temperature signal to provide a number of pulse errors corresponding to temperature error for each of the number of pulses. Each pulse error is a function of the corrective frequency and a temperature versus frequency characteristic of the first oscillator. An accumulator receives each pulse error to generate a cumulative error corresponding to one of the number of pulses. A variable delay device counts a quantity of corrective pulses from second oscillator to provide a delayed output pulse in accordance with the desired frequency. The quantity of corrective pulses is a function of the cumulative error signal received from the accumulator. The converter, memory, accumulator and delay device may be part of a microcontroller.
While these patents teach corrective actions for oscillator excursion caused by temperature variations, they do not teach correcting for hysteresis or for correcting delay times by adding instruction cycles.