Pommie,
This is too large a program to post the whole thing.
I can post pieces of it.
Since I have one version working I suspect it's the way I'm using
the 16F88.
The code to read and convert the a_to_d value is identical.
Here's the status of the ports in the program that has the problem,
when I read the a_to_d value.
All RA ports are outputs and low. Except MCLR.
RB1, 2 and 3 are unused inputs and are low.
RB0 has a 0-5v 60Hz signal.
RB4 has an IR photo transistor which, when active, pulls the port low.
RB5 and RB6 are wired to switches which pull these ports low when pressed.
RB7 is the analog input.
So at the time I'm reading the a_to_d value RB0 is toggling,
and RB4, 5 and 6 are pulled high by the internal pullups the rest
are low.
On the program that works,
All RA ports are outputs and low. Except MCLR.
RB0, and 3 and are unused inputs and are low.
RB1 is an output and is high.
RB0, 4, 6 are inputs and low, pullups are off.
RB2 and 5 are used for uart.
RB7 is analog input.
Does any of this help?
Thanks,
jerryd