Monday, 19 October 2015

PIC16F877A SEVEN SEGMENT OPERATED BY SWITCH


#include<pic.h>
#include<htc.h>
#define __PIC16F877A_H
#define sw PORTCbits.RC0
__CONFIG(WDTE_OFF & FOSC_HS);
void delay(unsigned int i)
{
while(i--);
}
int main(void)
{
TRISD=0x00;
TRISC=0xff;
int i,arr[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
sw=0x00;
for(i=0;i<=9;i++)
{
while (sw==0x00);
{
PORTD=arr[i];
while(sw==0x01);
}
}
}

No comments:

Post a Comment