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 | ||
---|---|---|
| ||
|
For more Information, consult the Codesys OnineHelp under POUs for Implicit Checks.
See also the faq on Error Checking with "POU for implicit checks".