P3

#1
#include<xc.h>
__PROG_CONFIG(1,0x3FE4);
__PROG_CONFIG(2,0x1EFF);
#define _XTAL_FREQ 16000000
#define LED_1 RB1
#define LED_2 RB2
#define LED_3 RB3
void init_uC (void);
void main (void)
{
init_uC();
while(1)
{
if(RB0==0)
{
__delay_ms(800);
if(RB0==1)
LED_1=1;
else
{
__delay_ms(1000);
if(RB0=1)
LED_2=1;
else
LED_3=1;
}
__delay_ms(3000);
PORTB=0x00;
}
}
}
void init_uC (void)
{
OSCCON=0x7B;
TRISB=0x01;
PORTB=0x00;
ANSELB=0x00;
}
cron