Reply by Leandro Schmitz October 20, 20092009-10-20
In debug mode, you can see for yourself what ctr_set_isr() does.
Just enable the View of Registers and see the VIC group of register, before
and after ctr_set_isr().

On Mon, Oct 19, 2009 at 6:55 PM, artsaagluap wrote:

> Hi,
>
> I am struggling with interrupts using CrossWorks. I can't work out
> ctl_set_isr(). Any "for dummies" explanation of what it does and how it
> makes plain functions work as interrupts?
>
>
>


An Engineer's Guide to the LPC2100 Series

Reply by artsaagluap October 20, 20092009-10-20
thanks Michael,

I read what the parameter are in the CrossWorks documentation and I set up the interrupts as you say, except that I used ctl_global_interrupts_enable(); instead of libarm_enable_irq();
I was trying to see how the ctl_set_isr() worked so I could see why it wasn't working for me. Reading the code for ctl_set_isr() was a bit too hard for me to fathom.

Since posting this I got my interrupts working by using a simple project where I knew the interrupts worked and put all the code from my other program into that and it works. To me I had it right the first time but the interrupt only happened once somehow the next time the interrupt happened the ISR was not called.

--- In l..., "nutleycottage" wrote:
>
> Hi,
>
> --- In l..., "artsaagluap" wrote:
> >
> > Hi,
> >
> > I am struggling with interrupts using CrossWorks. I can't work out ctl_set_isr(). Any "for dummies" explanation of what it does and how it makes plain functions work as interrupts?
> > ctl_set_isr(EINT1_INT, 1, CTL_ISR_TRIGGER_FIXED, buttonISR, 0);
>
> The first parameter is the hardware interrupt source number - see the user manual for a list of these.
>
> The second parameter is a priority. For LPC21xx/LPC22xx priorities 1-15 are hardware scheduled and 16-31 are software scheduled. For LPC23xx/LPC24xx priorities 1-31 are hardware scheduled. Note that you'll need to build the VIC_irq_handler.s with the NESTED_INTERRUPTS preprocessor define if you require interruptable interrupts.
>
> The third priority is not used by the VIC interrupt controller as found on the LPC21xx,22xx,23xx,24xx this is for ATMEL/OKI controllers.
>
> The fourth parameter is the function pointer to call.
>
> The last parameter is 0 or a pointer for the current function pointer if you want to swap function pointers.
>
> To set up interrupts you'll need to
>
> main()
> {
> libarm_enable_irq(); // turn on global interrupts
>
> ctl_set_isr(number,...); // set interrupt source
> ctl_unmask_isr(number); // enable interrupt source
> ....
> }
>
> Regards
> Michael
>

Reply by nutleycottage October 20, 20092009-10-20
Hi,

--- In l..., "artsaagluap" wrote:
>
> Hi,
>
> I am struggling with interrupts using CrossWorks. I can't work out ctl_set_isr(). Any "for dummies" explanation of what it does and how it makes plain functions work as interrupts?
>

ctl_set_isr(EINT1_INT, 1, CTL_ISR_TRIGGER_FIXED, buttonISR, 0);

The first parameter is the hardware interrupt source number - see the user manual for a list of these.

The second parameter is a priority. For LPC21xx/LPC22xx priorities 1-15 are hardware scheduled and 16-31 are software scheduled. For LPC23xx/LPC24xx priorities 1-31 are hardware scheduled. Note that you'll need to build the VIC_irq_handler.s with the NESTED_INTERRUPTS preprocessor define if you require interruptable interrupts.

The third priority is not used by the VIC interrupt controller as found on the LPC21xx,22xx,23xx,24xx this is for ATMEL/OKI controllers.

The fourth parameter is the function pointer to call.

The last parameter is 0 or a pointer for the current function pointer if you want to swap function pointers.

To set up interrupts you'll need to

main()
{
libarm_enable_irq(); // turn on global interrupts

ctl_set_isr(number,...); // set interrupt source
ctl_unmask_isr(number); // enable interrupt source
....
}

Regards
Michael

Reply by Felipe de A N L October 20, 20092009-10-20
This is a problem, leak of time to learn and understand is a problem.
There's never a easy way in programing uC.

You don't have to write in assembler to set up interruption, just have to
configure the right registers.

2009/10/20 Dick Balaska

> In another thread ([lpc2000] Re: Interrupt only runs once. CrossWorks on
> LPC2103), you wrote:
> "It was broken, now it works, i don't know why, and i don't care."
>
> Remind me to never hire you.
>
> dik
>
> Am 10/19/2009 11:41 PM, also sprach artsaagluap:
>
> > I am in a hurry and I don't have any experience writing in assembler.
> >
> > --- In l... , Felipe de A
> N L wrote:
> >
> >> Y dont you setup manually each interruption? It is the long way but
> would be
> >> free of unknown procedures.
> >>
> >>
> >>
> >> 2009/10/19 artsaagluap
> >>
> >>
> >>> Hi,
> >>>
> >>> I am struggling with interrupts using CrossWorks. I can't work out
> >>> ctl_set_isr(). Any "for dummies" explanation of what it does and how it
> >>> makes plain functions work as interrupts?
> >>>
> >>>
> >>>
> >>>
> >
> >
> >
> >
> >
> >
> >
Reply by Dick Balaska October 20, 20092009-10-20
In another thread ([lpc2000] Re: Interrupt only runs once. CrossWorks on
LPC2103), you wrote:
"It was broken, now it works, i don't know why, and i don't care."

Remind me to never hire you.

dik

Am 10/19/2009 11:41 PM, also sprach artsaagluap:
> I am in a hurry and I don't have any experience writing in assembler.
>
> --- In l..., Felipe de A N L wrote:
>
>> Y dont you setup manually each interruption? It is the long way but would be
>> free of unknown procedures.
>>
>> 2009/10/19 artsaagluap
>>
>>
>>> Hi,
>>>
>>> I am struggling with interrupts using CrossWorks. I can't work out
>>> ctl_set_isr(). Any "for dummies" explanation of what it does and how it
>>> makes plain functions work as interrupts?
>>>
>>>
>>>
>>>
>
Reply by artsaagluap October 20, 20092009-10-20
I am in a hurry and I don't have any experience writing in assembler.

--- In l..., Felipe de A N L wrote:
>
> Y dont you setup manually each interruption? It is the long way but would be
> free of unknown procedures.
>
> 2009/10/19 artsaagluap >
> >
> > Hi,
> >
> > I am struggling with interrupts using CrossWorks. I can't work out
> > ctl_set_isr(). Any "for dummies" explanation of what it does and how it
> > makes plain functions work as interrupts?
> >
> >
>

Reply by Felipe de A N L October 19, 20092009-10-19
Y dont you setup manually each interruption? It is the long way but would be
free of unknown procedures.

2009/10/19 artsaagluap

> Hi,
>
> I am struggling with interrupts using CrossWorks. I can't work out
> ctl_set_isr(). Any "for dummies" explanation of what it does and how it
> makes plain functions work as interrupts?
>
>
>


Reply by artsaagluap October 19, 20092009-10-19
Hi,

I am struggling with interrupts using CrossWorks. I can't work out ctl_set_isr(). Any "for dummies" explanation of what it does and how it makes plain functions work as interrupts?