Issue:
By calling a Function Block [FB] from within a Function [FUN] you notice strange effects like:
the FREQUENCY FB is not working.
the cycletime is very high.
Solution:
Use a Program [PRG] instead of the Function [FUN].