Badger,

What microcontroller are you using?

I ask just incase it is one with analogue/comparators on port a. this might be causing you problems.

Regards

Darryl