PIC16F877A ADC example with CCS PIC C compiler

The microcontroller PIC16F877A has 8 ADC (Analog to Digital Converter) channels (–PIC16F877A datasheet–). The resolution of the PIC16F877A ADC module is 10-bit, which means the analog value after conversion is stored as a 10-bit number that varies from 0 to 1023 (0x3FF). The ADD module has high and low-voltage reference input that is software selectable to some combination of VDD, VSS, RA2 or RA3.

PIC16F877A ADC example with CCS C compiler:
This is an example to start with the ADC module, example circuit schematic is shown below:
PIC16F877A ADC CCS C example circuit
The LCD used to display the analog value after conversion where channel 0 (RA0) is the analog input and analog signal can be changed from the potentiometer. The output analog voltage of the potentiometer varies from 0V to 5V. The reference voltage is set to VDD (+5V) and GND (through software). The microcontroller must be supplied with 5V (on pins VDD and VSS).
To know how to use LCD display with PIC16F877A microcontroller see the following topic:
Interfacing PIC16F877A with LCD using CCS C compiler  

PIC16F877A ADC example CCS C code:
This is the C code used for this example with some comments.

PIC16F877A ADC example video:
The following video shows our example in a real hardware circuit.


Discover more from Simple Circuit

Subscribe to get the latest posts sent to your email.

1 thought on “PIC16F877A ADC example with CCS PIC C compiler”

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top