#include<pic.h>
#include<htc.h>
#define __PIC16F877A_H
#define sw1 PORTDbits.RD0
#define sw2 PORTDbits.RD1
__CONFIG(WDTE_OFF & FOSC_HS);
void delay(unsigned int i)
{
while(i--);
}
void main()
{
PORTC=0x00;
TRISC=0X00;
TRISD=0X00;
while(1)
{
if(sw1==0)
{
PORTC=0x82;
}
else if(sw2==0)
{
PORTC=0x00;
}
}
}
No comments:
Post a Comment