<?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: Not Allocated function parameter in CodeWarrior Development Tools</title>
    <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663088#M5884</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alice,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry that was a typo it is actually PWMDTY5 which is the PWM Duty Cycle Register 5 as defined in&amp;nbsp;MC9S12XDP512.h.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem though is why is dc not assigned the value passed as the function argument.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;When stepping through the function in the Simulator/Debugger the value of the local variable dc in the DATA1 window shows as&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;dc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;not allocated&amp;gt; &amp;nbsp;unsigned char&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;The call from main()&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;setLEDDutyCycle(ATD1DR2L);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;(Value of ATD1DR2L = 0xA0) as read from the Data-&amp;gt;Locals window.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 16 Nov 2016 13:59:49 GMT</pubDate>
    <dc:creator>tnriley</dc:creator>
    <dc:date>2016-11-16T13:59:49Z</dc:date>
    <item>
      <title>Not Allocated function parameter</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663086#M5882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am using CodeWarrior 5.1 Special Edition and am&amp;nbsp;having trouble passing a value to a function.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The call from main()&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;setLEDDutyCycle(ATD1DR2L);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;(Value of ATD1DR2L = 0xA0) as read from an external pot.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The function is as follows:&lt;/P&gt;&lt;P&gt;static void setLEDDutyCycle(uint8_t dc){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PWMCTY5 = dc;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;PWMDTY4 = dc;&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When stepping through the function in the Simulator/Debugger the value of the local variable dc in the DATA1 window shows as&lt;/P&gt;&lt;P&gt;dc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;not allocated&amp;gt; &amp;nbsp;unsigned char&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Other functions that I have are working, but confused about this one.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas where I am off track?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2016 21:54:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663086#M5882</guid>
      <dc:creator>tnriley</dc:creator>
      <dc:date>2016-11-15T21:54:24Z</dc:date>
    </item>
    <item>
      <title>Re: Not Allocated function parameter</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663087#M5883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Tim,&lt;/P&gt;&lt;P&gt;What about the type of &amp;nbsp;PWMCTY5 ?&lt;/P&gt;&lt;P&gt;Could you please share your project , or there is some confidential about the project,&lt;/P&gt;&lt;P&gt;you can delete some code , then only remain the code which can show the error .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Alice&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2016 07:35:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663087#M5883</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2016-11-16T07:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Not Allocated function parameter</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663088#M5884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alice,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry that was a typo it is actually PWMDTY5 which is the PWM Duty Cycle Register 5 as defined in&amp;nbsp;MC9S12XDP512.h.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The problem though is why is dc not assigned the value passed as the function argument.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;When stepping through the function in the Simulator/Debugger the value of the local variable dc in the DATA1 window shows as&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;dc&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;not allocated&amp;gt; &amp;nbsp;unsigned char&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;The call from main()&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;setLEDDutyCycle(ATD1DR2L);&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="border: 0px;"&gt;&lt;SPAN style="border: 0px; font-weight: inherit;"&gt;(Value of ATD1DR2L = 0xA0) as read from the Data-&amp;gt;Locals window.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Nov 2016 13:59:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663088#M5884</guid>
      <dc:creator>tnriley</dc:creator>
      <dc:date>2016-11-16T13:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Not Allocated function parameter</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663089#M5885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Tim,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For in the function of "setLEDDutyCycle()" , dc do nothing , only be given to other variable or&lt;/P&gt;&lt;P&gt;register , so&amp;nbsp; the compiler optimize it .&lt;/P&gt;&lt;P&gt;For example add&amp;nbsp; dc++; in that function , it will not optimize it .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope it helps&lt;BR /&gt;Have a great day,&lt;BR /&gt;Alice Yang&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2016 05:10:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663089#M5885</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2016-11-17T05:10:13Z</dc:date>
    </item>
    <item>
      <title>Re: Not Allocated function parameter</title>
      <link>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663090#M5886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Alice,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Interesting, but dc is passed in and is being used to set PWM port parameters.&amp;nbsp;In all cases the code executed properly as indicated by the ability to set the LED brightness from the pot attached to&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;ATD1DR2L.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the IDE optimized it to &amp;lt;NULL&amp;gt; basically? I did the following to test.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) Tried to declare as volatile in the parameter listing - Same result&lt;/P&gt;&lt;P&gt;2) Added the statement dc %= 0xff; - Same result&lt;/P&gt;&lt;P&gt;3) Added the statement dc++; before&amp;nbsp;&lt;SPAN&gt;dc %= 0xff; - dc is now assigned the passed value in the Data1 -Locals window.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f;"&gt;However the only time the correct passed value shows up in the Data1-Locals window is when the value is incremented.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Nov 2016 15:41:48 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-Development-Tools/Not-Allocated-function-parameter/m-p/663090#M5886</guid>
      <dc:creator>tnriley</dc:creator>
      <dc:date>2016-11-17T15:41:48Z</dc:date>
    </item>
  </channel>
</rss>

