- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using the CY8C20524-12PVXI with the intention of controlling a display with a rotary encoder. It seems that when I run the application, the Interrupt Service Routine runs once, without touching a button. When I press the button, the ISR runs, but nothing happens each subsequent time that I press the button. The while loop in the main function still executes instructions, so I know that the ISR maintains context and returns to the correct address.
It seems like I need to clear the interrupt in order to interrupt again, but I haven't been able to successfully do so yet.
My GPIO setup is portrayed in the following code:
=========================================================
#pragma interrupt_handler GPIO_ISR
...
void main(void)
{
IO_CFG |= 0x01; // set the IO_CFG_IOINT bit
IO_CFG |= 0x02; // set REG_EN to 1
// set pin as Open Drain Low, High Z
ROT_SW_DriveMode_0_ADDR |= ROT_SW_MASK;
ROT_SW_DriveMode_1_ADDR |= ROT_SW_MASK;
ROT_SW_Data_ADDR |= ROT_SW_MASK;
M8C_EnableIntMask(INT_MSK0, INT_MSK0_GPIO); //Enable the GPIO in INT_MSK0:
ROT_SW_IntEn_ADDR |= ROT_SW_MASK; // Enableinterrupts on Rotary Switch
M8C_EnableGInt; //Enables the Global Interrupt
...
while (1)
{
...
if ( rotarySwitchPressed != button_idle ){
rotarySwitchPressed = button_idle;
...
ROT_SW_Data_ADDR |= ROT_SW_MASK;
M8C_EnableIntMask(INT_MSK0, INT_MSK0_GPIO);
}
...
}
}
...
void GPIO_ISR(void)
{
// disable button interrupt
M8C_DisableIntMask(INT_MSK0, INT_MSK0_GPIO);
rotarySwitchPressed = button_pressed;
return;
}
=========================================================
Is there a register I need to write to in order to enable a GPIO to trigger the ISR more than one time?
Thanks!
Solved! Go to Solution.
- Labels:
-
PSoC1 MCU
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @JeJa_2249041 ,
You would need to clear the GPIO interrupt in the ISR, by using
M8C_ClearIntFlag(INT_MSK0, INT_MSK0_GPIO)
You can find detailed information in PSoC®1 Interrupts, and PSoC®1 - Getting Started With GPIO.
Best regards,
Sampath Selvaraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello @JeJa_2249041 ,
You would need to clear the GPIO interrupt in the ISR, by using
M8C_ClearIntFlag(INT_MSK0, INT_MSK0_GPIO)
You can find detailed information in PSoC®1 Interrupts, and PSoC®1 - Getting Started With GPIO.
Best regards,
Sampath Selvaraj