Interrupt both edges on 13xx
06-15-2016
09:55 AM
1,053件の閲覧回数


NXP Employee
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Content originally posted in LPCWare by mozmck on Tue Aug 27 17:23:47 MST 2013
I'm moving a project from an LPC1114 to a LPC1347 chip, and I'm not sure how to set up a pin interrupt to interrupt on both edges - rising and falling edges. Can I set it up so both rising and falling edge interrupts go to the same pin interrupt handler? In the LPC1114 this was easy and straight-forward, but in the 13xx chips it is not clear and the sample code does not show any way to do it at all.
It looks like I should be able to just set the correct bit in both the IENF and IENR registers to enable both edges - will this work?
Thanks.
I'm moving a project from an LPC1114 to a LPC1347 chip, and I'm not sure how to set up a pin interrupt to interrupt on both edges - rising and falling edges. Can I set it up so both rising and falling edge interrupts go to the same pin interrupt handler? In the LPC1114 this was easy and straight-forward, but in the 13xx chips it is not clear and the sample code does not show any way to do it at all.
It looks like I should be able to just set the correct bit in both the IENF and IENR registers to enable both edges - will this work?
Thanks.
2 返答(返信)
06-15-2016
09:55 AM
1,007件の閲覧回数


NXP Employee
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Content originally posted in LPCWare by mozmck on Wed Aug 28 18:36:22 MST 2013
Thanks, I thought that might work but was not sure. I'll have boards to test with in a few days but thought I'd ask first and maybe save some time.
Thanks, I thought that might work but was not sure. I'll have boards to test with in a few days but thought I'd ask first and maybe save some time.
06-15-2016
09:55 AM
1,007件の閲覧回数


NXP Employee
- 新着としてマーク
- ブックマーク
- 購読
- ミュート
- RSS フィードを購読する
- ハイライト
- 印刷
- 不適切なコンテンツを報告
Content originally posted in LPCWare by tha on Wed Aug 28 16:51:01 MST 2013
Hi Mozmck,
Yes, the pin interrupt will work with rising and falling edge. You can use this little code snippet to test it out yourself:
You can monitor which edge is detected by setting a break point inside the PIN_INT0_IRQHandler() function.
The gpio.c file and gpio.h is from the code bundle.
Hi Mozmck,
Yes, the pin interrupt will work with rising and falling edge. You can use this little code snippet to test it out yourself:
#include "LPC13Uxx.h"/* LPC13Uxx Peripheral Registers */ #include "gpio.h" int main (void) { GPIOInit(); /* use port0_1 as input event, interrupt test. */ GPIOSetDir( PORT0, 1, 0 ); /* channel 0, port0, bit 1, edge trigger, rising edge. */ //Set P0_1 detect rising edge GPIOSetPinInterrupt( 0, 0, 1, 0, 1 ); //Now set it for falling edge also LPC_GPIO_PIN_INT->IENF |= (0x1<<0);/* faling edge */ GPIOPinIntEnable( 0, 1 ); while(1); } |
You can monitor which edge is detected by setting a break point inside the PIN_INT0_IRQHandler() function.
The gpio.c file and gpio.h is from the code bundle.
