For this AVR tutorial we will be using the AVR assembly code from the Calculating Execution Time for Code with Double Loops tutorial.
End: RJMP End
The entire code in the AVR Studio editor should be similar to that below:
LDI R16, 5 Again: LDI R17, 4 Here: DEC R17 NOP BRNE Here DEC R16 NOP BRNE Again NOP NOP End: RJMP End
AVR Studio is now in simulation mode notice the yellow arrow, which indicates the microcontroller is about to execute this line of code.
Also notice the 'Processor' window pane to the left, which indicates the value of the Cycle Counter, Frequency, Stop Watch, etc. At this point the Cycle Counter and Stop Watch is at 0, indicating that no instruction as been executed. The Frequency for this simulation is set to 4MHz.
The simulator will now execute all the instruction up to where the cursor is located. You should now see an update 'Processor' window pane showing the number of cycles that has passed to execute up to this point in the code, given by Cycle Counter.
We are interested in the Stop Watch value which gives the time taken to execute the instructions up to this point in the code. That is the Execution Time for our code.