title: How to write and read specific bit of a 32 bit register
body: <p>I'm new to bit operations and trying to experiment little bit. </p>
  
  <p>let's say I have a 32 bit register which is constructed as follows:</p>
  
  <pre><code>Bit 31:12 RESERVED
  Bit 11    CONFIG1
  Bit 10    CONFIG2
  Bit 9:0   DATA
  </code></pre>
  
  <p>There exists already a Function to write data into the register:</p>
  
  <pre><code> #define WR_REG_32(address, value)    (*((volatile u32 *)(address)) = (value))
  </code></pre>
  
  <p>I would like to write the value 0x0 at Bit 10 (CONFIG2). The value should be in the format like for example:</p>
  
  <pre><code>0x00005000 
  </code></pre>
  
  <p>So, how to know what hex value to use in order to write to Bit 10 the value 0x0 without touching the other bits?</p>
  
  <p>Also, what is the easiest way to read from the 32 bit register only the values from bit 0 - 9 ?</p>