Posts

Showing posts with the label PIC Programs

Second and Minute Counter using PIC16F877A - PIC Programming - Proteus Simulation - MPLB C Code

Image
Problem  -  Second and Minute Counter using PIC PIC16F877A micro-controller. Software Support  - MPLAB IDE for C programming,Proteus for simulation purpose. Components  - PIC 16F877A- Micro controller,LED arrays,External clock. Theory :- We have two sets of LED arrays, one for displaying seconds and other for minutes.Both arrays has six LEDS each,since up to sixty must be counted.An external clock is used here,it will configure each counter increment by one second.                    Sixth pin serves external clock pulses,it will make a delay of one second on each count.LED arrays for second counting is given in port B,arrays for minute counting in port D.Each LED is given a series resistance to control voltage.                             Into the code, First,timer zero made reset then it is turned on by control regi...

Stepper Motor Interfacing with PIC16F877A - PIC Programming - Proteus Simulation - MPLAB C Coding

Image
Problem  - Stepper Motor Interfacing with PIC PIC16F877A micro-controller. Software Support  - MPLAB IDE for C programming,Proteus for simulation purpose. Components  - PIC 16F877A- Micro controller,Stepper motor,ULN2003 driver IC.. Theory :-    Some theory regarding stepper motor.It is an electric motor which can be controlled by pulse trains.As in the figure,a permanent magnet rotates based on field generated by four stators.One of the major feature of stepper motor is the degree of rotation can be defined by step angle.     Full sequence method is used here giving step angle of ninety degrees.An driver IC is always needed because the micro controller alone can't provide necessary power.While interfacing with micro controller a sequence of shifted binary numbers are fed into the motor.            In this case,we have ninety degree step angle hence four shifted values has to be generated.So i...

7 Segment Interfacing with PIC16F877A - PIC Programming - Proteus Simulation - MPLAB Coding

Image
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. Theory :-           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.                                ...

PIC 16F877A Programs - MPLAB - Proteus

Image
1. Up Down Counter 2. 7 Segment Display Interfacing 3. Stepper Motor Interfacing 4. Second and Minute Counter

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

Image
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 :- Program:- #include<pic.h> #define _XTAL_FREQ 1000000 void main() { TRISB=0; while(1) { if(RD3==1) PORTB=(PORTB+1)&0X0F; else PORTB=(PORTB-1)&0X0F; __delay_ms(500); } } For more PIC 16F877A programs - click here