Sunday, 18 October 2015

PIC16F877A LED SANDWATCH

#include<pic.h>
#include<htc.h>
#define __PIC16F877A_H
#define led PORTDbits.RD0
__CONFIG(WDTE_OFF & FOSC_HS);
void delay(unsigned int i)
{
while(i--);
}
void main()
{
TRISD=0X00;
int i,a=0X01,b=0,c=0,j;
while(1)
{

c=0,b=0,a=0x01;
for(i=8;i>=1;i--)
{
for(j=0;j<i;j++)
{
c=b|(a<<j);
PORTD=c;
delay(3000);
}
b=c;
}
}
}

No comments:

Post a Comment