<?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: powf() problem - unpredictable changing the variables not used in this function... in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161261#M4471</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;You should go to Processor Expert -&amp;gt; View -&amp;gt; Inspector. In the component inspector, go to the&lt;BR /&gt;"Build options" tab and under "Generate PRM file"-&amp;gt;"Stack specification" you can set the stack size. At least this is how it works with CW for HC08 v6.3.&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Dec 2009 18:10:33 GMT</pubDate>
    <dc:creator>Navidad</dc:creator>
    <dc:date>2009-12-15T18:10:33Z</dc:date>
    <item>
      <title>powf() problem - unpredictable changing the variables not used in this function...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161258#M4468</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 searched a few posts on this forum (especially about powf()), but it seems, that nobody had similar problem like me. I am not professional, so it can be some basic mistake which I am not aware about...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the MCU - MC9S08JM60, with OpenSource BDM, CodeWarrior IDE v5.9.0 - Build 2830 (install file CW_MCU_V6_2_SE.exe, downloaded from feescale), Processor Expert v3.06 for freescale HC(S)08/RS08/CFV1, CW plugin IDE v4.26.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Until I am using powf() function, everything working fine. But when I call the powf function, it unpredictably change variables outside this function. I found it out by stepping the program in debugging mode. I have included&amp;nbsp; #include &amp;lt;math.h&amp;gt; and I added an ansifs.lib to my project since without it there was some errors about not defined float (or something...).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying calculate altitude, so it have to be accurate:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp; .&amp;nbsp;&amp;nbsp; 
#include &amp;lt;math.h&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .
float&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; altitude;
unsigned int&amp;nbsp;&amp;nbsp;&amp;nbsp; cislo;
unsigned int&amp;nbsp;&amp;nbsp;&amp;nbsp; pressure_value;
&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp; case 2:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Altimeter:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; menu_Altimeter();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_SelectSlave(ADC_I2C_ADDR); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i2c_RecvBlock(i2c_data_r,3,i2c_cnt_r);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // I2C recieve data ffrom I2C

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pressure_value=i2c_data_r[0];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pressure_value=pressure_value&amp;lt;&amp;lt;8;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pressure_value=pressure_value+i2c_data_r[1]+32767;&amp;nbsp; // 0-65535 -&amp;gt; 40-116kPa

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // equation dividied in parts
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; altitude = 34720 + pressure_value;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; altitude = powf(altitude, 0.190263236508);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // There is the problem...
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; altitude = ((-5.08604881782 * altitude) + 44.33076923)*10000;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cislo = altitude/1;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NumberToString(cislo, ConvertedLong);&amp;nbsp;&amp;nbsp; // convert cislo to string
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LcdGotoXYFont(2, 5);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LcdStr(FONT_1X, ConvertedLong);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // display on LCD
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LcdUpdate();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(menu_H!=2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; goto StartOfMenu;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; case 3:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Pressure:
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; menu_Pressure();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;;)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;SPAN&gt;&amp;nbsp;There is showed the function which causing the problem and I skipped varibles and definition which are not urgent in this case...&lt;/SPAN&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;After powf() calculate the altitude, it change not only the altitude value, but it change also another variables, but I have no Idea why, I was trying computing it in steps with help of another variables, but the result was the same after powf() function...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;there is the screen from debuger &lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.matelko.com%2Fimages%2Fdebuger.PNG" rel="noopener noreferrer" target="_blank"&gt;debuger.png&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If is there anybody with some clue what could be wrong, I would really appreciate help! Thanks for any advice and sorry about my English. &lt;SPAN aria-label="Wink" class="emoticon-inline emoticon_wink" style="height:16px;width:16px;"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:06:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161258#M4468</guid>
      <dc:creator>RastislavMatula</dc:creator>
      <dc:date>2020-10-29T09:06:44Z</dc:date>
    </item>
    <item>
      <title>Re: powf() problem - unpredictable changing the variables not used in this function...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161259#M4469</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sounds a lot like a stack overflow.&lt;/P&gt;&lt;P&gt;increase the STACKSIZE parameter in the prm file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 13 Dec 2009 03:22:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161259#M4469</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2009-12-13T03:22:24Z</dc:date>
    </item>
    <item>
      <title>Re: powf() problem - unpredictable changing the variables not used in this function...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161260#M4470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for quick response... that was the problem, now is everything working fine. &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;But can I ask you, Is there any way to set this value in something like "project settings" inside the CW? Every time I am adding beans and PE is rebuilding those files, STACKSIZE is set back to default value. I wasn't able to find such settings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And there is one more (Out topic) question. Is there any way to save the Debugger windows layout? I am able to save new layout, but not like default. So everytime I start the debugger, I have to load my saved layout. It begins to be bothering me, when there is some problem, and I have to after every small change in code set the windows back to my settings.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Once again thank you very much for help &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>Tue, 15 Dec 2009 17:57:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161260#M4470</guid>
      <dc:creator>RastislavMatula</dc:creator>
      <dc:date>2009-12-15T17:57:28Z</dc:date>
    </item>
    <item>
      <title>Re: powf() problem - unpredictable changing the variables not used in this function...</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161261#M4471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;You should go to Processor Expert -&amp;gt; View -&amp;gt; Inspector. In the component inspector, go to the&lt;BR /&gt;"Build options" tab and under "Generate PRM file"-&amp;gt;"Stack specification" you can set the stack size. At least this is how it works with CW for HC08 v6.3.&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Dec 2009 18:10:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/powf-problem-unpredictable-changing-the-variables-not-used-in/m-p/161261#M4471</guid>
      <dc:creator>Navidad</dc:creator>
      <dc:date>2009-12-15T18:10:33Z</dc:date>
    </item>
  </channel>
</rss>

