PIC16F819 ADC: Understanding Voltage, Current & Signal Conversion

  • Thread starter Thread starter mearvk
  • Start date Start date
  • Tags Tags
    Adc
AI Thread Summary
The PIC16F819 microcontroller features an ADC that can only measure voltages up to 5 volts, which raises concerns about its ability to handle higher voltages like those from a 9-volt battery. Users can utilize voltage dividers to scale down higher voltages for accurate readings within the ADC's range. The ADC converts analog voltages into digital values, with common resolutions of 10 bits, allowing for precise measurements. While the ADC is primarily designed for voltage measurement, it can also digitize audio signals, provided they are within the specified voltage range. Understanding the ADC's operation requires familiarity with its specifications and functions, such as the sample and hold feature, to effectively utilize it in various applications.
mearvk
Messages
133
Reaction score
0
Got a couple pic16f819s and was pondering something relatively simple like a voltage meter or a frequency counter.

My question is the MC I have comes with an ADC that seems to max out at 5 volts. This seems to mean that I couldn't test for more than 5 volts. For instance I could test a 9 volt battery even with this thing. That seems pretty weird but I leave that alone.

I come from a computer background and have some year of experience pouring over poorly written documentation. Having said that the literature for electronics is pretty rough to understand.

Take the ADC on my pic16. The way it would be intuitively used would be to take a certain voltage and then send an analog signal (voice or radio) on that voltage. The output would be some digital representation of the analog.

This already is terribly confusing. There are an infinite number of possible analog values for any length of time. How then does the IC map this onto a digital value?

Moving on. How does the ADC know whether it's measuring voltage, current or some signal? Many on the internet suggest you can use an ADC as a voltmeter or an ammeter. Great but how does the IC know which it's supposed to be using, the signal the current or the voltage?

Heres the PIC page: http://www.dimensionengineering.com/appnotes/Gmeter/PIC16F818.pdf

You can google ADC voltmeter, ammeter, signal converter etc and find tons old projects.
 
Engineering news on Phys.org
A to D converters measure 0 to 5 volts in steps of 256 or 1024 steps so each step is 19.5 mV or 4.88 mV.

The output will then be whichever step is closest to the input voltage.

So, assuming a 1024 (10 bit) A to D, then a 3 volt input will give a digital output of 614. (3 / 5 * 1024 = 614.4).

You can then do this a litlle later and you might get a different value which you then use and make use of somewhere. You might record it on a CD perhaps.

Measuring 9 volts is not a problem. Suppose you put two 10 K resistors in series across the 9 volt supply with one side connected to ground.
Put the A to D converter across the one connected to ground.
The bottom one would have 4.5 volts across it which is in the range of the A to D converter. So you read the 4.5 volts and multiply it by 2 in software.
 
Thanks for the reply VK.

Your suggestion is a good one.

Like I said though, very strange that an ADC would be limited to reading voltage. Why not have a separate IC for converting voltage to a binary or decimal number which then could be outputted without all the nonsense of adding a bunch of resistors in series to artificially multiply max voltage?

And more to my point why doesn't ADC mean converting analog to digital in the sense of an analog signal (voice, radio) to its digital representation? Why bother calling it ADC? Call it a voltmeter port if that's all it does. ADC has a way different meaning in computing and signal processing - where it's not tied tightly in meaning to voltage.

One last question - how would one convert from a microphone input (analog) to a digital representation? Can this be done using the ADC or not?

Thanks.
 
mearvk, yes, your on-chip Analog-to-Digital Converter (ADC) will digitise audio (voice) frequencies. They convert the applied voltage to (in this case) 10 digital bits, as vk6kro has clearly described. It would digitise a fixed DC also. That's what they do. There are also separate ADCs available that do the same thing. You may use the specification sheet for your PIC, section 11, to read up on how your ADC works and how to use it. Pay particular attention to the "sample and hold" function.
 
I come from a computer background and have some year of experience pouring over poorly written documentation. Having said that the literature for electronics is pretty rough to understand.

i came from an analog background and was terribly frustrated by computer literature where everything was defined in terms of something else undefined. As if relative addressing went to the heads of tech writers and destroyed their logic.

After i learned the vocabulary i realized how precise their writing was after all.

So dig in and don't think that being a computer whiz makes you an electronics whiz.

A multiplexer cannot switch a voltage greater than its supply (unless it's a relay mux)
so if your PIC is running on 5 volts don't hand it ten.
see para 23.11 of PIC manual
http://ww1.microchip.com/downloads/en/DeviceDoc/31023a.pdf
23.11 Connection Considerations
If the input voltage exceeds the rail values (VSS or VDD) by greater than 0.3V, then the accuracy
of the conversion is out of specification.
and fig 23.3 diode clamps to VDD and VSS.

old jim
 
Last edited:
I guess my understanding was a meaningful signal could be transmitted with a constant voltage and thus why would an ADC read inputs using voltage variations. Presumably other physical qualities could be used perhaps current or resistance. That was a question mark in my head. It kind of makes sense, although it was not clear at the time.
 
Thread 'Weird near-field phenomenon I get in my EM simulation'
I recently made a basic simulation of wire antennas and I am not sure if the near field in my simulation is modeled correctly. One of the things that worry me is the fact that sometimes I see in my simulation "movements" in the near field that seems to be faster than the speed of wave propagation I defined (the speed of light in the simulation). Specifically I see "nodes" of low amplitude in the E field that are quickly "emitted" from the antenna and then slow down as they approach the far...
Hello dear reader, a brief introduction: Some 4 years ago someone started developing health related issues, apparently due to exposure to RF & ELF related frequencies and/or fields (Magnetic). This is currently becoming known as EHS. (Electromagnetic hypersensitivity is a claimed sensitivity to electromagnetic fields, to which adverse symptoms are attributed.) She experiences a deep burning sensation throughout her entire body, leaving her in pain and exhausted after a pulse has occurred...
Back
Top