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.

What are the steps to intialize the port and ADC of PIC16F877A?

Status
Not open for further replies.

swethamenon

Member level 4
Joined
Sep 12, 2012
Messages
70
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,745
hoW to write instructions for port and ADC initalization of PIC.
i dont know PIC programming..
its urgent..
 

To use a PORT as GPIO , you need to disable the corresponding ANSEl_ bits (disabling the ADC feature)
Then set the Pins direction as In or out in corresponding TRIS regs, Using PORT / l_AT regs you can either read the status or outs data.

I think , referring a simple PIC tutorial help you to implement this.
 

I think you are talking about how to use ADC of PIC microcontroller. Well I would say if you don't have knowledge even basic of PIC programming then it would be very difficult. But using PORTS of PIC microcontrollers as digital output is very simple.
 

For initialization of ports, read this: https://www.mikroe.com/chapters/view/16/chapter-3-pic16f887-microcontroller/#c3v3

For initialization of ADC, go through this:
https://www.edaboard.com/blog/1573/

---------------------------------------------------------------------------------------------------------------------------------------

SEQUENTIAL STEPS IN ANALOGUE TO DIGITAL CONVERSION USING THE INTERNAL ADC

So, here are the steps to configure the ADC and carry out the conversion:
• Decide which pins need to be analogue, which pins need to be digital and which (if any) need to be configured as reference pins.
• Select the appropriate settings for PCFG[3:0] in ADCON1.
• Select ADC module conversion clock by setting ADCS[2:0] in ADCON1 and ADCON0.
• Select justification method – left-justification or right-justification by setting/clearing ADFM in ADCON1.
• Turn on ADC module by setting ADON to 1 in ADCON0.
• Select which channel is to be sampled/measured and converted by setting CHS[2:0] in ADCON0.
• Wait the required acquisition time.
• Start conversion by setting GO/DONE to 1 in ADCON0.
• Check if conversion is over by checking if GO/DONE has been cleared to 0.
• If conversion is over, read the results from ADRESH:ADRESL.

To learn about the ADC, read these:
https://www.edaboard.com/blog/1569/
https://www.edaboard.com/blog/1570/
https://www.edaboard.com/blog/1571/
https://www.edaboard.com/blog/1572/
https://www.edaboard.com/blog/1573/
https://www.edaboard.com/blog/1574/
 

i think u can get this detail,by referring datasheet itself...u just go through the description of pins..and pic has inbuilt ADC,in datasheet itself given the procedure for programming ADC.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top