
Table of contents
S7-1200 Programmable controller
8 System Manual, 11/2011, A5E02486680-05
7.4.2 In-range and Out-of-range instructions..................................................................................... 184
7.4.3 OK and Not OK instructions...................................................................................................... 185
7.5 Math .......................................................................................................................................... 186
7.5.1 Calculate instruction.................................................................................................................. 186
7.5.2 Add, subtract, multiply and divide instructions..........................................................................187
7.5.3 Modulo instruction ..................................................................................................................... 188
7.5.4 Negation instruction .................................................................................................................. 189
7.5.5 Increment and decrement instructions...................................................................................... 189
7.5.6 Absolute value instruction ......................................................................................................... 190
7.5.7 Minimum and Maximum instructions.........................................................................................191
7.5.8 Limit instruction ......................................................................................................................... 192
7.5.9 Floating-point math instructions ................................................................................................ 192
7.6 Move.......................................................................................................................................... 194
7.6.1 Move and block move instructions............................................................................................ 194
7.6.2 FieldRead and FieldWrite instructions ...................................................................................... 197
7.6.3 Fill instructions .......................................................................................................................... 199
7.6.4 Swap instruction........................................................................................................................ 200
7.7 Convert...................................................................................................................................... 201
7.7.1 CONV instruction ...................................................................................................................... 201
7.7.2 Conversion instructions for SCL ............................................................................................... 202
7.7.3 Round and truncate instructions ............................................................................................... 204
7.7.4 Ceiling and floor instructions..................................................................................................... 205
7.7.5 Scale and normalize instructions .............................................................................................. 206
7.8 Program control......................................................................................................................... 209
7.8.1 Overview of SCL program control statements .......................................................................... 209
7.8.2 IF-THEN statement ................................................................................................................... 210
7.8.3 CASE statement........................................................................................................................ 211
7.8.4 FOR statement.......................................................................................................................... 212
7.8.5 WHILE-DO statement ............................................................................................................... 213
7.8.6 REPEAT-UNTIL statement ....................................................................................................... 214
7.8.7 CONTINUE statement............................................................................................................... 214
7.8.8 EXIT statement ......................................................................................................................... 215
7.8.9 GOTO statement....................................................................................................................... 216
7.8.10 RETURN statement .................................................................................................................. 216
7.8.11 Jump and label instructions....................................................................................................... 217
7.8.12 JMP_LIST instruction ................................................................................................................ 217
7.8.13 SWITCH instruction................................................................................................................... 218
7.8.14 RET execution control instruction ............................................................................................. 220
7.8.15 Re-trigger scan cycle watchdog instruction ..............................................................................221
7.8.16 Stop scan cycle instruction........................................................................................................ 222
7.8.17 Get Error instructions ................................................................................................................ 222
7.9 Word logic operations ............................................................................................................... 226
7.9.1 AND, OR, and XOR instructions ............................................................................................... 226
7.9.2 Invert instruction........................................................................................................................ 227
7.9.3 Encode and decode instructions............................................................................................... 227
7.9.4 Select, Multiplex, and Demultiplex instructions......................................................................... 228
7.10 Shift and Rotate ........................................................................................................................ 231
7.10.1 Shift instructions........................................................................................................................ 231
7.10.2 Rotate instructions .................................................................................................................... 232