Hi List, Any person can help in the following C problem please. I am using PICC with MPLAB to program the PIC16f84A ...the problem is : void initi() { GIE = 0x00; TRISA = 0x10; // RA4 as input, the rest are output TRISB = 0x00; // all output PORTB = 0xff; PORTA = 0x00; } unsigned char Key1() { return 1; } ..... ..... void main() { initi(); Device = 0x80; keySelector = 0x00; keyMask = 0x07; rData = 0x85; // test Data while(RA4) { PORTA = Key1(); } // S1 PORTA = 0xff; // S2 while(1) { do{ Receive(); temp = rData; temp &= 0xE0; temp = Device - temp; }while(temp); keySelector = rData & keyMask; switch(keySelector) { case 0x00 : PORTA = Key7();break; case 0x01 : PORTA = Key6();break; case 0x02 : PORTA = Key5();break; case 0x03 : PORTA = Key4();break; case 0x04 : PORTA = Key3();break; case 0x05 : PORTA = Key2();break; case 0x06 : PORTA = Key1();break; case 0x07 : PORTA = Key0();break; } } }/* End main*/ Dose S1 go to infinite loop as long as RA4 = 1 or it will be excuted for one time and go to S2 ? thanx in advance. Regards Salah. -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics