Tutorial 18:  Analogue to Digital Conversion

The PIC16F877 has an 8 Channel 10-bit analogue to digital converter. This tutorial shows how to configure ADC converter using the onboard dedicated RC oscillator enabling wakeup from sleep. The circuit is uses the POTSLIDER and VOLTAGEDIVIDER8 components to create 8 discrete voltage sources which are input to the 8 ADC channels. A KEYPADDECODED component determines which channel is polled and the 10 bit result is output to a DIGITAL16 component.

Download FEATURE877_Tutorial18.zip and unzip into folder <your path>\Tutorial 18

Filename Version Description
tut18.pjt 1.0 MPLAB (2.3) Project
tut18.asm 1.0 PIC16F877 Assembler code
tut18.hex 1.0 Precompiled HEX
tut18.lst 1.0 Precompiled LST
tut18.vbb 1.0 Virtual Breadboard simulation

Running the Simulation

Open tut7.vbb and press RUN. There are three user interaction components DIAL8, POTSLIDER and KEYPADDECODED are used to change the parameters of the circuit and the 10-bit output result.

Code Walk Through

 

Features Demonstrated

TRISA/PORTA

TRISB/PORTB

TRISC/PORTC

TRISD/PORTD

TRISE/PORTE

ADC Conversion

ADC Interrupt

ADC Wakeup from Sleep

Components Used

PIC16F877

POTSLIDER

DIGITAL8

DIGITAL16

VOLTAGEDIVIDER8

DMM