
Table of contents
S7-200 SMART
8System Manual, 09/2015, A5E03822230-AC
7.5.3 Number value to ASCII string conversion............................................................................ 208
7.5.4 ASCII sub-string to number value conversion ..................................................................... 212
7.5.5 Encode and decode ............................................................................................................. 215
7.6 Counters............................................................................................................................... 216
7.6.1 Counter instructions ............................................................................................................. 216
7.6.2 High-speed counter instructions .......................................................................................... 220
7.6.3 Noise reduction for high-speed inputs ................................................................................. 224
7.6.4 High-speed counter programming ....................................................................................... 226
7.6.5 Example initialization sequences for high-speed counters.................................................. 238
7.7 Pulse output ......................................................................................................................... 247
7.7.1 Pulse output instruction (PLS) ............................................................................................. 247
7.7.2 Pulse train output (PTO) ...................................................................................................... 249
7.7.3 Pulse width modulation (PWM)............................................................................................ 251
7.7.4 Using SM locations to configure and control the PTO/PWM operation............................... 252
7.7.5 Calculating the profile table values ...................................................................................... 255
7.8 Math ..................................................................................................................................... 259
7.8.1 Add, subtract, multiply, and divide ....................................................................................... 259
7.8.2 Multiply integer to double integer and divide integer with remainder................................... 262
7.8.3 Trigonometry, natural logarithm/exponential, and square root............................................ 264
7.8.4 Increment and decrement.................................................................................................... 266
7.9 PID ....................................................................................................................................... 268
7.9.1 Using the PID wizard ........................................................................................................... 269
7.9.2 PID algorithm ....................................................................................................................... 274
7.9.3 Converting and normalizing the loop inputs......................................................................... 278
7.9.4 Converting the loop output to a scaled integer value........................................................... 279
7.9.5 Forward- or reverse-acting loops......................................................................................... 279
7.10 Interrupt................................................................................................................................ 282
7.10.1 Interrupt instructions ............................................................................................................ 282
7.10.2 Interrupt routine overview and CPU model event support................................................... 284
7.10.3 Interrupt programming guidelines ........................................................................................ 285
7.10.4 Types of interrupt events that the S7-200 SMART CPU supports ...................................... 287
7.10.5 Interrupt priority, queuing, and example program................................................................ 288
7.11 Logical operations................................................................................................................ 293
7.11.1 Invert .................................................................................................................................... 293
7.11.2 AND, OR, and exclusive OR................................................................................................ 294
7.12 Move .................................................................................................................................... 296
7.12.1 Move byte, word, double word, or real................................................................................. 296
7.12.2 Block move........................................................................................................................... 297
7.12.3 Swap bytes........................................................................................................................... 298
7.12.4 Move byte immediate (read and write) ................................................................................ 299
7.13 Program control.................................................................................................................... 300
7.13.1 FOR-NEXT loop................................................................................................................... 300
7.13.2 JMP (jump to label) .............................................................................................................. 301
7.13.3 SCR (sequence control relay).............................................................................................. 303
7.13.4 END, STOP, and WDR (watchdog timer reset)................................................................... 312
7.13.5 GET_ERROR (Get non-fatal error code) ............................................................................. 313
7.14 Shift and rotate..................................................................................................................... 315
7.14.1 Shift and rotate..................................................................................................................... 315