Table of contents
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
11
7.8.2 JMP_LIST (Define jump list) instruction ..................................................................................... 255
7.8.3 SWITCH (Jump distributor) instruction ...................................................................................... 256
7.8.4 RET (Return) instruction ............................................................................................................ 258
7.8.5 ENDIS_PW (Enable/disable CPU passwords) instruction ......................................................... 259
7.8.6 RE_TRIGR (Restart cycle monitoring time) instruction .............................................................. 262
7.8.7 STP (Exit program) instruction ................................................................................................... 263
7.8.8 GET_ERROR and GET_ERROR_ID (Get error and error ID locally) instructions .................... 263
7.8.9 SCL program control statements ............................................................................................... 267
7.8.9.1 Overview of SCL program control statements ........................................................................... 267
7.8.9.2 IF-THEN statement .................................................................................................................... 268
7.8.9.3 CASE statement......................................................................................................................... 269
7.8.9.4 FOR statement ........................................................................................................................... 270
7.8.9.5 WHILE-DO statement ................................................................................................................ 271
7.8.9.6 REPEAT-UNTIL statement ........................................................................................................ 272
7.8.9.7 CONTINUE statement ............................................................................................................... 273
7.8.9.8 EXIT statement .......................................................................................................................... 273
7.8.9.9 GOTO statement ........................................................................................................................ 274
7.8.9.10 RETURN statement ................................................................................................................... 274
7.9 Word logic operations ................................................................................................................ 275
7.9.1 AND, OR, and XOR logic operation instructions ....................................................................... 275
7.9.2 INV (Create ones complement) instruction ................................................................................ 276
7.9.3 DECO (Decode) and ENCO (Encode) instructions ................................................................... 276
7.9.4 SEL (Select), MUX (Multiplex), and DEMUX (Demultiplex) instructions ................................... 278
7.10 Shift and rotate ........................................................................................................................... 281
7.10.1 SHR (Shift right) and SHL (Shift left) instructions ...................................................................... 281
7.10.2 ROR (Rotate right) and ROL (Rotate left) instructions .............................................................. 282
8 Extended instructions .......................................................................................................................... 283
8.1 Date, time-of-day, and clock functions ....................................................................................... 283
8.1.1 Date and time-of-day instructions .............................................................................................. 283
8.1.2 Clock functions ........................................................................................................................... 286
8.1.3 TimeTransformationRule data structure .................................................................................... 289
8.1.4 SET_TIMEZONE (Set timezone) instruction .............................................................................. 290
8.1.5 RTM (Runtime meters) instruction ............................................................................................. 291
8.2 String and character ................................................................................................................... 292
8.2.1 String data overview .................................................................................................................. 292
8.2.2 S_MOVE (Move character string) instruction ............................................................................. 293
8.2.3 String conversion instructions .................................................................................................... 293
8.2.3.1 S_CONV, STRG_VAL, and VAL_STRG (Convert to/from character string and number)
instructions ................................................................................................................................. 293
8.2.3.2 Strg_TO_Chars and Chars_TO_Strg (Convert to/from character string and array of
CHAR) instructions .................................................................................................................... 302
8.2.3.3 ATH and HTA (Convert to/from ASCII string and hexadecimal number) instructions ............... 304
8.2.4 String operation instructions ...................................................................................................... 306
8.2.4.1 MAX_LEN (Maximum length of a character string) instruction .................................................. 306
8.2.4.2 LEN (Determine the length of a character string) instruction ..................................................... 307
8.2.4.3 CONCAT (Combine character strings) instruction ..................................................................... 307
8.2.4.4 LEFT, RIGHT, and MID (Read substrings in a character string) instructions ............................ 308
8.2.4.5 DELETE (Delete characters in a character string) instruction ................................................... 310
8.2.4.6 INSERT (Insert characters in a character string) instruction ..................................................... 311
8.2.4.7 REPLACE (Replace characters in a character string) instruction ............................................. 312