Hi PICer friends, many thanks for a lot of suggestion about the subject. In my mind now I have a clear idea whay can I do. I try to explain. The application is very similar to a mail box (for paper mail), whit the same hole to insert mail. (2 x 6 inch). Each time a envelope in feeded trought the hole an IR barrier intercept it and count. As a principle of operation, I would like use only 16F84 resource, on one pin I modulate the LED and charging a capacitor, and on other pin i read trought a phototrasnistro the light until the capacitor is discharged. Do you agree?? Ciao Leonardo