The following diagram displays the complete PIC16f877a architecture. It consists of the various blocks that are discussed below.

PIC16f877a Architecture


CPU is one of the important parts of the PIC16f877a architecture. The CPU consists Arithmetic logic unit (ALU), a memory unit (MU), a control unit (CU), Accumulator. ALU performs arithmetic and logical operations, MU stores instructions to be processed and data after processing. CU communicates with ALU and Main memory thereby controlling the operations of the systems. The accumulator is used to store results and further processes.

I/O Port

As we saw from the last article, PIC contains 5 ports, port A through E. Port A is a 16-bit port while ports B to D are 8 bit meanwhile port E is a 3-bit port. Port A can be used as an input or output port based on the status of the TRISC register, all its pins are analog. Port B has all digital pins. Port C pins are used for serial communication. Port D acts as a slave port for connection to the microprocessor BUS.


Data transfer between different peripherals is done using the bus. There are two kinds of buses, data and address buses.

  • Data bus: This is used to transfer or receive data between components. The data bus consists of 8, 32,64, etc. separate lines. The number of lines refers to the width of the data bus. Higher the number of lines, the faster the data transfer but at a higher cost.
  • Address bus: This bus is used to identify memory addresses. It is also used to transfer the ID of IO devices, which are unique for each component. Unlike the data bus, the address bus is unidirectional in nature.

A/D converter

Analog to digital converter is used to convert an analog signal into digital form which lets us interface electronics with the physical world around us. A/D module of PIC microcontroller consists of 5 inputs for 28 pin devices and 8 inputs for 40 pin devices. The operation of the analog to digital converter is controlled by ADCON0 and ADCON1 special registers. The resolution of the A/D convertor in PIC is 10 bit and the sampling rate can go as high as 100k samples/second. The input signal can vary from 0 to 5 volts.

PIC16f877a Architecture


PIC 16F877A has three Timer Modules; Timer0, Timer1 and Timer2. These are registers whose value increases up to 255 and then starts again from 0. Timers 0 and 1 are 8-bit timers while Timer2 is a 16-bit timer. We can set when the timer will increment with the help of Prescaler. It divides the oscillator clock before it will reach logic that increases timer status. For example, a value of the Prescaler id of 32 will mean that the Timer will increment by one after 32 pulses. The timer increments till it reaches a value of 255 after which it triggers an interrupt and initializes itself to zero again. This interrupt is called Timer Interrupt.


PIC16f877a architecture consists of 20 internal interrupts and three external interrupt sources which are associated with different peripherals like ADC, USART, Timers, and so on.

Serial Communication

In serial communication, data is transferred bit by bit between two devices, unlike parallel communication where several bits can be sent at one time. PIC microcontroller has a full-duplex, serial mode of communication which means that data can be both transmitted and received by the devices interacting in serial mode. Various protocols are used for the efficient transfer of data between different devices, some of them are:

  • USART (Universal Synchronous and Asynchronous Receiver and Transmitter): It is a hardware module for serial communication. It is used for transmitting and receiving the data bit by bit over a single wire with respect to clock pulses and is carried out using two lines, Tx (transmission line) and Rx (reception line).  
  • SPI (Serial Peripheral Interface): Like USART, this protocol is used to transfer data from one device to another, but quicker than USART. PIC microcontroller supports three-wire SPI communications between two devices on a common clock source.
  • I2C (Inter-Integrated Circuit): It is a serial communication protocol used to connect low-speed devices such as EEPROMS, microcontrollers, A/D converters, etc. 


Oscillators provide a clock to our microcontroller, which is an essential part of the system as every instruction which is executed by the microcontroller is synchronized to the clock. Crystal oscillators are the most famous among other types of oscillators such as SAW, MEMS and voltage-controlled oscillators.

 CCP Module

The Capture-Compare-Pulse-Width-Module is used for modulation and waveform generation. It works in three modes: capture, compare and PWM mode.

  • Capture mode: This captures the value of Timer1 when the CCP pin goes high.
  • Compare mode: It generates an output when the Timer1 value reaches a certain reference value.
  • PWM mode: PWM mode provides pulse width modulated output with a 10-bit resolution and programmable duty cycle.

The article, PIC16f877a architecture is written with reference to the following articles:

Spread knowledge

Leave a Comment

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