Continue to Site

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.

newcomer to PIC

Status
Not open for further replies.

neelam29

New Member
hi,
I'm a newcomer to PIC, but i know 8051. as i've just started there is question in my mind,
For calculating time taken by an instruction to execute, in 8051, we use formula:-
Time, t = (No. of clock cycles x 12)/ (Xtal Frequency)
For example :- in case of timer suppose TH0=1Eh & TL0=2Ch or TMR=1E2Ch = 7724d; & crystal frequency=24MHz, then
time, t= 7724x12/24e6=3.862 mSecs
How do we calculate this in case of PIC micro-controllers, is it:- t= (No. of clock cycles x 4)/ (Xtal Frequency)??

Thanks
 
PIC is easy, because almost all instructions take only one clock cycle, the exception are instructions that change address (like GOTO) which take only two cycles, and branch instructions which take either one or two!..

An instruction cycle is 1/4 of the external clock, so with a 4MHz clock one instruction cycle is 1uS.
 
I second the tech-tools assembler (CVASM). It is very 8051 like... I learned PIC with it (back when it was Parallax PASM) and do all of my PIC programming with it.

Rick
 
Having programmed many processors, PICs, 6502, Z80, 68000 to name a few, I find that writing in the format that the processors designers though best is the way to go. To use a non standard syntax just makes your code unreadable to other programmers.

Mike.
P.S. The weirdest processor I have ever worked on was the SuperFX chip used in some SNES games.
 
Pommie said:
Having programmed many processors, PICs, 6502, Z80, 68000 to name a few, I find that writing in the format that the processors designers though best is the way to go. To use a non standard syntax just makes your code unreadable to other programmers.

I completely agree, the non-standard assemblers still produce the same PIC machine-code anyway, just that one 'instruction' may produce a number of lines of code - which makes it VERY difficult to work out timings etc.
 
I use a Tech-Tools Mathias and I can plug in the timing module when I need it. The only real faults are only some 12 & 14 bti with it is they haven't made any new modules in years.
They have a timing module so I can get lazy about counting loops.

I use the 16F877, 16F84, 12C508, 12CE675 & 16F628A mostly. For a high end 18F2525 I'll use a ICD2.

Nothing beats an ICE for debugging though.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top