Measuring time in Structured Text


Thread Starter


I'm looking to measure the time delay between an output and an input, likely to be of the order of a tenth of a second, but I don't know how to go about doing so.

Any suggestions?

Curt Wuollet

Not very clear, but perhaps a DSO? (digital storage oscilloscope). Should actually be about the scan cycle time. If I understand what you want.

Depends on the implementation you're using. You may have timer functionality built in, or if not, you probably have access to a real time clock or at least a run timer (a single timer that records how long the app has been running).

If the first, read the docs on how to use the timer, which will explain how to start/stop/reset, etc. Start it on your first event, then read it at the second event.

If a real time clock or run timer, when the first event occurs, read and store that value in a variable, then when the second event occurs, read the time again and subtract the previously stored value.