Hi Robert,
I finally figured it out around 3:30 AM.
Void main (void)
{
while (1) /* Loop forever */
{
delay();
printf("\r\nresultat=%d",value);
}
}
/* Timer Counter 0 Interrupt executes each 10ms @ 60 MHz CPU Clock */
void tc1 (void) __irq
{
printf("!");
//value = T1CR1;
T1IR = 0x20; // Clear interrupt flag
VICVectAddr = 0; // Acknowledge Interrupt
}
void init_capture ( void )
{
PINSEL0 = 0x00A50000; // set RX,TX and Capture on both CAP1,1 and CAP1,0
VICVectAddr0 = (unsigned long)tc1; // set interrupt vector in 0
VICVectCntl0 = 0x20 | 5; // use it for Timer 1 Interrupt
VICIntEnable = 0x00000010; // Enable Timer0 Interrupt
T1CCR = ((1<<5) | (1<<3)); // Capture CAP1,1 Rising only...
T1PR = 0xF;
T1TCR = 2; // Reset counter...
T1TCR = 1; // Start counter again...
}
And I felt pretty stupid about the all incrementing thing as I realized that
the Timer 1 was running for it self as a separate thing, on the smaller
processors that I have played with before the counter would be automatically
reset etc. ... but I guess it makes sense now that I know it he he :)
Thanks for the clarification
Best regards
Lasse Madsen
-----Original Message-----
From: Robert Adsett [mailto:subscriptions@...]
Sent: 27. februar 2005 05:45
To: lpc2000@yahoogroups.com
Subject: Re: [lpc2000] Capture problem - counting towards no end...
At 11:17 PM 2/26/05 +0100, Lasse Madsen wrote:
>Why is the damn capture module counting towards no end without a stop!?
>It should count to 2200 according to my calculations!?
>
>Why does it increment all the time?
Because there is nothing to stop it?
You have to set up trigger on a rising edge and if your comment is correct
you expect a rising edge every few milliseconds. Assuming a 9600 bd serial
port you will only get a couple of characters out in that time so you will
get several captures for each print cycle each capture higher than the
other (by about 2200) until the 32bit timer overflows.
Basically it's doing what it's supposed to.
Robert
" 'Freedom' has no meaning of itself. There are always restrictions,
be they legal, genetic, or physical. If you don't believe me, try to
chew a radio signal. "
Kelvin Throop, III
Yahoo! Groups LinksMessage
RE: [lpc2000] Capture problem - counting towards no end...
2005-02-27 by Lasse Madsen
Attachments
- No local attachments were found for this message.