![]() |
||||||||
|
Electronics Reviews |
Electronic Projects |
Electric R/C Planes |
General Aviation |
Hammond Organs |
Calculator Collection |
Slide Rule Collection |
My Blog: Stefanisms |
|
I originally wrote this program for the HP-67 calculator, and then ported it to the HP-41C series. This program selects component values for an op-amp based relaxation oscillator, given the desired frequency and output wave form peak voltages. It can also solve the inverse problem, finding the frequency and voltages resulting from given component values. The following is the schematic for such an oscillator:
R1 and R2 form a voltage divider, with an additional input from the op-amp output through R3. When the op-amp output is at a high-level, the voltage at the non-inverting input of the op-amp is higher than when the op-amp output is at a low level. When the output is high, capacitor C1 also charges through R4 until the voltage across it (which is applied to the op-amp's inverting input) reaches the voltage at the non-inverting input. At that time, the op-amp output goes low, and the capacitor begins to discharge through R4 until the voltage once again reaches the (now lower) voltage at the non-inverting input. If one were to monitor the op-amp output, it would alternate between a high level (VOH, generally close to positive supply voltage, VPOS) and a low level (VOL, generally close to negative supply voltage, VNEG). The duty cycle of this square wave depends on the relative time it takes to charge and discharge C1 through R4, which in turn depends on the low (VPL) and high (VPH) peak voltages that C1 cycles between (which in turn depend on R1, R2, and R3). Monitoring the voltage across C1 shows a triangle wave.
With this program, you can select components for such an oscillator to achieve a desired frequency, and if it matters to your design, desired low and high triangle peaks (VPL and VPH). After the program computes the required component values, you can modify these values to match those actually available in the real world. The program will then compute what effect these changes have on the frequency and triangle peak voltages. The following equations describe the operation of the oscillator:
You will first need to choose values for C1 and R1 arbitrarily, since for any desired frequency and given C1 and R1, it will be possible to find (possibly impractical) values for R2, R3, and R4. A good choice for R1 is generally somewhere around 10kΩ to 100kΩ. The choice of C1 depends on the frequency, and a readily available value near (50/f) μF is usually suitable. Using the ProgramFirst type in the program and save it, or read it from a previously recorded magnetic card. The card should be labelled as follows:
Forward Solution: Finding R2, R3, and R4Consider the following example: It is desired to find values for R2, R3, and R4 to produce an oscillator of about 2500Hz, with a triangle waveform that oscillates between 1.2V and 1.4V. The op-amp is to operate from a single 5V supply, and the op-amp's output is capable of a low of 0.3V and a high of 5V. Use a 0.022μF capacitor for C1, and a 22kΩ resistor for R1. Follow these steps to solve the problem:
NotesSpecifying VOL and VOH is optional. If this step is omitted, the program will assume the op-amp output can span the entire negative and positive supply voltage range.If the triangle wave form peak voltages don't matter to your design (because you're only using the square wave output), you don't need to specify them. The program will assume peak voltages ranging from VOL+(VOH-VOL)/3 to VOH-(VOH-VOL)/3, which is the middle third of the op-amp output voltage range. This also happens to result in a 50% duty cycle. To achive a low duty cycle square wave, choose VPL and VPH close to the bottom of the op-amp output range (VOL). Likewise for a high duty cycle, choose VPL and VPH close to the top of the range (VOH). For the most stable oscillation frequency, choose VPL and VPH far away from the op-amp output voltage limits, VOL and VOH (to keep the triangle edges steep), and far away from each other (to keep any variations a small percentage of the overall voltage swing). Since these two goals are at odds with one another, a good compromise is to select VPL and VPH to span the middle of the VOL to VOH range (which is the default if VPL and VPH aren't specified). Reverse Solution: Finding VPL, VPH, Frequency, and Duty CycleAfter finding the above ideal solution, we'll want to use real-world component values to build the physical circuit. The closest E-24 resistor values to those computed are: R2 = 7.5kΩ, R3 = 120kΩ, and R4 = 68kΩ. What effect will using these values have on the frequency, VPL, and VPH? These are the steps to find out:
Other Uses for this ProgramThe oscillator design facilitated by this program consists of two parts, a comparator with hysteresis, and a capacitor being charged and discharged by the comparator output through a resistor. The equations describing the comparator aspect of the circuit are not affected by those describing the behaviour of the resistor-capacitor network, so the program can be used to design such comparators for other applications.
Here is a brief example of using this program to design a comparator: Assume we want to design a comparator operating from a +/-12V supply, whose output goes low when the voltage exceeds +2V, and goes high when the voltage subsequently drops below -3V. Assume the op amp used has an output that can swing to within 0.7V of the voltage limits. Use a 10kΩ resistor for R1. Follow these steps to solve the problem:
Now select the closest real-world resistor values for R2 and R3 and determine how that affects the switching points:
Additional Real-World ConsiderationsThe mathematical model used as the basis of this program assumes that VOL and VOH are constant, regardless of load. For sufficiently low current, this is close enough to true to be ignored. Thus it is important to use fairly high resistor values for R3 and R4 (10kΩ or bigger to be on the safe side). If the value of R3 computed by the program is too low, start with a higher value for R1. Similarly, if the value computed for R4 is too low, use a lower value for C1. Some op-amps have an open-collector output. This means that when the output is low, it is pulled low through an output transistor, but when the output is high, it is simply floating. Thus, a pull-up resistor is needed to pull the output high. The chosen pull-up resistor must meet two requirements:
For the LM339 comparator that I often use in my designs, I've found that a 1kΩ resistor works well, together with R3 and R4 values about 100 times as much. As described above, use a higher value for R1 to achieve a higher value for R3, and use a lower value for C1 to achieve a higher R4. Program Listing
Registers and Flags
Revision History2009-May-25 — Initialize release of HP-41C/CV/CX version. 2009-Jun-11 — Fixed a bug where the data entry flag sometimes wasn't cleared even though there had been no data entry. Other HP Calculator ProgramsI've written programs for many of the HP calculators calculators in my collection. You may be interested in some of these:
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SubscribeShare |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||