Calling Function Blocks Multiple Times Same Cycle

A given function block can usually be called multiple times without causing problems when using a single-core controller.

Example

It is possible to call MC_MoveVelocity multiple times to start velocity moves on multiple axes.

Set the Execute input to False between every call to start a new velocity move.

  • When doing this, the ability to monitor the status of the velocity moves is lost because the axis parameter is changed for each call.
  • If there is no concern with monitoring the status of the velocity moves, call MC_MoveVelocity any number of times in a given cycle.

Function blocks that start a motion-related action need to avoid race conditions when using a multi-core controller.

The function blocks have to save argument data so that calculations and error detection can be determined during the next controller cycle.

There are two consequences to this:

  • With the possible exception of the multicoreFbExecuteDuplicateValueInCycle error 76, the Error and ErrorID outputs report no error on the first cycle.
    • The Error and ErrorID outputs reports their status in the next VM cycle.
  • The function block cannot be called with the same Execute state twice in a single VM cycle.
    • If a function block is called with the same Execute state twice in a single VM cycle, a multicoreFbExecuteDuplicateValueInCycle error 76 is returned immediately.

Function Blocks - Start Motion-related Actions

See Also