In this example RB1 pin is used as digital output pin and RD0 is used as digital input pin. Pin RDO is connected with taster as on picture. RB1 pin can be used as general purpose output pin to drive LED diode directly or as TTL level signal output. When we push button, we change state of diode. Complete source code programmed in dsPic C30 compiler with MPLAB project files is provided and every line has comments with detailed explanation.
When writing a program for microcontroller (also often called firmware) it is very useful to have communication with microcontroller. In this way you can give command and get feedback from microcontroller about current state and readings. This can be done by several integrated peripherals that are used for communication. One is especially convenient because every PC has serial port and that peripheral is UART (Universal Asynchronous Receiver Transmitter). It is asynchronous communication and basic configuration that is most often used needs only two pins. These are TX and RX.
Fuses are an extremely important part programming a chip, but are rarely explained thoroughly. You only need to set them once, but if you don't do it right, it's a disaster!
Here is example for ATtiny2313