We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Hi!
Im using a lpc2368 I need some help setting up external interrupt. I get square waves on P2.13 and P1.31 and want to get interrupts on the raising edge on these ports. How do I this? Im guessing I need to install my interrupt handler with:
VIC_Install_IRQ(DWORD IntNumber, void* HandlerAddr, DWORD Priority)
What is the input parameters for that function?
lets assume that we got these handlers:
void MyEINTHandler0(void) __irq{ //do something...
VICVectAddr = 0; // ACK the VIC }
and
void MyEINTHandler1(void) __irq{ //do something...
to install them just run
VIC_Install_IRQ(???,(void *)MyEINTHandler0,???); VIC_Install_IRQ(???,(void *)MyEINTHandler1,???);
but what is IntNumber and priority? Where do I set which port and bit to trigger the interrupts? Any good examples to look at?
Best wishes.
That will be described in the documentation for that function - have you read it?
If it's a Keil function, then start here: http://www.keil.com/support/man/
If it's not a Keil function, then you need to find whoever did supply the function - and get the documentation from there!
In either case, they will assume that you understand how interrupts work on the lpc2368 - it is an NXP chip, so consult the NXP documentation for it.
I'm not sure where VIC_Install_IRQ() comes from.
I have only used "naked" C code based directly on the descriptions in the user manual.
You install all interrupt handles the same way. All you need to do is look at the peripherial-specific registers to see how they should be configured to produce the intended interrupts.
Hi,
the VIC_Install_IRQ function is from NXP, you can have a peek here: www.mikrocontroller.net/.../irq.c
What is the recipe for setting up interrups?
I'm not getting what EINT1, EINT2, EINT3 is, used as input IntNumber (Interrupt number) in VIC_Install_IRQ. Whats the differences between EINT0-EINT3?
I see in the docs that EINT3, channel 17 is shared with GPIO interrupts. What does this mean? Does all my interrupts on GPIO ports share the same interrupt function as EINT3? And in this function I have to determinate from what Port and pin the interrupt was generated?
The processor can have four processor pins that generates external interrupt 0 to external interrupt 3 - all individually enabled and configurable for type of interrupt (such as rising or falling edge).
The processor also have two pin-change interrupts - all 32 pins on p0 and all 32 pins on p2 can be configured to generate pin change interrupts.
That one VIC channel is handling both eint3 and pin change interrupts means that if you use both, your interrupt handler needs to check a couple of status bits to figure out the reason for the interrupt.
If the search function had been working, I would have recommend you to use it. It wasn't more than a couple of weeks since I did cover this in another thread.
If you the source was a pin-change interrupt, then a different register can tell which of the 32 pins on the port that was causing it.
The advantage with EINTx from the pin-change interrupts is that you you have better control of priority for the EINTx signals while at the same time get a slightly faster interrupt handler.
But all this is covered excellently in the NXP user manuals. They really have very good manuals for the ARM families I have been looking at.
I don't know what I'm doing wrong here, I set bit 13 in IO2IntEnR to get rising edge interrupts on P2.13 but I don't get any interrupts from p2.13. Is there anymore register I need to set to get it started? I can read from the port and see if I got an '1' or '0' so the port works.
And I have installed my interrupt handler with the VIC_Install_IRQ functions as:
VIC_Install_IRQ(EINT3_INT,(void *)EXT_EINT_isr,1);
what else do I need to get this to work?
Well, scattering essentially the same question over 2 different threads doesn't help:
http://www.keil.com/forum/docs/thread16866.asp