Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

LAB02 ME3013/14 – Programmable Logic Controllers

HCMC University of Technology Laboratory 02:


Faculty of Mechanical Engineering
Department of Mechatronics PROGRAMMING PLC WITH GX WORKS
1. Introduction
1.1. Introduction
GX Works software provides an efficient and easy way to create and edit sequence programs for
PLCs. It is easy to debug programs and update them as necessary with GX Works. The operation status
of the PLC and program can be monitored with personal computer (PC) screen, so if some parts are not
working as planned, changes and updates can be conducted at once.
1.2. Objective:
In this lab, students will learn how to create a program using GX Works with the followings:
- Write Ladder programs using basic instructions (I/O instructions) with GX Works.
- Explain the operation of Timer and Counter and use them in programming exercises.
- Write the programs for a sequential control using Ladder.

2. Lab software and device


2.1. GX Works 2:
GX Works 2 (GXW2) uses internationally standardized programming languages including Ladder
Logic, Sequential Function Chart (SFC) and Structured Text (ST).
Programs are developed using a personal computer running GXW2 and it is usually written to the
programmable controller CPU via a USB or Serial cable.
Some major functions of GXW2 are listed below:
- Memory and file management
- Developing programmable controller programs
- Managing program documentation (comments, etc.)
- Reading/writing data (especially programs) from/to the CPU module
- Verifying program operation

1
LAB02 ME3013/14 – Programmable Logic Controllers

The display screen of GXW2


2.2. Lab device
- Laptop with GX Works 2 (self-prepared)

3. Lab contents
3.1. Duration: 5 class hours / group (2-3 students).
3.2. Basic exercises:
3.2.1. Build a new project:
 Open GXW2: Start  Programs  MELSOFT  GX Works 2.

 Project  New project  Select:


o Project type: Simple project
o PLC Series: FXCPU
o PLC Type: FX3G
o Language: Ladder
o Press OK

2
LAB02 ME3013/14 – Programmable Logic Controllers

 Write a program
 Compile  Build (or press F4) to convert the written program

 Online  Write to PLC … . Apply the same steps as described in Lab01

3.2.2. Input and output instructions

3.2.3. Set and reset instructions

3.2.4. Interlocking: one output would literally lock another output in place if the first one was
conducted, and vice versa.

3
LAB02 ME3013/14 – Programmable Logic Controllers

Question: If both inputs (X2 and X3) are active simultaneously, which output (Y0 or Y1) is
energized? Please check and answer.
3.2.1 Blinking light: Please read and compile the following code to learn Timer operation.

3.2.2 Counting workpieces: Please read and compile the following code to learn Counter
operation.

3.3. Sequential control:


Some of the basic ideas about sequential control are:
- Steps (states) with actions to be executed when the step (state) is active.
- Transitions from one active step (state) to another taking place if the transition condition is
logically true.

4
LAB02 ME3013/14 – Programmable Logic Controllers

Action(s)

Action(s)

Grafcet flowchart
There are some rules when designing the sequential control:
- Use one control relay (CR) for each step (state) in a control flow.
- When one step is active, only the control relay in this step is energized and other relays are
de-energized.
- The number of steps in the control flow is one-by-one with number of steps in a control
program. Each step in the control flow is described as a rung in ladder (control) program as
shown in Fig. 3.
With supposing that Step i, j and k are the consecutive steps.

A control rung
Fig. 4 shows an example of the sequential control which is described by a Grafcet flowchart

5
LAB02 ME3013/14 – Programmable Logic Controllers

Start
X1

Step 1 Y1
T1=3s

Step 2 Y2
T2=2s

Step 3 Y3
T3=2s

Step 4 Y4
T4=2s

A Grafcet flowchart of the sequential control


The below figure shows Ladder program of the sequential control based on the above
flowchart.

6
LAB02 ME3013/14 – Programmable Logic Controllers

Ladder program for the sequential control

Exercise 01: Based on the above example, please answer the following two questions
- (1A) When output (light) Y2 or Y3 or Y4 turns ON, if button X1 is pressed what happen? If
something is wrong, please solve this problem.
- (1B) From the answer 1A, modify the transition condition between (active) step 2 (M2, line
10) and step 3 (M3, line 19) to “If X4 is pressed three times and Timer T2 turns ON”  Step
3 (M3) is active. Please write down your answer.

Caution: Double output (coil)

Exercise 02: Based on Exercise 1A, write the program as the followings:
- In step 2: Output Y2 and Y3 turn ON
- In step 3: Output Y2, Y3, and Y4 turn ON

Exercise 03: Consider the pump system as shown below.

- There are 3 outputs pump, valve (V), and motor.


- There are two inputs X0 and X1 for a start and stop.
- When X0 is pressed, pump Y0 should get on for 10 seconds.
- After 10 seconds, Y0 off, and valve Y1 should get on for 5 seconds.
- After 5 seconds, Y1 off, and motor Y2 should get on for 7 seconds.
- After 7 seconds, the system should stop until X0 is pressed again.
- Draw a flowchart and make a program for this.

7
LAB02 ME3013/14 – Programmable Logic Controllers

Exercise 04: There is a car parking area as shown below.

- There are two inputs for a start and stop.


- There are entry gate Q0 and exit gate Q1.
- On entry, the system has two sensors, I0 outside and I1 inside.
- On exit, the system has two sensors I2 and I3.
- When a car comes in front of I0 sensor, gate Q0 is open.
- When a car reaches to I1 sensor, nothing will happen.
- When the car crosses sensor I1 then gate Q0 will be closed and counted up.
- Inside the parking area, when the car reaches sensor I2, exit gate Q1 is open.
- When the car crosses I3 sensor, then Q1 is closed, and it would be count down on display to show
the present number of cars inside the parking area.
- The maximum number of parked cars is ten. When parking area is full, and the 11th car comes in
front of entry sensor I0, the entry gate should not open.
- Draw a flowchart and make a program for this.

8
LAB02 ME3013/14 – Programmable Logic Controllers

HCMC University of Technology PROGRAMMING PLC WITH GX WORKS


Faculty of Mechanical Engineering
Department of Mechatronics Class:…… Group:… Date:…/.…/20….

Name Student ID Signature

Answer:

You might also like