
The analog channels AN0 to AN7 are highlighted for you. The eight pins which can read the analog voltage are mentioned in the datasheet. The value 1024 is obtained by 2^10 since our ADC is 10 bit. This means the output value of our ADC will be 0-1024 (2^10) and there are 8 pins (channels) on our MCU which can read analog voltage. The PIC we are using has 10-bit 8-channel ADC. Now that we know some basics on ADC, lets open our datasheet and learn how to use the ADC on our PIC16F877A MCU. The speed of the comparison depends on the Clock frequency (Fosc) on which the PIC is operating. This type of ADC uses a reference voltage (which is variable) and compares the input voltage with the reference voltage using a comparator and difference, which will be a digital output, is saved from the Most significant bit (MSB). Successive Approximation ADC: The SAR ADC works with the help of a comparator and some logic conversations. So let’s learn a bit about SAR ADC before we start using it. The type of ADC used in PIC16F877A is called as the Successive approximation ADC or SAR in short. The most common types of ADCs are flash, successive approximation, and sigma-delta. There are many types of ADC available and each one has its own speed and resolution.

Interfacing ADC0808 with 8051 Microcontroller.Hence ADC is an important work tool for MCU projects and lets learn how we can use it on our PIC16F877A.Īlso check our previous articles on using ADC in other microcontrollers: In order to know the temperature of the real world, the MCU has to just read the output voltage of this temperature sensor and relate it to the real world temperature. A temperature sensor for instance may give out 2.1V when the temperature is 25C and go upto 4.7 when the temperature is 60C. Almost all the sensors like temperature sensor, flux sensor, pressure sensor, current sensors, voltage sensors, gyroscopes, accelerometers, distance sensor, and almost every known sensor or transducer produces an analog voltage of 0V to 5V based on the sensors reading. Most of the Microcontroller projects will involve an ADC (Analog to Digital converter) in it, because it is one the most used ways to read data from the real world. In this tutorial, we will learn How to Use ADC with our PIC microcontroller PICF877A.

If you are an absolute beginner, then please visit the complete list of PIC tutorials here and start learning. Till now, we have covered many basic tutorial like getting started with MPLABX, LED blinking with PIC, Timers in PIC, interfacing LCD, interfacing 7-segment etc. This is our 9th tutorial of Learning PIC microcontrollers using MPLAB and XC8.
