How To Configure Microcontroller Digital Pin – Input/Output Modes?

Understanding how a digital pin of a microcontroller is configured took me lot of time. Because of, lack of proper material. Most of the articles found on the internet are incomplete. And they talk only from one point of view i.e., either as inputs or as output. Some other articles do not compare and differentiate between both of them. So in this post I am putting some effort to make the topic simple to understand for everyone.  Following are the slides from my notebook.

Page 1
Page 1
Page 2
Page 2
Page 3
Page 3

References:

  1. http://www.w9xt.com/page_microdesign_pt3_ouput_basics.html
  2. http://www.w9xt.com/page_microdesign_pt4_drive_led.html
  3. http://www.w9xt.com/page_microdesign_pt5_input_basics.html
  4. http://www.w9xt.com/page_microdesign_pt6_switch_inputs.html
  5. http://electronics.stackexchange.com/a/28096/23686