Does your PIC have ADC?
If it does...
http://www.picbasic.co.uk/forum/showthread.php?t=562

http://www.picbasic.co.uk/forum/showthread.php?t=561