title: Why do we add an Offset when addressing DDRx ,PORTx in avr?
body: <p>I recently started programming my <strong>Arduino (ATmega328p)</strong> using AVR and gained sufficient knowledge on using avr lib,instead of arduino IDE.I started with a blink led example. </p>
  
  <p>Then i tried the same eg but this time however i didnot <strong>include io.h</strong> or any other lib,  and instead used pointer to PORTs Like <em>DDRB or PORTB</em> etc.</p>
  
  <p>According to atmega328p datasheet, DDRB is at 0x04 and PORTB at 0x05.</p>
  
  <p>However setting them high for my blinking led eg didnot work.
  <strong>Instead i had to add an offset of 0x20 to both addresses, after it worked perfectly.</strong>
  i.e.,DDRB=0x24 and PORTB=0x25
  Where is this offset(0x20) comming from ?</p>