Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

adc confirguration for pic16f877a microcontroller

Status
Not open for further replies.

glenndingding

Newbie level 5
Joined
Feb 15, 2012
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Philippines
Activity points
1,403
hi,

i am new using micro c. i am using pic16f877a microcontroller but i do not know how to configure its ADC. can anyone help me please.

i want to use channels AN0,AN1,AN2,AN3 for my inputs...please send me a code.
 

If you look at page 112 of the data sheet which can be downloaded from Microchip,
You will see that to configure the A/D you write to register ADCON1. for example

ADCON1 = 0x80; /* 10 bit Right justified result, all analog inputs, Vdd as +ref, Vss -ref */

Then on page 111
To configure the conversion clock, select the input channel and turn on the A/D, you write to ADCON0, for example

ADCON0 = 0x81; /* Channel 0, A/D on, Conversion clock Fosc/32 */

These two registers are all you need to configure the A/D.

Then you set bit ADON in register ADCON0 to start the conversion.
ADON is cleared when the conversion is done.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top