Appendix VAR_INPUT divisor : REAL; END_VAR Example of CheckDivReal implementation: IF divisor = 0 THEN CheckDivReal := 1; ELSE CheckDivReal := divisor; END_IF Operator DIV uses the output of function CheckDivReal as divisor. In a program like shown in the following example this avoids a division by 0, the divisor (d) is set from 0 to 1. So the result of the division is 799. 10.7.4 FUNCTION CheckDivWord : WORD 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 [ } 313] , for example to avoid a division by 0. The name of the function is defined and may have only this identifier.
NOTE System load CheckBound function may cause increased system load. Please use CheckBounds only for test 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 TwinCAT 2 PLC Control 336 Version: 1.0