You are on page 1of 7

Siemens S7-1200

CPU 1212C AC/DC/Relay

Bit Logic Operations


• Positive and Negative Edge

www.codeandcompile.com
• Exercise Example

Code and Compile


Learning Made Easy
www.codeandcompile.com
Bit Logic Instructions in LAD – Positive & Negative Edge
Positive Edge – SCAN Operand
The state of this contact is TRUE when a positive transition
(OFF to-ON) is detected on the assigned bit I0.0.
The bit M0.0 will be ON for 1 clock cycle.

Negative Edge - SCAN Operand

www.codeandcompile.com
negative
The state of this contact is TRUE when a positive transition
(ON to-OFF) is detected on the assigned bit I0.1.
The bit M0.1 will be ON for 1 clock cycle.

The P & N contact can be located anywhere in the network except the end of a branch.
ON
Positive Edge Negative Edge
OFF
M0.0 M0.1
ON

OFF
I0.0 I0.1 Time
Exercise Example
Write a Logic to latch the motor when I0.0 goes from OFF to ON and unlatch the
motor when U0.1 goes from ON to OFF.
Ladder Solution
PLC Wiring

www.codeandcompile.com

X10

X11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3

L1 N L+ M 1M 2M 0 1

0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
120-240 24VDC Analog
24VDC Inputs
VAC Inputs

SIEMENS
SIMATIC
FBD Solution S7-1200 Relay Outputs

X1 P1 1L 2L

0.0
0.1
0.2
0.3

0.4
0.5
X12
1 2 3 4 5 6 7 8

Profinet (LAN)
Ethernet Port
Bit Logic Instructions in LAD – P_TRIG and N_TRIG
P_TRIG - SCAN RLO
The Q output power flow or logic state is TRUE when a positive
transition (OFF-to-ON) is detected on the CLK power flow in (LAD).

www.codeandcompile.com
P_TRIG Example N_TRIG Example

N_TRIG - SCAN RLO


The Q output power flow or logic state is TRUE when a negative
transition (ON-to-OFF) is detected on the CLK power flow in (LAD).

P_TRIG & N_TRIG instruction cannot be located at the beginning or end of a network
Exercise Example
Write a Logic to latch the motor when either I0.0 or I0.1 goes from OFF to ON and
unlatch the motor when either I0.2 or I0.3 goes from ON to OFF.

Ladder Solution PLC Wiring

www.codeandcompile.com

X10

X11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3

L1 N L+ M 1M 2M 0 1

0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
120-240 24VDC Analog
24VDC Inputs
VAC Inputs

SIEMENS
SIMATIC
S7-1200 Relay Outputs

X1 P1 1L 2L

0.0
0.1
0.2
0.3

0.4
0.5
X12
1 2 3 4 5 6 7 8

Profinet (LAN)
Ethernet Port
Exercise Example in FBD
Write a Logic to latch the motor when either I0.0 or I0.1 goes from OFF to ON and
unlatch the motor when either I0.2 or I0.3 goes from ON to OFF.

FBD Solution PLC Wiring

www.codeandcompile.com

X10

X11
1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 2 3

L1 N L+ M 1M 2M 0 1

0.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
120-240 24VDC Analog
24VDC Inputs
VAC Inputs

SIEMENS
SIMATIC
S7-1200 Relay Outputs

X1 P1 1L 2L

0.0
0.1
0.2
0.3

0.4
0.5
X12
1 2 3 4 5 6 7 8

Profinet (LAN)
Ethernet Port
What did we learn in this lesson?

 Positive Edge contact is TRUE when a positive


transition (OFF to-ON) is detected on its operand.
 Negative Edge contact is TRUE when a negative
transition (ON to-OFF) is detected on its
operand.
 P_TRIG contact is TRUE when the instruction
detects a change in the result of logic operation
(RLO) from "0" to "1“

www.codeandcompile.com
 N_TRIG contact is TRUE when the instruction
detects a change in the result of logic operation
(RLO) from “1" to “0"

Thank you
Get copy of this presentation
in the course!

Code and Compile


Learning Made Easy
www.codeandcompile.com

You might also like