Thanks for all your help! sagor1 was right about RC1. I now have the LEDs working, so moved on to getting the RS485 and UART side working. I wasted a lot of time trying to use USB to RS485 devices and just getting garbage, but finally got clean transmission using a USB to RS232 cable and an old serial to RS485 mini PCB. That is giving me the right data at pin 26 on the PIC. I send 4 digits, the MMSS from the PC clock plus #13 every 5 seconds, as in the attached trace.
Sometimes, the digits come through with extra bits on, like 93 instead of 33. I expect I will need to add validation code once the basics are working
My problem now is, if I plug values straight into portB I get say 4,5,6,7 displayed for ever more as I wold expect. When I try to read the 4 characters using an ISR routine, I get what appear to be random numbers appearing at different intervals. My guess is I'm doing implied character to int or vice versa in my code, which I've attached.
So if anyone can see the blindingly obvious that I can;t see, I would be grateful for pointing in the right direction. I see on my PicKit 3 that I'm just about to go over 200 reprogrammings for the PIC chip. Fortunately I have a few spares in case the legs fall off! The crystal on the PCB is AEXL009L and has 4.0000000 printed on it, which I make is 40MHz, although I'm not sure if the baud rate applies to receive side of the UART.