That will work just fine Tony.
The one A/D input can be used to monitor and trigger to many levels of the input range within tolerance, but your application is a snap with only three states: Max A/D, Mid A/D and Min A/D.
Here's an example using a three state momentary switch:
Just make sure the switching value being monitored will not damage your uC.
Now a simple routine can monitor and do what you need:
Code:
SW_1 VAR BYTE ' A/D setup with 8bit
ADCIN 0, SW_1 ' Assuming PIC Vdd is 5V and using A/D input 0
SELECT CASE SW_1
CASE IS < 26 ' Input less than 0.50V
' Do something
CASE IS < 135 ' Input less than 2.64V
' Do something else or nothing at all
CASE IS > 135 ' Input more than 2.64V
' Do something
END SELECT
Bookmarks