Not sure, but I seem to recall having an issue with putting if/then/else/endif on the same line. Might be a syntax thing where you need to put wend on its own?
Worth a shot?
Picster
Not sure, but I seem to recall having an issue with putting if/then/else/endif on the same line. Might be a syntax thing where you need to put wend on its own?
Worth a shot?
Picster
Well, the adcon0.2=1 was the solution!
I guess last night I was not very wake to see it.
While/Wend can be just fine on the same line, there is no problem.
Thank you for the help,
Ioannis
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