<?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: Bizzare Codewarrior problem in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127262#M665</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Ha , makes sense.&lt;/P&gt;&lt;P&gt;Thanks for the help guys.This is something very easy to miss and could cause endless problems for the unwary. I'm lucky this was a small/simple piece of code!!&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Rob&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 22 Aug 2006 13:48:53 GMT</pubDate>
    <dc:creator>Seegoon</dc:creator>
    <dc:date>2006-08-22T13:48:53Z</dc:date>
    <item>
      <title>Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127255#M658</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi to all.&lt;/DIV&gt;&lt;DIV&gt;I have written some simple code that is giving me some weird results.&lt;/DIV&gt;&lt;DIV&gt;I am using Codewarrior ver 5.5.1272.&lt;/DIV&gt;&lt;DIV&gt;The code has 2 main parts. A 1ms timer and a main function.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Here is the main function:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;PRE&gt;void main(void){&amp;nbsp; /*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/&amp;nbsp; PE_low_level_init();&amp;nbsp; /*** End of Processor Expert internal initialization.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ***/&amp;nbsp;&amp;nbsp;&amp;nbsp; DDRB_BIT6 = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set portB bit 6 to output (light outout)&amp;nbsp; DDRB_BIT7 = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set portB bit 7 to output (status_led)&amp;nbsp; DDRA_BIT6 = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //set portA bit 6 to input&amp;nbsp; gate_open_flag = 0; light_on_delay = 20;&amp;nbsp; while(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; if(light_trigger==0)&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; trigger turns on light&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; counter_1sec = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Light = !Light;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while(light_trigger==0 &amp;amp;&amp;amp; ( counter_1sec &amp;lt; 4));&amp;nbsp;&amp;nbsp;&amp;nbsp; //wait for button to be released or 4 sec to pass&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; //TIE_C0I = 0;&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(counter_1sec &amp;lt; 4)&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; // button not held down , light on - TIMED&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; timeout_flag = 1;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //enable timeout in 1ms timer module&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; status_led_mode = 0;&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; else&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; // button held down , light on permanently&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; //flashes status led (x) times&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; status_led_mode = 1;&amp;nbsp;&amp;nbsp; //set led to flash-- delay 2 sec-- flash&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timeout_flag = 0;&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; while(light_trigger==0);&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(gate_open_flag &amp;amp;&amp;amp; Light == 0)&amp;nbsp; //gate turns on light for delay time&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; counter_1sec = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Light = 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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( counter_1sec &amp;gt; light_on_delay &amp;amp;&amp;amp; gate_open_flag)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; gate_open_flag = 0;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Light = 0;&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;BR /&gt;&amp;nbsp;&lt;BR /&gt;What happens:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The variable counter_1sec is incremented in the 1ms timer every 1000ms. Light_trigger is mapped to portA bit 6.&lt;/DIV&gt;&lt;DIV&gt;When light_trigger is held low one of 2 things happen:&lt;/DIV&gt;&lt;DIV&gt;If it is held low for less than 4 seconds the IF part of the if..else statement executes. If it is held low for longer than 4 seconds the ELSE statement executes. Everything works fine up till here.The&amp;nbsp;&amp;nbsp; //TIE_C0I = 0;&amp;nbsp;&amp;nbsp; instruction turns off the 1ms interrupt. I put this in there to help me step through the code with the debugger (P&amp;amp;E USB multilink )without continuously jumping to the timer interrupt.&lt;/DIV&gt;&lt;DIV&gt;The main problem happens on the line:&amp;nbsp;&amp;nbsp;&amp;nbsp;" status_led_mode = 1; " in the ELSE statement.&lt;/DIV&gt;&lt;DIV&gt;Before this line the value of the status_led_mode variable is 0.&lt;/DIV&gt;&lt;DIV&gt;After this line executes the value is 5 , not 1 as you would expect. I have stepped through this code many times&amp;nbsp;with the same result.&lt;/DIV&gt;&lt;DIV&gt;Now if I change the instruction to&amp;nbsp;"&amp;nbsp; status_led_mode = 2;&amp;nbsp; " or any number&amp;nbsp; other than 1 it works correctly.&lt;/DIV&gt;&lt;DIV&gt;Any idea what may be going on&amp;nbsp;here.&lt;/DIV&gt;&lt;DIV&gt;I have&amp;nbsp;noticed that the assembler that is generated is different if I use the value 1 as opposed to&amp;nbsp;any other number&amp;nbsp;.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It looks like the compiler is performing some sort of optimization somewhere.&lt;/DIV&gt;&lt;DIV&gt;I have tried creating the project from scratch with Processor expert (all default settings) with the same result.&lt;/DIV&gt;&lt;DIV&gt;Any help appreciated as I'm really stumped.Cheers&lt;/DIV&gt;&lt;DIV&gt;Rob&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Aug 2006 17:23:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127255#M658</guid>
      <dc:creator>Seegoon</dc:creator>
      <dc:date>2006-08-21T17:23:56Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127256#M659</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Sorry&amp;nbsp; I forgot to mention the processor.&lt;/P&gt;&lt;P&gt;I'm using the MC9S12c32CFU16 part.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Aug 2006 17:41:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127256#M659</guid>
      <dc:creator>Seegoon</dc:creator>
      <dc:date>2006-08-21T17:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127257#M660</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;And what is "status_led_mode" then? An integer variable? Some port pin?&lt;BR /&gt;&lt;BR /&gt;As a sidenote, it is good practice to set all unused pins to outputs in DDR registers, and to set PUCR to a value that makes sense to the application. PORTA and PORTB have no pull-ups activated out of reset, so if those pins are set as inputs and left unconnectet on the circuit board, the result will be random.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Aug 2006 19:40:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127257#M660</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2006-08-21T19:40:12Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127258#M661</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Status_led_mode is a variable. An insigned int. Sorry it's declared higher up in the code which I have not&amp;nbsp;shown.&lt;/P&gt;&lt;P&gt;I have been doing some experimenting and this is what I have found. Code has been stripped down to this.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt; while(1)    {          if(light_trigger==0)             //  trigger turns on light      {    //    counter_1sec = 0;        Light = !Light;        while(light_trigger==0 ) ;        TIE_C0I = 0;             if(counter_1sec &amp;lt; 4)                   // button not held down , light on - TIMED          {            timeout_flag = 1;     //enable timeout in 1ms timer module            status_led_mode = 0;          }          else                        // button held down , light on permanently          {              //flashes status led (x) times            status_led_mode = 1;   //set led to flash-- delay 2 sec-- flash            timeout_flag = 0;                }                     while(light_trigger==0);      }&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I&amp;nbsp;have found this:&lt;/P&gt;&lt;P&gt;If&amp;nbsp;I comment out this line&amp;nbsp;&amp;nbsp;counter_1sec = 0;&amp;nbsp; then the code works like it should.&lt;/P&gt;&lt;P&gt;Status_led_mode&amp;nbsp; always gets a value of 1 in the ELSE statement&lt;/P&gt;&lt;P&gt;If I leave it in , the value of Status_led_mode&amp;nbsp; becomes one more than counter_1sec( which is an unsigned int). ie If I hold the light_trigger input low for 15s the value in status_led_mode becomes 16.&lt;/P&gt;&lt;P&gt;Still confused :0(&lt;/P&gt;&lt;P&gt;P.S Thanks for the sidenote.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Rob&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Aug 2006 19:59:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127258#M661</guid>
      <dc:creator>Seegoon</dc:creator>
      <dc:date>2006-08-21T19:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127259#M662</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;is light_trigger and all other variables which are accessed by both the interupt handler and the &lt;BR /&gt;main code volatile?&lt;BR /&gt;I did see in the past really strage effects of a missing volatile, effects which are not obvious to humans like me, just to compilers :smileyhappy:&lt;BR /&gt;In the end, I think we would need complete, compilable code.&lt;BR /&gt;&lt;BR /&gt;Daniel&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 03:32:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127259#M662</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2006-08-22T03:32:04Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127260#M663</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi there.&lt;/P&gt;&lt;P&gt;Using volatile has solved my problem:0) &amp;nbsp;I did try that before but it did not seem to work. Maybe there was another problem that I was not aware of. I was under the impression that you should use the 'volatile' keyword on registers that may be changed at random by external events unknown to the compiler.&lt;/P&gt;&lt;P&gt;Does this mean that I should declare EVERY variable as volitile just in cast the compiler decides to optimize it in some way?&lt;/P&gt;&lt;P&gt;Thanks again for the help.&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Rob&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 13:17:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127260#M663</guid>
      <dc:creator>Seegoon</dc:creator>
      <dc:date>2006-08-22T13:17:46Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127261#M664</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi, Seegoon:&lt;BLOCKQUOTE&gt;&lt;HR /&gt;I was under the impression that you should use the 'volatile' keyword on registers that may be changed at random by external events unknown to the compiler.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;But any variable that is modified in an ISR will "be changed at random by external events unknown to the compiler". &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 13:32:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127261#M664</guid>
      <dc:creator>rocco</dc:creator>
      <dc:date>2006-08-22T13:32:27Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127262#M665</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Ha , makes sense.&lt;/P&gt;&lt;P&gt;Thanks for the help guys.This is something very easy to miss and could cause endless problems for the unwary. I'm lucky this was a small/simple piece of code!!&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Rob&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 13:48:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127262#M665</guid>
      <dc:creator>Seegoon</dc:creator>
      <dc:date>2006-08-22T13:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127263#M666</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;The problem is rather that Codewarrior has optimization enabled by default and lacks a single switch for turning all optimization off. Every other compiler I know of, for every platform, has the optimizer disabled by default and has also got a compiler switch "disable/enable optimizer".&lt;BR /&gt;&lt;BR /&gt;I remember when I once thought I found a bug in the optimizer. Metrowerks couldn't find the cause of the problem (which I later found, it was one of the optimizing switches that made the code behave wrongly).&lt;BR /&gt;But they couldn't find the cause and suggested that I should use volatile, because then the optimizer containing the possible bug wouldn't be used...&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 Aug 2006 14:37:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127263#M666</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2006-08-22T14:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Bizzare Codewarrior problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127264#M667</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Another thing ; This has probably nothing to do with your problem ,but I wouldnt write this ;&lt;BR /&gt;&lt;BR /&gt;while(light_trigger==0);&lt;BR /&gt;&lt;BR /&gt;I think its cleaner to write &lt;BR /&gt;&lt;BR /&gt;while(light_trigger==0){}&lt;BR /&gt;&lt;BR /&gt;But its perhaps just a matter of taste ?&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 23 Aug 2006 04:23:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Bizzare-Codewarrior-problem/m-p/127264#M667</guid>
      <dc:creator>kwik</dc:creator>
      <dc:date>2006-08-23T04:23:57Z</dc:date>
    </item>
  </channel>
</rss>

