#include<xc.h>
__PROG_CONFIG(1,0x3FE4);
__PROG_CONFIG(2,0x1FEF);
#define _XTAL_FREQ 16000000
#define LED_apas_scurt RB1
#define LED_apas_mediu RB2
#define LED_apas_lung RB3
void init_uC(void);
void main(void)
{
init_uC();
while(1)
{
if(RB0==0)
{
__delay_ms(800);
if(RB0==1) LED_apas_scurt=1;
else
{
__delay_ms(1000);
if(RB0==1) LED_apas_mediu=1;
else LED_apas_lung=1;
}
__delay_ms(1000);
PORTB=0b00000000;
}
}
}
void init_uC(void)
{
OSCCON=0x7B;
TRISB=0b00000001;
PORTB=0b00000000;
ANSELB=0b00000000;
}
I2luY2x1ZGU8eGMuaD4KX19QUk9HX0NPTkZJRygxLDB4M0ZFNCk7Cl9fUFJPR19DT05GSUcoMiwweDFGRUYpOwoKI2RlZmluZSBfWFRBTF9GUkVRIDE2MDAwMDAwCiNkZWZpbmUgTEVEX2FwYXNfc2N1cnQgUkIxCiNkZWZpbmUgTEVEX2FwYXNfbWVkaXUgUkIyCiNkZWZpbmUgTEVEX2FwYXNfbHVuZyBSQjMKCnZvaWQgaW5pdF91Qyh2b2lkKTsKCnZvaWQgbWFpbih2b2lkKQp7Cglpbml0X3VDKCk7Cgl3aGlsZSgxKQoJewoJCWlmKFJCMD09MCkgCgkJewoJCQlfX2RlbGF5X21zKDgwMCk7CgkJCWlmKFJCMD09MSkgTEVEX2FwYXNfc2N1cnQ9MTsKCQkJZWxzZQoJCQl7CgkJCQlfX2RlbGF5X21zKDEwMDApOwoJCQkJaWYoUkIwPT0xKSBMRURfYXBhc19tZWRpdT0xOwoJCQkJZWxzZSBMRURfYXBhc19sdW5nPTE7CgkJCQkKCQkJfQoJCQlfX2RlbGF5X21zKDEwMDApOwoJCQlQT1JUQj0wYjAwMDAwMDAwOwoJCX0KCX0KfQp2b2lkIGluaXRfdUModm9pZCkKewoJT1NDQ09OPTB4N0I7CglUUklTQj0wYjAwMDAwMDAxOwoJUE9SVEI9MGIwMDAwMDAwMDsKCUFOU0VMQj0wYjAwMDAwMDAwOwp9