I found this interesting so looked a bit more...
I've done a couple of projects with analogue in that worked great
I think your program is resetting bits in ADCON1 register and resetting ports back digital
depending on the value read from the port that starts out analogue.
For an 8 bit result, setting ADCON1:7 to zero sets the 10 bit result left justified so you
only see the high 8 bits in the word which are most significant because you access the
high byte of a word with the 10 bit result shifted into place.
How much of this is handled by PBP I don't remember, but that's what's happening.
Otherwise the 10 bit result is right justified, and you see a 16 bit word who's leading
6 bits are always zero, and that's the 10 bit result.
I'll bet that you're making PBP access a 16 bit word comprised of the ADCON1 register,
and the lower end result register, and that's somehow enough to wreck the contents
of ADCON1, and leave your program running with a digital port.
I was thinking asm when doing this,
it would be nice if someone else has any thoughts on what PBP is doing.
I suspect the DEFINE would set the ADCON1 bit 7 without touching the other bits,
and setting it again directly might only override it.
Bookmarks