Sep 9, 2012 #21 I internetuser2k12 Banned Joined Jul 25, 2012 Messages 1,192 Helped 171 Reputation 342 Reaction score 162 Trophy points 1,343 Activity points 0 Try this code, it will work. Code: void main() { TRISE = 0X03; PORTE.F2 = 0; TRISC = 0x08; CMCON = 0x07; ADCON1 = 0b10000111; while(1) { if(PORTE.F1 == 1) { Delay_ms(150); if(PORTE.F1 == 1) PORTE.F2 = 0; //UP } if(PORTE.F0 == 1) { Delay_ms(150); if(PORTE.F0 == 1) PORTE.F2 = 0; //dn } if(PORTC.F3 == 1) { Delay_ms(150); if(PORTC.F3 == 1) { PORTE.F2 = 1; //ok } } } } Attachments aboelle.rar 13.3 KB · Views: 75 ss13.jpg 165.9 KB · Views: 82 Last edited: Sep 9, 2012
Try this code, it will work. Code: void main() { TRISE = 0X03; PORTE.F2 = 0; TRISC = 0x08; CMCON = 0x07; ADCON1 = 0b10000111; while(1) { if(PORTE.F1 == 1) { Delay_ms(150); if(PORTE.F1 == 1) PORTE.F2 = 0; //UP } if(PORTE.F0 == 1) { Delay_ms(150); if(PORTE.F0 == 1) PORTE.F2 = 0; //dn } if(PORTC.F3 == 1) { Delay_ms(150); if(PORTC.F3 == 1) { PORTE.F2 = 1; //ok } } } }