<?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: problem with SW_I2C output data in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151485#M8237</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now it would appear that my issue is related to the log10() function - I exited out of codewarrior and went back in and restarted the BDM. Now if I take the log10() function out the result from the Get_ADC_Raw() which uses the SW_I2C bean is correct but if I leave it in the code the result from Get_ADC_Raw() is not correct.&lt;/P&gt;&lt;P&gt;Am I having some type of pointer or initialization issue related to using the log10() that is effecting the SW_I2C bean result?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Puzzled and frustrated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Apr 2012 04:42:30 GMT</pubDate>
    <dc:creator>admin</dc:creator>
    <dc:date>2012-04-04T04:42:30Z</dc:date>
    <item>
      <title>problem with SW_I2C output data</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151484#M8236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I run the below loop in main().&lt;BR /&gt;&lt;BR /&gt;I use a subroutine called Get_ADC_Raw() that utilizes the SW_I2C bean to gets data from a outside IC.&lt;BR /&gt;The below code will work for me – the data from Get_ADC_Raw() is put into a variable OutX Then this data is pushed out to my screen by the subroutine OutputRawtoScreen()&lt;BR /&gt;&lt;BR /&gt;What I would like to do is take that data which is in variable OutX and do a couple of calculations, the last calculation is a log10().&lt;BR /&gt;&lt;BR /&gt;The below code works - (only because set the OutX variable to a fixed value) I get the correct data from the Get_ADC_Raw() - it outputs correctly to the screen for me and the other calculation including the log10() work fine for me. Now if I eliminate the line “OutX = 4000” and just try to use the raw data that should be in that variable it seems to mess up the data that comes out of the Get_ADC_Raw() routine.&lt;BR /&gt;&lt;BR /&gt;This is probably something simple I’m doing wrong and have worked the last couple of days to try and solve the problem without success.&lt;BR /&gt;&lt;BR /&gt;My original project and code was developed around the MC9S08QE128 processor and it worked fine and was pretty much complete - I only started to have issues when I switched to the MC9S08JM60 processor (I needed USB capabillity). I'm sure it is probably something simple like an initialization that I need to take care of but I just can't find the solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is a basic run down of the code which has subroutines that are placed in other .c files that I link using .h files.&lt;/P&gt;&lt;P&gt;I am new to this forum and this is my first post so I apolgize if my explanation of my issue is not clear.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be be much appreicated - thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; unsigned int OutX;&lt;BR /&gt;&amp;nbsp; float logVal;&lt;BR /&gt;&amp;nbsp; float logOut;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif"&gt;&lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/A&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OutX = Get_ADC_Raw();&amp;nbsp;&amp;nbsp; //get data from SW_I2C bean&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OutputRawtoScreen(OutX); //output that data to my display&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OutX = 4000;&amp;nbsp;&amp;nbsp; //set the variable to 4000&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logVal = OutX/32.767;&amp;nbsp; //divide the var value by 32.767 and out into logVal&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logVal = logVal/1000;&amp;nbsp;&amp;nbsp; //divide the logVal by 1000 and place back in logVal&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; logOut = 10*log10(logVal);&amp;nbsp;&amp;nbsp; // do a log10 conversion on the logVal and place in logOut&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Apr 2012 23:08:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151484#M8236</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2012-04-03T23:08:17Z</dc:date>
    </item>
    <item>
      <title>Re: problem with SW_I2C output data</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151485#M8237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Now it would appear that my issue is related to the log10() function - I exited out of codewarrior and went back in and restarted the BDM. Now if I take the log10() function out the result from the Get_ADC_Raw() which uses the SW_I2C bean is correct but if I leave it in the code the result from Get_ADC_Raw() is not correct.&lt;/P&gt;&lt;P&gt;Am I having some type of pointer or initialization issue related to using the log10() that is effecting the SW_I2C bean result?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Puzzled and frustrated!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 04:42:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151485#M8237</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2012-04-04T04:42:30Z</dc:date>
    </item>
    <item>
      <title>Re: problem with SW_I2C output data</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151486#M8238</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, and welcome to the forum.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With the use of floats, and functions such as log10(), this will require a significantly larger stack than the case where floats are not used.&amp;nbsp; I suspect that you are experiencing stack overflow.&amp;nbsp; If so, the solution is to increase the stack size.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 11:40:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151486#M8238</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2012-04-04T11:40:31Z</dc:date>
    </item>
    <item>
      <title>Re: problem with SW_I2C output data</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151487#M8239</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;MAC - Your the man!!&lt;/P&gt;&lt;P&gt;Thanks a million!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Apr 2012 20:47:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/problem-with-SW-I2C-output-data/m-p/151487#M8239</guid>
      <dc:creator>admin</dc:creator>
      <dc:date>2012-04-04T20:47:53Z</dc:date>
    </item>
  </channel>
</rss>

