Hi,
I have a problem - can`t understand why code execution time in RUN mode is about 30 cycles, while in STEP-by-STEP mode is onle 9 cycles!
I write small program:
volatile Uint16 i=0;
void main(void)
{
peripherial_init(); // timer0 - init,... etc, all interrupt disable!
CpuTimer0Regs.TIM.all = 1000; //
i++;
i++;
i++;
i++;
i++;
i++;
i++;
i++;
while(1) {};
}
And if I set breakpoint on the infinite loop and make RUN command than value CpuTimer0Regs.TIM.all = 969. So it mean that eight (i++) instructions performed for about 30 cycles! But if I use STEP-by-STEP then CpuTimer0Regs.TIM.all = 991.
Somebody please help me to understand why it happens? Thanks!
PS: TIMER0 was init correctly. Assembler code of eight (I++) instructions is:
//30 i++;
0x00029B: 761F001B MOVW DP,#0x001B
0x00029D: 0A12 INC @18
//31 i++;
0x00029E: 0A12 INC @18
//32 i++;
0x00029F: 0A12 INC @18
//33 i++;
0x0002A0: 0A12 INC @18
//34 i++;
0x0002A1: 0A12 INC @18
//35 i++;
0x0002A2: 0A12 INC @18
//36 i++;
0x0002A3: 0A12 INC @18
//37 i++;
0x0002A4: 0A12 INC @18