We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi i'm using lpc2103 and timer0 to make a 10 second delay .but my code just give me 2 second delay . it seems that timer is running 5 time faster ! here is my code :
T0TCR=(1<<1); //Reset Timer0 T0MR0=30000000; //Loading match register value T0PR=0; //Loading Prescalar register value T0PC=T0TC=0; T0MCR=(1<<0)|(1<<2); //Generates interrupt and reset on match T0TCR=(1<<0); //Starting Timer while(!(T0IR&(1<<0))); //Waiting for interrupt T0IR=(1<<0); //Clearing interrupt my crystal is 12MHZ and by setting T0PR to 0 I set PCLK the same as CCLK. so my PCLK is 3 MHZ and the time for counter to reach 30000000 is 10 second. but it just produce 2 second. can any one help me ?
soled . just look in startup.s file in line 129 chnage value of 24 to 20