HIGH/LOW are really only meant to be used on PORT registers.
Those commands also clear the corresponding TRIS bit which is at certain offset from the register (PORT) in question. That offset is 80h (at least for the '877, don't know if other parts/familes might be different).
So when you do HIGH ADCON0.2 the compiler generates code to also clear bit 2 at the memory addess 80h "away" from ADCON0 which in this case happens to be ADCON1 and unexpected things may occur.
from the user manual
The HIGH command may only be used on output pins. If used on bits within
variables or bits within registers (other than PORT or GPIO), unexpected behavior
may result.
Warning I'm not a teacher
its best to wait till all else fails![]()
Warning I'm not a teacher
Bookmarks