ABC of Electronics cosycom.com
PIC BASICS · LESSON 04

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.

PIC16-series (DIP package, top view) VDD (power) RA0 / AN0 RA1 / AN1 RA2 / AN2 RA3 / MCLR RA4 / T0CKI RA5 VSS (ground) RB0 / INT RB1 / SDA RB2 / SCL RB3 / PGM RB4 RB5 RB6 / TX RB7 / RX
A generic PIC16-family pinout. Names and pin counts vary by exact part number, but the pattern — power pins, a reset pin, and two or more 8-pin "ports" doubling as peripherals — is typical of the whole family.

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.

KEY TAKEAWAY
Most pins are general-purpose by default and gain a special job only when your code turns on the matching peripheral. Reading a pinout diagram is mostly about spotting which pins are fixed (power, ground, reset) and which are flexible.