Hello. I am an expert control engineer. I have delivered multiple PLC based projects via TIA Portal including three-axis crane position control, DEH control of a steam turbine that were highly modular using FBs. I am an expert of all IEC 61131-3 programming languages and can surely help with the implementation of the FB. A timer can be used to collect the data from 2 DIs with in 2 seconds in array format that can be used for processing via a developed algorithm. I can work to your satisfaction. Kindly contact me at your earliest. Thank you.