This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

lpc2103 timer0

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 ?