You could use small MOSFETs to switch the resistors to a nice quiet analog ground. However, parts count is starting to go up quite a bit. If you are tempted by a digital pot, I have used the Xicor Quade2pot range quite a bit, they seem pretty good, although the datasheet is pretty obscure on some aspects. As an aside, I have the preliminary datasheet for a new Xicor part that contains: 3 digital pots (one 64 tap 50k, one 100 tap 10k and one 200 tap 10k), reset supervisor with power on reset, low voltage reset with adjustable trip levels, a manual reset input, three voltage monitor pins with user adjustable threshold (one with a hardware output, the other two readable through the serial bus), 2K eeprom memory and 2.7 to 5.5 volt operation. Phew. Sounds like a very useful part though, it's number is X6402 The only thing I would check about the LDR arrangement is linearity. I don't know how straight the transfer curve of a typical LDR is and combined with the non-linearity of a typical LED, you would have to use some kind of lookup table to get specific gains from the circuit. Certainly do-able though. Regards Mike Rigby-Jones > -----Original Message----- > From: Nikolai Golovchenko [SMTP:golovchenko@MAIL.RU] > Sent: Wednesday, October 27, 1999 7:17 AM > To: PICLIST@MITVMA.MIT.EDU > Subject: Re: Variable gain amp using PIC - possible? > > Hello!, > > > Thanks Rob! This editor is what I needed. > I hope, this drawing is better readable: > > +1.5 > 2.5V -1.5 |\ > ---------|+ \ RA0 > | >----+---- > +-|- / | > | |/ | > | R | > +---\/\/\---+ > | > --- C > --- > | > | R1=R 1:2 RA1 > +---\/\/\---+--- > | R2=R/3 1:4 RA2 > +---\/\/\---+--- > | R3=R/7 1:8 RA3 > +---\/\/\---+--- > | R4=R/15 1:16 RA5 > +---\/\/\---+--- > > Right, I didn't take into account the noise from current going through PIC > Besides there is a protection diod on any pin with anode tied to ground! > The diodes will switch on all resistors when output swings below virtual > ground (2.5V) 8-( Because the capacitor starts discharging in that > condition ) Will this diod disable any possibility of the plot??? > > I'm thinking about LDR or digital potentiometers now... Nice thing about > LDR is that it can be controlled with only one digital line if you use PWM > - needs only RC network for filtering. > > Thanks to all who replied. > Nikolai >