PIC16F877 ADC code and Proteus simulation




This post provides the ADC code using PIC16F877 microcontroller. This code is written in C language using MPLAB with HI-TECH C compiler. You can download this code from the ‘Downloads‘ section at the bottom of this page.

PIC16F877 ADC

It is assumed that you know how to interface LCD with PIC16F877 microcontroller. If you don’t then please read this page first, before proceeding with this article.

The result of simulating the code in Proteus is shown below.

PIC16F877 ADC code and Proteus simulation schematic

In the above figure, pin10(AN7) of PIC16F877 is being used as ADC input pin[1]. The result of ADC conversion is shown on the LCD screen. If you attach pin10 of PIC16F877 to ground, then a value of 0000 will be displayed on the LCD screen and if you attach pin10 with 5v power supply, then a value of 1023 will be displayed on the LCD screen. In other words, ADC resolution is 10bits and value of ADC result varies from 0(0v) to 1023(5v). Because there is a variable resistor of 50% value attached on pin10 of PIC16F877 in Figure1, that is why it has 2.5v on it. As a result, a value of 511(Half of 1023) is being displayed on the LCD.

Code

The main function code is shown below.

Downloads

ADC code using PIC16F877 was compiled in MPLAB v8.85 with HI-TECH C v9.83 compiler and simulation was made in Proteus v7.10. To download code and Proteus simulation click here.

 

For more detail: PIC16F877 ADC code and Proteus simulation




Current Project / Post can also be found using:

  • PIC16F88 dtmf code and Proteus simulation
  • adc proteus sample
  • c program to build ADC simulation using pic 16f877a
  • adc driver for pic pic16f877a

Leave a Comment

*
= 5 + 3

Read previous post:
PIC16F877 stop watch
PIC16F877 stop watch code and Proteus simulation

This PIC16F877 microcontroller tutorial answers the question, " How to implement a stop watch using PIC16F877 ? " Using PIC16...

Close
Scroll to top