Plc programming problem


Please someone help me with this
Here’s what my problem is I am using a scanner to scan trills… The output of the scanner is the input of an Air gun;; I.e my scanner is an input and my air gun is the output
So this is how my process works.
I am scanning trills, when a trill passes in front of a scanner, an output is given by my scanner to the Plc, and when there is no tray no output is given to Plc, now what I want to do is that for the trills which are slightly longer, I want my air gun to blow them away, Now in that case the output is gonna be given by the scanner to the plc for slightly longer time, maybe a few milliseconds longer than the ideal case(where the trill is of perfect size) What I want to do is that my air gun shall only operate when an output of the scanner was given for that’ slightly longer time, in all other cases the air gun shall stay de-energied… I am having confusion with how to write code in between them I have mapped my scanner to x1 input on plc and air gun to y1 output. So [XIC]energise>> ()y1 I am having confusion on what to put in between if like timers how do I measure such precise time difference and how do I Initialisé my gun with scanner input and what to do to reset it again after once it was used and held for few seconds…