PIC16F877A – Introduction

In this article we will see the PIC16F877A Introduction.

PIC Introduction

Peripheral Interface Controllers (PIC) is one of the advanced microcontrollers developed by microchip technologies. These microcontrollers are widely used in modern electronics applications.  A PIC controller integrates all type of advanced interfacing ports and memory modules. These controllers are more advanced than normal microcontroller like 8051. The first PIC chip was announced in 1975 (PIC1650). As like normal microcontroller, the   PIC   chip also combines a  microprocessor unit called CPU and is integrated with various types of memory modules (RAM, ROM, EEPROM ,etc), I/O ports, timers/counters, communication ports, etc.

All PIC microcontroller family uses Harvard architecture. This architecture has the program and data accessed from separate memories so the device has a program memory bus and a data memory bus (more than 8 lines in a normal bus). This improves the bandwidth (data throughput) over traditional von Neumann architecture where program and data are fetched from the same memory (accesses over the same bus). Separating program and data memory further allows instructions to be sized differently than the 8-bit wide data word. Now we will move to PIC16F877A.

PIC16F877A Introduction

Microcontroller PIC16F877A is one of the PICMicro Family microcontroller which is popular at this moment, start from beginner until all professionals. Because very easy using PIC16F877Aand use FLASH memory technology so that can be write-erase until thousand times. The superiority this Risc Microcontroller compared to with other microcontroller 8-bit especially at a speed of and his code compression.

The 16F877A is a capable microcontroller that can do many tasks because it has a large enough programming memory (large in terms of sensor and control projects) 8k words and 368 Bytes of RAM. This is enough to do many different projects.

Note: There is a more modern part (the 16F887) that has nearly the same functionality as the 16F877A but also includes an internal clock – like the 16F88 and the 18F4550. In addition the 16F887 also has low power operation using nano wattTM technology.

The four features that you might make you use a 16F887 instead of a 16F877(A) are

  • External gate.
  • Volt Reference.
  • Nano WattTM.
  • Internal Clock.

The gate could be used to more accurately capture an input time e.g. for a reciprocal frequency counter.

The volt reference means you don’t need an external reference although it will probably not be useful for highly accurate operation. It is definitely more useful in a battery powered operation where you want to compare the input battery voltage to a known reference e.g. using the comparator and the internal 0.6V reference.

Nano WattTM could be useful for battery powered operation.

The internal clock is useful for lab development (not for accuracy) and for general operation – it can also be set to 31kHz so consuming less power.

All the above depend on your specific application requirements.

PIC16F877A have 40 pin by 33 path of I/O. The 40 pins make it easier to use the peripherals as the functions are spread out over the pins.  This makes it easier to decide what external devices to attach without worrying too much if there are enough pins to do the job.

One of the main advantages is that each pin is only shared between two or three functions so its easier to decide what the pin function (other devices have up to 5 functions for a pin).
A slight disadvantage of the device is that it has no internal oscillator so you will need an external crystal or other clock source. However the internal oscillator is only 1% accurate and adding a crystal (max 20MHz crystal - for 5MHz internal instruction cycle) and two 15pF capacitors is not a great chore - the accuracy will be 100ppm depending on the crystal used.


The pinout of the 16F877A is:

Features of PIC16F877A

The PIC16F877A CMOS FLASH-based 8-bit microcontroller is upward compatible with the PIC16C5x, PIC12Cxxx and PIC16C7x devices. It features 200 ns instruction execution, 256 bytes of EEPROM data memory, self programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital (A/D) converter, 2 capture/compare/PWM functions, a synchronous serial port that can be configured as either 3-wire SPI or 2-wire I2C bus, a USART, and a Parallel Slave Port.

High-Performance RISC CPU

  • Lead-free; RoHS-compliant
  • Operating speed: 20 MHz, 200 ns instruction cycle
  • Operating voltage: 4.0-5.5V
  • Industrial temperature range (-40° to +85°C)
  • 15 Interrupt Sources
  • 35 single-word instructions
  • All single-cycle instructions except for program branches (two-cycle)

Special Microcontroller Features

  • Flash Memory: 14.3 Kbytes (8192 words)
  • Data SRAM: 368 bytes
  • Data EEPROM: 256 bytes
  • Self-reprogrammable under software control
  • In-Circuit Serial Programming via two pins (5V)
  • Watchdog Timer with on-chip RC oscillator
  • Programmable code protection
  • Power-saving Sleep mode
  • Selectable oscillator options
  • In-Circuit Debug via two pins

Peripheral Features

  • 33 I/O pins; 5 I/O ports
  • Timer0: 8-bit timer/counter with 8-bit prescaler
  • Timer1: 16-bit timer/counter with prescaler
    • Can be incremented during Sleep via external crystal/clock
  • Timer2: 8-bit timer/counter with 8-bit period register, prescaler and postscaler
  • Two Capture, Compare, PWM modules
    • 16-bit Capture input; max resolution 12.5 ns
    • 16-bit Compare; max resolution 200 ns
    • 10-bit PWM
  • Synchronous Serial Port with two modes:
    • SPI Master
    • I2C Master and Slave
  • USART/SCI with 9-bit address detection
  • Parallel Slave Port (PSP)
    • 8 bits wide with external RD, WR and CS controls
  • Brown-out detection circuitry for Brown-Out Reset

Analog Features

  • 10-bit, 8-channel A/D Converter
  • Brown-Out Reset
  • Analog Comparator module
    • 2 analog comparators
    • Programmable on-chip voltage reference module
    • Programmable input multiplexing from device inputs and internal VREF
    • Comparator outputs are externally accessible

If you want to see the Datasheet please visit here.

0 0 vote
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x
%d bloggers like this: