PIC16F877A with a 20MHz oscillator

Status
Not open for further replies.

josh1245

Newbie level 5
Helloo!

Can you please tell me how long does a PIC16F877A micro controller take to execute one line of coding when used with a 20 MHz oscillator??

Tahmid

fosc = 20MHz
tosc = 1/fosc
tcy = 4 * tosc = 4/fosc

So, tcy = [4/(20 * ${ 10}^{ 6}$)] s = [4/(20 * ${ 10}^{ 6}$)] * ${10 }^{6 }$ µs = 0.2µs = 200ns

Hope this helps.
Tahmid.

betwixt

Super Moderator
Staff member
Note: Tahmid's figures are for one machine instruction (a single non-branching assember instruction).

One line of code may be considerably longer if it is written in a high level language.

Brian.

Tahmid

Yea, the time calculated is that for one instruction cycle.

In assembly, there are a few 2 instruction-cycle instructions.

In high-level language, one line could be 1 instruction cycle or very long, depending on the line of code.

josh1245

Newbie level 5
thank you soo much Tahmid, & Brain... since Im new to micro controllers, I am using MicroC, but not assembly.., can you please tell me how it works with microC if you do not mind.??

Tahmid

It depends on the instruction / line of code. You can use the stopwatch option in the debugger to check the time.

Ishah

Member level 1
It depends on the instruction / line of code. You can use the stopwatch option in the debugger to check the time.

Hi Tahmid,

Can you guide me to fill this stop watch of MicroC.

FvM

Super Moderator
Staff member
Stopwatch runs between breakpoints or single steps in debugging. Nothing to fill out.

Ishah

Member level 1
Stopwatch runs between breakpoints or single steps in debugging. Nothing to fill out.

Sorry Im new of this, it's quiet shame for me to ask but, it that mean I need to click F9 (start Debugger) ? Where i can check the time.. ?

Thanks FvM.

FvM

Super Moderator
Staff member
that mean I need to click F9 (start Debugger) ?
I'm sure you'll also find out which hotkeys are available to access
- breakpoints
- single stepping

Status
Not open for further replies.