Introduction to Microcontroller Programming
About PICmicro Chips
Clocking Your PICmicro Devices E-Blocks Flowcode Step By Step
PICmicro Projects
Labs |
Analogue to Digital ConversionMuch of our 'real world' data is analogue, but computers (including the PICmicro microcontroller) can only process digital data. Fortunately the PICmicro has a circuit inside it that can convert information inside it from an analogue format to a digital format. This is called an Analogue to Digital Converter - ADC or A/D for short. The ADC inside the PICmicro chip divides the range of possible analogue voltages into equal steps. The first step is given the number 0, and the highest step is given the highest number that the A/D converter can handle. The highest number the ADC can handle is determined by the resolution of the ADC inside the chip. The resolution is determined by the number of 'bits' the internal circuitry of the ADC has. The resolution of PICmicro ADCs is 8, 10 or 12 bit. For example, if the biggest analogue voltage is 5V, and the PICmicro has a 8 bit A to D converter:
When the PICmicro is told to look at an analogue signal, and convert it, it divides the analogue signal by 20mV, to find out how many steps up the signal sits. This gives the digital equivalent of the analogue signal. The next graph may make this clearer. In our example, the converter outputs 0 for any analogue signal up to 20mV, outputs 1 for analogue signals between 20 and 40mV, and so on. |