How about doing it this way? Now, every time around the checkit will read the pot and take care of the LED
Jerson
CHECKIT:
Pot GPIO.2,255,BO
IF BO>125 Then
LED=1 'LED ON WHEN BO>125,OFF WHEN BO<125
else
LED = 0
endif
GoTo CHECKIT
How about doing it this way? Now, every time around the checkit will read the pot and take care of the LED
Jerson
CHECKIT:
Pot GPIO.2,255,BO
IF BO>125 Then
LED=1 'LED ON WHEN BO>125,OFF WHEN BO<125
else
LED = 0
endif
GoTo CHECKIT
With the POT command PBP needs to control the I/O-pin. If you have the pin
configured as an A/D input, the POT command can't toggle the pin to charge
the capacitor.
You could use ADCIN with the A/D configured for 8-bit or simply make the pin
digital, then use the POT command.
Jerson that the 1st. way I wrote the code but for some reason it would not compile
Bruce you a little over my head ( newbie) are you saying this is wrong?
TRISIO = %00001100 ' MAKE GPIO.2/.3 INPUTS
ANSEL = %00000100 'MAKE GPIO.2 ANALOG
please explan more
thanks
If you are using the POT command, then you do not want to make the pin
an analog input. It needs to be configured for digital I/O.
Change this: ANSEL = %00000100 ' MAKE GPIO.2 ANALOG
To this: ANSEL = %00000000 ' MAKE GPIO.2 (and all other A/D pins) digital.
Why?
Because the POT command requires a pin it can control by flipping it from
output, charging the cap, then flipping it back to an input. If you have the
A/D feature for that pin enabled, then the pin no longer functions as a digital
I/O-pin, and the POT command will fail.
If you prefer not to use the POT command, then you could use the ADCIN
command. In that case you would want to configure the pin as an analog
input with ANSEL = %00000100 ' MAKE GPIO.2 ANALOG
thanks Bruce
I will give it a try, with you and others I'm learning
Bookmarks