Pages: [1]   Go Down
Author Topic: Clock cycle per instructions  (Read 2108 times)
0 Members and 1 Guest are viewing this topic.
Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I just want to know how many clock cycle it take the ATmega on the Arduino to do the instructions that make your program.

In the day of 8085, 8086, 6809, 6502  ect....   all instruction - Op-Code that some clock cycle to complete.

Example :   MOV A, B  2 clock
                INC A        4 clock
                MOV B, A   2 clock

Where can I fing this information about ATMega / Ardiuno clock cycle per instruction.  In some program / application, this knowledge will be usefull. Because every instructions take time to complete.
               
 
Logged

Montreal
Online Online
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Exactly, look for microprocessors (AtMega328p or AtMega2560 etc) data sheet on Atmel.com
It around 350 - 500 pages docs, that include all information.
Logged

Victoria, BC, Canada
Offline Offline
Full Member
***
Karma: 0
Posts: 222
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's a couple of posts about creating a machine language listing of your code - combined with the information Magician provided, you can figure out the cycles for your code:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1207951658/2#2
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1241117308

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16514
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Many of the avr instructions work in just one clock cycle. Here is a link to the instruction set, and clock cycles per instruction is listed starting on page 11:

http://www.atmel.com/dyn/resources/prod_documents/doc0856.pdf
Logged

Toronto, Canada
Offline Offline
Edison Member
*
Karma: 2
Posts: 1234
"Keep it R.E.I.L. - "Research, Experiment, Investigate and Learn"
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Gentlement...Thank you for the info. I have a lot of reading to do and to figure things out.

I have a new question and I will make a new subject.
Logged

Pages: [1]   Go Up
Jump to: