i change with this:
Code:
CMCON = 7 ' PortA = digital I/O
ANSEL = %00000011 ' Will set RA0-RA1 as analog and all others as digital
TRISA = %00000011
ADCON0 = %11000001 ' Configure and turn on A/D Module
ADCON1 = %00000000 ' Left justified. Six Least Significant bits of ADRESL are read as ‘0’
and work but i want only the positive result and not the negative of command: if (value - P2) >= 1
23 - 25 = -2 (P2=25)
27 - 25 = 2 (P2=25)
the pin PORTA.2 turn on , and for -2 and for 2 , but i want only for 2.
How to make this;
Bookmarks