<?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>CodeWarrior for MCUのトピックRe: Is there a bit data type in CW?</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-a-bit-data-type-in-CW/m-p/199931#M7507</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Take a look at the appropriate derivative header file, say mcs912dt256.h, that's located in the directory {CodeWarrior Install}\lib\hc12c\include\. In it you will find bit-fields declared for the various processor registers. When you use the CodeWarrior Project wizard to build a project, it includes this derivative header file for you automatically. Check out some of the example programs found in (CodeWarrior_Examples) to see how the code accesses the MCU's registers. HTH.&lt;BR /&gt;&lt;BR /&gt;---Tom&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Nov 2008 23:42:32 GMT</pubDate>
    <dc:creator>J2MEJediMaster</dc:creator>
    <dc:date>2008-11-06T23:42:32Z</dc:date>
    <item>
      <title>Is there a bit data type in CW?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-a-bit-data-type-in-CW/m-p/199930#M7506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;Hi,bros!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm alway wondering wether CW have a bit data type?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;And if I need to declear a bit type data ,then how?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If i need to use S12's a parallel prot's(common port ,just like port a or port b,not port s or port j) one bit as a seriea communication pin,and datas are translated bit by bit on the line,then how to write the programm?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope to get some kind help！ Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by syf on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-11-06&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;05:01 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Nov 2008 20:57:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-a-bit-data-type-in-CW/m-p/199930#M7506</guid>
      <dc:creator>syf</dc:creator>
      <dc:date>2008-11-06T20:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a bit data type in CW?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-a-bit-data-type-in-CW/m-p/199931#M7507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;Take a look at the appropriate derivative header file, say mcs912dt256.h, that's located in the directory {CodeWarrior Install}\lib\hc12c\include\. In it you will find bit-fields declared for the various processor registers. When you use the CodeWarrior Project wizard to build a project, it includes this derivative header file for you automatically. Check out some of the example programs found in (CodeWarrior_Examples) to see how the code accesses the MCU's registers. HTH.&lt;BR /&gt;&lt;BR /&gt;---Tom&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Nov 2008 23:42:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-a-bit-data-type-in-CW/m-p/199931#M7507</guid>
      <dc:creator>J2MEJediMaster</dc:creator>
      <dc:date>2008-11-06T23:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: Is there a bit data type in CW?</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-a-bit-data-type-in-CW/m-p/199932#M7508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;I would strongly advise against using bitfields. They come with a large number of undefined and unspecified behavior, making them completely non-portable and unreliable. Professional embedded programmers never use them.&lt;BR /&gt;&lt;BR /&gt;The way bitfields are defined in the CW headers is also non-standard code where they use char instead of int for bitfields. This is not allowed in C, and the CW headers will not compile in an ISO compliant C compiler. Set CW to "Strict ANSI" and see for yourself.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Instead, I strongly recommend to use bit masks:&lt;BR /&gt;&lt;BR /&gt;#define PORTX (*(volatile unsigned char*)0x1234)&lt;BR /&gt;&lt;BR /&gt;#define PORTX_PIN1 0x01&lt;BR /&gt;#define PORTX_PIN2 0x02&lt;BR /&gt;#define PORTX_PIN3 0x04&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;PORTX |= PORTX_PIN1; /* set pin to active */&lt;BR /&gt;PORTX &amp;amp;= ~PORTX_PIN1; /* set pin to passive */&lt;BR /&gt;&lt;BR /&gt;This code is pure ISO C and is portable to any compiler or computer in the world.&lt;BR /&gt;&lt;BR /&gt;Message Edited by Lundin on &lt;SPAN class="date_text"&gt;2008-11-13&lt;/SPAN&gt; &lt;SPAN class="time_text"&gt;10:39 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 13 Nov 2008 17:38:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/Is-there-a-bit-data-type-in-CW/m-p/199932#M7508</guid>
      <dc:creator>Lundin</dc:creator>
      <dc:date>2008-11-13T17:38:14Z</dc:date>
    </item>
  </channel>
</rss>

