Introduction to
PIC 16F877A Microcontroller
Embedded Systems by Dr. Pratikanta Mishra 1
PIC Microcontrollers
• Programmable IC or Peripheral Interface
Controller (PIC) was originally designed by
General Instruments Co.
• In the late 1970s, GI introduced PIC® 1650
and 1655 – RISC with 30 instructions.
• PIC was sold to Microchip
• Features: low-cost, self-contained, 8-bit,
Harvard structure, pipelined, RISC, single
accumulator, with fixed reset and interrupt
vectors.
Embedded Systems by Dr. Pratikanta Mishra 2
PIC Microcontroller Product Family
• PIC10 • PIC24F • PIC32
• PIC12 • PIC24H
• PIC14 • Digital Signal
• PIC16 controllers:
• PIC17 • dsPIC30
• PIC18 • dsPIC33F
8-Bit 16-Bit 32-Bit
Microcontrollers Microcontrollers Microcontrollers
Embedded Systems by Dr. Pratikanta Mishra 3
About PIC16F877A
• Why PIC16F877A is very popular?
This is because PIC16F877A is very cheap. Apart
Medical
from that it is also very easy to be assembled. Automotive
Additional components that you need to make this IC
work are just a 5V power supply adapter, a ~20MHz
crystal oscillator and 2 units of ~22pF capacitors. Communications
Military
• What are the advantages of PIC16F877A?
This IC can be reprogrammed and erased up to
10,000 times. Therefore, it is very good for the new
product development phase. Comsumer Industrial
• What are the disadvantages of PIC16F877A?
This IC has no internal oscillator; we need an external
crystal of another clock source.
Embedded Systems by Dr. Pratikanta Mishra 4
Features of PIC16F877A
• 8-bit Microcontroller: ALU can perform operations on
8-bit data
• 8k x 14 words (bit) of Flash Program Memory: Address
locations in the program memory
• 512 Bytes of Data Memory: 368 bytes for normal data
operation + some of them for special function registers
• 256 Bytes of EEPROM: Stores the value of the
constants (saves the space for instructions in program
memory)
• CMOS flash/EEPROM technology: 100,000 erase/write
cycle on Flash, 1,000,000 erase/write cycle Data EEPROM
• RISC Architecture (35 instructions each of 14-bits)
• All single-cycle instructions except program
branches, which are two-cycle
• Clock frequency up to 20 MHz is supported
• Operation frequency = Clock frequency/4
Embedded Systems by Dr. Pratikanta Mishra 5
Features of PIC16F877A
• Five I/O ports:
• PORTA – 6 pins – RA0-RA5
• PORTB – 8 pins – RB0-RB7
• PORTC – 8 pins – RC0-RC7
• PORTD – 8 pins – RD0-RD7
• PORTE – 3 pins – RE0-RE2
• User configurable I/O pins = 33
• Each port pin can source/sink 25mA of current
• Port pins have multiple functionality
• 10-bit analog to digital converters: 8-Chanels
• Timer0 & 2 (8-bit), Timer1(16-bit): Timer (based on
clock) and Counter (based on external event)
• Interrupt capability (up to 14 sources)
• Two Pulse width modulation modules: 16-bit
• Capture and Compare modes are supported
• In circuit serial programming (ICSP): PGD, PGC, PGM
• Watch dog timer with own RC oscillator
Embedded Systems by Dr. Pratikanta Mishra 6
Features of PIC16F877A
• Parallel slave port (PSP): 8 bits wide (PORTD)
• SPI, I2C(Master/Slave mode) & USART with 9 bit
detection
• Supports Power on Reset and Brownout Reset
operations
• IC supply voltage = 5V
• Low power consumption (0.6 mA @ 3 V)
Embedded Systems by Dr. Pratikanta Mishra 7
Architecture of PIC16F877A
8
Embedded Systems by Dr. Pratikanta Mishra
Memory Organization of PIC16F877A
Program Memory with Stack:
Embedded Systems by Dr. Pratikanta Mishra 9
Memory Organization of PIC16F877A
Data Memory:
10
Embedded Systems by Dr. Pratikanta Mishra
Memory Organization of PIC16F877A
Data Memory:
Embedded Systems by Dr. Pratikanta Mishra 11