#include<pic.h>
#include<htc.h>
#define __PIC16F877A_H
#define sw PORTCbits.RC7
__CONFIG(WDTE_OFF & FOSC_HS & LVP_ON);
void delay(unsigned int i)
{
while(i--);
}
void main()
{
TRISCbits.TRISC7=1;
TRISC=0Xff;
TRISD=0X00;
PORTD=0x00; //for making output port
int i=0;
while(1)
{
if(sw==0)
{
i++;
while(sw==0);
}
PORTD=i;
}
}
#include<htc.h>
#define __PIC16F877A_H
#define sw PORTCbits.RC7
__CONFIG(WDTE_OFF & FOSC_HS & LVP_ON);
void delay(unsigned int i)
{
while(i--);
}
void main()
{
TRISCbits.TRISC7=1;
TRISC=0Xff;
TRISD=0X00;
PORTD=0x00; //for making output port
int i=0;
while(1)
{
if(sw==0)
{
i++;
while(sw==0);
}
PORTD=i;
}
}
No comments:
Post a Comment