CheckDivWord : WORD

CheckDivWord : WORD 1:

If you define functions in your project with the name CheckDivWord, you can use them to check the value of the divisor if you use the operator DIV, for example to avoid a division by 0. The name of the function is defined and may have only this identifier.

CheckDivWord : WORD 2:

The function can cause a significant increase in system load, so it should only be used for testing purposes.

CheckDivWord function may cause increased system load. Please use CheckDivWord only for test purposes.

VAR_INPUT
    divisor : WORD;
END_VAR

Example of CheckDivWord implementation:

IF divisor = 0 THEN
    CheckDivWord := 1;
ELSE
    CheckDivWord := divisor;
END_IF