You are here

Setting Up GPIO Interrupts | Cypress Semiconductor

Support & Community

Setting Up GPIO Interrupts

Last Updated: March 20, 2011

How do I Set Up GPIO Interrupts?


First, enable the interrupt from the particular pin you are using and set the interrupt type for the pin. 

As an example, here are the steps you need to take for enabling a rising edge interrupt on Port1 bit 0:
- Set the pin used as input in PSoC Designer
- Enable the GPIO in INT_MSK0: or reg[INT_MSK0], 20h
- Enable an interrupt on the pin: mov reg[PRT0IE], 01h ; this is a Write-only register, so you cannot do AND/OR functions.
- Set the interrupt type to falling edge (10b): mov reg[PRT0IC1], 01h ; a Write-only register: mov reg[PRT0IC0], 00h ; a Write-only register

The PRTxIC1 and PRTxIC0 registers act as a 2-bit control for each pin, where the high bit for a pin is in the PRTxIC1 register and the low bit for a pin is in the PRTxIC0 register.

The write-only registers will return undefined values if read. Therefore, if you need to change the mode of pins independently while running you will have to keep a variable for the register contents. If you want to set a pin's mode, the variable would have to be changed, saved, and copied to the register.

You will need to insert your interrupt vector in your boot.tpl file.

Lastly, enable the global interrupts by: M8C_EnableGInt.

For more information on GPIO, you read this post at PSoC Hacker. You can also have a look at the following KBA for more information on implementings ISRs.

Provide feedback on this article

Browse KB By Product

Browse KB by Type