I am new to AVR micros (fair experience with PIC18F and PIC16F) and I have a few clarification questions for you when it comes to execution speeds. I am trying to learn AVR on my own, after having taken formal classes on PIC, so I am fuzzy on a few of the differences.
The way I understand it, PIC throughput can be calculated by taking 1/4 of the operating speed, since an instruction executes every 4 clock cycles. So if you are running a PIC at 12MHz from an external crystal it will be executing 3 MIPS, correct? And it will stay pretty much constant at 3 MIPS no matter what instructions are executing?
I am reading the AVR datasheet and to me it seems like they can run at much faster execution speeds, but not all the time. The way I understand it (which may be wrong), running an AVR with a 12MHz crystal will execute at "about" 12 MIPS. It seems to me that the reason AVRs can perform with better throughput is due to their optimized ALU. So in theory, if all the instructions were ALU instructions the AVR would execute at exactly 12 MIPS on a 12MHz clock. However, in reality the program is doing other stuff besides ALU operations so your real-world throughput will be somewhat less than the ideal 12 MIPS. Is this the right way of thinking about it or am I totally turned around? If this is correct, is there any possible way to estimate the average number of instructions per second the AVR is executing for timer counting? Or does it constantly fluctuate throughout program operation such that it is very hard to time correctly by counting cycles?
Sorry if I sound like a n00b but I have to start somewhere! Any insight/help/info/links/corrections are greatly appreciated! I have been googling and I'm hearing mixed things.
The way I understand it, PIC throughput can be calculated by taking 1/4 of the operating speed, since an instruction executes every 4 clock cycles. So if you are running a PIC at 12MHz from an external crystal it will be executing 3 MIPS, correct? And it will stay pretty much constant at 3 MIPS no matter what instructions are executing?
I am reading the AVR datasheet and to me it seems like they can run at much faster execution speeds, but not all the time. The way I understand it (which may be wrong), running an AVR with a 12MHz crystal will execute at "about" 12 MIPS. It seems to me that the reason AVRs can perform with better throughput is due to their optimized ALU. So in theory, if all the instructions were ALU instructions the AVR would execute at exactly 12 MIPS on a 12MHz clock. However, in reality the program is doing other stuff besides ALU operations so your real-world throughput will be somewhat less than the ideal 12 MIPS. Is this the right way of thinking about it or am I totally turned around? If this is correct, is there any possible way to estimate the average number of instructions per second the AVR is executing for timer counting? Or does it constantly fluctuate throughout program operation such that it is very hard to time correctly by counting cycles?
Sorry if I sound like a n00b but I have to start somewhere! Any insight/help/info/links/corrections are greatly appreciated! I have been googling and I'm hearing mixed things.