This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IAR调试



检验void Delay_5us();的延时时间是多少

进入调试界面后,单步运行至Delay_5us();如第一张图片中所示;

然后进入void Delay_5us()函数,

void Delay_5us()

{

    unsigned int i;

  for(i=0;i<5;i++);

}

对应第二张图片中的Disassembly窗口,它对应的汇编程序是这样的:

clr.w   R15

jmp  0xC078

inc.w  R15

cmp.w  #0x5,R15

jnc 0xC076

调试过程中,发现程序进入该延时函数继续单步执行,程序执行过程是这样的:

clr--cmp-inc-cmp-inc-cmp-inc-cmp-inc-cmp-inc-cmp 最后退出延迟函数,那么延时时间就应该是6*时钟周期了,请问这样理解对吗?