<?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 Re: Interrupt handler looping infinitely, need help (9S08DZ60) in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Interrupt-handler-looping-infinitely-need-help-9S08DZ60/m-p/194841#M15481</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I was able to fix this issue for anyone that may see this thread in the future.&lt;BR /&gt;&lt;BR /&gt;I am using the device initialization to create an MCU_init() which happens to initialize the vector table and interrupt service routines. by editing the vector table and declaring the interrupt handler in MCU_init.c, I was able to fix the problem. What was happening before was the MCU_init.c had just declared all ISRs as UNASSIGNED_ISR, which just made the interrupt execute meaningless code somewhere in memory.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 24 Feb 2008 05:19:57 GMT</pubDate>
    <dc:creator>bdayberr</dc:creator>
    <dc:date>2008-02-24T05:19:57Z</dc:date>
    <item>
      <title>Interrupt handler looping infinitely, need help (9S08DZ60)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Interrupt-handler-looping-infinitely-need-help-9S08DZ60/m-p/194840#M15480</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;On the dev board I am working on (DEMO9S08DZ60) there are two push-button switches tied to a few of the port b pins on the MC, and I am trying to use one to cause an interrupt. I am following the general outline in &lt;/SPAN&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.google.com%2Furl%3Fsa%3Dt%26ct%3Dres%26cd%3D1%26url%3Dhttp%253A%252F%252Fwww.freescale.com%252Ffiles%252Fmicrocontrollers%252Fdoc%252Fapp_note%252FAN2616.pdf%26ei%3DP1C_R8zXG4LAoASQ5-3PAw%26usg%3DAFQjCNGWNB9ni7j_-VG8SDCMuRD3hxhbpA%26sig2%3D5B78ssE7ivp8U89RsXn-_A" rel="nofollow" target="_blank"&gt;AN2616&lt;/A&gt;&lt;SPAN&gt; which describes how to use C and codewarrior. There is a portion of the guide that shows how to have an interrupt on SW1, which is very similar, if not identical, to what I am trying to do. By following the advanced data for my MCU and this guide, I have the following code for this interrupt:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(In a header file)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;#define VNswitch 22&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(in the main.c file, at the top)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;interrupt VNswitch void intSW1(){&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; LED1 = SW1;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PTBSC_PTBACK = 1;&amp;nbsp;&amp;nbsp; /*ACK interrupt*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(just above the infinite program for loop, initializing interrupt)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PTBSC_PTBIE = 0; /*mask interrupts*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PTBES_PTBES6 = 1;/*edge select*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PTBPE_PTBPE6 = 1;/*pullup pin*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PTBPS_PTBPS6 = 1;/*select pin*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PTBSC_PTBACK = 1;/*clear false ints*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; PTBSC_PTBIE = 1;/*enable interrupts*/&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When I run the program, I know for a fact the interrupt does make it to the CPU, because I can have the debugger running, step through initializations, then press SW1 and the debugger hangs for a second, then shows no program in the C code, but about 3 dozen BRSET commands in assembly, with a CMP thrown in somewhere. I continue to step through, and eventually get to the RTI instruction, step, the debugger hangs for a sec again, then goes right back to beginning of the interrupt code, with a program counter of 0. This process continues infinitely until I perform a target reset. Does anyone know why my interrupt handling goes on forever once the interrupt has occured? Intuitively I feel it has something to do with the interrupt acknowledgement not occuring, or something regarding the interrupt flag not properly being cleared. Any ideas? I am just trying to get a simple interrupt working for a pushbutton switch, it can't be that hard.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by bdayberr on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-02-22&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;10:53 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 23 Feb 2008 06:51:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Interrupt-handler-looping-infinitely-need-help-9S08DZ60/m-p/194840#M15480</guid>
      <dc:creator>bdayberr</dc:creator>
      <dc:date>2008-02-23T06:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Interrupt handler looping infinitely, need help (9S08DZ60)</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Interrupt-handler-looping-infinitely-need-help-9S08DZ60/m-p/194841#M15481</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I was able to fix this issue for anyone that may see this thread in the future.&lt;BR /&gt;&lt;BR /&gt;I am using the device initialization to create an MCU_init() which happens to initialize the vector table and interrupt service routines. by editing the vector table and declaring the interrupt handler in MCU_init.c, I was able to fix the problem. What was happening before was the MCU_init.c had just declared all ISRs as UNASSIGNED_ISR, which just made the interrupt execute meaningless code somewhere in memory.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 24 Feb 2008 05:19:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Interrupt-handler-looping-infinitely-need-help-9S08DZ60/m-p/194841#M15481</guid>
      <dc:creator>bdayberr</dc:creator>
      <dc:date>2008-02-24T05:19:57Z</dc:date>
    </item>
  </channel>
</rss>

