<?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 problem with compiler and pass-parameter - 9S08AW48 - USB multilink - CW6.2 in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/problem-with-compiler-and-pass-parameter-9S08AW48-USB-multilink/m-p/152766#M3753</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working with 9S08AW48 micro with CodeWarrior 6.2, USB multilink interface for HCS08 and my embedded target.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've a problem with the compiler options (I think) and the parameter passed to / from a function; the instructions, for example, are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key = CheckKeyPressed();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SendDataToLCD(Key);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SerialPC_SendChar(Key);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(I've already tried to declare the variable "Key" static and file global, function-internal, but nothing)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The function "CheckKeyPressed" calculates the correct value: this value will be returned by "return KeyPressed", but the value I will see after the returning, is different from that one that i see in the function just before exiting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code for CheckKeyPressed() is: &lt;/SPAN&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;function CheckKeyPressed() {&lt;BR /&gt; &amp;nbsp; // variable declaration ...&lt;BR /&gt;&lt;BR /&gt; &amp;nbsp; index = getReg8(PTGD) &amp;amp; 0x0F;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt; &amp;nbsp; KeyPressed = Keyboard[index];&lt;BR /&gt;&lt;BR /&gt; &amp;nbsp; return KeyPressed; &amp;nbsp; &amp;nbsp;//KeyPressed has the correct value...&lt;BR /&gt; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;SPAN&gt;Key = CheckKeyPressed(); &amp;nbsp;//"Key" receives a wrong value...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried to check the "Disable Optimizations" flag in the Compiler tab of the "Edit-&amp;gt;Standard Setting" menu, but no change in the simulation occurs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Can anyone help me? I think there are some problems related to compiler optimisation and parameter-passing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Thanks in advance for any suggestion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Girmauro&lt;/SPAN&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Feb 2009 01:22:26 GMT</pubDate>
    <dc:creator>girmauro</dc:creator>
    <dc:date>2009-02-14T01:22:26Z</dc:date>
    <item>
      <title>problem with compiler and pass-parameter - 9S08AW48 - USB multilink - CW6.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/problem-with-compiler-and-pass-parameter-9S08AW48-USB-multilink/m-p/152766#M3753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm working with 9S08AW48 micro with CodeWarrior 6.2, USB multilink interface for HCS08 and my embedded target.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've a problem with the compiler options (I think) and the parameter passed to / from a function; the instructions, for example, are:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Key = CheckKeyPressed();&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SendDataToLCD(Key);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; SerialPC_SendChar(Key);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;(I've already tried to declare the variable "Key" static and file global, function-internal, but nothing)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The function "CheckKeyPressed" calculates the correct value: this value will be returned by "return KeyPressed", but the value I will see after the returning, is different from that one that i see in the function just before exiting.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code for CheckKeyPressed() is: &lt;/SPAN&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;function CheckKeyPressed() {&lt;BR /&gt; &amp;nbsp; // variable declaration ...&lt;BR /&gt;&lt;BR /&gt; &amp;nbsp; index = getReg8(PTGD) &amp;amp; 0x0F;&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;BR /&gt; &amp;nbsp; KeyPressed = Keyboard[index];&lt;BR /&gt;&lt;BR /&gt; &amp;nbsp; return KeyPressed; &amp;nbsp; &amp;nbsp;//KeyPressed has the correct value...&lt;BR /&gt; &amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;}&lt;/DIV&gt;&lt;DIV&gt;&lt;BR /&gt;&lt;/DIV&gt;&lt;SPAN&gt;Key = CheckKeyPressed(); &amp;nbsp;//"Key" receives a wrong value...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I've tried to check the "Disable Optimizations" flag in the Compiler tab of the "Edit-&amp;gt;Standard Setting" menu, but no change in the simulation occurs. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Can anyone help me? I think there are some problems related to compiler optimisation and parameter-passing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; Thanks in advance for any suggestion.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Girmauro&lt;/SPAN&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Feb 2009 01:22:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/problem-with-compiler-and-pass-parameter-9S08AW48-USB-multilink/m-p/152766#M3753</guid>
      <dc:creator>girmauro</dc:creator>
      <dc:date>2009-02-14T01:22:26Z</dc:date>
    </item>
    <item>
      <title>Re: problem with compiler and pass-parameter - 9S08AW48 - USB multilink - CW6.2</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/problem-with-compiler-and-pass-parameter-9S08AW48-USB-multilink/m-p/152767#M3754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Make sure you do not have any implicit parameter declarations. The compiler issues a warning for those, so make sure you do not ignore the warning.&lt;BR /&gt;Passing characters around is only possible with proper function prototypes.&lt;BR /&gt;So in your sample code, show the complete signatures of the functions.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Feb 2009 17:29:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/problem-with-compiler-and-pass-parameter-9S08AW48-USB-multilink/m-p/152767#M3754</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2009-02-14T17:29:50Z</dc:date>
    </item>
  </channel>
</rss>

