<?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 HC08: keyboard interrupt problem in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC08-keyboard-interrupt-problem/m-p/129824#M964</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;hi people,&lt;/DIV&gt;&lt;DIV&gt;I have the DEMO9S08QG8 demoboard. i am trying to enable an output&amp;nbsp;through the KBI&amp;nbsp;modul with CW..&lt;/DIV&gt;&lt;DIV&gt;when i push the switch, the interrupt occurs. the interrupt routine is executed. but after the RTI instruction is executed,&amp;nbsp;it jumps to&amp;nbsp;the beginning of the interrupt routine, not back to the mainloop...&lt;/DIV&gt;&lt;DIV&gt;so it gets stuck inside the interrupt routine...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any idea what the problem is?&lt;/DIV&gt;&lt;P&gt;Message Edited by CrasyCat on &lt;SPAN class="date_text"&gt;2007-04-13&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;02:22 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 09 Sep 2006 17:12:03 GMT</pubDate>
    <dc:creator>hasan</dc:creator>
    <dc:date>2006-09-09T17:12:03Z</dc:date>
    <item>
      <title>HC08: keyboard interrupt problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC08-keyboard-interrupt-problem/m-p/129824#M964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;hi people,&lt;/DIV&gt;&lt;DIV&gt;I have the DEMO9S08QG8 demoboard. i am trying to enable an output&amp;nbsp;through the KBI&amp;nbsp;modul with CW..&lt;/DIV&gt;&lt;DIV&gt;when i push the switch, the interrupt occurs. the interrupt routine is executed. but after the RTI instruction is executed,&amp;nbsp;it jumps to&amp;nbsp;the beginning of the interrupt routine, not back to the mainloop...&lt;/DIV&gt;&lt;DIV&gt;so it gets stuck inside the interrupt routine...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Any idea what the problem is?&lt;/DIV&gt;&lt;P&gt;Message Edited by CrasyCat on &lt;SPAN class="date_text"&gt;2007-04-13&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;02:22 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Sep 2006 17:12:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC08-keyboard-interrupt-problem/m-p/129824#M964</guid>
      <dc:creator>hasan</dc:creator>
      <dc:date>2006-09-09T17:12:03Z</dc:date>
    </item>
    <item>
      <title>Re: keyboard interrupt problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC08-keyboard-interrupt-problem/m-p/129825#M965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Hasan,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;It sounds like you may not be clearing the interrupt flag before exiting the ISR.&amp;nbsp; You need to write a 1 to the KBACK bit within KBISC register.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Another possibility is that you have selected both edge and level interrupt by setting the KBMOD bit to 1.&amp;nbsp; This would mean that interrupts could repeatedly occur while the key remained pressed (or released if the wrong polarity were selected).&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Yet another possibility is that you do not allow for key bounce, and the ISR is re-entered a number of times.&amp;nbsp; A satisfactory way of allowing for de-bounce would be to disable further interrupts for the particular key, before leaving the ISR.&amp;nbsp; Then, within the main loop, allow for a 50-100 millisecond delay before re-enabling&amp;nbsp;interrupts for the key that was pressed.&amp;nbsp; Because of key bounce, you might get interrupts occurring as the key is released, as well as when pressed, but this would depend on the switch characteristics.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 10 Sep 2006 01:04:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC08-keyboard-interrupt-problem/m-p/129825#M965</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2006-09-10T01:04:05Z</dc:date>
    </item>
    <item>
      <title>Re: keyboard interrupt problem</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC08-keyboard-interrupt-problem/m-p/129826#M966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi&amp;nbsp;Mac,&lt;/DIV&gt;&lt;DIV&gt;Thanks for your help. The problem was the KBACK bit. And now it works.&lt;/DIV&gt;&lt;DIV&gt;Well.. I think&amp;nbsp;I have got&amp;nbsp;much&amp;nbsp;to learn...&lt;/DIV&gt;&lt;DIV&gt;Regards,&lt;/DIV&gt;&lt;DIV&gt;Hasan&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Sep 2006 12:56:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/HC08-keyboard-interrupt-problem/m-p/129826#M966</guid>
      <dc:creator>hasan</dc:creator>
      <dc:date>2006-09-11T12:56:32Z</dc:date>
    </item>
  </channel>
</rss>

