EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Rowley timer

Started by mayotte_d June 18, 2009
I set up a timer interrupt using Rowley CrossStudio and was amazed at how easy it was to get a timer interrupt going. It was basically 2 snippets.

I accidentally deleted the lst snippet that started the timer and haven't been able to reconstruct it. Mainly its my ignorance of the api structure.

The line as I remember it was:

ctl_start_timer(??);

where the ?? is the part I cant seem to get right. I thought it was onTimer but that doesn't work. When it worked, it was producing a timer interrupt to the below routine.

Can someone please put me out of my misery and just tell me what to enter so I don't keep getting "conflicting types.." errors.
void onTimer(void)
{
count++;

An Engineer's Guide to the LPC2100 Series

----- Original Message -----
From: "mayotte_d"
To:
Sent: Thursday, June 18, 2009 5:37 PM
Subject: [lpc2000] Rowley timer
> X-Antispam: NO; Spamcatcher 5.2.1. Score 50
>
> I set up a timer interrupt using Rowley CrossStudio and was amazed at how
> easy it was to get a timer interrupt going. It was basically 2 snippets.
>
> I accidentally deleted the lst snippet that started the timer and haven't
> been able to reconstruct it. Mainly its my ignorance of the api structure.
>
> The line as I remember it was:
>
> ctl_start_timer(??);
>
> where the ?? is the part I cant seem to get right. I thought it was
> onTimer but that doesn't work. When it worked, it was producing a timer
> interrupt to the below routine.
>
> Can someone please put me out of my misery and just tell me what to enter
> so I don't keep getting "conflicting types.." errors.
This is how I did it when I was testing the function:

int main(void)
{
IO0DIR |= 0x00000100;
IO0SET = 0x00000100;

Initialise();

unsigned long pclk liblpc2000_get_pclk(liblpc2000_get_cclk(OSCILLATOR_CLOCK_FREQUENCY));

ctl_set_isr(4, 0, CTL_ISR_TRIGGER_FIXED, timer0ISR, 0);
ctl_unmask_isr(4);

T0TCR = 0; /* Reset timer 0 */
T0PR = 0; /* Set the timer 0 prescale counter */
T0MR0 = pclk - 1; /* Set time 0 match register to generate an interrupt at
1Hz */
T0MCR = 3; /* Generate interrupt and reset counter on match */
T0TCR = 1; /* Start timer 0 */

ctl_global_interrupts_enable();

while (1)
;

return 0;
}

It was a long time ago but I think it worked.

Leon

Thanks Leon. I might use that in the future. I just stumbled across the reason for the error. I guess I need more rest but I had inserted the correct statement which was:

ctl_start_timer(onTimer);

into the wrong line (between functions and not in the function) and so now that I put it in the correct place it works ok.

I am going to go take a nap now.

--- In l..., "leon Heller" wrote:
>
> ----- Original Message -----
> From: "mayotte_d"
> To:
> Sent: Thursday, June 18, 2009 5:37 PM
> Subject: [lpc2000] Rowley timer
> > X-Antispam: NO; Spamcatcher 5.2.1. Score 50
> >
> > I set up a timer interrupt using Rowley CrossStudio and was amazed at how
> > easy it was to get a timer interrupt going. It was basically 2 snippets.
> >
> > I accidentally deleted the lst snippet that started the timer and haven't
> > been able to reconstruct it. Mainly its my ignorance of the api structure.
> >

> > The line as I remember it was:
> >
> >
> >
> > ctl_start_timer(??);
> >
> > where the ?? is the part I cant seem to get right. I thought it was
> > onTimer but that doesn't work. When it worked, it was producing a timer
> > interrupt to the below routine.
> >
> > Can someone please put me out of my misery and just tell me what to enter
> > so I don't keep getting "conflicting types.." errors.
> This is how I did it when I was testing the function:
>
> int main(void)
> {
> IO0DIR |= 0x00000100;
> IO0SET = 0x00000100;
>
> Initialise();
>
> unsigned long pclk > liblpc2000_get_pclk(liblpc2000_get_cclk(OSCILLATOR_CLOCK_FREQUENCY));
>
> ctl_set_isr(4, 0, CTL_ISR_TRIGGER_FIXED, timer0ISR, 0);
> ctl_unmask_isr(4);
>
> T0TCR = 0; /* Reset timer 0 */
> T0PR = 0; /* Set the timer 0 prescale counter */
> T0MR0 = pclk - 1; /* Set time 0 match register to generate an interrupt at
> 1Hz */
> T0MCR = 3; /* Generate interrupt and reset counter on match */
> T0TCR = 1; /* Start timer 0 */
>
> ctl_global_interrupts_enable();
>
> while (1)
> ;
>
> return 0;
> }
>
> It was a long time ago but I think it worked.
>
> Leon
>


The 2024 Embedded Online Conference