<?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 KBI and Port I/O in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/KBI-and-Port-I-O/m-p/178496#M12706</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'am scripting a MC9S08SE8CLR and I found my self in trouble with this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have the KBI working properlly but I want to USE A PTA ping to control a display, so I can display a huendred counter. The question is, Can I use the KBI and the the PTA in pin at the same time ???, and how would you do it??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another thing is that I make the KBI in one variable like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;if (--KBI_Debounce == 0){&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; KBI_ProcessKey =0;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; auxptb=PTBD;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ProccesKey((PTAD|0b11110000) &amp;amp; ((auxptb&amp;lt;&amp;lt;4)|0b00111111)); // de esta forma los puertos A&amp;amp;B queden en una sola variable&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InitKBI(KBISC|0b11001111);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (--KBI_Debounce == 0){&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; KBI_ProcessKey =0;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; auxptb=PTBD;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ProccesKey((PTAD|0b11110000) &amp;amp; ((auxptb&amp;lt;&amp;lt;4)|0b00111111)); // de esta forma los puertos A&amp;amp;B queden en una sola variable&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InitKBI(KBISC|0b11001111);&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void InitKBI(byte KBIpin) {&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;KBISC_KBIE=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;KBIPE = KBIpin; &amp;nbsp; &amp;nbsp; &amp;nbsp; //enable KBI pin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;KBISC = KBISC_KBIE_MASK|KBISC_KBACK_MASK; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //enable KBI int and clear KBF&lt;/P&gt;&lt;P&gt;} //end InitKBI&lt;/P&gt;&lt;DIV&gt;Many Thanks&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I really appreciate examples about it&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Leo Sandoval&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 25 Jan 2011 03:54:20 GMT</pubDate>
    <dc:creator>leofab70</dc:creator>
    <dc:date>2011-01-25T03:54:20Z</dc:date>
    <item>
      <title>KBI and Port I/O</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/KBI-and-Port-I-O/m-p/178496#M12706</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello everybody&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'am scripting a MC9S08SE8CLR and I found my self in trouble with this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I already have the KBI working properlly but I want to USE A PTA ping to control a display, so I can display a huendred counter. The question is, Can I use the KBI and the the PTA in pin at the same time ???, and how would you do it??&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another thing is that I make the KBI in one variable like this&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;if (--KBI_Debounce == 0){&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; KBI_ProcessKey =0;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; auxptb=PTBD;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ProccesKey((PTAD|0b11110000) &amp;amp; ((auxptb&amp;lt;&amp;lt;4)|0b00111111)); // de esta forma los puertos A&amp;amp;B queden en una sola variable&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InitKBI(KBISC|0b11001111);&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (--KBI_Debounce == 0){&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; KBI_ProcessKey =0;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; auxptb=PTBD;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ProccesKey((PTAD|0b11110000) &amp;amp; ((auxptb&amp;lt;&amp;lt;4)|0b00111111)); // de esta forma los puertos A&amp;amp;B queden en una sola variable&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; InitKBI(KBISC|0b11001111);&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void InitKBI(byte KBIpin) {&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;KBISC_KBIE=0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;KBIPE = KBIpin; &amp;nbsp; &amp;nbsp; &amp;nbsp; //enable KBI pin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;KBISC = KBISC_KBIE_MASK|KBISC_KBACK_MASK; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //enable KBI int and clear KBF&lt;/P&gt;&lt;P&gt;} //end InitKBI&lt;/P&gt;&lt;DIV&gt;Many Thanks&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I really appreciate examples about it&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Leo Sandoval&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Jan 2011 03:54:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/KBI-and-Port-I-O/m-p/178496#M12706</guid>
      <dc:creator>leofab70</dc:creator>
      <dc:date>2011-01-25T03:54:20Z</dc:date>
    </item>
    <item>
      <title>Re: KBI and Port I/O</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/KBI-and-Port-I-O/m-p/178497#M12707</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Leo, and welcome to the forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I presume that you would use one of the PTA4-PTA7 pins that are not associated with the KBI use.&amp;nbsp; These pins can continue to be used as GPIO in the normal manner, as can any of the KBI pins that are not enabled for KBI use, such as PTB0 and PTB1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I notice that the datasheet recommends to clear the flag, and then to enable KBI interrupts, as two separate operations.&amp;nbsp;&lt;BR /&gt;This is to guarantee that the flag will be clear when interrupts are enabled.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; void InitKBI( byte KBIpin) {     KBISC_KBIE = 0;    KBIPE = KBIpin;           // enable KBI pins    KBISC = KBISC_KBACK_MASK; // Clear KBF flag    KBISC = KBISC_KBIE_MASK;  // Enable KBI interrupts }
&lt;/PRE&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:27:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/KBI-and-Port-I-O/m-p/178497#M12707</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2020-10-29T09:27:44Z</dc:date>
    </item>
  </channel>
</rss>

