Introduction
PIC series of controller high performance, low cost RISC controllers. It is based on Harvard architecture allowing use of separate instruction and data buses. The architecture allows a typical 14 bit wide instructions word length and 8-bit data width. Being RISC controller, it supports only 35 instructions and all instructions except jump and branch instructions execute in single cycles. It has large number of registers arranged in banks of register. The number of register banks depends on the PIC family and the type of controller. A quick comparison is given below:
Controller | No. of PINS | Clock speed | No. of instructions | Program Memory | EEPROM | RAM | Others |
16C61 | 18 (13 I/O pins) | 20 MHz | 35 | 1Kx 14-bits | x | 36 Bytes | PoR, PWRT, WDT with onChip Osc, SLEEP mode, 3 Timers, CCP, Synchronous Serial Port (SSP) with SPI and I2C, USART, Parallel slave port(PSP), BoR, 3 interrupt sources. 02 i/o ports |
16F877 | 28/40 pins | 20MHz | 35 | 8Kx14-bits | 256×8 bytes | 368×8 bytes | All above; 05 i/o ports, 14 interrupt sources |
PIN Diagram of PIC16F877 controller
PIC 16F877 comes in 28, 40 and 44 pin packages. Table below shows different types of packages, pin count and the pin diagram are shown in table:
PIC16F87x packages, Ref: http://ww1.microchip.com/downloads/en/devicedoc/30292d.pdf | ||
Package Type | PIN count | Pin diagram |
Plastic Dual In-line Package, or PDIP, is one of the most mature plastic IC packages still in use today |
40 | ![]() |
PLCC Plastic Leaded Chip Carrier is a form of SMD IC package |
44 | ![]() |
A quad flat package (QFP) is a surface-mounted integrated circuit package with “gull wing” leads extending from each of the four sides. Socketing such packages is rare and through-hole mounting is not possible |
44 | ![]() |
This controller operates at 20MHz, Power-on reset (POR), Broun-out reset(BOR), 8Kx14 program memory, 256 byte EEROM and 368 bytes of data memory (RAM), 14 interrupt sources, five ports Port A,B,C,D,E; three timers, 2 CCP module, MSSP, USART serial ports, PSP parallel slave peripheral, 10-bit ADC module and 35 instructions. The 40 pins of the PDIP package PIC16F877 is described below:
PIN | Signal Classification | Signal name | Description |
1 | MCLR’/Vpp | Master Clear /
Programming voltage input. |
The low signal on pin 1 resets this device |
12,31,
|
Power | Vss
|
Connected to Ground for all logic and i/o |
11,32 | Power | Vdd | Connected to Positive supply for all logic and i/o |
2 | Port A; PORTA is a bi-directional I/O port | RA0 | I/O as well Analog i/p0 |
3 | RA1 | I/O as well Analog i/p1 | |
4 | RA2 | I/O as well Analog i/p2 or –Ve analog reference voltage | |
5 | RA3 | I/O as well Analog i/p2 or +Ve analog reference voltage | |
6 | RA4 | RA4 can also be the clock input to the Timer0 timer/ counter. Output is open drain type | |
7 | RA5 | RA5 can also be analog input4 or the slave select for the synchronous serial port. | |
33 | Port B ;Bi-directional i/o port. It can be software programmed for internal weak pull-up on all inputs | RB0 / INT | I/O as well as external INT input |
34 | RB1 | I/O | |
35 | RB2 | I/O | |
36 | RB3 / PGM | I/O and can also be the low voltage programming input. | |
37 | RB4 | Interrupt-on-change pin | |
38 | RB5 | Interrupt-on-change pin | |
39 | RB6/ PGC | Interrupt-on-change pin or In-Circuit Debugger pin. Serial programming clock. | |
40 | RB7 / PGD | Interrupt-on-change pin or In-Circuit Debugger pin. Serial programming data | |
15
|
Bi-directional Port C | RC0/T1OSO/ T1CKI | RC0 can also be the Timer1 oscillator output or a Timer1 clock input. |
16 | RC1/T1OSI/ CCP2 | RC1 can also be the Timer1 oscillator input or Capture2 input/Compare2 output/PWM2 output. | |
17 | RC2/CCP1 | RC2 can also be the Capture1 input/Compare1 output/PWM1 output | |
18 | RC3/SCK/SCL | RC3 can also be the synchronous serial clock input/ output for both SPI and I2C modes | |
23 | RC4/SDI/SDA | RC4 can also be the SPI Data In (SPI mode) or data I/O (I2C mode). | |
24 | RC5/SDO | RC5 can also be the SPI Data Out (SPI mode). | |
25 | RC6/TX/CK | RC6 can also be the USART Asynchronous Transmit or Synchronous Clock. | |
26 | RC7/RX/DT | RC7 can also be the USART Asynchronous Receive or Synchronous Data | |
19
|
Port D ; It is It is Bi-directional I/O and parallel salve port | RD0/PSP0 | PORTD is a bi-directional I/O port or parallel slave port when interfacing to a microprocessor bus. |
20 | RD1/PSP1 | ||
21 | RD2/PSP2 | ||
22 | RD3/PSP3 | ||
27 | RD4/PSP4 | ||
28 | RD5/PSP5 | ||
29 | RD6/PSP6 | ||
30 | RD7/PSP7 | ||
8 | Bi-directional Port E | RE0/RD’/AN5 | RE0 can also be read control for the parallel slave port, or analog input5. |
9 | RE1/WR’/AN6 | RE1 can also be write control for the parallel slave port, or analog input6 | |
10 | RE2/CS’/AN7 | RE2 can also be select control for the parallel slave port, or analog input7 | |
13 | OSC1/ClkIn | Oscillator and Clock | Oscillator crystal input/external clock input
|
14 | OSC2/ClkOut | Oscillator and Clock | Oscillator crystal output. Connects to crystal or resonator in crystal oscillator mode. In RC mode, OSC2 pin outputs CLKOUT which has 1/4 the frequency of OSC1, and denotes the instruction cycle rate. |