<?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 CodeWarrior Low Power Modes in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-Low-Power-Modes/m-p/140329#M2452</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;I’m currently using CodeWarrior v5.5.1272 with a 9S12A64 processor.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have to use this chip in a power critical situation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;I’ve implemented assembly language code with this processor before and the low power function is written like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;S_WAIT:&amp;nbsp; cli&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;enable interrupts&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wai&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;low power mode&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sei&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;disable interrupts (executes first instruction after wait)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;*****other work******&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bra&amp;nbsp;&amp;nbsp;&amp;nbsp; S_WAIT&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;This code in the P&amp;amp;E Microcomputer Systems assembler works perfect.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; The processor goes to WAIT mode and executes the other work below it before going to wait mode again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;My problem occurs when I transfer the code to C:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;for(;;) { Cpu_EnableInt();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //enable interrupts Cpu_SetWaitMode();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //low power mode Cpu_DisableInt();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //disable interrupts (executes first instruction after wait) //Other work}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;SPAN style=": ; font-size: 3; font-family: 'Times New Roman';"&gt;When I use the Simulator to check the WAIT statement it seems to enter it but the timer can’t get it out.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;When I use the P&amp;amp;E debugger it seems that the process hits the WAIT statement but doesn’t do any of the work below it.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I’ve even tried STOP mode which should totally shut down my processor (because I have no RTIs) but it continues its normal timer operation when that should be turned off.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I’ve tried the copying the same assembly code I have into CodeWarrior with the same results.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; According to the debugger I don’t ever get back to my WAIT mode.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have a Timer that’s 100ms and I’ve measured that it only does 30ms of work.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; The WAIT doesn’t break the ‘for’ loop, does it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;Why is there such a difference for very similar codes?&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Why doesn’t the Timer interrupt break the wait statement in the simulator?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 29 Oct 2020 08:40:32 GMT</pubDate>
    <dc:creator>okcee</dc:creator>
    <dc:date>2020-10-29T08:40:32Z</dc:date>
    <item>
      <title>CodeWarrior Low Power Modes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-Low-Power-Modes/m-p/140329#M2452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;I’m currently using CodeWarrior v5.5.1272 with a 9S12A64 processor.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have to use this chip in a power critical situation.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;I’ve implemented assembly language code with this processor before and the low power function is written like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;S_WAIT:&amp;nbsp; cli&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;enable interrupts&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wai&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;low power mode&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sei&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;disable interrupts (executes first instruction after wait)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ;*****other work******&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bra&amp;nbsp;&amp;nbsp;&amp;nbsp; S_WAIT&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;This code in the P&amp;amp;E Microcomputer Systems assembler works perfect.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; The processor goes to WAIT mode and executes the other work below it before going to wait mode again.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;My problem occurs when I transfer the code to C:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;for(;;) { Cpu_EnableInt();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //enable interrupts Cpu_SetWaitMode();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //low power mode Cpu_DisableInt();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //disable interrupts (executes first instruction after wait) //Other work}&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;SPAN style=": ; font-size: 3; font-family: 'Times New Roman';"&gt;When I use the Simulator to check the WAIT statement it seems to enter it but the timer can’t get it out.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;When I use the P&amp;amp;E debugger it seems that the process hits the WAIT statement but doesn’t do any of the work below it.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I’ve even tried STOP mode which should totally shut down my processor (because I have no RTIs) but it continues its normal timer operation when that should be turned off.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I’ve tried the copying the same assembly code I have into CodeWarrior with the same results.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; According to the debugger I don’t ever get back to my WAIT mode.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have a Timer that’s 100ms and I’ve measured that it only does 30ms of work.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; The WAIT doesn’t break the ‘for’ loop, does it?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;Why is there such a difference for very similar codes?&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Why doesn’t the Timer interrupt break the wait statement in the simulator?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Times New Roman'; font-size: 3;"&gt;Any help would be appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 08:40:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-Low-Power-Modes/m-p/140329#M2452</guid>
      <dc:creator>okcee</dc:creator>
      <dc:date>2020-10-29T08:40:32Z</dc:date>
    </item>
    <item>
      <title>Re: CodeWarrior Low Power Modes</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-Low-Power-Modes/m-p/140330#M2453</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Debugger needs the cpu clocks to operate.&amp;nbsp; WAI or STOP stops the clocks from functioning.&amp;nbsp; The debugger doesn't execute those instructions.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 21 Jun 2006 03:01:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/CodeWarrior-Low-Power-Modes/m-p/140330#M2453</guid>
      <dc:creator>okcee</dc:creator>
      <dc:date>2006-06-21T03:01:59Z</dc:date>
    </item>
  </channel>
</rss>

