PIC16F819 ADC: Understanding Voltage, Current & Signal Conversion

  • Thread starter mearvk
  • Start date
  • Tags
    Adc
In summary, the MC I have comes with an ADC that maxes out at 5 volts. This means that I can't measure voltages higher than 5 volts with the ADC. Moving on, the ADC on the MC doesn't seem to have a way of knowing which it's supposed to be using, the signal the current or the voltage. Heres a link to a PDF that explains the ADC in more detail.
  • #1
mearvk
133
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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:
  • #6
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.
 

Related to PIC16F819 ADC: Understanding Voltage, Current & Signal Conversion

1. What is the PIC16F819 ADC and how does it work?

The PIC16F819 ADC is an analog-to-digital converter (ADC) that is used to convert analog signals into digital signals. It works by taking in an analog signal and converting it into a corresponding digital value based on a set of rules and algorithms.

2. What is the difference between voltage and current?

Voltage is the measure of the potential difference between two points in an electrical circuit. It is often compared to water pressure in a pipe. Current, on the other hand, is the flow of electric charge through a circuit. It is often compared to the amount of water flowing through a pipe.

3. How does the PIC16F819 ADC convert voltage and current into digital signals?

The PIC16F819 ADC uses a process called sampling and quantization to convert voltage and current into digital signals. Sampling involves taking a snapshot of the analog signal at regular intervals, while quantization involves assigning a digital value to each sampled point based on its amplitude.

4. What is the purpose of signal conversion in the PIC16F819 ADC?

The purpose of signal conversion in the PIC16F819 ADC is to enable the microcontroller to process and interpret analog signals, which are necessary for many electronic devices to function. By converting analog signals into digital signals, the microcontroller can perform calculations and make decisions based on the input received from the external world.

5. How accurate is the PIC16F819 ADC in converting voltage and current?

The accuracy of the PIC16F819 ADC depends on factors such as the resolution of the ADC, the quality of the analog signal, and the external reference voltage used. Typically, the PIC16F819 ADC has a resolution of 10 bits, meaning it can represent 1024 discrete voltage or current levels. However, the accuracy can be improved by using a more precise external reference voltage and optimizing the input circuitry.

Similar threads

  • Electrical Engineering
Replies
14
Views
4K
  • Electrical Engineering
Replies
6
Views
2K
  • Electrical Engineering
Replies
5
Views
6K
  • Electrical Engineering
Replies
7
Views
1K
Replies
7
Views
4K
  • Electrical Engineering
Replies
3
Views
871
Replies
2
Views
1K
Replies
2
Views
924
  • Electrical Engineering
Replies
6
Views
3K
Replies
22
Views
2K
Back
Top