int x0,x1,y0,y1,z0,z1; void main() { GPIO = 0x00; CMCON = 0x07; TRISIO = 0b00111000; x0=1;x1=0; y0=1;y1=0; z0=1;z1=0; while (1) { if ((GPIO.GP5==0)&&(x0==1)) { x0=0; x1=1; GPIO.GP0=1; delay_ms(600); } if ((GPIO.GP5==0)&&(x1==1)) { x1=0; x0=1; GPIO.GP0=0; delay_ms(600); } ////////////////////////////////////// if ((GPIO.GP4==0)&&(y0==1)) { y0=0; y1=1; GPIO.GP1=1; delay_ms(600); } if ((GPIO.GP4==0)&&(y1==1)) { y1=0; y0=1; GPIO.GP1=0; delay_ms(600); } ////////////////////////////////////// if ((GPIO.GP3==0)&&(z0==1)) { z0=0; z1=1; GPIO.GP2=1; delay_ms(600); } if ((GPIO.GP3==0)&&(z1==1)) { z1=0; z0=1; GPIO.GP2=0; delay_ms(600); } ////////////////////////////////////// } }