<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.element14.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>PSoC4 Smarter Life Challenge - DAS Project :Example 2 Key Interrupt</title><link>https://community.element14.com/challenges-projects/design-challenges/smarter-life/w/documents/16721/psoc4-smarter-life-challenge---das-project-example-2-key-interrupt</link><description /><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>PSoC4 Smarter Life Challenge - DAS Project :Example 2 Key Interrupt</title><link>https://community.element14.com/challenges-projects/design-challenges/smarter-life/w/documents/16721/psoc4-smarter-life-challenge---das-project-example-2-key-interrupt</link><pubDate>Wed, 17 Dec 2014 03:55:17 GMT</pubDate><guid isPermaLink="false">93d5dcb4-84c2-446f-b2cb-99731719e767:aae92d33-2c60-41fd-ab5c-49c0c0a5e6b9</guid><dc:creator>bose</dc:creator><comments>https://community.element14.com/challenges-projects/design-challenges/smarter-life/w/documents/16721/psoc4-smarter-life-challenge---das-project-example-2-key-interrupt#comments</comments><description>Current Revision posted to Documents by bose on 12/17/2014 3:55:17 AM&lt;br /&gt;
&lt;p style="margin:0;"&gt;This example helps to understand the configuration for the Key Interrupt and how to react to the same on the Cypress PSoC 4 Pioneer Kit.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;Here is the Application schematics:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/620x351/__key/communityserver-wikis-components-files/00-00-00-01-96/1222.contentimage_5F00_45792.png"&gt;&lt;img alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/01/96/1222.contentimage_45792.png-620x351.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=hQAqukda%2Bj%2FM7Uq3SBj6LmnpcCNQlmU%2FeNtVL199rug%3D&amp;amp;se=2026-05-27T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=L8yoRqA3ndzLATf9A5fPCA==" style="max-height: 351px;max-width: 620px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/1011x443/__key/communityserver-wikis-components-files/00-00-00-01-96/4454.contentimage_5F00_45793.png"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/01/96/4454.contentimage_45793.png-1011x443.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=4owJ1aJrkLDiClFGq%2FGM2QetEzVI3Gnj0GYoARKj%2BC4%3D&amp;amp;se=2026-05-27T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=8OJNOh/v2uMf90qqAKi8Lw==" style="max-height: 443px;max-width: 1011px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;This examples uses and non-hardware connected pins, so the pin components inserted this needs to be disabled.&lt;/p&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;The input pin needs to be configured so that its able to have a internal Pull up enable to help in default value stabilization and an interrupt on Falling edge as pressing the button would set a Logical low on the input.&lt;/p&gt;&lt;p style="margin:0;"&gt;The specific configurations for the PinSW { &lt;strong&gt;Digital Input Pin [v1.90]&lt;/strong&gt; } are shown below:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/552x413/__key/communityserver-wikis-components-files/00-00-00-01-96/5025.contentimage_5F00_45794.png"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/01/96/5025.contentimage_45794.png-552x413.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=Doesn%2FD7kELnM0SVn2TAwnq%2BZ2X3mJpY%2Bh4bpr%2FTnHE%3D&amp;amp;se=2026-05-27T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=34l9z/ZpMEnrQUyfyl9ulg==" style="max-height: 413px;max-width: 552px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/552x413/__key/communityserver-wikis-components-files/00-00-00-01-96/4530.contentimage_5F00_45795.png"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/01/96/4530.contentimage_45795.png-552x413.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=VsQxg5rn0J573HOXkz9G2L%2BBSoV7B9d4i6L3uK0vkY8%3D&amp;amp;se=2026-05-27T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=s5FwuOhNQibuRpVXuvH5oQ==" style="max-height: 413px;max-width: 552px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/552x413/__key/communityserver-wikis-components-files/00-00-00-01-96/1738.contentimage_5F00_45796.png"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/01/96/1738.contentimage_45796.png-552x413.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=TCLwxIwXOTZRyulxGEFEBxxrJ1fMKokQ7bulZWu2dDg%3D&amp;amp;se=2026-05-27T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=ec3ma03G4dvobPkWlX/2KQ==" style="max-height: 413px;max-width: 552px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;Similarly the output pin { &lt;strong&gt;Digital Output Pin [v1.90]&lt;/strong&gt; } need to be configured as follows:&lt;/p&gt;&lt;p style="margin:0;"&gt;&lt;span&gt;&lt;a href="https://community.element14.com/resized-image/__size/552x413/__key/communityserver-wikis-components-files/00-00-00-01-96/0333.contentimage_5F00_45797.png"&gt;&lt;img loading="lazy" alt="image" src="https://community-storage.element14.com/communityserver-components-secureimagefileviewer/communityserver/wikis/components/files/00/00/00/01/96/0333.contentimage_45797.png-552x413.png?sv=2016-05-31&amp;amp;sr=b&amp;amp;sig=SxWigCHwzHGCS%2BFI1XSmHatXuZFUzoKgMGNWPLtnvmU%3D&amp;amp;se=2026-05-27T23%3A59%3A59Z&amp;amp;sp=r&amp;amp;_=lTnMj3sG2hv4zxA+Vg4lRQ==" style="max-height: 413px;max-width: 552px;" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin:0;"&gt;In the source code we need to have an Interrupt handler to receive the interrupt event. In this case we turn On the LED for 100ms.&lt;/p&gt;&lt;p style="margin:0;"&gt;The code for this example is as follows:&lt;/p&gt;&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;project.h&amp;gt;
// Interrupt Handler
CY_ISR(isr_wakeup)
{
    Pin_LED_Write(0);
    CyDelay(100);     //Delay of 100ms using Cypress Lib
    Pin_LED_Write(1);
    Pin_SW_ClearInterrupt(); // Clear the Interrupt just in case
}
int main()
{
     Pin_LED_Write(1); //Switch off the LED initially
     // Configure the Key ISR handler
     isr_WakeUp_StartEx(isr_wakeup);
     CyGlobalIntEnable; //Enable Interrupts
     while(1);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="display:none;"&gt;&lt;/div&gt;&lt;p style="margin:0;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;&lt;p style="margin:0;"&gt;After building and programming this the Red color in the RGB Led would glow momentarily after the User button is pressed.&lt;/p&gt;&lt;p style="margin:0;"&gt;There is not glitch filter or de-bounce added in this design so there might be cases where there would be erroneous blinks. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;

&lt;div style="font-size: 90%;"&gt;Tags: psoc4, examples, smarter, das_project, smarter_life&lt;/div&gt;
</description></item></channel></rss>