<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Assigning a larger value to a bit</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/17004/assigning-a-larger-value-to-a-bit</link><description> bit bitVal;
unsigned char byteVal;
:
:
 bitVal = byteVal; 
 Question: 
How does C51 determine whether to set or clear the bit? 
Does it: 
 A). Simply copy the LSB of the byteVal into the bit, or 
 B). Clear the bit if the byteVal is zero; set it otherwise</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: Assigning a larger value to a bit</title><link>https://community.arm.com/thread/54236?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2002 14:10:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ed0651ad-50ec-4390-9ab2-9bbc1ade8203</guid><dc:creator>Andrew Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;Take a look at the following thread for an answer to this question.&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
I&amp;#39;d prefer to be able to look in the &lt;i&gt;&lt;b&gt;manual!!&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
How can I say &amp;quot;Please read the manual&amp;quot; if it&amp;#39;s not &lt;i&gt;in&lt;/i&gt; the F... Manual!!??  ;-)&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assigning a larger value to a bit</title><link>https://community.arm.com/thread/38466?ContentTypeID=1</link><pubDate>Tue, 12 Mar 2002 11:02:34 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d7d10186-551b-4fc5-b52d-84e75b39dd4f</guid><dc:creator>Jon Ward</dc:creator><description>&lt;p&gt;Take a look at the following thread for an answer to this question.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.keil.com/forum/docs/thread1328.asp#Msg5232"&gt;http://www.keil.com/forum/docs/thread1328.asp#Msg5232&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Jon&lt;/b&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assigning a larger value to a bit</title><link>https://community.arm.com/thread/38467?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2002 14:30:34 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cc46c0ae-48dc-4207-a032-9fa0a290c307</guid><dc:creator>Dan Henry</dc:creator><description>&lt;p&gt;Some cross-compilers handle it differently, and for that reason, I have always performed the byte-to-integer-bit and byte-to-boolean-bit conversions explicitly to handle either case.  For example HI-TECH PICC (obviously for Microchip PIC microcontrollers) abides by a more ANSI-like interpretation, remaining faithful to C&amp;#39;s integer conversion (narrowing) rules, and implements it like Andrew&amp;#39;s example &lt;b&gt;A&lt;/b&gt;.&lt;br /&gt;
&lt;br /&gt;
If I had ever thought about how bytes *should* be converted to bits, this is the way a &amp;quot;language lawyer&amp;quot; would probably have specified it (i.e., ANSI-like).&lt;br /&gt;
&lt;br /&gt;
Regards,&lt;br /&gt;
&lt;br /&gt;
--Dan Henry&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Assigning a larger value to a bit</title><link>https://community.arm.com/thread/38462?ContentTypeID=1</link><pubDate>Tue, 05 Mar 2002 13:42:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:238c390f-8ff9-47f0-81f3-d42764a1c69b</guid><dc:creator>Mark Odell</dc:creator><description>&lt;p&gt;I&amp;#39;d expect it to be:&lt;br /&gt;
&lt;pre&gt;bit  bitVar;
char charVar = 0xA5;

bitVar = charVar;

// would be interp. as below, e.g. a boolean treatment of charVar.
bitVar = !!charVar;&lt;/pre&gt;
Regards,&lt;br /&gt;
&lt;br /&gt;
- Mark&lt;br /&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>