I might be slow.. but I still dont understand fully.


You have 2 jumpers you can read at startup to set the time window.. so you get 4 different times (16,18,19,29 sec).. I am with you this far.

Then you say you look for something to happen during this time window... if it happens.. then you start a new time window to look again... if it doesnt you stop the program.

so...

power up
check input pins
load a word variable with the correct time (1600 for 16 s and 2000 for 20 sec)

start_again:

n=0
for n =0 to word variable
check for your signal
if you find your signal goto start_again
Delay_ms(9)
Delay_us(1000) ' here you can adjust the loop time
next n

STOP


This could work unless you are looking for 16.000000000000000 seconds or similar. By adjusting the delay_us() time you can calibrate the loop time.

Since you doesnt seem to have anything else to do during this time why do you want to use the timer?
/me