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;
}
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?