Obsidean_VM/04-InLavoro/9..... MASTER Transport/Standard Transport/FB Scan Time - FB1.md

28 lines
1.2 KiB
Markdown
Raw Normal View History

2025-02-18 05:37:27 -03:00
### FB Scan Time ( FB1 )
***
This function needs to be called before the code that needs to be measured and at the end of the code. The time between each call is taken, and in the second call, the input SecondCall needs to be set to True.
```pascal
Example: OB32 - Intterrupt of 5.0 ms
-----------------------------------------
"FB Scan Time_DBx"(CalculateRuntime := false,
CycleTime := 5.0);
...
PROGRAM .....
...
"FB Scan Time_DBx"(CalculateRuntime:=true,CycleTime:=5.0);
```
Then on the DB the FB will calculate this:
***
* Max: Maximum time between calls since last reset
- Average: Average elapsed time between calls since last reset
- Min: Minimum time between calls since last reset
- CallLost%: When the cycletime input has a valid time, CallLost calculates the percentage of cycles lost every second. This is useful for timing and monitoring Interrupt OB3x. The cycletime parameter must be set to the interrupt time in milliseconds. Then, the FB counts the number of times per second it is called and calculates the percentage of lost calls.
The Reset bit on the DB resets all memory's. Also there is a auto reset the first 10 seconds the CPU goes from STOP to START.