<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Instruction for reading the state of a button in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Instruction-for-reading-the-state-of-a-button/m-p/418654#M23865</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Hello everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="hps"&gt;Below you can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;see&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the pattern&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;of how&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;micro&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;and&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;connected&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;MK10DN512ZVLL10&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;tab&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;made&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;by my university&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_0.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/60191iED3FB87B2F96AC57/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN class="ita-kd-inputtools-div"&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P class="g-unit"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Enabling&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the button highlighted&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;yellow&lt;/SPAN&gt;?&lt;BR /&gt;&lt;SPAN class="hps"&gt;How&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;instruction&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;read&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;their status&lt;/SPAN&gt;?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="g-unit"&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="g-unit"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Thanks&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;advance&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;for&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;any&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;indicaizone&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 16 Jul 2015 15:46:29 GMT</pubDate>
    <dc:creator>nikivendola</dc:creator>
    <dc:date>2015-07-16T15:46:29Z</dc:date>
    <item>
      <title>Instruction for reading the state of a button</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Instruction-for-reading-the-state-of-a-button/m-p/418654#M23865</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Hello everyone,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN class="hps"&gt;Below you can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;see&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the pattern&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;of how&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;micro&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;and&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;connected&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;MK10DN512ZVLL10&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;tab&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;made&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;by my university&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;...&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_0.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/60191iED3FB87B2F96AC57/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_0.png" alt="pastedImage_0.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;DIV&gt;&lt;SPAN class="ita-kd-inputtools-div"&gt;&lt;/SPAN&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;P class="g-unit"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Enabling&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;the button highlighted&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;yellow&lt;/SPAN&gt;?&lt;BR /&gt;&lt;SPAN class="hps"&gt;How&lt;/SPAN&gt; &lt;SPAN class="hps alt-edited"&gt;instruction&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;can&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;read&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;their status&lt;/SPAN&gt;?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="g-unit"&gt;&lt;SPAN lang="en"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P class="g-unit"&gt;&lt;SPAN lang="en"&gt;&lt;SPAN class="hps"&gt;Thanks&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;in&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;advance&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;for&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;any&lt;/SPAN&gt; &lt;SPAN class="hps"&gt;indicaizone&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 15:46:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Instruction-for-reading-the-state-of-a-button/m-p/418654#M23865</guid>
      <dc:creator>nikivendola</dc:creator>
      <dc:date>2015-07-16T15:46:29Z</dc:date>
    </item>
    <item>
      <title>Re: Instruction for reading the state of a button</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Instruction-for-reading-the-state-of-a-button/m-p/418655#M23866</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Niki,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you using KSDK or any RTOS?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you are in baremetal it is very simple. Please see the answer in the post below to see how to manage the GPIO pins.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/message/525257"&gt;Re: Port configuration&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Earl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;/* If this post answers your question please click the &lt;EM&gt;Correct answer &lt;/EM&gt;​button. */&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Jul 2015 16:31:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Instruction-for-reading-the-state-of-a-button/m-p/418655#M23866</guid>
      <dc:creator>EarlOrlando</dc:creator>
      <dc:date>2015-07-16T16:31:52Z</dc:date>
    </item>
    <item>
      <title>Re: Instruction for reading the state of a button</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Instruction-for-reading-the-state-of-a-button/m-p/418656#M23867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Niki&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is how to configure and read your input in the uTasker project:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;#define &lt;SPAN style="color: #e23d39;"&gt;BUTTON_SOS&lt;/SPAN&gt; (PORTC_BIT16)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;_CONFIG_PORT_INPUT_FAST_HIGH(C, &lt;SPAN style="color: #e23d39;"&gt;BUTTON_SOS&lt;/SPAN&gt;, PORT_PS_UP_ENABLE);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;if (_READ_PORT_MASK(C, &lt;SPAN style="color: #e23d39;"&gt;BUTTON_SOS&lt;/SPAN&gt;) != 0) {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fndDebugMsg("SOS is not pressed\n\r");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;else {&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fndDebugMsg("SOS is pressed\n\r");&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you prefer to configure an interrupt to fire when the button is pressed, the following code does it:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INTERRUPT_SETUP interrupt_setup; // interrupt configuration parameters&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;interrupt_setup.int_type&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = PORT_INTERRUPT; // identifier to configure port interrupt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;interrupt_setup.int_handler&amp;nbsp;&amp;nbsp;&amp;nbsp; = fnButtonPressed; // handling function&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;interrupt_setup.int_priority&amp;nbsp;&amp;nbsp; = 5; // interrupt priority level&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;interrupt_setup.int_port&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; = PORTC; // the port that the interrupt input is on&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;interrupt_setup.int_port_bits&amp;nbsp; = &lt;SPAN style="color: #e23d39;"&gt;&lt;STRONG&gt;BUTTON_SOS&lt;/STRONG&gt;&lt;/SPAN&gt;;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;interrupt_setup.int_port_sense = (IRQ_FALLING_EDGE | PULLUP_ON); // interrupt is to be falling edge sensitive&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;fnConfigureInterrupt((void *)&amp;amp;interrupt_setup); // configure interrupt&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;whereby the interrupt callback to handle the press is something like:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;// Button interrupt handler&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;//&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;static void fnButtonPressed(void)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; fnInterruptMessage(BUTTON_TASK, E_BUTTON_PRESSED);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why not add your board to the uTasker project so that you can simulate and test all operation and greaty accelerate your work with it?&lt;/P&gt;&lt;P&gt;Take a look at the following University board that was added to it in just a couple of hours (including SD card and USB operation):&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.utasker.com/kinetis/Capuccino-KL27/Capuccino-KL27.html" title="http://www.utasker.com/kinetis/Capuccino-KL27/Capuccino-KL27.html"&gt;µTasker Kinetis Capuccino-KL27 support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://www.coffeebrain.org/blog/" title="http://www.coffeebrain.org/blog/"&gt;http://www.coffeebrain.org/blog/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kinetis: &lt;A href="http://www.utasker.com/kinetis.html" title="http://www.utasker.com/kinetis.html"&gt;µTasker Kinetis support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;K60: &lt;A href="http://www.utasker.com/kinetis/TWR-K60N512.html" title="http://www.utasker.com/kinetis/TWR-K60N512.html"&gt;µTasker Kinetis TWR-K60N512 support&lt;/A&gt;&amp;nbsp; / &lt;A href="http://www.utasker.com/kinetis/TWR-K60D100M.html" title="http://www.utasker.com/kinetis/TWR-K60D100M.html"&gt;µTasker Kinetis TWR-K60D100M support&lt;/A&gt;&amp;nbsp; / &lt;A href="http://www.utasker.com/kinetis/TWR-K60F120M.html" title="http://www.utasker.com/kinetis/TWR-K60F120M.html"&gt;µTasker Kinetis TWR-K60F120M support&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;For the complete "out-of-the-box" Kinetis experience and faster time to market&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Jul 2015 10:46:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Instruction-for-reading-the-state-of-a-button/m-p/418656#M23867</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2015-07-17T10:46:08Z</dc:date>
    </item>
  </channel>
</rss>

