I need to write a program that will check if an input pin of PIC has a voltage. If a voltage exists then it will give voltage to a selected output pin like PORTB.RB1=1;
. Else it will give voltage to other selected output pin like PORTC.RC1=1;
.
Is it possible? I have tried to do this, but it does not work .
void main() {
TRISB=0;
TRISA=1;
TRISC=0;
while(1){
delay_ms(500);
// PORTB=0;
if(PORTA==1){
PORTB.RB1 =1;
}
else{
PORTC.RC1 =1;
}
}
}