user18982: I have hard time to understand what this doc tells me: https://www.microchip.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_use_bv.html
I has a macro called _BV that 

convert a bit number (usually within a byte register) into a byte value

And the example tells this

_BV(3) => 1 << 3 => 0x08

I am kinda used to bits and bytes etc. But I don't understand what the 3 in this example is? It says it converts a bit number but 3 is not binary it is an integer. And the macro resolves it to 0x08 which is the value of 8 in decimal.
I am very confused. I hope someone can explain to me what is happening here!

user7508: The bits within a byte are numbered 0 through 7 from right to left. The
rightmost (least significant) is bit 0, next is bit 1... and the
leftmost (most significant) is bit 7.
The expression _BV(3) builds a byte where bit 3 is set (is 1) and all
other bits are clear (are 0). In binary it looks like this:
position:   7  6  5  4  3  2  1  0
bit value:  0  0  0  0  1  0  0  0

The macro expands to 1<<3, which takes the integer 1 (0b00000001 in
binary) and shifts all its bits by three positions to the left. The
result can be written 0b00001000 in binary, 0x08 in hexadecimal, and 8
in decimal.

18982: <p>I have hard time to understand what this doc tells me: <a href="https://www.microchip.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_use_bv.html" rel="nofollow noreferrer">https://www.microchip.com/webdoc/AVRLibcReferenceManual/FAQ_1faq_use_bv.html</a></p>

<p>I has a macro called <code>_BV</code> that </p>

<blockquote>
  <p>convert a bit number (usually within a byte register) into a byte value</p>
</blockquote>

<p>And the example tells this</p>

<blockquote>
  <p>_BV(3) => 1 &lt;&lt; 3 => 0x08</p>
</blockquote>

<p>I am kinda used to bits and bytes etc. But I don't understand what the <strong>3</strong> in this example is? It says it converts a bit number but <strong>3</strong> is not binary it is an integer. And the macro resolves it to <strong>0x08</strong> which is the value of 8 in decimal.</p>

<p>I am very confused. I hope someone can explain to me what is happening here!</p>
 7508: <p>The bits within a byte are numbered 0 through 7 from right to left. The
rightmost (least significant) is bit 0, next is bit 1... and the
leftmost (most significant) is bit 7.</p>

<p>The expression <code>_BV(3)</code> builds a byte where bit 3 is set (is 1) and all
other bits are clear (are 0). In binary it looks like this:</p>

<pre><code>position:   7  6  5  4  3  2  1  0
bit value:  0  0  0  0  1  0  0  0
</code></pre>

<p>The macro expands to <code>1&lt;&lt;3</code>, which takes the integer 1 (0b00000001 in
binary) and shifts all its bits by three positions to the left. The
result can be written 0b00001000 in binary, 0x08 in hexadecimal, and 8
in decimal.</p>
