Thomas, thank you very much. I'm a newbie in PIC & electronics, these suggestions are very nice! mmm.., at the moment I have only RA4 free on 16F84, but i'm starting to port the logger code on 16F628 with a new design, so i think that it will be possible free two or three pins. Marco ----- Original Message ----- From: "Thomas McGahee" To: Sent: 25 febbraio, 2002 17.19 Subject: Re: A cheap A/D interface > You can build a simple voltage to pulse-width converter to do the job. > You can even have multiple "channels" quite easily. The basic idea is > to create a triangle wave that goes from 0 to +5 volts. This is fed > into the (-) input of a comparator or op-amp. The voltage you want to > measure > goes into the (+) input. 1 volt will generate a 1/5=20% duty cycle, > 2 volts will generate 2/5=40% duty cycle, etc.. > > The one triangle wave can feed into any number of comparators, so > you can easily generate multiple channels. > > ****** > > The triangle wave method above is self-repeating and so requires only > one PIC i/o line. If you have two i/o lines available, then you > can make a single-slope converter instead. > > A single slope converter consists of a capacitor driven by a constant > current source, and a comparator. The capacitor is discharged, then > allowed to charge. The ramp is connected to the (-) input of a comparator, > and the voltage to be measured is connected to the (+) input of the > comparator. When the output of the comparator goes LOW, the time is > proportional to the voltage. It is useful to have the constant current > source adjustable, so the scaling can be adjusted via a pc pot rather > than having to do it via software. > > Note that if the compliance voltage of the constant current source is > less than +5 volts, then you may have to use a simple voltage divider > at the (+) input of the comparator to reduce the max input voltage > to something less than the compliance voltage. > > Multiple comparators can be driven by a single ramp circuit, so > each additional analog input requires one i/o pin and one comparator. > > Fr. Thomas McGahee > > > > > > > > I have to interface my 16F84 Datalogger ( 4.5V supply) with sensors that > > > have a voltage output, but in my board I have only one free pin (RA4), > so > > > I'm thinking to a voltage-frequency converter. I need 8 bit resolution. > > > For a lot of reasons, I would like a really cheap solution, preferably > not > > > over 2-3$. > > > I have seen that a 4046 CMOS has a voltage-controlled oscillator, but I > > > haven't never used it: can it be an acceptable solution for my specs or > > I'm > > > going in a wrong way? Have anyone any suggestion about 4046 VCO use or > > other > > > low cost alternatives? > > > > -- > > http://www.piclist.com#nomail Going offline? Don't AutoReply us! > > email listserv@mitvma.mit.edu with SET PICList DIGEST in the body > > > > > > -- > http://www.piclist.com hint: To leave the PICList > mailto:piclist-unsubscribe-request@mitvma.mit.edu > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads