Introduction to PIC 16F877

Vysakh January 12, 2011 2 Comments

The basics of Peripheral Interface Controller have already been explained in recent posts. To know more about them, click on the links below.


Overview of PIC 16F877

PIC 16F877 is one of the most advanced microcontroller from Microchip. This controller is widely used for experimental and modern applications because of its low price, wide range of applications, high quality, and ease of availability. It is ideal for applications such as machine control applications, measurement devices, study purpose, and so on.  The PIC 16F877 features all the components which modern microcontrollers normally have. The figure of a PIC16F877 chip is shown below.

PIC 16F877

PIC 16F877


Features of PIC16F877

The PIC16FXX series has more advanced and developed features when compared to its previous series. The important features of PIC16F877 series is given below.

General Features

o   High performance RISC CPU.

o   ONLY 35 simple word instructions.

o   All single cycle instructions except for program branches which are two cycles.

o   Operating speed: clock input (200MHz), instruction cycle (200nS).

o   Up to 368×8bit of RAM (data memory), 256×8 of EEPROM (data memory), 8k×14 of flash memory.

o   Pin out compatible to PIC 16C74B, PIC 16C76, PIC 16C77.

o   Eight level deep hardware stack.

o   Interrupt capability (up to 14 sources).

o   Different types of addressing modes (direct, Indirect, relative addressing modes).

o   Power on Reset (POR).

o   Power-Up Timer (PWRT) and oscillator start-up timer.

o   Low power- high speed CMOS flash/EEPROM.

o   Fully static design.

o   Wide operating voltage range (2.0 – 5.56)volts.

o   High sink/source current (25mA).

o   Commercial, industrial and extended temperature ranges.

o   Low power consumption (<0.6mA typical @3v-4MHz, 20µA typical @3v-32MHz and <1 A typical standby).

Peripheral Features

o   Timer 0: 8 bit timer/counter with pre-scalar.

o   Timer 1:16 bit timer/counter with pre-scalar.

o   Timer 2: 8 bit timer/counter with 8 bit period registers with pre-scalar and post-scalar.

o   Two Capture (16bit/12.5nS), Compare (16 bit/200nS), Pulse Width Modules (10bit).

o   10bit multi-channel A/D converter

o   Synchronous Serial Port (SSP) with SPI (master code) and I2C (master/slave).

o   Universal Synchronous Asynchronous Receiver Transmitter (USART) with 9 bit address detection.

o   Parallel Slave Port (PSP) 8 bit wide with external RD, WR and CS controls (40/46pin).

o   Brown Out circuitry for Brown-Out Reset (BOR).

Key Features

o   Maximum operating frequency is 20MHz.

o   Flash program memory (14 bit words), 8KB.

o   Data memory (bytes) is 368.

o   EEPROM data memory (bytes) is 256.

o   5 input/output ports.

o   3 timers.

o   2 CCP modules.

o   2 serial communication ports (MSSP, USART).

o   PSP parallel communication port

o   10bit A/D module (8 channels)

Analog Features

o   10bit, up to 8 channel A/D converter.

o   Brown Out Reset function.

o   Analog comparator module.

Special Features

o   100000 times erase/write cycle enhanced memory.

o   1000000 times erase/write cycle data EEPROM memory.

o   Self programmable under software control.

o   In-circuit serial programming and in-circuit debugging capability.

o   Single 5V,DC supply for circuit serial programming

o   WDT with its own RC oscillator for reliable operation.

o   Programmable code protection.

o   Power saving sleep modes.

o   Selectable oscillator options.

Pin Diagrams

PIC16F877 chip is available in different types of  packages. According to the type of applications and usage, these packages are differentiated. The pin diagrams of a PIC16F877 chip in different packages is shown in the figure below.

Pin Diagrams of PIC 16F877 Chip

Pin Diagrams of PIC 16F877 Chip


Input/output ports

PIC16F877 has 5 basic input/output ports. They are usually denoted by PORT A (R A), PORT B (RB), PORT C (RC), PORT D (RD), and PORT E (RE). These ports are used for input/ output interfacing. In this controller, “PORT A” is only 6 bits wide (RA-0 to RA-7), ”PORT B” , “PORT C”,”PORT D” are only 8 bits wide (RB-0 to RB-7,RC-0 to RC-7,RD-0 to RD-7), ”PORT E” has only 3 bit wide (RE-0 to RE-7).

PORT-A RA-0 to RA-5 6 bit wide
PORT-B RB-0 to RB-7 8 bit wide
PORT-C RC-0 to RC-7 8 bit wide
PORT-D RD-0 to RD-7 8 bit wide
PORT-E RE-0 to RE-2 3 bit wid

All these ports are bi-directional. The direction of the port is controlled by using TRIS(X) registers (TRIS A used to set the direction of PORT-A, TRIS B used to set the direction for PORT-B, etc.). Setting a TRIS(X) bit ‘1’ will set the corresponding PORT(X) bit as input. Clearing a TRIS(X) bit ‘0’ will set the corresponding PORT(X) bit as output.

(If we want to set PORT A as an input, just set TRIS(A) bit to logical ‘1’ and want to set PORT B as an output, just set the PORT B bits to logical ‘0’.)

o   Analog input port (AN0 TO AN7) : these ports are used for interfacing analog inputs.

o   TX and RX: These are the USART transmission and reception ports.

o   SCK: these pins are used for giving synchronous serial clock input.

o   SCL: these pins act as an output for both SPI and I2C modes.

o   DT: these are synchronous data terminals.

o   CK: synchronous clock input.

o   SD0: SPI data output (SPI Mode).

o   SD1: SPI Data input (SPI mode).

o   SDA: data input/output in I2C Mode.

o   CCP1 and CCP2: these are capture/compare/PWM modules.

o   OSC1: oscillator input/external clock.

o   OSC2: oscillator output/clock out.

o   MCLR: master clear pin (Active low reset).

o   Vpp: programming voltage input.

o   THV: High voltage test mode controlling.

o   Vref (+/-): reference voltage.

o   SS: Slave select for the synchronous serial port.

o   T0CK1: clock input to TIMER 0.

o   T1OSO: Timer 1 oscillator output.

o   T1OS1: Timer 1 oscillator input.

o   T1CK1: clock input to Timer 1.

o   PGD: Serial programming data.

o   PGC: serial programming clock.

o   PGM: Low Voltage Programming input.

o   INT: external interrupt.

o   RD: Read control for parallel slave port.

o   CS: Select control for parallel slave.

o   PSP0 to PSP7: Parallel slave port.

o   VDD: positive supply for logic and input pins.

o   VSS: Ground reference for logic and input/output pins.

Take a look at the specifications of the PIC 16F87X Series

PIC 16F87X Specifications

PIC 16F87X Specifications

To know more about the Architecture and Memory Organization of PIC 16F877, click on the link below.


  • July 16, 2015

    Note which getting a cloud-hosted BI method doesn’t change this formula.

    Obscure BI is simply like typical business intelligence service with respect to the
    sorts of data incorporation and also report creation/maintenance you will
    want. Lacking big up-front mechanical and also applications investments in affect BI
    can certainly be attractive to begin with, but ever since
    the service commissions will dramatically go above the mechanical and also
    software fees related with anyway, this will be prevented in perspective.
    Furthermore, start mechanical HP (such as, CPU and additionally RAM) that enterprise-scale BI
    applications demand end up being considerably more expensive over time
    when compared to in reality purchasing the hardware oneself.

    my web blog light bot

  • kriz
    March 6, 2014

    operating speed of pic16f877 is 20 Mhz

Leave a Reply

Your email address will not be published. Required fields are marked *