mikroc

Why is my If statement not working properly?


So I'm building a simple MikroC program that sets PORTB.B0 if PORTA.B0 is equaled to 1

void main() {
   PORTA.B0=1;
   while(1){
   if(PORTA.B0){
        PORTB.B0=1;
   }
   }
}

However it doesn't give me anything PortB.B0 isn't equal to 1 only portA.

Can anyone help?


Solution

  • Just try if(PORTA.B0==1). This should work.