I read thisOriginally Posted by mat janssen
ADCON0.0=1 ' A/D converter module is operating
I read thisOriginally Posted by mat janssen
ADCON0.0=1 ' A/D converter module is operating
The adcon0,0 is an internal bit to tell us what the condition is of the adc.
You need it if your programm is made in assembler.
All of this is solved for you in the picbasicpro compiler.
i change with this:
and work but i want only the positive result and not the negative of command: if (value - P2) >= 1Code: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’
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;
Test if the first number is greater then the second number and then do the subtraction. If otherwise then do nothing.
Thank you.Originally Posted by mat janssen
I use this code:
Code:If value >= P2 then If (value - P2) >= 1 then PORTB.1=1 else PORTB.1=0 endif endif
Bookmarks