Introduction to Microcontroller Programming - Course Index
- Introduction
- About the Author
- About this Course
- Feedback
- Course Navigation
- Quick Course Navigation
- How to use this Course
- Acronyms Used and Course Conventions
About PICmicro Chips - What is a PICmicro?
- Microcontrollers
- Digital versus Analogue
- Inputs and Outputs
- Memory
- Programming
- 16F1937 Architecture
Clocking Your PICmicro Devices E-Blocks Flowcode Step By Step - Introduction to Flowcode
- Basic Flowcode Functions
- Digital Outputs
- Digital Inputs
- Basic Loops
- The LCD Display
- Binary Numbers
- Decisions
- Goto (Connection Point)
- 7-Segment Displays
- Software Macro
- Strings and Memory
- A Simple Hi-Fi
PICmicro Projects - Introduction to PICmicro Projects
- Construction Methods
- Choosing a Power Source
- Adding Inputs
- Input Conditioning
- Adding Outputs
- Adding Drivers
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: - the highest 8 bit number is 1111 1111 (= 255 in decimal)
- the first step is 0000 0000 (= 0 in decimal)
- This makes a total of 256 steps, so each step is a voltage jump of 5V/256,which equals about 20mV per step.
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. |