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.

Help me with Clock of PIC16F877A microcontroller

Status
Not open for further replies.

electronics_guy

Member level 2
Joined
Apr 12, 2012
Messages
49
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,655
Hi everyone, I need some help in understanding the clock of PIC16F877A microcontroller. I am currently working on the ADC module of PIC16f877A. I read the data sheet but I couldn't understand it clearly. I have some questions:
I am using a 4 MHz crystal on my development board, so what I understood from the data sheet is I need to make the clock select bits ADCS2:ADCS1:ADCS0 as 001(coz the max device frequency can be 5 MHz and since I am using 4 MHz I select 001). Is my selection right?

Plz help



Thanks in advance.
 

I am using a 4 MHz crystal on my development board, so what I understood from the data sheet is I need to make the clock select bits ADCS2:ADCS1:ADCS0 as 001(coz the max device frequency can be 5 MHz and since I am using 4 MHz I select 001). Is my selection right?

Right! that way you have a 8 TOSC divider which gives you a TAD cycle of 2us (as the datasheet states, you need more than 1.6us TAD cycle...)
 

Thanx a lot Ryu. :) I also have another doubt... regarding PCFG<3:0> bits.... i.e If i select PCFG<3:0> as 011x then all the pins of PORTA and PORTE will be configured as digital pins... What does that mean? Can anyone help me understand?
 

Thanx a lot Ryu. :) I also have another doubt... regarding PCFG<3:0> bits.... i.e If i select PCFG<3:0> as 011x then all the pins of PORTA and PORTE will be configured as digital pins... What does that mean? Can anyone help me understand?

Hi,

The 877A has 8 analogue channels RA0-5 RE0-2.

When the chip is powered on , all these lines are set by default to Analogue mode. ie they are set as INputs expecting to see an analogue signal.

Much of the time you do not want 8 analogue pins, so you modify there funtion to Digital Input/Output by changing those 4 bits of ADCON1.
eg
banksel ADCON1 ; make all analogue ports Digital i/o
movlw 0x06
movwf ADCON1
 

@wp100 thanks a lot. So my question is why should I change or what happens when I change them to digital pins? I don't know if I am asking very silly question but, thats eating me a lot....
Thanks
 

@wp100 thanks a lot. So my question is why should I change or what happens when I change them to digital pins? I don't know if I am asking very silly question but, thats eating me a lot....
Thanks

Hi,

The Analogue ports are input only, expect to receive a signal anywhere between 0 and +5v and require the micro to use its ADC hardware which is quiet slow.

Ports that are set to Digital can be Inputs or Outputs, are very fast and require a simple high +5v or low 0v signal to denote the two possible states.
They can be anything from simple Switch inputs to Relay outputs or things like data transmission input/output at high speed

You want to follow a good tutorial like this one which will teach you all the basics, it covers both Assember and C languages
**broken link removed**
 

Hi,

The Analogue ports are input only, expect to receive a signal anywhere between 0 and +5v and require the micro to use its ADC hardware which is quiet slow.

Ports that are set to Digital can be Inputs or Outputs, are very fast and require a simple high +5v or low 0v signal to denote the two possible states.
They can be anything from simple Switch inputs to Relay outputs or things like data transmission input/output at high speed

You want to follow a good tutorial like this one which will teach you all the basics, it covers both Assember and C languages
**broken link removed**

Thanks a lot. That helped. :)
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top