CheckDivByte : BYTE

CheckDivByte : BYTE 1:

If you define functions in your project with the name CheckDivByte, 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.

CheckDivByte : BYTE 2:

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

VAR_INPUT
    divisor : BYTE;
END_VAR

Example of CheckDivByte implementation:

IF divisor = 0 THEN
    CheckDivByte := 1;(**)
ELSE
    CheckDivByte := divisor;
END_IF