I change the xtal value in options for target, but the ticks time not change, why? select use simulator in options for debug. Thanks for your answer!
You need to use the sec value to determine execution times. Another way is the Performance Analyzer. Reinhard
Thanks for your answer! I am a beginer for keil c51, I found my question should be as follows: when I change the xtal in options, but the time of timer0 which I used not changed.
Sorry, still I do not understand your question. What 'time' did not change? How did you measure this 'time'? Reinhard
I use timer0 to control the P1 output, but the flash frequency not change as the xtal setting changed. I watch the flash in simulator mode. Push button "Peripheral" and select "Port0", can see the port flash. my program is as follows: #include <reg51.h> #include <stdio.h> #define RELOADVALH 0x9e;//3C #define RELOADVALL 0x58;//B0 unsigned int tick_count = 0; void main(void) { TMOD=(TMOD & 0xf0) | 0x01; TR0=0; TH0=RELOADVALH; TL0=RELOADVALL; TR0=1; EA=1; ET0=1; for(;;) { P0 = 0; } } void timer0(void) interrupt 1 { TR0=0; TH0=RELOADVALH; TL0=RELOADVALL; TF0=0; TR0=1; tick_count++; if (tick_count == 120) { tick_count = 0; P1 = ~P1; } //printf("tick_count=%05u\n",tick_count); }
You are running on the simulator. The simulator shows the time in the register window under sec=. Reinhard