Jerry Meng wrote: > > At 10:40 PM 12/14/96 EST, you wrote: > >I need to operate a 1 milliamp panel meter using a 16C54. > >The meter will be used to display measured periods, which > >I have set up the timer to determine. The problem I am > >having concerns driving the analog meter from 0 to 1 ma. ...... No need for any more chips. The essence of PICing, IMHO, is to absolutely minimize hardware. It seems silly to me to add expensive outboard chips to PICs if you don't need them. PWM will be quite easy and may require only a resistor in series with the meter and no other components. Assuming you are using 5V for the PIC Vdd, the value of the series resistor Rx can be calculated from: 1 mA = Vdd / (Rx + Rmeter) rearranging terms: Rx = (Vdd / 1mA) - Rmeter You can determine the meter resistance 'Rmeter' by measuring with an ohmmeter, or, better yet, you can put a potentiometer in series with the meter and adjust it until you get a full scale reading with the port pin set to a logic hi level. At 1 mA, the CMOS port outputs will drive very nearly to Vdd and Vss, so either method will provide good accuracy. If you detect any needle vibration at your PWM frequency, add some capacitance in parallel with the meter. Such capacitance could be as large as (approximately): C = 0.1 sec / (Rx || Rmeter) Farads Where (Rx || Rmeter) is the parallel combination of the values. For example, suppose: Rx = 4K and Rmeter = 1K (BTW, many 1mA meters have 1K resistance) Then, C = 0.1 / (800) = 125 uF The meter inertia and inducance should average out the PWM nicely. Meter coil inductive flyback should not be much of the problem: Q is usually quite low and made even lower by Rx. NOTE: If you use an ohmmeter to measure meter resistance, be sure to verify that it does not source much more than 1mA to make its resistance measurements. If you use the potentiometer method, be sure to avoid adjusting it to too low a resistance value, or, use another resistor in series to prevent overcurrent from damaging the port pin or the meter. The potentiometer method has the advantage that you are also adjusting out any forward drop due to port pin output impedance. -- Paul Mathews, consulting engineer AEngineering Co. optoeng@whidbey.com non-contact sensing and optoelectronics specialists