Thanks to everyone who made suggestions. But I RTFM and came up with the answer, which just may help someone else.....
PORTD is also the PARALLEL SLAVE PORT. To make it a general purpose I/O port, Bit4 of TRISE must be set to 0 IE TRISE.4 = 0
Did that and now seems to be OK. Will spend the next few hours reverting to the final code and see what happens.
Peter Moritz.
Bookmarks