<?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: Minimize Interrupt routines in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190255#M14552</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, my interrupt routines are very simple and the 5 cycles that pushing and popping of the H-reg would only save me 5 cycles x 2MHz bus clock = 2,5 µs. Most likely it will not be a problem.&lt;/P&gt;&lt;P&gt;I am writing(trying to) the interrupt routines in assembly but it's not going well &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I think I am gonna leave it as it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quote from "HC(S)08 Build Tools Reference Manual for Microcontrollers" :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"....If you are sure that H is not written in the&lt;BR /&gt;interrupt routine, you can use the TRAP_PROC pragma to disable the saving and restoring&lt;BR /&gt;of H..."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 15 Jun 2009 18:27:12 GMT</pubDate>
    <dc:creator>P_B</dc:creator>
    <dc:date>2009-06-15T18:27:12Z</dc:date>
    <item>
      <title>Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190251#M14548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using a MC9S08QD4 and CodeWarrior.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to minimize the Interrupt routines that I have to absolute minimum.&lt;/P&gt;&lt;P&gt;In this case it means removing the "PSHH" and "PULH" instructions which is done at the beginning and end, respectivly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to keep all the code in C.&lt;/P&gt;&lt;P&gt;I saw in the compiler manual that you can use the #pragma TRAP_PROC" keyword for the interrupt routines and that will remove the pushing and popping of the H-reg.&lt;/P&gt;&lt;P&gt;Unfortunatley that does not remove the instructions &lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif"&gt;&lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, can anyone help me with this.. or should I write the routines in assembly instead?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;/P&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 16:09:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190251#M14548</guid>
      <dc:creator>P_B</dc:creator>
      <dc:date>2009-06-15T16:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190252#M14549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;I want to minimize the Interrupt routines that I have to absolute minimum.&lt;/P&gt;&lt;P&gt;In this case it means removing the "PSHH" and "PULH" instructions which is done at the beginning and end, respectivly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to keep all the code in C.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I see a contradiction here.&amp;nbsp; You want to use only C yet you want the absolute minimum, and to also remove the PSHH and PULH instructions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using only C means you let the compiler do its best.&amp;nbsp; You only concentrate on writing tight C code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Removing PSHH and PULH means you're messing with assembly code, and the C compiler can't possibly know what you're doing.&amp;nbsp; If the compiler had no need protecting H in the first place, it wouldn't (unless there is no optimization with your compiler).&amp;nbsp; I don't think you can tell a compiler to avoid specific assembly language instructions, so that it won't ever mess with the H register (LDHX, AIX, etc.)&amp;nbsp; Even if it were possible, the advantage of removing just two bytes (PSHH &amp;amp; PULH) is too small a gain compared to the loss of the remaining code still written in C, and handicapped by trying NOT to use H affecting instructions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, I don't care what anyone else might tell you, the &lt;STRONG&gt;absolute&lt;/STRONG&gt; minimum cannot be had in C, period!&amp;nbsp; Use assembly for interrupt handler.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 16:31:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190252#M14549</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2009-06-15T16:31:41Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190253#M14550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;I don't think you can tell a compiler to avoid specific assembly language instructions, so that it won't ever mess with the H register (LDHX, AIX, etc.)&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Finally, I don't care what anyone else might tell you, the &lt;STRONG&gt;absolute&lt;/STRONG&gt; minimum cannot be had in C, period!&amp;nbsp; Use assembly for interrupt handler.&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, line 4 to 5 on page 422 in "HC(S)08 Build Tools Reference Manual for Microcontrollers" says something else.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In my case the absolut minimum can be made in C, it won't be smaller than assembly, it will be equal.&lt;/P&gt;&lt;P&gt;Then why not use assembly? Well I would like to keep it in C for customer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 16:50:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190253#M14550</guid>
      <dc:creator>P_B</dc:creator>
      <dc:date>2009-06-15T16:50:43Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190254#M14551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, I didn't urge you not to use C.&amp;nbsp; I only emphasized that you can't expect the &lt;STRONG&gt;absolute&lt;/STRONG&gt; minimum in C.&amp;nbsp; And it seemed to me that was your primary goal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;You're right, it may be possible for C to produce code just as good as assembly (never better, of course, by common logic) but &lt;STRONG&gt;only if&lt;/STRONG&gt; the statements involved are trivial, e.g. simple assignment or if statements, etc.&amp;nbsp; But for any code that's a bit more involved the advantage is always on the assembly side. I did assume your interrupt handler does something not too trivial, or else you wouldn't care about optimizing it further.&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;By the way, what do those lines (4 &amp;amp; 5) say?&amp;nbsp; I can't find the doc you're referring to, but I'm curious, can you quote?&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by tonyp on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-06-15&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;01:35 PM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 17:28:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190254#M14551</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2009-06-15T17:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190255#M14552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well, my interrupt routines are very simple and the 5 cycles that pushing and popping of the H-reg would only save me 5 cycles x 2MHz bus clock = 2,5 µs. Most likely it will not be a problem.&lt;/P&gt;&lt;P&gt;I am writing(trying to) the interrupt routines in assembly but it's not going well &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So I think I am gonna leave it as it is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quote from "HC(S)08 Build Tools Reference Manual for Microcontrollers" :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"....If you are sure that H is not written in the&lt;BR /&gt;interrupt routine, you can use the TRAP_PROC pragma to disable the saving and restoring&lt;BR /&gt;of H..."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 18:27:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190255#M14552</guid>
      <dc:creator>P_B</dc:creator>
      <dc:date>2009-06-15T18:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190256#M14553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;P&gt;Quote from "HC(S)08 Build Tools Reference Manual for Microcontrollers" :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"....If you are sure that H is not written in the&lt;BR /&gt;interrupt routine, you can use the TRAP_PROC pragma to disable the saving and restoring&lt;BR /&gt;of H..."&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;OK, this is &lt;EM&gt;most certainly&lt;/EM&gt; referring to code &lt;STRONG&gt;you&lt;/STRONG&gt; have written in assembly.&amp;nbsp; The compiler knows whether its own generated code uses H or not, so it should not change its behavior with this pragma for code the compiler generates, as it would be a sure disaster.&amp;nbsp; The statement does not imply you can force the compiler not use the H register at all in its own generated code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 18:41:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190256#M14553</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2009-06-15T18:41:00Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190257#M14554</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I understand what you mean and it seems logical.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But what does the statement imply then?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am quoting the whole text now instead:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Quote from "HC(S)08 Build Tools Reference Manual for Microcontrollers" :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-------------------------------&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pragma TRAP_PROC&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;This pragma defines an interrupt routine (i.e., activating this pragma terminates the&lt;BR /&gt;function with an RTI instruction instead of an RTS). Normally, interrupt routines save and&lt;BR /&gt;restore the H register at the entry response exit. If you are sure that H is not written in the&lt;BR /&gt;interrupt routine, you can use the TRAP_PROC pragma to disable the saving and restoring&lt;BR /&gt;of H (see #pragma TRAP_PROC: Mark Function as Interrupt Function)&lt;/P&gt;&lt;P&gt;------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well english is not my native language so I might miss-interpret.&lt;/P&gt;&lt;P&gt;But I thought it meant that if I was sure that the code I write (or more exactly the generated assembly) in the interrupt routine will not modify the H-reg in any way, I can use the TRAP_PROC to disable the pushing and popping.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 19:07:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190257#M14554</guid>
      <dc:creator>P_B</dc:creator>
      <dc:date>2009-06-15T19:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190258#M14555</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok. I have written everything in assembly now, and it works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only have two 5 cycle instructions per routine PLUS the RTI of course.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now to the problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the compiler to find the mc9s08qd4.inc by itself. Right now i have written this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
    INCLUDE "mc9s08qd4.inc"         ; include device file&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;... in the assembler file and had to add the file in the source directory together with all the other .c .h and .asm files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to have it similar to the derivative.h file in which the MC9S08QD4.h file is included without having the actual file in the project, rather fetching it somewhere from the compiler directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can anyone help me with this?&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:41:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190258#M14555</guid>
      <dc:creator>P_B</dc:creator>
      <dc:date>2020-10-29T09:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190259#M14556</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you want to tell the compiler your function is an interrupt function and you do not want to save/restore H register in the function entry/exit code, you need to specify the pragma&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma TRAP_PROC SAVE_NO_REGS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in front of the function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then it is your responsibility to make sure the register H is not modified within the function.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 15 Jun 2009 21:36:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190259#M14556</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2009-06-15T21:36:37Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190260#M14557</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear P_B,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would encourage you to embed your assembly code in the C program rather than write separate assembly code which seems to be implied by your later question.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An Example&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;// Note - Untested, I don't have a QD4!&lt;/P&gt;&lt;P&gt;//&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;#pragma TRAP_PROC SAVE_NO_REGS&lt;BR /&gt;interrupt VectorNumber_Virq&lt;BR /&gt;void exampleInterruptCodeInAssembly(void) {&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; asm {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mov&amp;nbsp; #0xFF,PTADD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nop&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nop&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lda&amp;nbsp;&amp;nbsp; #50&lt;BR /&gt;&amp;nbsp;&amp;nbsp; oloop:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; psha&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lda&amp;nbsp;&amp;nbsp; #100&lt;BR /&gt;&amp;nbsp;&amp;nbsp; loop:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; deca&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bne&amp;nbsp;&amp;nbsp; loop&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lda&amp;nbsp;&amp;nbsp; PTAD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; coma&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sta&amp;nbsp;&amp;nbsp; PTAD&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pula&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; deca&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bne&amp;nbsp;&amp;nbsp; oloop&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;This has the advantage of not needing separate files plus you have access to the usual register definitions.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note: The compiler may do some 'optimization' of the assembly language so it may be a good idea to disassemble to the code to check exactly what is produced.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;bye&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by pgo on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-06-16&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;10:56 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2009 07:55:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190260#M14557</guid>
      <dc:creator>pgo</dc:creator>
      <dc:date>2009-06-16T07:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190261#M14558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, everyone thanks for the support!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the "SAVE_NO_REGS" was the thing I needed!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now everything is in C, just like I wanted &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just one thing... I can't find any info on the "SAVE_NO_REGS" in the manual. I found something in the CW help, it only says something about some page registers.&lt;/P&gt;&lt;P&gt;How are you supposed to get the "TRAP_PROC" pragma working when there is no explicit explanation about "SAVE_NO_REGS" ?????&lt;/P&gt;&lt;P&gt;Perhaps I have missed something?&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2009 13:34:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190261#M14558</guid>
      <dc:creator>P_B</dc:creator>
      <dc:date>2009-06-16T13:34:50Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190262#M14559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;P_B wrote:&lt;BR /&gt;&lt;P&gt;Ok. I have written everything in assembly now, and it works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I only have two 5 cycle instructions per routine PLUS the RTI of course.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now to the problem:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want the compiler to find the mc9s08qd4.inc by itself. Right now i have written this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
    INCLUDE "mc9s08qd4.inc"         ; include device file&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;... in the assembler file and had to add the file in the source directory together with all the other .c .h and .asm files.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to have it similar to the derivative.h file in which the MC9S08QD4.h file is included without having the actual file in the project, rather fetching it somewhere from the compiler directory.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So can anyone help me with this?&lt;/P&gt;&amp;nbsp;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Thought I would answer the above by myself &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;P&gt;I think I know now how to do the above. Even though I am not gonna use it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just make a new project, and make sure you have assemby and C selected.&lt;/P&gt;&lt;P&gt;That should generate a derivative.inc and derivative.h... problem solved &lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:41:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190262#M14559</guid>
      <dc:creator>P_B</dc:creator>
      <dc:date>2020-10-29T09:41:48Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190263#M14560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Looks like some information are missing in the manual.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please submit a service request and ask for an update of the compiler manual including description of pragma TRAP_PROC SAVE_NO_REGS.&lt;BR /&gt;&lt;BR /&gt;Click &lt;A href="https://www.freescale.com/webapp/servicerequest.create_SR.framework?regFlag=fromOpenSR" rel="nofollow" target="_blank"&gt;here&lt;/A&gt; to submit a service request.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2009 16:36:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190263#M14560</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2009-06-16T16:36:32Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190264#M14561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I looked through my HCS08 interrupts (CW6.0) and I find that H is only pushed/popped if it is used inside the ISR. And if it is used, I'd be quite grateful if is actually pushed first. I'm only using #pragma TRAP PROC and nothing else.&lt;BR /&gt;&lt;BR /&gt;So I'm not sure what the problem is here? Do different CW versions behave differently?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2009 18:32:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190264#M14561</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2009-06-16T18:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Minimize Interrupt routines</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190265#M14562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I did check with V6.2..&lt;/P&gt;&lt;P&gt;With TRAP_PROC alone, H is pushed/restores in interrupt function even when it is not used.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In order to prevent that from happening you need to use TRAP_PROC SAVE_NO_REGS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not have V6.0 installed so I cannot comment on what is happening there.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CrasyCat&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 16 Jun 2009 18:57:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Minimize-Interrupt-routines/m-p/190265#M14562</guid>
      <dc:creator>CrasyCat</dc:creator>
      <dc:date>2009-06-16T18:57:06Z</dc:date>
    </item>
  </channel>
</rss>

