1. The conditions for functions that can be called by CALLM instructions

1. The conditions for functions that can be called by CALLM instructions

Even if the functions in the function block can be compiled, it does not mean that they can be called by the ladder diagram instruction CALLM.In fact, functions that can be called by CALLM need to meet some constraints:

  1. The number of parameters cannot exceed 8.

  2. The parameters can be all uppercase types customized by SamSoar2022. In fact, these types are pointers to basic types.

Name Corresponding Type Meaning
BIT uint322_t * Pointer to bit register (M/Y/S)
WORLD int16_t * Pointer to signed integer (D/TV/CV/AO)
UWORD uint16ut * Pointer to unsigned integer
DWORD int32_t * pointer to signed double integers
UDWORLD uint32/t * pointer to unsigned double integers
FLOAT float * pointer to floating-point numbers
  • The type corresponding to BIT is 32-bit, but each 32-bit integer only maps the value of one bit register and is not generated through bit combination. Please be careful when using it.

    1. Parameter types can also be defined as C language types such as boolean, int, short, float, etc.

    2. When using CALLM to call a function block in a ladder diagram, if the parameter is a 32-bit type of WORD, UDWORD, FLOAT, then the address value of input D should be an even number, as odd numbered addresses can cause program execution errors.