This is for comparators
you want
Code:
ADCON1 = %00100000 'Pin #2 is voltage reference
The LCD lines and HSEROUT line should be something like
Code:
LCDOUT "TARGET VDC ", #TARGETVDC
HSEROUT [#TorchVoltsFull]
The divide by multiply by 256 should not be there. The 8bit ADC goes from 0 to 255. As we talked before withe the voltage divider feeding the ADC and using using the reference voltage. Well it worked pretty neat for you. The torch voltage will be the same "number" as the ADC value.
Other than that it should do something 
Now I will toss something else at you.
Think how fast the torch move up and down. Those few line of code before the ADC is read could mean trouble. You may want to increment the movement.
Bookmarks