http://www.rakeshmondal.info/IR-Sensor-Interface-pic18f4550-input
Read this post on rakeshmondal.info