Up Down Counter - MPLAB code - Proteus Simulation - PIC 16F877A - LEDs

Problem - Design an Up Down counter for PIC 16F877A.

Software Support - MPLAB IDE for C programming,Proteus for simulation purpose.

Components - PIC 16F877A- Micro controller,SPDT switch as input,LEDs for output.

Theory :-

The program should work as follow,
If switch is high,then it must work as up counter.
If switch is low,then it must work as down counter.

In this program,switch is connected to RD3,LEDs to lower pins of port B.
It will check for switch status continuously and when 
high,Port B is incremented 
low,Port B is decremented

Value in port B is multiplied by 0x0F so it remain as a 4 bit counter. 

Circuit Setup & Output :-


#define _XTAL_FREQ 1000000
void main()

For more PIC 16F877A programs - click here

Popular posts from this blog

8051 Assembly Program Code for Sorting in Descending Order - Keil - AT89C51

8051 Assembly Program Code for Sorting in Ascending Order - Keil -AT89C51