ArduinoUno - Time needed for each C instruction ?

Hi all,
i need to synchronize my arduino with another IC modem and i need to know how many time is needed for execute "each C instruction".
Looking the ATMEGA328 Datasheet I've seen that each "low level" instruction take 1/16000 more or less 62.5 nano second ...

but how many time takes ,

int i = 0;
i = i + 1;
or Serial.print(i) ?

Thanks for the info,

i need to know how many time is needed for execute "each C instruction".

The Arduino doesn't execute C instructions. The compiler converts the C instructions of machine instructions, and then optimizes them. The linker links them all together to form an executable. You will have a very difficult time determining how long "a C instruction" takes to execute, since many turn into more than one machine instruction.

i = 0;

is going to take a different amount of time than


will take, and


will take a different amount to time depending on whether there is room in the outgoing buffer, or not.

In short, you can't get what you are asking for.

you need to look at the compiled code assembly. C/C++ code has little relationship to actual code size.
For example, in your example, int i will most probably evaporate into a single load instruction.

You can search your IDE installation for 'avr-objdump.exe', it will have a help screen you can view.

This is how I do it in windows and the 1.5.2 IDE ( using a bat file in shell:SendTo ):
D:\arduino-1.5.2\hardware\tools\avr\bin\avr-objdump.exe -S %1 > %1%.txt

Use micros() to synchronize?

As others have said, how long it takes to execute a 'line' of code really depends on what the line is and how it is compiled.

You can get an idea by doing something like:

startTime = micros();
…..line of code here…..
executeTime = micros()-startTime;

I don't think this will be accurate enough for consistently syncing two devices. can you use the i2c interface or a signal on a digital pin?

another IC modem

Part number?

Generally there will be a way of synchronising comms that doesn't involve counting clock cycles.


in attachment the data sheet seems that are necessary for registry control write 525 microsecond before to accept the data …

thanks for help,

st7540.pdf (384 KB)