Programming Guidelines

This chapter explains some rules on the usage of the libraries and the structure AXIS_REF.

  • A general rule is that ALL Function Blocks which are used for a specific drive are to be used in the same PLC-task. When multitasking is used for the PLC, it is allowed to have different drives in different tasks, but all blocks belonging to a specific drive need to be in the same task. There is no multithreading protection for the AXIS_REF instance.

  • If AXIS_REF is used as input on a user defined Function Block or program or function, always use it as VAR_IN_OUT and never use it as VAR_INPUT or VAR_OUTPUT. The reason is that this would

    • Break the consistency and destroy data.
    • Consume a lot of computing power by copying data.
  • The “Min update time” update time for the fieldbus, defined under PLC Configuration > Couplers[FIX] > [fieldbus master type] must not exceed the half of the scantime of the PLC-task. For example, if scantime of PLC-task is 5 ms, “Min update time” should not be greater than 2 ms.

  • Any instance of a Function Block should be called only once per cycle and in only one specific task.

    If the instance is used in several tasks, it has to be checked that is not called several times.

    Because this could corrupt the handshake from Function Block to AXIS_REF to CMC_MOTION_KERNEL_REAL and vice versa.

  • Some PLCopen Function Blocks are only allowed to be called within the same task as the CMC_MOTION_KERNEL_REAL Function Block. This is mentioned in the Function Block descriptions.

  • If PLCopen Function Blocks are called from a different task, they cycle time should be at least 2 times the cycle time for CMC_MOTION_KERNEL_REAL Function Block is.