Many thanks to Richard and Dave for letting me know I should be using PORT instead of LAT and thanks to Henrik for the explanation.

Making the changes has fixed the issue and also cured a couple of other bits of randomness that were also happening.

Upto this point the program has basically been proof of concept hence why various subroutines we prototyped on another PIC before being inserted into the main code. Time now to do an upto date printout and get the highlighter pens out to note all the changes I need to make to get my program tidied up and working the way I want it to.

Thanks again guys.