<?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: Boolean Variables / Bit fields using CW 4.7 + PE 2.98 - signedness/Bit ...[S12XDP512] in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Boolean-Variables-Bit-fields-using-CW-4-7-PE-2-98-signedness-Bit/m-p/166750#M5439</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Is the stack big enough, sounds like a stack overrun.&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, 23 Jun 2008 22:19:33 GMT</pubDate>
    <dc:creator>CompilerGuru</dc:creator>
    <dc:date>2008-06-23T22:19:33Z</dc:date>
    <item>
      <title>Boolean Variables / Bit fields using CW 4.7 + PE 2.98 - signedness/Bit order problems?? [S12XDP512]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Boolean-Variables-Bit-fields-using-CW-4-7-PE-2-98-signedness-Bit/m-p/166749#M5438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hi Folks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;right now i encounter some problem that puzzles me: In my current project, i use some boolean variables and bit fields. In PE_Types.h there are also the #define's and typedef's needed for this (typedef unsigned char bool; #define TRUE 1;#define FALSE 0&lt;/SPAN&gt;&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;&lt;BR /&gt;&lt;SPAN&gt;But, and that's how the problems show up, on some occasion such a boolean variable, which should be either 0 or 1 decimal, but nothing else, shows as 128 (have seen other values as well, 50, 212, 192 and more) in the debugger, which is far from what i would expect.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On top of that (but maybe related) i have some unsigned chars (uint8_t to be exact) set up as bit fields in order to hold some flags. Right now i'm using only the 4 least significant Bits using constructs like "if (var &amp;amp; __CURRENT) { do_some(); var &amp;amp;= ~__CURRENT; }", __CURRENT being replaced by the preprocessor as stated by "#define __CURRENT 0x04" so as to have some more verbosity in the source. But even though i currently am working just on the lower 4 bits, the upper 4 bits of that unsigned char occasionally get set in some semi-random way, about half the time i see it, they're the given Pattern ~__CURRENT shifted by four bits to the left...&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I checked and double-checked my code if i was somewhere did arithmetics instead of logical instructions (like adding some value instead of OR'ing a bit or subtracting instead of AND'ing the inverse) but haven't found any going over all the files (including those generated by ProcessorExpert) several times.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Any suggestions on this??&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by analogist on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-06-23&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;12:38 PM&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by analogist on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-06-23&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;12:48 PM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2008 18:37:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Boolean-Variables-Bit-fields-using-CW-4-7-PE-2-98-signedness-Bit/m-p/166749#M5438</guid>
      <dc:creator>analogist</dc:creator>
      <dc:date>2008-06-23T18:37:28Z</dc:date>
    </item>
    <item>
      <title>Re: Boolean Variables / Bit fields using CW 4.7 + PE 2.98 - signedness/Bit ...[S12XDP512]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Boolean-Variables-Bit-fields-using-CW-4-7-PE-2-98-signedness-Bit/m-p/166750#M5439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Is the stack big enough, sounds like a stack overrun.&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, 23 Jun 2008 22:19:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Boolean-Variables-Bit-fields-using-CW-4-7-PE-2-98-signedness-Bit/m-p/166750#M5439</guid>
      <dc:creator>CompilerGuru</dc:creator>
      <dc:date>2008-06-23T22:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Boolean Variables / Bit fields using CW 4.7 + PE 2.98 - signedness/Bit ...[S12XDP512]</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Boolean-Variables-Bit-fields-using-CW-4-7-PE-2-98-signedness-Bit/m-p/166751#M5440</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Looks just like that, increased stack size and now it suddenly works as expected...&lt;BR /&gt;&lt;BR /&gt;Thanks a bunch!&lt;BR /&gt;Florian&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Jun 2008 22:22:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Boolean-Variables-Bit-fields-using-CW-4-7-PE-2-98-signedness-Bit/m-p/166751#M5440</guid>
      <dc:creator>analogist</dc:creator>
      <dc:date>2008-06-23T22:22:56Z</dc:date>
    </item>
  </channel>
</rss>

