Alloy
Advanced Member level 4
Hey.
Why this code:
always prints 1?
I have disconnected the programmer..
I have button on RB7...
and button does not work...
Why this code:
Code:
void main() {
OSCCON = 0X70; // Set internal oscillator at 8MHz
ADCON1 = 0x0F; // Configure AN pins as digital
UART1_Init(9600);
// enable weak pull-ups on port B
INTCON2.RBPU = 1;
TRISB.F7 = 1; //Configure RB7 as input (PGD)
while(1){
if(PORTB .B7)
{
UART1_Write_Text("0");
}
else
{
UART1_Write_Text("1");
}
Delay_ms(500);
}
}
I have disconnected the programmer..
I have button on RB7...
and button does not work...