Hi Peter, Thank you for your reply. Our approach is interesting but I program with MPLAB. It has no integrated 'PWM' function. I have to program a PWM to control the speed of a DC-Motor by using the 16C84 timer. It seems me difficult to program two independent PWM in the same PIC without dummy software loop... Regards Robert Rivoir -----Original Message----- From: Peter Cousens [SMTP:cousens@her.forthnet.gr] Sent: jeudi 24 septembre 1998 00:28 To: Rivoir Robert Subject: Re: Cheap PIC analog multimeter Rivoir Robert wrote: > > Hi Peter, > Thanks for your reply. > > I am very interested by your circuit > I want to make 'intelligent' battery switcher / solar charger for my ZAP > electric bicycle. > Can you send me your schema ? > > Many thanks in advance > > Robert Rivoir Here is the code and the circuit. The 16f84 hooks up to a lcd shown at the top of the schematic and the 5M6 resistors form an attenuator that automatically ajusts from 5 to 40V full scale Why 5M6 ? I've got thousands of them, I should have put them on portb.0,1,2 it would have made driving the attenuator pins much easier. It is simple, I output a voltage with pwm(8bit)on portb.0 then read portb.2 then output a higher or lower pwm voltage depending on if portb.2 is high or low when portb.2 changes from low to high I know the voltage I'm measuring is equal to my pwm voltage