Background of the Invention
Analog to digital converters usually require precision resistors or capacitors and switches. Such elements tend to unduly increase the cost of those converters as does the need for large power supplies. In applications using microprocessors the possibility of using the microprocessor for counting time presents itself. It is therefore an object of this invention to provide apparatus for producing in a simple, accurate and economical way a digital representation of an analog voltage when a microprocessor is available to provide the counting function.
Summary of the Invention
A voltage to duty cycle converter is provided for producing a digital representation of an analog voltage. The circuit includes a series connected capacitor and resistor charged over a voltage range from a reference voltage source which can be disconnected or shorted for discharge of the capacitor over that range. The duty cycle of this switching is proportional to the analog voltage. The charging period is terminated when the capacitor takes a charge which exceeds the analog voltage by a small amount. At that time a detector responds to that difference by switching the reference voltage source off or by shorting it so that the capacitor discharges to decrease the charge by the same small amount below the analog voltage at which time the reference voltage source is switched back on or reconnected and another cycle begins.
Brief Description of the Drawings
FIG. 1 is a circuit diagram of one form of the invention.
FIG. 2 is a circuit diagram of another form of the invention.
Description of the Preferred Embodiment
The conversion of an analog voltage to a digital representation, such as the duty cycle of a waveform, is a function which has many uses. Among them is its use to convert an analog position; for example, a slidewire contact position on an analog recording instrument. It is desirable in some instances to make this conversion for the purpose of further processing of the resulting digital representation as in a microprocessor. For example, when the slidewire contact is in a rebalanceable recorder used for measuring industrial process variables, the microprocessor may be programmed to provide alarm functions.
In FIG. 1 the slidewire S1 may be a slidewire whose contact is positioned in accordance with a process measurement. The slidewire is supplied from a power supply at a voltage +V so that the input to the non-inverting input 10 of a buffer amplifier U2 is a varying analog voltage which must be converted to digital form for processing.
The amplifier U2 is supplied by power supplies +V and -V and has its output connected to its inverting input so that the output voltage closely follows the input voltage.
The potentiometer R8 and resistor R9 provide a span adjustment when connected as shown in FIG. 1 so that only a portion of the buffer amplifier output is used. By the span adjustment, the range of voltages over which the variable input will change during full travel of the potentiometer contact 11 is determined.
The tap 12 of the potentiometer R8 is fed through an input resistor R1 to the non-inverting input of a differential amplifier U1. A positive voltage on this input causes the output line 14 to be positive if we assume that any signal to the inverting input is less than the input provided from contact 12. The diode CR1 is conductive for positive amplifier outputs on line 14 so that a current flows in the output circuit for amplifier U1 under these conditions.
The output circuit includes an optical isolator AR1 connected in series with a resistor R5 and a zener diode VR1 so that a reference voltage of constant value is produced across VR1 with any variations in the output of U1 appearing across resistor R5. The current in the optical isolator AR1 then provides an output on output line 16 which is an inverted form of the output on line 14. The output on line 16 is thus zero when 14 is positive.
The difference between the analog voltage and the oppositely poled potential across VR1 of greater magnitude causes a charging in one direction of capacitor C1 by virtue of the resulting current flow through the series circuit including resistor R3 and capacitor C1 and the analog voltage input across R9 and the lower part of R8. The capacitor C1 is connected to the inverting input of amplifier U1 so that when capacitor C1 charges to a value which places the inverting input of U1 at a small voltage above that at the non-inverting input, the output on line 14 will go negative. The small voltage is that magnitude of unbalance required at the inputs to reach one limit of the dead band of U1 so as to reverse the polarity of the output of U1. CR1 will then be back-biased, output current flow from U1 will cease and the voltage across VR1 will go to zero. When this occurs the positive feedback provided by the series circuit including capacitor C2 and resistor R2 connected to line 14 through resistor R6 causes the potential at the non-inverting input of U1 to decrease. The result will be a firm toggle action for U1 as its output goes negative with a resulting clean waveform.
Since a negative output from U1 cuts off current flow through AR1, the ouput on line 16 will go from zero to +V. This positive going edge will occur at a time period T1 after the previous negative going edge, which period is a function of the magnitude of the input voltage since C1 will have been charged over a portion of its charging curve which is determined by the magnitude of the input voltage.
Also, with a negative output from U1 the capacitor C1 will charge in the other direction (also referred to as a discharge) through resistor R3 and resistor R4 which shunts VR1, all due to the analog voltage at contact 12. R4 is preferably as small as practicable so that the resistance of the discharge path substantially equals the resistance of the charging path. The potential at the inverting input of U1 will then fall until it reaches a potential which is a small voltage below the potential of the input to the non-inverting input of U1 thus reaching the other limit of the dead band. At that time, which is after a period T2 from the start of the cycle, the output of amplifier U1 will again go positive and current will again flow through optical isolator AR1 to produce a negative going edge to the waveform of the signal on line 16 at the isolator output thus starting another cycle in the continuing oscillation of U1.
As seen in FIG. 1, the inverting input to amplifier U1 is connected through resistor R11 to a contact 20 on potentiometer R10 which has one side supplied from a potential source -V and the other side tied to a circuit common. This arrangement provides a means for adjusting the zero for the range of variations spanned by the input from contact 12.
The circuit of FIG. 1 serves to provide a high degree of noise immunity from the input signal. A proportion of the noise at the input as determined by the voltage divider action of R1, R2, C2, and R7 is applied to the non-inverting input of U1. The same proportion of input noise, determined by the voltage divider action of C1, R3, and R4 is applied to the inverting input of U1. Since the two noises are equal, they cancel at power line frequency.
As the voltage at tap 12 increases the difference between it and the voltage across VR1 gets smaller so that more time is needed for the part of the cycle when line 14 is positive and AR1 is "on."
AR1 optically couples the output of U1 to the microprocessor 20. The waveform of the output of U1 is thus repeated in inverted form on line 16 since the transistor of AR1 is conductive during the positive portions of the cycle on the output line 14. The transistor of AR1 is connected to the +V supply by way of R12 with the emitter connected to earth ground and the base connected to the emitter by way of the base bias resistor R13. AR1 may be replaced by optical isolators configured as a Darlington pair if increased output is desired.
The waveform of the voltage on line 16 is shown beside that line in FIG. 1. In that waveform the negative going edge of the cycle is the start of the time periods which are measured. The time to the positive going edge is T1 and the time to the next negative going edge is T2. The microprocessor is programmed to read the count at those points and to calculate from those readings the ratio T1/T2 which is the duty cycle of the waveform on line 16. The value of the duty cycle is proportional to the analog voltage at tap S1 and hence is an indication of that value. The duty cycle value may be used in a program in the microprocessor as may be desired for alarming functions, for example. Alternatively, of course, the value may be displayed in digital display 24.
A variation of the circuit of the FIG. 1 is shown in FIG. 2. In FIG. 2 the isolator AR1 has been omitted indicating that electrical isolation is not required. Thus, the line 16 is directly connected to junction 15 when AR1 is omitted.
In FIG. 2 the resistor R4 of FIG. 1 is replaced by a transistor TR1 which serves to provide a conducting path for the charging of capacitor C1 by the analog voltage when the negative output from U2 on line 14 causes TR1 to be biased "on" by virtue of the resistor R14 connecting the base of TR1 to the output line 14.
With the arrangement of FIG. 2 the positive feedback network including R2 and C2 does not include R6 and R7 as shown in FIG. 1.
The differential amplifier U1 in both FIG. 1 and FIG. 2 is a detecting means for detecting the relationship between the input voltage to be converted and the sum of that voltage plus the negative feedback supplied by the voltage across C1 so that the switching means CR1 and R5 in FIG. 1 serves to switch the voltage source VR1 into and out of the circuit. Also, it will be evident that R5 and VR1 will be a switch means for turning the voltage source VR1 "on" in FIG. 2 while transistor TR1 in FIG. 2 will be the switch means for turning the voltage source VR1 "off."
Other than the changes just mentioned, the circuit of FIG. 2 operates substantially as set forth for FIG. 1.
It will be evident that other variations in the circuit of FIG. 1 may be made. For example, the capacitor C1 may have its one terminal connected to circuit common instead of to contact 12 as shown in FIG. 1. With such a change, the capacitor will discharge without the benefit of current flow due to the analog voltage. However, the capacitor itself will have a greater voltage difference in that the difference will include not only the small voltage required to switch but also the analog voltage magnitude. Still other changes will be evident to those skilled in the art including, for example, changes in the polarities.
In carrying out this invention, the parameters of the circuits of FIGS. 1 and 2 may be as set forth below: