Friends, Is there any way to calculate the time of execution for a piece of 8051 Assembly Code ?.Say for example I am having a 8051 delay loop in assembly code.I just want to find out how much time is elapsed in executing the delay loop.I searched in Google, but in vain. Thanking You. Regards, Vamanan Kutty
The Datasheet will tell you the execution time of each instruction - you just have to add-up the execution times of the instructions in your code. You could use An Excel (or similar) spreadsheet. Alternatively, you could use the uVision performance analyser.
Dear Neil, The assembly code consists of Loop inside a Loop inside a Loop.It is creating confusion to calculate the execution time exactly. The following was the code DLYKK: MOV R3, #39 MOV R2, #38 MOV R1, #79 TDK: DJNZ R1, TDK DJNZ R2, TDK DJNZ R3, TDK RET Can you please guide me how to reach the exact timing.Is there any execution time calculator other than performance analyzer?. I will try with performance analyzer. Thanks for your suggestion.
The simplest would be to use uVision's built-in simulator and run that piece of code. You will see the number of elapsed CPU cycles in the register pane. - Dejan
"The assembly code consists of Loop inside a Loop inside a Loop" So just do the sums for the inner loop, then insert the result into the calculation for the outer loop! Don't forget that the timing of DJNZ may be different depending on whether it jumps or not... Or just run it in the simulator!
http://www.keil.com/support/man/docs/uv3/uv3_cm_perfanalyze.htm
the number of "instruction cycles" instructiuons take are found in "the bible" ch 2. Erik here are the links to "the bible" Chapter 1 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_ARCH_1.pdf chapter 2 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_PROG_GUIDE_1.pdf chapter 3 http://www.semiconductors.philips.com/acrobat/various/80C51_FAM_HARDWARE_1.pdf
"the number of 'instruction cycles' instructiuons take are found in 'the bible' ch 2." That would be for the standard 8051. Modern derivatives may vary - check the Datasheet for the specific device in question.