Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


To prevent an exception in the application (caused by a division by zero) it is best to check all code for division by any variable,
and make sure it can never be zero (or at least won't execute the division if it is zero).

If you don't want to do this (and f.e. want to automatically divide by 1 if there is a zero), you can add the objects "POUs for Implicit Checks...." to your application.

Use the Steps within the OnlineHelp for more detail.
In principle, the following is done:

  • Enable the "Division checks" options.
  • CODESYS will automatically create a code and call this with every division to check if the variable value is 0.
  • The Code will then replace this by 1, see Example.

    Example: 

Regarding Implicit Checks:

Warning
titleConsequence when using Implicit Checks
  • The code will be somewhat larger and therefor slower.

  • Our recommendation is to use it only on application development phase, later on the final machine remove them.
    Reason:  it will use a lot of resources and performance.

  • Keep in mind, that actually the check functions are only wrapped around the FB’s / POU’s in the project, they are not used in the libraries of the project.


Info

The POUs for implicit checks must NOT be copied, renamed or the declaration changed in any way!
See also, the comment above the functions insistently will point this out!

 Which function is called, depends in principle on the involved data types with the divisions (usually from the largest involved, ( e.g. LINT / INT => LINT variant).



For more Information, consult the Codesys OnineHelp under POUs for Implicit Checks.
See also the faq on Error Checking with "POU for implicit checks".