O, yeah, you are right, how stupid I am.
Thank you very much!
--- In lpc2000@yahoogroups.com, Daniel Widyanto <daniel.widyanto@...> wrote:
>
>
>
> Hi,
>
> Check your PINSEL0:
> PINSEL0 |= 1<<12; //set P0.6 as cap0.2
>
> If you read the manual carefully (page 75 section 4.1), it's suppose to be:
> PINSEL0 |= 1<<13;
>
> -daniel
>
> --- On Thu, 7/9/09, robinfei2638 <robinfei2638@...> wrote:
>
> From: robinfei2638 <robinfei2638@...>
> Subject: [lpc2000] Re: unable to count the external clock
> To: lpc2000@yahoogroups.com
> Date: Thursday, July 9, 2009, 7:06 PM
>
>
> --- In lpc2000@yahoogroups .com, "robinfei2638" <robinfei2638@ ...> wrote:
> > Hi,
> >
> > I was trying to use the capture pin to count an external clock, then check
the result from a hypertermial. However, the reading is always zero, the TC
didn't increase. Anybody can help? Thanks.
> > Here is my code
> >
> > void capture()
> > {
> > char s[30]; // Buffer for keep string from integer convert
> > volatile uint32 i;
> >
> > uart0_init(9600) ; // Initial UART0
> > PINSEL0 |= 1<<12; //set P0.6 as cap0.2
> >
> > T0PR = 0;
> > T0CCR = 1<<7;
> > T0TC = 0;
> > T0TCR=0x01;
> >
> > while(1)
> > {
> > i=T0CR2;
> > sprintf(s,"Counter= %d \r",i);
> > uart0_puts(s) ; // Display to Terminal program
> >
> >
> > }
> > }
> >
> > Robin
> >
>
> sorry, i forgot to mention, I'm using a LPC2148 chip.
>