@ device PIC16F877 define osc 4 define adc_bits 8 main: trisb =$00 trisa =$ff adcon1 = 7 sw1 var porta.0 sw2 var porta.1 sw3 var porta.2 lamp1 var portb.0 lamp2 var portb.1 lamp1=0 lamp2=0 while(1) if(!sw1 and sw2 and sw3) then repeat lamp1=1 lamp2=0 pause 10 until(!sw3):endif if(sw1 and !sw2 and sw3) then repeat lamp1=0 lamp2=1 pause 10 until(!sw3):endif if(sw1 and sw2 and !sw3) then repeat lamp1=0 lamp2=0 pause 10 until(!sw1 or !sw2):endif wend end