<?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 HS12 Interrupts with CALL in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199207#M8003</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My application uses the Modulus downcounter to generate interrupts when the count reaches zero to update a real time clock. Calling a subroutine in ppage $22 hangs up the micro unless Modulus interrupts are disabled. The interrupt service routine is in a non-paged location.&amp;nbsp; The same thing happens with serial communications to a LCD display. I've had to change serial operations to a polling mode to avoid those interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why can't interrupts be used with the CALL function? The RTI instruction does not seem to restore the ppage value and this may be the reason. Can anyone shed some light on this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The processor is a MC9S12DP512.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 May 2010 00:10:17 GMT</pubDate>
    <dc:creator>astro_goto</dc:creator>
    <dc:date>2010-05-12T00:10:17Z</dc:date>
    <item>
      <title>HS12 Interrupts with CALL</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199207#M8003</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My application uses the Modulus downcounter to generate interrupts when the count reaches zero to update a real time clock. Calling a subroutine in ppage $22 hangs up the micro unless Modulus interrupts are disabled. The interrupt service routine is in a non-paged location.&amp;nbsp; The same thing happens with serial communications to a LCD display. I've had to change serial operations to a polling mode to avoid those interrupts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why can't interrupts be used with the CALL function? The RTI instruction does not seem to restore the ppage value and this may be the reason. Can anyone shed some light on this problem?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The processor is a MC9S12DP512.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 00:10:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199207#M8003</guid>
      <dc:creator>astro_goto</dc:creator>
      <dc:date>2010-05-12T00:10:17Z</dc:date>
    </item>
    <item>
      <title>Re: HS12 Interrupts with CALL</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199208#M8004</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Do you exit from paged routine with RTS? CALL'ing routines from ISR is OK, provided you exit back to ISR with &lt;STRONG&gt;RTC&lt;/STRONG&gt; instruction. Also if your ISR writes to and modifies PPAGE, then you should restore PPAGE before return from interrupt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 01:37:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199208#M8004</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-05-12T01:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: HS12 Interrupts with CALL</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199209#M8005</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, my paged subroutine was indeed ended with RTC, and the interrupt ISR did not touch PPAGE, it only updated the real time clock variables in un-paged RAM. The serial transmissions to the LCD display also took place in un-paged Flash memory. Changing the serial operations from interrupt to polled and disabling the Modulus interrupts solved the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Does anyone else use the CALL function with ongoing interrupts?&amp;nbsp; I would be most interested in comparing systems.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 05:26:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199209#M8005</guid>
      <dc:creator>astro_goto</dc:creator>
      <dc:date>2010-05-12T05:26:53Z</dc:date>
    </item>
    <item>
      <title>Re: HS12 Interrupts with CALL</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199210#M8006</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I'm not certain what you are trying to do here... could you describe it with pseudo code? CALLing functions is harmless. CALL stacks the PPAGE value and it is an atomic instruction that can't be interrupted. RTC restores PPAGE and it can't be interrupted either. Obviously you can't CALL "my_isr_routine", but I don't think that's the case here...? Does the subroutine change the variables used by the interrupt? If so, the bug is very likely related to missing semaphores or a missing volatile keyword.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 May 2010 20:10:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199210#M8006</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2010-05-12T20:10:58Z</dc:date>
    </item>
    <item>
      <title>Re: HS12 Interrupts with CALL</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199211#M8007</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My application is a telescope control sytem that uses the Modulus module to generate interrupts for a real time clock. It is setup with the following code:&lt;/P&gt;&lt;P&gt;;&amp;nbsp;&amp;nbsp; &amp;nbsp;modulus downcounter setup&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;bset&amp;nbsp;&amp;nbsp; &amp;nbsp;MCCTL,#modmc+mcen&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;enable modulus mode&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;bset&amp;nbsp;&amp;nbsp; &amp;nbsp;MCCTL,#mczi+mcpr1+mcpr0&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; ;enable modulus ints, set&lt;BR /&gt;;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;prescaler to divide bus clock by 16&lt;BR /&gt;;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;bus clock = PLLCLK/2 = 24MHz&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;bset&amp;nbsp;&amp;nbsp; &amp;nbsp;MCCTL,#flmc&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;force load reg into mod count reg&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;movw&amp;nbsp;&amp;nbsp; &amp;nbsp;#50000,MCCNT&amp;nbsp;&amp;nbsp; &amp;nbsp;;set load reg for 30 interrupts/sec&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;The Modulus ISR is:&lt;/P&gt;&lt;P&gt;modulus_irq: &amp;nbsp;&amp;nbsp; equ&amp;nbsp;&amp;nbsp; &amp;nbsp;*&amp;nbsp;&amp;nbsp; &amp;nbsp;;modulus int service routine, 30/sec&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;bset&amp;nbsp;&amp;nbsp; &amp;nbsp;MCFLG,mczf&amp;nbsp;&amp;nbsp; &amp;nbsp;;clears the modulus interrupt flag by writing&lt;BR /&gt;;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;a 1 to the mczf bit7, all other bits reserved&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; dec&amp;nbsp;&amp;nbsp; &amp;nbsp;point5&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;0.5 sec timer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;bne&amp;nbsp;&amp;nbsp; &amp;nbsp;mi1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;movb&amp;nbsp;&amp;nbsp; &amp;nbsp;#15,point5&amp;nbsp;&amp;nbsp; &amp;nbsp;;reload 0.5 sec timer&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;jsr&amp;nbsp;&amp;nbsp; &amp;nbsp;clock&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;update date/time variables by 0.5 sec&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;movb&amp;nbsp;&amp;nbsp; &amp;nbsp;#$FF,time&amp;nbsp;&amp;nbsp; &amp;nbsp;;set time flag&lt;BR /&gt;mi1:&amp;nbsp;&amp;nbsp; &amp;nbsp;rti&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The application program loaded in non-paged Flash $3F contains the statement:&lt;/P&gt;&lt;P&gt;call get_star_coord,$22&amp;nbsp;&amp;nbsp; ;(uses only global variables)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The following code segment is loaded in ppage $22:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;org $8000&lt;/P&gt;&lt;P&gt;get_star_coord:&amp;nbsp;&amp;nbsp; &amp;nbsp;equ&amp;nbsp;&amp;nbsp; &amp;nbsp;* &amp;nbsp;&amp;nbsp; &amp;nbsp;;converts ascii coord to fp degrees&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;std&amp;nbsp;&amp;nbsp; &amp;nbsp;temp_fp&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;d points to ascii seconds value&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;jsr&amp;nbsp;&amp;nbsp; &amp;nbsp;ASCFLT&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;convert ascii seconds to fp in FPACC1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldx&amp;nbsp;&amp;nbsp; &amp;nbsp;#fp_60&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;constant 60 converts seconds to minutes&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;jsr&amp;nbsp;&amp;nbsp; &amp;nbsp;GETFPAC2&lt;/P&gt;&lt;P&gt;................&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;jsr&amp;nbsp;&amp;nbsp; &amp;nbsp;FLTDIV&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;convert seconds to fractional minutes&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;jsr&amp;nbsp;&amp;nbsp; &amp;nbsp;UINT2FLT&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;convert degrees to fp&amp;nbsp; in FPACC1&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;jsr&amp;nbsp;&amp;nbsp; &amp;nbsp;PULFPAC2&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;retrieve fractional degrees on stack&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;jsr&amp;nbsp;&amp;nbsp; &amp;nbsp;FLTADD&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;add fractional degrees&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;rtc &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;return (get_star_coord,$22) with fp degrees in FPACC1&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The subroutine is doing coordinate calculations in floating point using other subroutines in non-paged Flash but is being interrupted periodically by the Modulus system. There is not enough space in non-paged Flash to load this sub or others. I hope this makes clear what the program is doing. I'll be happy to explain further, if needed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 May 2010 03:40:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199211#M8007</guid>
      <dc:creator>astro_goto</dc:creator>
      <dc:date>2010-05-13T03:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: HS12 Interrupts with CALL</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199212#M8008</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OOPS!!!! Problem solved and my face is RED. Careful examination of the program code revealed an incorrect value in setting up the Modulus module. When corrected as shown in the above code snippet, the interrupt hang-up disappeared.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm truly sorry for the confusion I may have caused.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 May 2010 09:09:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/HS12-Interrupts-with-CALL/m-p/199212#M8008</guid>
      <dc:creator>astro_goto</dc:creator>
      <dc:date>2010-05-13T09:09:24Z</dc:date>
    </item>
  </channel>
</rss>

