Quote Originally Posted by HenrikOlsson View Post
Hi,
For that you need to use the Analog to Digital converter available in most PICs (but not all). It CAN be done with the comparators too by generating the VRef voltage with for example PWM and then sweeping the voltage from zero upwards while watching the comparator output. When the comparator output toggles you know the voltage. But the ADC is easier though....

Which PIC are you using?
thanks HenrikOsson for your suggestion i hope it will help me, truely i have no anywhere to get the information on that issue, can you give me the reference book so that i can read to get enough concept on how to use ADC on comparators or can you give me sample code so that to be easy for me to understand.
I suggest to use PIC16F877, is it possible to work as i want, please Henrikosson help me