Quote Originally Posted by RuudNL View Post
...
If PORTB.0=1
...

You're assuming it can read port B properly.

I'd start even easier, just blink a LED, nothing else, then build from that.