void main()
{
adcon1=0x06;cmcon=0x06;
TrisA=0x01;TrisB=0x00;TrisC=0xff;
porta=0x00;portb=0x00;portc=0x00;
read_input,x=0;
do
{
read_input=portc^0xff;
if(read_input==0)
{
x=0;
control(x);
portb=0x3f;
}
if(RC0_bit==0)
{
x=1;
control(x);
portb=0X06;
delay_ms(1000);
}
if(RC1_bit==0)
{
x=2;
control(x);
portb=0X5b;
delay_ms(1000);
}
if(RC2_bit==0)
{
x=3;
control(x);
portb=0X4f;
delay_ms(1000);
}
if(rc3_bit==0)
{
x=4;
control(x);
portb=0X66;
delay_ms(1000);
}
if(rc4_bit==0)
{
x=5;
control(x);
portb=0X6d;
delay_ms(1000);
}
if(rc5_bit==0)
{
x=6;
control(x);
portb=0X7d;
delay_ms(1000);
}
if(rc6_bit==0)
{
x=7;
control(x);
portb=0X07;
delay_ms(1000);
}
if(rc7_bit==0)
{
x=8;
control(x);
portb=0X7f;
delay_ms(1000);
}
delay_ms(100);
}while(1);
}