Thanks for your idea,

One more question. How am i gonna define the voltage. I have added a loop like but it didnt work. What can be the problem ?

ADC_READ:

ADCIN 0, ADCINFO
D=ADCINFO*100/51

timeloop:
if D>3 then
T1CON.0=1
if D>=4 then
T1CON.0=0
endif
ELSE
goto timeloop
endif