Tuesday, January 16, 2007

ADC interfacing with PIC16F877A

ADC Experiment
The most practical method of reading Analog signal is by using an ADC built into a PICmicro® MCU. The ADC read can be carried out in the following macro:

ADCRead Macro
bsf ADCON0, GO ; Turn on the ADC
btfsc ADCON0, GO ; Wait for it to Complete
goto $ - 1

The experiment uses the circuit shown below:

The parts needed for this experiment are listed in the table:
PICmicro® MCU

Vdd/Vss Decoupling Capacitor; 0.1 uF (Any Type)

_MCLR Pull Up Resistor;10K, 1/4 Watt

4 MHz Ceramic Resonator; Three Leaded Ceramic Resonator with Built in 27-33pF Capacitors

RA0 Potentiometer;10K

PORTB LED Current Limiting Resistors; 8x 220W, 1/4 Watt


Breadboard; Any Type

+5 Volt "Vcc" Power Supply; Any Type

You may click here to download the fully tested sample code.

note: The Macro shown above is not used in my sample code.