Basic instructions
8.1 Bit logic operations
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
235
For R_TRIG and F_TRIG, when you insert the instruction in the program, the "Call options"
dialog opens automatically. In this dialog you can assign
whether the edge memory bit is stored in its own data block (single instance) or as a local
tag (multiple instance) in the
block interface. If you create a separate data block, you will find it in the project tree in the
"Program resources" folder
under "Program blocks > System blocks".
Table 8- 17 Data types for the parameters (P and N contacts/coils, P=, N=, P_TRIG and N_TRIG)
Memory bit in which the previous state of the input is saved
IN Bool Input bit whose transition edge is detected
Output bit which indicates a transition edge was detected
Power flow or input bit whose transition edge is detected
Output which indicates an edge was detected
All edge instructions use a memory bit (M_BIT: P/N contacts/coils, P_TRIG/N_TRIG) or
(instance DB bit: R_TRIG, F_TRIG) to store the previous state of the monitored input signal.
An edge is detected by comparing the state of the input with the previous state. If the states
indicate a change of the input in the direction of interest, then an edge is reported by writing
the output TRUE. Otherwise, the output is written to FALSE.
Note
Edge instructions evaluate the input and memory
-bit values each time they are executed,
including the first execution. You must account for the initial states of the input and memory
bit in your program design either to allo
w or to avoid edge detection on the first scan.
Because the memory bit must be maintained from one execution to the next, you should use
a unique bit for each edge instruction, and you should not use this bit any other place in your
program. You should als
o avoid temporary memory and memory that can be affected by
other system functions, such as an I/O update. Use only M, global DB, or Static memory (in
an instance DB) for M_BIT memory assignments.