<?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 Floating Point Support for HCS08 in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161987#M4530</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="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;Good Morning,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;I have used floating-point operations in HC08 processors for many years, but this is the first time that I have tried it with an HCS08 processor.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I am trying to multiply a floating-point number and a short, and the processor simply hangs up.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have plenty of stack space and plenty of memory.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Here are the significant lines of code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;float Kp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;short E;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;float temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;short Rs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;Rs = RS232RX &amp;lt;&amp;lt; 2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;E =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Rs - A2D0[0];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;// proportional controller&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;temp = Kp * E;&lt;SPAN&gt;&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;&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;/SPAN&gt; // this hangs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;if(temp &amp;gt; 1023)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; temp = 1023;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;else if(temp &amp;lt; -1023)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; temp = -1023;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;PWM0 = (short)temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;The code hangs up at the line:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;E =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Rs - A2D0[0];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;I then tried to typecast E from a short to a float before the multiply:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;float Efloat;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;Efloat = (float)E;&lt;SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; // this hangs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;It hangs up on the typecast.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Interestingly, if I comment out that line and set the values to constants, the typecast from float to short works fine:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;PWM0 = (short)temp;&lt;SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; // this is OK&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;I am using the ansitfs library.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 09 Nov 2007 00:18:43 GMT</pubDate>
    <dc:creator>Dakota</dc:creator>
    <dc:date>2007-11-09T00:18:43Z</dc:date>
    <item>
      <title>Floating Point Support for HCS08</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161987#M4530</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="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;Good Morning,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;I have used floating-point operations in HC08 processors for many years, but this is the first time that I have tried it with an HCS08 processor.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I am trying to multiply a floating-point number and a short, and the processor simply hangs up.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have plenty of stack space and plenty of memory.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Here are the significant lines of code:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;float Kp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;short E;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;float temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;short Rs;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;Rs = RS232RX &amp;lt;&amp;lt; 2;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;E =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Rs - A2D0[0];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;// proportional controller&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;temp = Kp * E;&lt;SPAN&gt;&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;&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;/SPAN&gt; // this hangs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;if(temp &amp;gt; 1023)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; temp = 1023;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;else if(temp &amp;lt; -1023)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; temp = -1023;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;PWM0 = (short)temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;The code hangs up at the line:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style=": ; color: #000000; font-size: 3; font-family: 'Times New Roman';"&gt;E =&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Rs - A2D0[0];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;I then tried to typecast E from a short to a float before the multiply:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;float Efloat;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;Efloat = (float)E;&lt;SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; // this hangs&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;It hangs up on the typecast.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Interestingly, if I comment out that line and set the values to constants, the typecast from float to short works fine:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;PWM0 = (short)temp;&lt;SPAN&gt;&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;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt; // this is OK&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;I am using the ansitfs library.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Any help would be greatly appreciated.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color: #000000; font-family: 'Times New Roman'; font-size: 3;"&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 00:18:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161987#M4530</guid>
      <dc:creator>Dakota</dc:creator>
      <dc:date>2007-11-09T00:18:43Z</dc:date>
    </item>
    <item>
      <title>More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161988#M4531</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;FONT color="#000000" face="Times New Roman" size="3"&gt;After seeing my original message online, I realized that it is a bit verbose.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; To the point, Code written with CodeWarrior for HCS08, using the ansitfs library, seems to hang up when typecasting from a short to a float, or when typecasting from an int to a float.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; It also hangs up when trying to multiply a short and a float.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; It does seem to work fine, however, when typecasting from a float to an int or short.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;Has anyone seen this problem, and is there a solution?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;Thank you.&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 00:53:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161988#M4531</guid>
      <dc:creator>Dakota</dc:creator>
      <dc:date>2007-11-09T00:53:37Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161989#M4532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;No, did not see this.&lt;BR /&gt;But can you show where it actually hangs for you? Maybe with a screeshot (so also the registers and the memory around the SP is visible)?&lt;BR /&gt;&lt;BR /&gt;Also which core are you using, and is everything in the zero page as required by the tiny memory model?&lt;BR /&gt;Which compiler options do you use?&lt;BR /&gt;ansitfs.lib is for IEEE32/32 tiny memory model for the S08.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 06:31:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161989#M4532</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2007-11-09T06:31:06Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161990#M4533</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;FONT color="#000000" face="Times New Roman" size="3"&gt;Good Morning,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;I created the project using the IEEE32/32 tiny memory module, and have not changed any of the compiler settings.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have created many variables in higher memory using the #pragma DATA_SEG FAR FAR_RAM statement, and these variables do not seem to create any problems (I access them with no errors).&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; The problem only occurs when I tried to multiply an integer and a float.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I have worked around the problem by multiplying my floating point number by 64, performing integer multiplication, and then bit shifting the result to the right by 4.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Using this workaround, my entire project works well, although the code is somewhat difficult to read, and I would much rather use the floating-point multiplication.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;When troubleshooting the problem, I tried multiplying a float and a float – that worked fine.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I then tried multiplying an integer and an integer – that also worked fine.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; The problem only occurs when trying to multiply a float and an integer.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I then tried to typecast the integer to a float before performing the multiplication – and that is where the problem occurred.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;I have attached a screenshot of the emulator screen stopped at the point where it hangs.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I would also gladly send you the project, if you are interested.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; It is a small project, and it is not proprietary.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;Thank you.&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 19:38:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161990#M4533</guid>
      <dc:creator>Dakota</dc:creator>
      <dc:date>2007-11-09T19:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161991#M4534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;As far as I know, tiny means that all non explicitely allocated variables must be in the zero page, and this&lt;BR /&gt;does include the stack.&lt;BR /&gt;The current SP in the screenshot is 0x246, so I would suggest not to use the tiny memory model,&lt;BR /&gt;but instead the small memory model and to explicitely allocate all the variables you want in the zero page.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 19:55:58 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161991#M4534</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2007-11-09T19:55:58Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161992#M4535</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;FONT color="#000000" face="Times New Roman" size="3"&gt;Good Morning,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;In CodeWarrior v6, when a new project is created using the tiny memory module, the following message appears:&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;“By default all variables are in the zero page (direct memory access). Variables outside the zero page can be used with pragmas or the far keyword.”&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;I used pragmas to locate commonly used variables outside of the zero page (such as my PWM values, the A2D array, and other data collection variables).&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; I also located the stack in high memory (in the .prm file).&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Memory location 0x246 is within my stack.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; This is the seventh project in which I have used this same configuration (I just create a new folder, copy the old files into it, and open this copied project as a starting point).&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Every project has worked with no problem – the high memory variables can be accessed, the new variables created go into low memory, and the stack works as expected.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;The only problem that I have is multiplying a float and an integer (as I mentioned integer*integer and float*float works fine). The problem seems to be in casting the integer to a float (casting the float to an integer also works fine).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;I have a work-around and, in fact, my work-around runs faster than the library floating point multiply routine.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; It just makes the code a little difficult to understand.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;Thank you.&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Nov 2007 22:11:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161992#M4535</guid>
      <dc:creator>Dakota</dc:creator>
      <dc:date>2007-11-09T22:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161993#M4536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I must admit that the text in the wizard (or the maual, AFAIK) does not explicitly mention the stack, but it really is supposed to be in the zero page too for the tiny memory model. So "all variables" includes the ones on the stack.&lt;BR /&gt;&lt;BR /&gt;"normal" accesses to stack variables do not cause any problems even if the stack is allocated outside of the zero page, however there are certain otherwise perfectly legal C constructs, like you integer to float conversion, where the compiler does generate code with the assumption that the stack is in the zero page. And if you do not place it there, then those constructs will fail. Unfortunately stack are coded completely without the linker, and only the linker does know where you stack ends up (and eventually not even the linker, if you have multiple stacks or do not use the provided support).&lt;BR /&gt;Anyway, so to summarize, if you do not place the stack into the zero page, then you may run into issues. But I do see that a lot of reasonable code will run just fine. Your choice.&lt;BR /&gt;To be on the safe side, I would use the small memory model and place all but the variables you currently place extended explicitly in the zero page.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;BR /&gt;PS: Something else which is not reliable with SP beyond 0xFF and tiny: Struct returns.&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Nov 2007 03:50:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161993#M4536</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2007-11-10T03:50:28Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161994#M4537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;/FONT&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;Thank you for the information.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; For future projects, I will try the small memory model (it is a little late for this one).&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; It seems that the tiny memory model is really only intended for memory usage up to FF.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;In the small memory model, is the stack restricted to high memory (the message states that all variables are placed in high memory)?&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; It seems that, for the small memory model, variables placed in low memory (zero page) must be defined with a pragma.&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; Will I have the same problem?&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt; In other words, with the small memory model, will I only be able to use high memory if I want to perform floating point operations?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 10 Nov 2007 19:09:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161994#M4537</guid>
      <dc:creator>Dakota</dc:creator>
      <dc:date>2007-11-10T19:09:52Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161995#M4538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Not sure I understand the question.&lt;BR /&gt;&lt;BR /&gt;In the tiny memory model, everything outside the zero page must be explicitly placed with a pragma.&lt;BR /&gt;In the small memory model, everything which should take advantage of zero page addressing and which should be allocated in the zeropage has to be explicitly qualified with a pragma instead.&lt;BR /&gt;However a failure in doing so in the small memory model only causes that the compiler wont take advantage of the more efficient zero page addressing modes, it still will just work fine though.&lt;BR /&gt;For locals (on the stack), I would not expect a significant increase in code size when using small versus tiny.&lt;BR /&gt;For globals tiny/using zero page is more efficient, and therefore I would allocate the often used variables in the zero page when using the small memory model and the code efficiency/size is critical.&lt;BR /&gt;&lt;BR /&gt;In the small memory model the stack can be anywhere in the 64k addressing range, well it should have RAM there :smileyhappy:. The stack can be (even partially) in the zero page, but there is no advantage in doing so. So I would fill the zero page with globals instead.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 15:45:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161995#M4538</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2007-11-12T15:45:44Z</dc:date>
    </item>
    <item>
      <title>Re: More Concise</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161996#M4539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thank you.&amp;nbsp; I think that you answered my question.&amp;nbsp; For future projects, I will use the small memory model and place commonly used global variables in the zero page with a pragma.&amp;nbsp; That way, the floating point routines should work as expected.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Nov 2007 18:40:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Floating-Point-Support-for-HCS08/m-p/161996#M4539</guid>
      <dc:creator>Dakota</dc:creator>
      <dc:date>2007-11-12T18:40:50Z</dc:date>
    </item>
  </channel>
</rss>

