PIC16F877A Microcontroller Introduction and Features (original) (raw)

The PIC microcontroller PIC16f877a is one of the most renowned microcontrollers in the industry. This microcontroller is very convenient to use, the coding or programming of this controller is also easier. One of the main advantages is that it can be write-erase as many times as possible because it uses FLASH memory technology. It has a total number of 40 pins and there are 33 pins for input and output. PIC16F877A is used in many pic microcontroller projects. PIC16F877A also have much application in digital electronics circuits.

PIC16F877A microcontroller

PIC16f877a finds its applications in a huge number of devices. It is used in remote sensors, security and safety devices, home automation and many industrial instruments. An** EEPROM** is also featured in it which makes it possible to store some of the information permanently like transmitter codes and receiver frequencies and some other related data. The cost of this controller is low and its handling is also easy. It is flexible and can be used in areas where microcontrollers have never been used before as in microprocessor applications and timer functions etc.

PIN CONFIGURATION AND DESCRIPTION Of PIC16F877A microcontroller

PIC16F877A Pin configurationPIC16F877A Pin configuration

reset circuit

crystal interfacing with PIC16F877A

Note: All pins have multiple functionalities. Like PORTC pins can be used as digital input pins, digital output pins, for UART communication, I2C communication. But, we can use one function of each port at a time or you have to program it smartly so that you can switch between different functionalities. Like once you need one pin to read analog signal, define it for analog purpose and then switch to other functions like digital output etc. For beginners, we suggest to use one pin for single functionality and you can use multi-function mode, once you become an expert in programming.

HOW TO PROGRAM THE INPUT AND OUTPUT PORTS

TRISB=0;
PORTB=0XFF;
PORTB=~PORTB;

Compiler for PIC16F877A microcontroller

Like all other microcontroller, PIC16F877A also provide built-in useful features as mentioned in this list:

Some other momentous features are listed below :

CODE TO LIGHT UP A SINGLE LED/ FLASHING LED

This is simple tutorial on blinking an LED with PIC16F877A microcontroller. We use Mikro C for pic compiler to write this code. If you are just getting started with pic microcontroller programming, you can check this tutorial on Mikro C for pic:

void main()

 {

      TRISB.F0 = 0  // the direction of RB0 is set as output

                 //or TRISB = 0xFE (0xFE = 11111110)

      do // setting the infinite loop

      {

        PORTB.F0 = 1; // setting the RB0 pin to high

        Delay_ms(500); // delay of 500 milli seconds

        PORTB.F0 = 0; // setting the RB0 pin to low

        Delay_ms(500); // again a delay of 500 milli seconds

     }while(1);

 }

This code is used to toggle PORTC pin number zero with the delay of five hundred mili seconds. Inside the main function this line initialize the RB0 as digital output pin.

TRISB.F0 = 0

After that do while loop is used, because we want to toggle LED again and again. Inside the do while loop, these line make the RB0 digital high for 500ms.

PORTB.F0 = 1; // setting the RB0 pin to high
Delay_ms(500); // delay of 500 milli seconds

And similarly these lines, turn off the LED for 500ms.

PORTB.F0 = 0; // setting the RB0 pin to low
Delay_ms(500); // again a delay of 500 milli seconds

Circuit diagram for flashing LED WITH PIC16F877A

LED blinking

you may also like to read tutorials on PIC16F877A microcontroller

Download PIC16F877A DataSheet