Searching \ for 'Pic71 A/D' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/ios.htm?key=a%2Fd
Search entire site for: 'Pic71 A/D'.

Truncated match.
PICList Thread
'Pic71 A/D'
1997\02\02@230226 by tumilty

picon face
I am new using the pic and would like to build a digital volt meter to
read the voltage when charging my battery for my radio controlled boats.
I tried the example in the apps notes AN546. The one example only gives
me 0-255 not a decmial number. The next example gives me switches to use
and I don't need the switches, I only want 1 A/D channel and 4 decmial
digits. Is there anyone who can help

Thanks Tom

1997\02\03@000340 by Steve Hardy

flavicon
face
> From: Carol & Tom Tumilty <spam_OUTtumiltyTakeThisOuTspaminterlog.com>
> I am new using the pic and would like to build a digital volt meter to
> read the voltage when charging my battery for my radio controlled boats.
> I tried the example in the apps notes AN546. The one example only gives
> me 0-255 not a decmial number. The next example gives me switches to use
> and I don't need the switches, I only want 1 A/D channel and 4 decmial
> digits. Is there anyone who can help
>
> Thanks Tom
>

Let's presume you are using a 7.2V NiCd pack...

If you want 4 digits (0000-9999) then you will need at least a 14-bit
ADC.  However, for battery charging you don't really need this level of
precision - 8 bits should do if you shift the input appropriately (e.g.
convert a 0-8.99V terminal voltage to, say, -4 to 4.99V then discard the
negative portion (since normally your battery shouldn't be discharged
that much) giving a nice 0-5V range.  Use a 4V zener diode to drop the
voltage into a suitable range.  In your display routine, you convert
the binary to decimal then add back the 4V.  Your precision (not
necessarily accuracy!) will be about 20mV.

Converting 0-255 binary, representing 0-4.99V, into 4-8.99V decimal
requires some simple manipulation.  One way is to scale the result
into two bytes.  The first byte will end up with the whole number
of volts, and the second byte contains the fraction (perhaps hundredths).
To do this, try the following:

       get B = 0..255 count from ADC.
       Multiply B by 5 into a 16-bit register pair (W and L).
       W contains the whole number of volts (0-4).
       L contains the fractional remainder (0..255).
       Multiply L by 10 into another register pair (T and L).
       T now contains the tenths (0-9) and L the remainder (0..255).
       Multiply H by 10 into register pair (H and L).
       H contains the hundredths (0-9).
       Finally, add 4 to W to scale the result correctly to 4-8.99V.

Multiplication by a constant is most easily performed using
shifts and adds.

I can't help thinking that it would be a whole lot cheaper for you
to lash out and buy a digital multimeter - you'll probably need it
to debug your PIC circuitry anyway!

Regards,
SJH
Canberra, Australia

1997\02\03@011805 by TONY NIXON 54964

flavicon
picon face
>I can't help thinking that it would be a whole lot cheaper for you
>to lash out and buy a digital multimeter - you'll probably need it
>to debug your PIC circuitry anyway!

That's probably true, and it's a sad state of affairs for the
'hobbyt' programmer come electronics enthusiast when off the shelf
products cost less to buy than to create for themselves.

I think it would be a nice safe teething project for someone new to
PIC's even if the easy way out would be to buy the meter.
Cost aside (sometimes) it's more fun and self satisfying to build
things for yourself.

Then you can say - "Hey!! I made that" to the poor souls who can't.

Regards

Tony




Just when I thought I knew it all,
I learned that I didn't.

1997\02\03@112748 by tumilty

picon face
TONY NIXON 54964 wrote:
{Quote hidden}

Hi tony I have a few milti-meters all ready but I would like to build
the "meter" in the charger for convience and fun.

thanks
tom

1997\02\03@214400 by Frank Lewon

flavicon
face
Hi Carol & Tom.
I'm also a new commer to the land -o- pic. And was also interested in the
voltmeter applications of the C71. Here is what I found. The 8 bit
resolution of the AD may be suitable to read voltages below 25.5 volts dc.
25.5 volts = 255 counts, you hard wire the decimal point in place. You also
have to install a suitable input divider to range the AD for 1 count =.1
volts dc. The real trick here is to adjust the Vref to reduce ratiometric
errors. Set Vref to 2.55 volts and tell the AD converter to use an external
Vref.
This should get you pointed in the right dirrection.
Good Luck and cheers. FrankLewon Applications Specialist/B.Z/Products,Inc.

----------
{Quote hidden}

More... (looser matching)
- Last day of these posts
- In 1997 , 1998 only
- Today
- New search...