Got the board working by changing LATB = 0 to LATB = 0xFFFF