As Joe mentioned about the ADC.
Take a look at this:
http://www.picbasic.co.uk/forum/showthread.php?t=561