Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

some newbie's questions concerning pic16f877..

Status
Not open for further replies.

kimhsieh2

New Member
Hi ,
I am a newbie to the microcontroller. I just have a few questions concerning PIC16F877.

1. I am just not too sure about the relationship between the oscillating crystal and the internal clock of the pic. If we look at this picture here, it shows that a 32.768 kHz crystal is connected to the microcontroller. But does that means the microcontroller is also run at only 32.768 kHz?
**broken link removed**

2. I came across some sample code for pic16f84 online, which I would like to use part of it for my own program for pic16f877. I am just wondering that is the instruction set for pic16f84 compatible with that of pic16f877?

Thanks a lot for the help,
 

Exo

Active Member
1: A pic runs at 1/4 the speed of the clock. So a 4Mhz pic will execute 1000000 instructions a second. (except for branches wich take 2 cycles)

2: The instruction set for a f84 and a f877 are the same but you must take note for other diffirences between chips. For example copying a example for a f84 to a f877 might not work because a f877 has analog inputs wich need to be disabled before they can be used as digital io.

The datasheets hold all the info you need.
 

kimhsieh2

New Member
Thanks a lot for the reply, Exo..

So just to confirm the idea..
u said that pic run at 1/4 of the speed of clock.. so that means if i connect a 32.768kHz of crystal to the PIC, does that means I force the clock of the PIC to run at 32.768kHz and in turn cause the PIC to execute 8192 instruction per second? or there's no relationship at all between the oscillating crystal and the PIC's internal clock?
 

Eclipsed

New Member
As stated above, most instructions execute at 1/4 the osc freq.Which means all single cycle instructions take 4 ticks of the osc to complete, branch instructions take 8 ticks of the osc to complete.So 32.768Khz osc freq. does equal 8192 single cycle instructions per second.There is a direct relation between the osc and the pics internal clock.
 

k7michal

New Member
looking at the above diagram I see that the crystal is connected to Vcc (source). This is new to me and I'm wondering if this is a corect diagram. Ususally the crystal is grounded via capacitors. :?:

Oh yeah, and as far as I know the 16F84 and the 16F877 have no internal oscillator. They both need and out side oscillating source to make them run.
 
Status
Not open for further replies.

Latest threads

Top