Hi, sorry, the circuit cannot be read. OTOH, you can try digital potentiometer from Xicor or from DALLAS... I hope this helps. Imre On Tue, 26 Oct 1999, Nikolai Golovchenko wrote: > Hello all. > I need to read 50Hz signal with PIC16F877. Actually, 10-bit accuracy is > enough, but the signal level is unknown, therefore PIC has to adjust to the > signal. The level changes relatively slowly and there is some time allowed > for adjusting. In this case four gain bands (1:2, 1:4, 1:8, 1:16) will do > the job. > > Now, the problem is that I don't want to use variable gain amps, because > they are too expensive and hard to get here, in Ukraine. Another way is to > use analog switches which will change the gain of a usual op amp. Can the > PIC's pins be used as analog switches, connected to ground? The datasheet > says that ports use FETS and that the leakage current is as small sa 1uA. > > I would connect four resistors to PIC and made the pins go low or tri-state. > Will the circuit work? > > __ > -------| + \ > | \ > | >------------- To RA0/AN0 > | / | > ---|-- / | > | ____ | > |-----[_____]---- > --------- > --------- > |---------------- > | | | | > [ ] [ ] [ ] [ ] > [ ] [ ] [ ] [ ] > | | | | > | | | ---------- RA1 > | | --------------- RA2 > | --------------------- RA3 > -------------------------- RA5 > > Thanks in advance. > >