So are you saying that everything works as you want it to work if you are using the LCD?
Yes ! But not on this plate . On this plate (Leds display )I use a PIC 16F876 and I have 3 free pins only on it . I can not install a LCD. Will be very usefully . I am not sure ( in my mind )every time that sensor work . In future I try to change PIC with 16F877 ,to can have together Leds and LCD display for ilk sensor .

There is no need to rewrite the entire program!!! Your answers have been practically handed to you in previous posts, with example provided. The only thing left to do is to write the code for you
I am not sure that I understand what you say !