7 Segment Interfacing with PIC16F877A - PIC Programming - Proteus Simulation - MPLAB Coding
Problem - 7 Segment Display interfacing with PIC PIC16F877A micro-controller.
Software Support - MPLAB IDE for C programming,Proteus for simulation purpose.
Components - PIC 16F877A- Micro controller,3 7segment displays as output.
Basically a 7 segment display is a combination of 7 display elements or segments.They are arranged in a format such that, if a number has to be displayed corresponding segments are turned on.The input to the display is in binary.The segments corresponding to ones are lightened.
The logic of the program is very simple.We are assuming a 8 bit number it can vary from 0-255, so we divide it into 3 digits and feed to 3 displays.Separation of digits is done by modulo division and normal division.
We are using PIC micro controller for processing.Two ports port D and B are used as output ports.Three seven segment displays are connected to this ports. While executing our program binary numbers are generated,which fed into corresponding displays.
Circuit Setup :-
#include<pic.h> //PIC header file
int x=0xff; //A random 8 bit number
TRISC=0; //PORT C as output
TRISD=0; //PORT D as output
PORTC=(x%10)<<4; //LSB to port C
PORTD=(x/10)<<4|(x%10); //MSB and middle digit to port D
For more PIC 16F877A programs - click here