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.

PIC24F Instruction cycle time

Status
Not open for further replies.

vinoth14

Junior Member level 1
Joined
Feb 27, 2015
Messages
19
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
184
Hi,

What is the machine cycle for PIC24F? I'm using 32MHz crystal.
 

Review datasheet for Fcy.

The processor clock source is divided by two to produce the internal instruction cycle clock, FCY.
 

If you are asking this because you are trying to determine the timing of your instructions (a very common reason), also remember that some instructions take multiple clocks to execute. You will need to look at the *specific* data sheet for the actual device to determine this for each instruction and also take into account that the cycle count can change (for example) depending on whether a branch is taken or not.
Susan
 

Considering that the architecture of this family is RISC, shouldn't all instructions spend the same (fetch+execution) time ?
 

The OP didn't say which PIC24F device they used so I picked the PIC24FJ256GA406 at random and looked at the "Instruction Set Summary" section (section 35)
While most instructions execute in 1 cycle:
- branch instructions take 1 or 2 cycles depending on whether they branch or not
- CALL (direct) takes 2 words and 2 cycles while the CALL (indirect) takes 1 word and 2 cycles
- the 'compare bit and skip' instructions take 1, 2 or 3 cycles
and so on.
Also the "16-bit MCU and DSC Programmer's Reference Manual" (which also covers the dsPIC instructions) has section 3.2.1 "Multi-Cycle Instructions" and similar sections explain the conditions under which the number of cycles vary. Also the individual instruction write-ups describe the number of cycles and exactly how to determine how many are required under various conditions.
(Actually it can be easier to write the code and run it in a simulator with the instruction stop-watch running over the critical sections of code.)
Susan
 

The OP asked about machine cycle, not execution time of an instruction.

In fact many basic instruction are executed in one cycle on PIC24F.
 

I know and you answered that in the first reply.
However, if you look at the start of my first reply, I was looking at why the question was being asked.
In my experience, if people are asking about clock frequencies it is because they are trying to get a peripheral to work correctly (e.g. a timer, ADC, DAC, PWM etc - which can have some interesting clock sources depending on the peripheral, use of a PLL and the device itself).
However such questions are rarely couched in terms of the 'instruction" cycle time (as in the thread title) unless the reason for asking is to work out how long an instruction sequence will take and I was just trying to get ahead in the game and point out one of the more common errors that is made at that point.
If this has diverted the conversation and confused things, then my apologies to the OP.
Susan
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top