I have a problem. I write a function in another c source file not main file, in this function nothing do, and I declare the function as extern. In main function I invoke it 200 times. However, the compiler does not use registerbank as counter. Why?
extern void func1(void); void func2(void) { unsigned char data i; for(i=200;i;i--); } main() { unsigned char data i,j; for(i=200;i;i--) // store i in 0x08 { func1(); } for(j=200;j;j--) // store j in R6 { func2(); } } the assembly code: C:0x0003 7508C8 MOV 0x08,#TMR2CN(0xC8) 19: { 20: func1(); C:0x0006 120025 LCALL func1(C:0025) 21: } C:0x0009 D508FA DJNZ 0x08,C:0006 22: for(j=200;j;j--) C:0x000C 7EC8 MOV R6,#TMR2CN(0xC8) 23: { 24: func2(); C:0x000E 120020 LCALL func2(C:0020) 25: } C:0x0011 DEFB DJNZ R6,C:000E