There is a note on Top Page of schematic for Project D -
To implement an ISR based on a pin -
1) Place digital input pin on schematic
2) Config pin as input, pull up or down, your preference. Under input tab
of pin config select rising or falling edge, depending on what pullup/down
you selected. Look at notes in datasheet for pin for additional considerations
on interrupt configuration.
3) Place isr component on schematic, connect to IRQ connection on pin. Name
it or accept default name, isr_1
4) In code enable global ISR's and the pin isr
5) Compile/Build project
6) There will now be a placeholder file for isr in project, named isr_1.c,
in that there is a placeholder area to put your interrupt code.
7) Compile/Build project
Thats pretty much it.
A couple of precautions -
Bad post, the precautions -
To configure a Pins component with an interrupt, you must use a digital input and configure the
Interrupt parameter on the Input subtab. When interrupts are used, the Pins component
displays with a bounding box, and the IRQ is displayed extending from the bottom of the
component. The typical use case is to connect an Interrupt component to this terminal. If the Pin
Interrupt is used to wake the part up from sleep or hibernate low-power mode, the Interrupt
component connected to the Pins irq terminal may not have InterruptType set to
An Interrupt can be used in all configurations of the Pins component, as long as you include
Interrupt – This parameter selects whether the pin can generate an interrupt and, if selected,
the interrupt type. The pin interrupt may be generated with a rising edge, falling edge, and
both edges. If set to anything but None, the component must be configured to be contiguous
to ensure it is mapped into a single physical port. A single port is required because all pins in
a port logically OR their interrupts together and generate a single interrupt signal and symbol
terminal. The Interrupt parameter uses dedicated pin interrupt logic, which latches the pins
that generated interrupted events. After an interrupt occurs, the Pin_ClearInterrupt() function
must be called to clear the latched pin events to enable detection of future events. If more
than one pin in the Pins component can generate an interrupt, the Pin_ClearInterrupt() return
value can be decoded to determine which pins generated interrupt events.
While not the preferred method, any digital input hardware connection can also be connected to
an isr component, providing the ability to generate a pin interrupt on high or low logic level
versus on an edge event. Using the digital input connection for a level interrupt does not use the
dedicated pin interrupt logic configured with this parameter.
Hi Dana, Thank you for the post. Very helpful. You said "If the Pin Interrupt is used to wake the part up from sleep or hibernate low-power mode, the Interrupt component connected to the Pins irq terminal may not have InterruptType set to "RISING_EDGE.""
The pin component data sheet, cy_pins_v2_10.pdf said that only applies to PSoC 5LP. I'm using PSoC 4 so I assume that does not apply. Correct? Or does that also apply to PSoC 4? And if so, how about Deep Sleep mode? Can a rising edge interrupt be used to exit from Deep Sleep mode?
Mark, you are here in a PSoC3 forum replying to a three year old post from Dana, who is not active for more than a year now.
I would suggest you to ask your question in a PSoC4 forum, because power saving modes are quire different in PSoC4 world.