#include<16f877A.h>#fuses XT,NOWDT
#use delay (clock=4000000)
#define use_portb_lcd TRUE
#include<lcd.c>
int role[5]={0x01,0x02,0x04,0x08,0xf0};
int sure=0,roleno=0,asilrole=1;
void main()
{
lcd_init();
ana:
printf(lcd_putc," \f Role Kontrol \n K.T.B.M.Y.O. ");
delay_ms(100);
bas:
if(input(pin_A1)){
delay_ms(100);
goto rolyaz;
}
goto bas;
rolyaz:
printf(lcd_putc," \f Role Kontrol \n Role No:%i ",asilrole);
delay_ms(100);
butonkontrolbir:
if(input(pin_A2)){
if(roleno==4){ goto rolyaz;}
delay_ms(100);
roleno=roleno+1;
asilrole=roleno+1;
goto rolyaz;
}
if(input(pin_A0)){
if(roleno==0){ goto rolyaz;}
delay_ms(100);
roleno=roleno-1;
asilrole=roleno+1;
goto rolyaz;
}
if(input(pin_A1)){
delay_ms(100);
goto suryaz;
}
goto butonkontrolbir;
break;
suryaz:
printf(lcd_putc," \f Role Kontrol \n Sure:%i sn ",sure);
delay_ms(100);
butonkontroliki:
if(input(pin_A2)){
delay_ms(100);
sure=sure+1;
goto suryaz;
}
if(input(pin_A0)){
if(roleno==0){ goto suryaz;}
delay_ms(100);
sure=sure-1;
goto suryaz;
}
if(input(pin_A1)){
delay_ms(100);
goto calis;
}
goto butonkontroliki;
break;
calis:
printf(lcd_putc," \f Role Kontrol \n CALISTIR ");
delay_ms(100);
butonkontroluc:
if(input(pin_A1))
{
yaz:
printf(lcd_putc," \f Role Kontrol \nR.NO:%i,Sure:%i ",asilrole,sure);
delay_ms(100);
if(sure==0){output_d(0x00); sure=0; roleno=0; goto bitti;}
output_d(role[roleno]);
delay_ms(250);
sure=sure-1;
goto yaz;
}
goto butonkontroluc;
break;
bitti:
printf(lcd_putc," \f Role Kontrol \n Bitti ");
delay_ms(100);
sonkontrol:
if(input(pin_A1)){goto ana;}
goto sonkontrol;
break;
}