Yahoo Groups archive

Lpc2000

Index last updated: 2026-04-28 23:31 UTC

Message

Re: [lpc2000] How to define 2 IRQs

2005-03-17 by Robert Adsett

At 07:03 PM 3/17/05 +0000, tphatrapornnant wrote:
>I have an IRQ problem. My program did not jump after interrupt
>occured. Now I'm using 2 IRQs (I don't want to use FIQ) and I assign
>IRQ 0 for Timer1 and IRQ 1 for Timer0.

<snip>

>In simulator, the addresses of Func_A and Func_B were loaded in
>vector table properly. But when interrupt occured (RawInt = 1), the
>program didn't jump to those function. I think my Startup.s is not
>correct. I don't know how to define addresses of 2 function for IRQs.

<snip>
>It seems program always jump to IRQ_Handler address. If I assign
>Func_A to IRQ_Handler
>
>IRQ_Handler:    B       Func_B
>
>Program will jump to Func_B when interrupt occurs. I used to hook
>these 2 function with FIQ and IRQ Handler. It worked well. But for 2
>IRQs, I don't know how to define them.
<snip>

 From a quick look, I think you are correct.  The IRQ in startup.s needs to 
read the vector from the VIC and jump to it.  I think there are examples in 
the files section.  I know that the newlib-lpc  at 
http://www.aeolusdevelopment.com has a GNU startup that has this routine in 
it (it's really just a different type of jump instruction in the table).

The interrupt routines for each of your Func_A and Func_B above need to be 
defined with your compilers equivalent of an interrupt keyword (if you 
trust it) or have a small assembly shell to take care of the necessary details.

BTW if you don't read and write to the VIC address register the 
corresponding interrupt won't be dismissed.

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
http://www.aeolusdevelopment.com/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.