electronics forum

Rules | Recent posts | topic RSS | Search | Register  | Log in

Newbie in PIC - Using ADC module


Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Newbie in PIC - Using ADC module
Author Message
devonsc



Joined: 30 Nov 2004
Posts: 116
Helped: 1


Post26 Dec 2004 18:56   

pic vref+


Hi, I've understand how to set-up the ADC module. By the way, I'm using PIC16F876.

I intend to divide my voltage by four through a voltage divider before applying it to the PIC for ADC conversion. However, I have problem understanding this:

For instance=>
a.) 4V, through a voltage divider, it would be 1V before being applied to the PIC for conversion.

b.) 5V, through a voltage divider, it would be 1.25V before being applied to the PIC for conversion but in this ADC module, will it take my 1.25V as 1V for conversion? If I won't face any problems in converting a 1.25V value, do you guys mind telling me on how do I store the converted binary value (which has decimal point)? I intend to store the converted value and call them later for LCD display.

Help needed...please?
Back to top
Google
AdSense
Google Adsense




Post26 Dec 2004 18:56   

Ads




Back to top
XNOX_Rambo



Joined: 13 Jul 2002
Posts: 437
Helped: 87
Location: Far out, man!


Post26 Dec 2004 19:58   

Re: Newbie in PIC - Using ADC module


Hi devonsc,

In your PIC you can select reference voltages for the ADC. See figure 11-1 in
the datasheet.
If you use Vdd for Vref+ and Vss for Vref- the ADC will convert input voltages in
the range from Vss (0V) to Vdd (say +5V) - i.e. your input signal should never
exceed Vref+ - but - its maximum value should be close to this limit, so that
you use the ADC to its full capacity.

If your maximum input signal is 1.25 V you will have to use an external
reference of 1.25 V connected to the Vref+ pin. Otherwise you will be "throwing
away" a big portion of the ADC range.

As for the binary/decimal numbers question:
The ADC has a resolution of 10 bits. This means that its binary range is from
0000000000b to 1111111111b - or 000h to 3FFh. Having a Vref+ of +5 V and an
input value of e.g. 2.5 V would lead to a value of 1FFh after AD conversion, i.e. 3FFh/2.

The output from the ADC i thus always an integer value between 000h and 3FFh.
When you are to display the actual, decimal input value you need to multiply
your stored ADC value with Vref+ - but as the PIC doesn't use hardware floating
point arithmetic you are in a pickle... Wink

Luckily there are floating point routines in assembler available - here is one example:
http://www.programmersheaven.com/zone5/cat197/15571.htm

The rest is easy... Wink

/Rambo
Back to top
Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
Post new topic  Reply to topic    EDAboard.com Forum Index -> Microcontrollers -> Newbie in PIC - Using ADC module
Page 1 of 1 All times are GMT + 1 Hour
Similar topics:
Newbie - PWM using PIC (1)
Need help with ADC module of PIC - +/-5 voltages (3)
xbee oem module comm using PIC... help (1)
Newbie in PIC - Using "EQU" (1)
ADC using pic 16f877a (2)
ADC using pic 16f877a (3)
Newbie Question (regarding simulation of BUFGCE module) (1)
need help in handling ADC in PIC using ASM (3)
newbie to pic (9)
Help! Newbie to PIC (3)


Abuse || Administrator || Moderators || Support us || sitemap
topic RSS