Quick PIC timing question

PICs can be thought of as running 1/4 their rated speed correct? In other words, doesn't it take 4 CLK cycles = for a single PIC instruction cycle? Doesn't look like these guys are pipelined so I'm assuming this is correct.....

-Adam

Reply to
ajcrm125
Loading thread data ...

"ajcrm125" schrieb im Newsbeitrag news: snipped-for-privacy@g47g2000cwa.googlegroups.com...

This is fully correct. However there is a pipelining between the instruction fetch and the 4-cycle instruction execute. This interleaves the ROM access time with the instruction execution time. Thats why it takes extra 4 clocks on jumps. Without this pipelining a PIC would need 8 cycles per instruction.

After all, a PIC executes read modify write cycles in its 4 cycle instructions. That was quite a nice architecture in the 70ties.

But it's not a RISC in the meaning of RISC nowadays.

MIKE

Reply to
M.Randelzhofer

So beacuse of this.. would it be more beneficial to go with a different microcontroller family/vendor? (I guess the answer would be based on performance requirements eh?)

Reply to
ajcrm125

I used PICs fpr several years, but because of the availability of a free C compiler (gnu) and the better functionality and performance i decided to switch ti Atmel ATMega.

Regards, Kurt

--
Kurt Harders
PiN -Präsenz im Netz GITmbH
 Click to see the full signature
Reply to
Kurt Harders

Atmel CPUs are great for beginners because of several factors:

  1. It is designed based on suggestions of compiler wirters so is very C friendly.
  2. There is a version of GCC for it.
  3. The programmer hardware is dead simple. You can build one with three or four resistors.

Although, PICs do have its own advantages for beginners:

  1. There are more web pages out there detailing projects & code for PICs than any other controller.
  2. formatting link
    -- nuff said.
  3. If you want to program in assembly, then the PIC was designed to be very easy to understand.

PIC programmers are complicated beasts due to the need for controllable dual voltage source. Cheap ones tend to not be reliable and I've even had to debug a programmer a friend of mine bought once. I use the fairly expensive EPIC programmer (~ USD $100) which have't given much problems.

Reply to
slebetman

And this gcc fits into eclipse as ide.

Thats half the truth :-). One additinal reason for my switch from PIC to Atmel was the paging structure of PIC memory for both, code and data. With growing complexity and size of the program this became the favorite source for problems :-).

Regards, Kurt

--
Kurt Harders
PiN -Präsenz im Netz GITmbH
 Click to see the full signature
Reply to
Kurt Harders

You mean paged instruction memory and banked file registers? I use C compilers (HITECH & CC5X depending on app) so they don't bother me.

Adam, if you really want to go the PIC path (due to larger online comunity etc..) then I suggest you look at HITECH and CC5X for compilers. They are commercial but lite versions are free for non commercial use. HITECH C supports 3 of the most popular PICs including 16F877. It is limited to producing only 4k programs but then again that's how much memory these chips have anyway. CC5X supports everything in the 16C/F family. But it can only compile up to 1k. But it does compile into assembly. Larger code can be split up into multiple C files to gnenrate multiple assembly files and then use MPASM to assemble together.

Anyway, I think Kurt is right, there are far more compelling reasons to use AVR than PIC. The only reason to use PICs is the huge amount of code available online.

Reply to
slebetman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.