Pin Diagrams & General-Purpose I/O
Before writing a line of code, it helps to know what each leg of the chip actually does. This lesson walks through a typical pinout and the idea of general-purpose I/O.
Every PIC chip has a fixed set of physical pins, and every pin has one or more jobs. Some pins are dedicated — power, ground, the reset line — and can't be reassigned. Most of the rest are general-purpose input/output (GPIO) pins: by default they can be configured, in software, as either a digital input or a digital output, and many can also double as a peripheral pin (a UART transmit line, an ADC input, a PWM output) when you turn that peripheral on.
Pins are grouped into ports, usually named PORTA, PORTB, PORTC and so on, each holding up to eight pins. You'll almost always see a pin referred to by its port-and-number, like RB0 for "PORTB, pin 0." Each port pin can carry a second label showing an alternate function it can be switched to — AN0 for an analog input channel, SDA/SCL for I2C, TX/RX for UART — but at power-on, nearly every pin defaults to being a plain digital I/O pin until your code configures it otherwise.
MCLR (master clear) is the reset pin — pulling it low restarts the chip and its program from the beginning, the same as if you'd cycled the power. VDD and VSS are the positive supply and ground pins; nearly all hobby PICs run happily on 5 V or 3.3 V, and the exact supported range is listed on the first page of the datasheet.