Table of contents
4
Device configuration ................................................................................................................................ 69
4.1
Inserting a CPU........................................................................................................................... 70
4.2
4.3
4.4
4.5
4.6
4.7
5
Programming concepts ............................................................................................................................ 79
5.1
5.2
5.3
5.3.1
Organization block (OB).............................................................................................................. 82
5.3.2
Function (FC) .............................................................................................................................. 84
5.3.3
Function block (FB) ..................................................................................................................... 84
5.3.4
Data block (DB)........................................................................................................................... 86
5.4
5.5
5.6
Copy protection ........................................................................................................................... 89
5.7
5.8
5.9
6
Programming instructions ........................................................................................................................ 93
6.1
Basic instructions ........................................................................................................................ 93
6.1.1
Bit logic........................................................................................................................................ 93
6.1.1.1
Set and reset instructions............................................................................................................ 95
6.1.1.2
6.1.2
Timers ......................................................................................................................................... 99
6.1.3
Counters.................................................................................................................................... 102
6.1.3.1
Counters.................................................................................................................................... 102
6.1.3.2
CTRL_HSC instruction .............................................................................................................. 105
6.1.3.3
6.1.3.4
Configuration of the HSC .......................................................................................................... 110
6.1.4
Compare.................................................................................................................................... 111
6.1.5
Math .......................................................................................................................................... 113
6.1.5.1
MOD instruction ........................................................................................................................ 114
6.1.6
Move.......................................................................................................................................... 119
6.1.6.1
Swap instruction........................................................................................................................ 122
6.1.7
Convert...................................................................................................................................... 123
6.1.7.1
6.1.8
Program control......................................................................................................................... 126
6.1.9
Logical operations ..................................................................................................................... 127
6.1.10
Shift and Rotate ........................................................................................................................ 130
6
S7-1200 Programmable controller
System Manual, 11/2009, A5E02486680-02