here’s a quick explanation that has helped quite a few people ...
suppose that we have an operation in our program which MUST be done at a specific rate ... for example: we need to execute a PID instruction once each 100 milliseconds ...
now suppose that the regular scan time of our program fluctuates ... and sometimes it takes quite a bit more than 100 milliseconds between subsequent scans ... in this case, our PID operation might suffer ...
now suppose that we place the PID instruction in a new subroutine ... instead of using the customary JSR (Jump to Subroutine) instruction to send the processor over to execute the new file, we set the file up as an STI (Selectable Timed Interrupt) ... and we set the STI’s setpoint for the required 100 milliseconds ...
now suppose that we watch the processor scan through that LONNNNNG program of ours ... he starts down through the rungs - but as he goes along, he’s continuously keeping an eye on his little wristwatch ... as soon as the STI setpoint elapses, the processor stops what he’s doing in the regular program scan - and goes and executes the rungs contained in the STI file ... then he COMES BACK to where he was in the regular program rungs and picks back up right where he left off ... and the next time the STI setpoint elapses, the processor does the same thing: he leaves the regular program rungs - he goes and executes the STI rungs - he comes back to where he left off in the regular rungs ...
secret handshake: the STI tells the processor to INTERRUPT the regular scan at a TIME which we get to SELECT ... STI = ITS ...
that should be enough to give you the basic ideas ... but ... also consider that any FIELD INPUT and FIELD OUTPUT issues associated with the operations in the STI might also have to be taken care of within the STI ... that’s why you’ll often see rungs with “Immediate Input” and “Immediate Output” instructions included inside the STI file ...
you asked for an example ... I don’t usually post the exercises that I use in my classes - but if you want to call me up, I’ll walk you through one or two over the phone ... if you’ve got a spare system to play with during the call, it should only take about 10 or 15 minutes to nail everything down ...
hope this helps ...