NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Microcontroller Programming » using the Analog-to-Digital converter

December 06, 2010
by lcruz007
lcruz007's Avatar

Hello,

I am looking at the code of the sound meter project, and was wondering how does the ADC works... Well I know the MCU takes a number of samples and read the minimum and maximum points. If I wanted to read that value using a variable, however, what number would it be? Is it the voltage maximum/minimum? or is there another scale used by the MCU?

Thanks in advance.

December 06, 2010
by Rick_S
Rick_S's Avatar

The ADC will return a 10 bit value (Range 0 to 1023 decimal) 0x0000 to 0x03FF hex depending on the voltage seen at the pin being checked in relationship to a reference voltage. The Reference can be set to VCC, the voltage at the AREF pin, or an internal regulated reference (don't remember what that voltage is right now but it's in the datasheet).

So, if it is configured to use VCC as the reference, and VCC = 5V, then if the voltage on the pin is 2.5V, you will get a reading of rougly 512 decimal or half the scale.

Hope that helps,

Rick

December 06, 2010
by lcruz007
lcruz007's Avatar

Thank you! That really helped! =)

Post a Reply

Please log in to post a reply.

Did you know that a piezoelectric buzzer can be used in reverse as a microphone? Learn more...