Hi Yettie,
The config for porta pins are as inputs (if I did the code right).inputs A.1 and A.4 are pulled high via a 470 ohm. A.0 is pulled low via a 470.

I've never tried setting the internal pull up/dn but I will.The motor is power by a seperate 24vdc supply but with a common ground.The motor is switched by a relay which is controlled by the PIC via a NPN transistor and the coil of the relay has a diode across the coil and is correct direction.

I presume the problem is with the way I've done the code as I'm still learning (and loving it). I'll use the Quote function in the future as you said.

Thanks for your ideas.