This is my last post on the SmartIO.  This time, I am going to describe how to use the SmartIO to trigger an interrupt.  For this project I will start from the “SmartIOCountUp” project.  That project is a 3-bit counter.  I thought that I would choose one of the states (000) and trigger an interrupt when that state is hit, then toggle the P25 user led.  I will keep data4, and gpio 3,6,7 exactly the same.  I will use gpio 2 to trigger the interrupt, which can be accomplished by setting it up as an output.  Here is the SmartIO configuration:


The next step is to use LUT2 to look for the “000” state and to create a rising edge.  The other states will be 0.


After making the modification to the SmartIO the next step is to fix the schematic.  To do this I add a pin for P22, its configuration is on the next screen.  In addition I move the P25 (aka the BlueLED on the master board) to pin by itself.


To configure the P22 pin.  There is a trick that is required to make the pin be both an output, so that it can be connected to the SmartIO LUT as well as an Input, so that it can be connected to the Port 2 interrupt.


After setting up the pin to be both an Input and an Output you need to configure the pin to have an interrupt on the rising edge.


Then I assign the pins.


The last step is to make the firmware.

  • Lines 4-9 create an interrupt service routine
  • Line 18 registers the interrupt service routine to be called with the Port2 interrupt is triggered
  • The rest is the same as before


When I run this, I see the Blue LED toggle each time it gets to state 000 (which is all three LEDs on as they are active low).

You can find this PSoC Creator workspace on github in the directory called “SmartIO”.  This project is called “SmartIOInterrupt”.

Index Description
PSoC4000s & The SmartIO – Part 1 An introduction to the SmartIO and first project
PSoC4000s & CSX Mutual CapSense Buttons Part 1 Using mutual capacitance
PSoC4000s & CSX Mutual CapSense Buttons Part 2 Using the CapSense tuner
PSoC4000s & The SmartIO – Part 2 A 3 input XOR logic gate
PSoC4000s & The SmartIO – Part 3 A 3 bit up counter state machine
PSoC4000s & The SmartIO – Part 4 Using an external clock with the Smart IO
PSoC4000s & The SmartIO – Part 5 Triggering an interrupt

Recommended Posts


  1. Great posts Alan, can’t wait for the 145 board get available. Do you know if there will be some AppNotes on SmartIO topic?
    Greets from México

    • Thanks The boards should be soon. As far as the App Note goes, they know that they need to do it, but the whole team is absorbed with a new chip that is a blend of old Cypress and old Spansion… that is going to be spectacular.

      • Hope to get news about the board, app notes, and that new chip too! Cypress never sleeps 🙂

Add a Comment

Your email address will not be published. Required fields are marked *