Lab2 SET-RESET

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 12

INTERNATIONAL UNIVERSITY

SCHOOL OF ELECTRICAL ENGINEERING

Programmable Logic Control (PLC) Lab- EEAC007IU

LAB 2: SET/RESET Ladder Logic

Full name: …………………………………..……………


Student’s ID: ……………………….…………………….
Class/Group: ………………………………………..…....
Date: …………………………………………….……….

Programmable Logic Control (PLC) Lab Page 1 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

I. OBJECTIVES
 Continue working with ladder logic diagram
 Differentiate the meanings of contact, coils, and FBD
 Understand and apply with LAD and FBD: P/N edge detections, Set/Reset

II. COMPONENTS & EQUIPMENTS


1. PC Pentum 4, 1.7 GHz, 1(XP)-2(Vista) GB RAM, free disk storage approximation 2 GB;
Operating system Windows XP Professional SP3/Windows 7 Professional/ Windows 7
Enterprise/ Windows 7 Ultimate/ Windows 2003 Server R2/Windows Server 2008
Premium SP1, Business SP1, Ultimate SP1
2. Software STEP 7 Professional V11 SP1 (Totally Integrated Automation (TIA) Portal V13)
3. Ethernet connection between PC and CPU 315F-2 PN/DP
4. PLC SIMATIC S7-1200; e.g, CPU 1214C

III. INTRODUCTION
3.1. Positive edge and negative edge detections
LAD:
Contact:

 P contact (LAD): The state is TRUE when there is a positive transition (from OFF to ON)
occurring at the bit “IN” assigned. Bit logic of this contact together with other signals will
determine the output bit logic.
 N contact (LAD): The state is TRUE when there is a negative transition (from ON to OFF)
occurring at the bit “IN” assigned. Bit logic of this contact together with other signals will
determine the output bit logic.

Programmable Logic Control (PLC) Lab Page 2 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Coil:

 P coil (LAD): bit of “OUT” is assigned with TRUE where there is a positive transition
(OFF to ON) detected from the signal passing through the coil.
 N coil (LAD): bit of “OUT” is assigned with TRUE where there is a negative transition
(OFF to ON) detected from the signal passing through the coil.

FBD:
At the begin of a branch of a network:

 P box (FBD): bit logic at the output of the box is TRUE when there is a positive transition.
 N box (FBD): bit logic at the output of the box is TRUE when there is a negative transition.

At the output of a branch of a network:

 P=box (FBD): bit logic of “OUT” is “TRUE” when there is a positive transition detected at
the input of the box. If this box is placed at the start of a branch of a network, the “OUT”
bit logic is based on the input bit assigned.
 N=box (FBD): bit logic of “OUT” is “TRUE” when there is a positive transition detected at
the input of the box. If this box is placed at the start of a branch of a network, the “OUT”
bit logic is based on the input bit assigned.

Programmable Logic Control (PLC) Lab Page 3 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

3.2. SR (Set/Reset)
Set and Reset for 1 bit and multi-bits
LAD:

LAD Input/ Output Data Type Description


SET OUT Bool When SET is assigned to 1, data at the
address set at the OUT is set to 1 and
this value at OUT does not change even
SET is not activated
RESET OUT Bool When RESET is assigned to 1, data at
the address set at the OUT is set to 0 and
this value at OUT does not change even
RESET is not activated
SET_BF OUT n:Constant When SET_BF is activated, a data
whose equivalent value is 1 is assigned
Elements of Boolean to “n” bit at the address of output OUT.
When SET_BF is not activated, value of
OUT does not change

It must be on the right lung

E.g.#MyArray[3]
RESET_BF OUT n:Constant When RESET_BF is activated, a data
whose equivalent value is 1 is assigned
Elements of Boolean to “n” bit at the address of output OUT.
When RESET_BF is not activated, value
of OUT does not change.

It must be on the right lung

E.g.#MyArray[3]

FBD:

Programmable Logic Control (PLC) Lab Page 4 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Input/Output Type Data Type


IN Boolean
OUT Boolean

SR and RS:

 Set/Reset block (SR): is used to set or reset the bit of the specified operand, depending on
the signal state of the inputs S and R1. If the signal state is "1" at input S and "0" at input
R1, the specified operand is set to "1". If the signal state is "0" at input S and "1" at input
R1, the specified operand will be reset to "0". Input R1 takes priority over input S. When
the signal state is "1" on both inputs S and R1, the signal state of the specified operand is
reset to "0".
 Reset/Set block (RS): is used to reset or set the bit of a specified operand based on the
signal state of the inputs R and S1. If the signal state is "1" at input R and "0" at input S1,
the specified operand will be reset to "0". If the signal state is "0" at input R and "1" at
input S1, the specified operand is set to "1". Input S1 takes priority over input R. When the
signal state is "1" at both inputs R and S1, the signal state of the specified operand is set to
"1". The instruction is not executed if the signal state at the two inputs R and S1 is "0". The
signal state of the operand then remains unchanged. The current signal state of the operand
is transferred to output Q and can be queried there.
Input and Output Data type Description
RS R Bool _Set takes priority. If
set signal (S1) and
reset signal (R) are
S1 Bool both true, value at
Q Bool OUT=1
SR S Bool _ReSet takes priority. If
R1 Bool set signal (S) and reset
signal (R1) are both
Q Bool true, value at OUT=0

 Truth tables

RS SR
S1 R OUT S R1 OUT
0 0 Previous state 0 0 Previous state

Programmable Logic Control (PLC) Lab Page 5 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

0 1 0 0 1 0
1 0 1 1 0 1
1 1 1 1 1 0

IV. EXERCISES (PRE-LAB)


Exercise 1. SR flip flop

Build the given circuit and Observe the operation. Under what conditions that the output
LIGHT is set/reset?
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………

Exercise 2. RS flip-flop.
Build the following circuit

Programmable Logic Control (PLC) Lab Page 6 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Observe the operation. Under what conditions that the output LIGHT is set/reset?
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………

V. EXPERIMENTS
Experiment 1. Use SET/RESET LAD contacts and coils
Write a LAD program to describe the following event:
1. Press START button to set the Outputs Q0.0, Q0.5, Q0.6, Q0.7 to 1. These outputs do
not change the values even the button is released
2. Press RESTART to reset the Outputs Q0.0, Q0.5, Q0.6, Q0.7 and these outputs do not
change the values even the button is released

Experiment 2. Use SET/RESET LAD contacts and coils


Write a LAD program to describe the following event:
1. Press first button, the LED 1 and LED 5 are ON
2. Press second button, the LED 2 and LED 4 are ON
3. Press third button, LED 3 is ON
4. Press fourth button, LED 5 is OFF

Programmable Logic Control (PLC) Lab Page 7 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Experiment 3. Use P edge and N edge, SET/ RESET LAD contacts and coils
Write a LAD program to describe the following event:
1. When press and release Button 1, Output 1 works
2. When press Button 2, Output 2 works.
3. When press STOP, both Outputs 1 and 2 are off
Verify the results using LEDs.

Experiment 4. Priority circuit with contactor to run the motor


A control circuit using contactor is a self-sustainable circuit or a circuit with memory. Known
that for this circuit, if buttons S1 and S2 are both pressed while the contactor is having electric
current, this circuit priory runs the motor (if it is considered as the output). The circuit is shown
in the following Figure 1:

Figure 1
Table of Symbol
S1 START button- Normally Open (NO)
S2 STOP button- Normally Close (NC)
K1 The contactor as output
Tasks:
1. Describe the operation of the circuit with contactor.
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………

Programmable Logic Control (PLC) Lab Page 8 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

2. Use ladder logic diagram with appropriate Set/Reset FBD to perform the operation of the
above circuit. Verify the work using kit or LEDs in the lab. Show the result to the
instructor.

Experiment 5. Priority circuit with contactor to stop the motor


A control circuit with contactor is re-investigated. In this case, when both buttons S1 and S2
are both pressed but the contactor does not have the electric current passed, the circuit will
priory stop the motor.

Figure 2.
Table of Symbol
S1 START button- Normally Open (NO)
S2 STOP button- Normally Close (NC)
K1 The contactor as output

Tasks:
1. Describe the operation of the circuit with contactor.
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
……………………………………………………………………………………………………
2. Use ladder logic diagram with appropriate Set/Reset FBD to perform the operation of the
above circuit. Verify the work using kit or LEDs in the lab. Show the result to the
instructor.

Programmable Logic Control (PLC) Lab Page 9 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Experiment 6. Control the convey belt by SET/RESET


A package A is carried on the conveyor belt shown in the following figure. When the package
reaches the desirable destination, the sensor CB1 detects and the conveyor belt stops. Press S1
to allow the belt to continue running until the next package is detected by the sensor CB1
again. A whole process is then repeated.

Figure 3. A conveyor belt


Write a ladder logic program using appropriate SET/RESET FBD or LAD to perform the
operation. Verify and show the result to instructor.

Experiment 7. Detecting the Direction of a Conveyor Belt


The following Figure 4 shows a conveyor belt that is equipped with two photoelectric barriers
(PEB1 and PEB2) that are designed to detect the direction in which a package is moving on
the belt. Each photoelectric light barrier functions like normally open contact.

Figure 4. 2 directions conveyor belt

Programmable Logic Control (PLC) Lab Page 10 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Known that

Write an algorithm using Ladder logic to describe the direction of the conveyor belt.

Experiment 8. Interlock control circuit

Figure 5. The Entry/ Exit of the parking lot


The Entry/Exit of the parking lot is a single lane passage. By controlling the indicators
appropriately, the program ensures that only one car can pass through the Entry/Exit. Known
that, in the parking lot, there are two indicators Y0 and Y1 individually directing the entering
and leaving cars respectively. By the interlock control circuit, only one indicator will show
“GO” signal.
 When an entering car draws near the vehicle control barrier, car entering sensor X0 will
be ON and Y0, the entering car indicator, will show “GO”. At the same time, the
leaving car indicator, Y1, will show “STOP”. In this case, car entering is allowed but
leaving is prohibited.
 When a leaving car draws near the vehicle barrier, the car leaving sensor X1 will be ON
and Y1 will show “GO” and Y0 will show “STOP”.
Write an algorithm based on ladder logic to describe the operation of this parking lot.

Programmable Logic Control (PLC) Lab Page 11 of 12


INTERNATIONAL UNIVERSITY
SCHOOL OF ELECTRICAL ENGINEERING

Experiment 9. Write an algorithm based on ladder logic to describe the following operations
a) 1st case:
 When START button is pressed, motor will run and a LED indicating the running
motor will be ON simultaneously.
 When STOP button is pressed, motor will be stopped and a LED indicating the
stopping motor will be ON simultaneously.
b) 2nd case:
 When proximity sensor is triggered, the fan will run and a LED indicating the running
motor will be ON simultaneously.
 When proximity sensor is left undetected, the fan will stop and a LED indicating the
stopping fan will be ON simultaneously.

Programmable Logic Control (PLC) Lab Page 12 of 12

You might also like