This is a simple circuit in which PIC16F628A is counting pulses, converting the number of counts in ASCII and sending the ASCII data to LCD. LCD is working. Even counter is functioning if a direct on the pin is given. But, if pulses are sent through a photo coupler, then the pin (and output of photo coupler doesnt go high). However, if photocoupler is disconnected from PIC then it functions as normal, but when connected with PIC, the output doesnt changes its state. Circuit is attached. Please check if I am doing something wrong.