Johnny Churne
Member level 5
Hello all my dear friend! I know can only make portA for input, but how to make PORTC for input?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
TRISC =0XFF
Hello all my dear friend! I know can only make portA for input, but how to make PORTC for input?
Whichever way you connect it, make sure there is a resistor to pull the pin to the opposite state when the switch (button) is open. Simply disconnecting the pin through a switch wil not make it change to the opposite logic state.I will connect button to portc.
void main(){
TRISC=0XFF;
TRISB=0XFF;
TRISD=0X00;
PORTD=0;
PORTC=0;
PORTB=0;
while(1){
if(PORTC.RC0==0){
PORTD=0X01;
}
}
}
while(1){
if(PORTC.RC0==0){
PORTD=0X01;
}