Hi-
The mode i am using is MK20DX256VMX7. I have a GPIO pin PTC8 initially set as input and interrupt source. If I change the pin later in code to toggling as code below, will it trigger interrupt?
/* testing on PTC8: turn off the GPIO */ | |
PORT_PCR_REG(PORTC_BASE_PTR, 8) = PORT_PCR_MUX(0x01); | |
GPIO_PDDR_REG(PTC_BASE_PTR) |= 1 << 8; // PTC8 as output | |
GPIO_PDOR_REG(PTC_BASE_PTR) |= (1 << 8); // PTC8 in high level | |
_time_delay(10); | |
/* testing on PTC8: turn off the GPIO */ | |
PORT_PCR_REG(PORTC_BASE_PTR, 8) = PORT_PCR_MUX(0x01); | |
GPIO_PDDR_REG(PTC_BASE_PTR) |= 1 << 8; // PTC8 as output | |
GPIO_PDOR_REG(PTC_BASE_PTR) &= ~(1 << 8); // PTC8 in low level | |
_time_delay(10) |
thanks!
Hui
Hui
If you have a GPIO configured to generate an interrupt on a falling or rising edge (eg. PORTC_PCR8 is originally 0x000a0103 for falling edge sensitive interrupt with pull-up enabled) you can change its direction from input to output (in GPIOC_PDDR bit 0 to 1) and it will drive the value in GPIOC_PDOR to the pin.
At the same time each change of the pin value from '1' to '0' will still trigger the original falling edge interrupt.
This allows generating a port interrupt by controlling the value on a GPIO output pin.
Regards
Mark
Hi Mark
Thanks a lot for your reply.
Hui
Hi Hui,
Have you config the IRQC:
and config the corresponding interrupt vector table ?
Hope it helps
ALice
Hi Alice
Thank you so much for your help!
Hui