Reference programming LD 7 SUB 8 ST var1 Example in ST: var1 := 7-2; Example in FBD: 7.2.3.4 DIV Division of one variable by another of the types: BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT, UDINT, REAL and LREAL. Example in IL: LD 8 DIV 2 ST var1 Example in ST: var1 := 8/2; Example in FBD: If you define functions in your project with the names CheckDivByte [ } 219] , CheckDivWord [ } 220] , CheckDivDWord [ } 220] and CheckDivReal [ } 219] , 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 functions must have the above listed names. 7.2.3.5 MOD Modulo Division of one variable by another of the types:
BYTE, WORD, DWORD, SINT, USINT, INT, UINT, DINT and UDINT. The result of this function will be the remainder of the division. This result will be a whole number. Example in IL: LD 9 MOD 2 ST var1 (* Result is 1 *) Example in ST: var1 := 9 MOD 2; Example in FBD: TX1200 198 Version: 1.3