FBD Examples
FBD Examples
FBD Examples
Practical Applications
Each FBD instruction triggers a specific operation. When you combine these
instructions into a program, you can accomplish a wide variety of automation tasks.
This chapter provides the following examples of practical applications of the FBD
instructions:
• Controlling a conveyor belt using bit logic instructions
• Detecting direction of movement on a conveyor belt using bit logic instructions
• Generating a clock pulse using timer instructions
• Keeping track of storage space using counter and comparison instructions
• Solving a problem using integer math instructions
• Setting the length of time for heating an oven
Instructions Used
Sensor S5
S1 O Start S3 O Start
S2 O Stop S4 O Stop
MOTOR_ON
I 1.1 >=1
Q 4.0
I 1.3 S
Network 2: Pressing either stop switch or the sensor at the end of the belt turns the
motor off.
I 1.2 >=1
I 1.4 Q 4.0
I 1.5 R
Network 3: If one of the photoelectric barriers is interrupted, this means that there
is a package between the barriers. The direction pointer shuts off.
&
I 0.0 Q 4.0
I 0.1 R
Q 4.1
R
Display Panel
Storage area Storage area Storage area Storage area Storage area
empty not empty 50% full 90% full Filled to capacity
Function Block Diagram that Activates the Indicator Lamps on the Display Panel
Network 1: Counter C1 counts up at each signal change from “0” to “1” at input CU
and counts down at each signal change from “0” to “1” at input CD. With a signal
change from “0” to ”1” at input S, the counter value is set to the value PV. A signal
change from “0” to “1” at input R resets the counter value to “0”. MW200 contains
the current counter value of C1. Q12.1 indicates “storage area not empty”.
C1
S_CUD
I 12.0 CU
I 12.1 CD
I 12.2 S CV MW210
Network 3: If 50 is less than or equal to the counter value (in other words if the
current counter value is greater than or equal to 50), the indicator lamp for “storage
area 50% full” is lit.
C MP
<= I
Q 15.2
50 IN 1
=
MW 200 IN 2
Network 4: Network 4: If the counter value is greater than or equal to 90, the
indicator lamp for “storage area 90% full” is lit.
CMP
>= I
Q 15.3
MW200 IN1
=
90 IN2
Network 5: If the counter value is greater than or equal to 100, the indicator lamp
for “storage area full” is lit.
CMP
>= I
Q 1 5 .4
M W 2 00 IN 1
=
100 IN 2
Function Block Diagram to Generate a Clock Pulse (pulse duty factor 1:1)
Network 1: If the signal state of timer T1 is 0, load the time value 250 ms into T1
and start T1 as an extended-pulse timer.
T1
SE
M0.2 &
S5T#250MS T
W
T1 & =
Network 4: When the timer T1 expires, the memory word 100 is incremented by 1.
ADD_I
??.? EN
MW100 IN1 OUT MW100
1 IN2 ENO
Network 5: The MOVE instruction allows you to output the different clock
frequencies at outputs Q12.0 through Q13.7.
M001
MOVE
??.? EN OUT QW12
MW100 IN ENO
Signal Check
A signal check of timer T1 produces the following result of logic operation (RLO) for
the negated input parameter of the AND logic operation (M0.2) in the clock pulse
example:
1
0
250 ms
As soon as the time runs out, the timer is restarted. Because of this, the signal
check produces a signal state of 1 only briefly.
The negated (inverted) RLO:
1
0
250 ms
Every 250 ms the RLO bit is 0. The jump is ignored and the contents of memory
word MW100 is incremented by 1.
Scan Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0 Time Value
Cycle in ms
0 0 0 0 0 0 0 0 0 250
1 0 0 0 0 0 0 0 1 250
2 0 0 0 0 0 0 1 0 250
3 0 0 0 0 0 0 1 1 250
4 0 0 0 0 0 1 0 0 250
5 0 0 0 0 0 1 0 1 250
6 0 0 0 0 0 1 1 0 250
7 0 0 0 0 0 1 1 1 250
8 0 0 0 0 1 0 0 0 250
9 0 0 0 0 1 0 0 1 250
10 0 0 0 0 1 0 1 0 250
11 0 0 0 0 1 0 1 1 250
12 0 0 0 0 1 1 0 0 250
T
1
M 101.1 0
Time
0 250 ms 0.5 s 0.75 s 1 s 1.25 s 1.5 s
DB1
OPN
Network 2: Input word IW0 is added to shared data word DBW3 (data block must
be defined and opened) and the sum is loaded into memory word MW100. MW100
is then multiplied by 15 and the answer stored in memory word MW102. MW102 is
divided by MW0 with the result stored in MW4.
ADD_I
??.? EN
Heating an Oven
The operator of the oven starts the oven heating by pushing the start push button.
The operator can set the length of time for heating by using the thumbwheel
switches shown in the figure. The value that the operator sets indicates seconds in
binary coded decimal (BCD) format.
Oven
4 4 4
T1 & =
Network 2: If the timer is running, the Return instruction ends the processing here.
T1 & RET
Network 3: Mask input bits I 0.4 through I 0.7 (that is, reset them to 0). These bits
of the thumbwheel inputs are not used. The 16 bits of the thumbwheel inputs are
combined with W#16#0FFF according to the (Word) And Word instruction. The
result is loaded into memory word MW1. In order to set the time base of seconds,
the preset value is combined with W#16#2000 according to the (Word) Or Word
instruction, setting bit 13 to 1 and resetting bit 12 to 0.
WAND_W
??.? EN
Network 4: Start timer T1 as an extended pulse timer if the start push button is
pressed, loading as a preset value memory word MW2 (derived from the logic
above).
T1
I 0.7 & SE
MW2 TV