internetuser2k12
Banned
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
Last edited: