ED4260 Manual

January 4, 2021 | Author: Anonymous | Category: N/A
Share Embed Donate


Short Description

Download ED4260 Manual...

Description

Quality assurance offers the quality assurance for this product.

Considerations for quality assurance Assurance contents We guarantee 1 year after service from the date of purchasing this product. If this product has any troubles or errors within such a period, you can receive free service from ED customer support center. Expenses covered by customers The necessary services shall be offered at a minimum cost of customers in the following cases. 1) If the warranty period expires. ※ However, it shall be valid for 5 years after the warranty period expires.

2) If the product has any troubles due to customers' negligence or Act of God. ※ They shall be handled at a charge of customers even during the warranty period.

Not guaranteed Any deliberate disassembly of this product for improving the performance cannot be covered by the manufacturer's warranty responsibility. Service guide Please, contact our customer support center for service application and consultation. Customer support center: +82-31-730-7525

FAX : +82-31-730-7313

※ For the safe and correct use of this product, please make sure to read the user's manual carefully before using it and follow the guidelines on how to handle and use this product.

Notice for equipment changes This product is subject to change without prior notice to improve its appearance, specifications and performance.

Caution 1. Keep the Manuals This manual provides basic information on ED-4260 System, the PLC experiment training device, along with directions for use. Before proceeding, it should be mentioned that the main unit of PLC under discussion is "GLOFA-GM4"manufactured by LS Industrial Systems(http://eng.lsis.biz). Therefore, one should refer to the manual provided with the product for basic instructions on usage. This manual focuses on how to use the peripherals and option module for PLC training, and it should also be noted that all manuals provided with ED-4260 should be kept with care. Manuals of other optional equipments should be kept too.

2. Manual *

Programmable Logic Controller (ED-4260 Experimental Manual)

※ Manuals for each option module is provided with the equipment. (This training book provides directions for using option modules) 3. Be Acquainted (1) The caution and the rest of the content of each manual must be read prior to using the equipment. (2) Read the information on functions of each module and the instructions for using the equipment before use. (3) Know in advance the functions and the usage of the power supply and the I/O ports in the ED-4260 frame, as well as the basic module (3 types). The basic modules are as follows : * PLC Input Controller (IM-4260-2) * PLC Output Simulator (OM-4260-3) * Count & Position Simulator (PM-4260-4)

(4) The input of this PLC is DC 12V~24V type. Therefore, one must never give the power over DC 24V to the PLC input port. (between input terminal and the com(common) terminal). (5) The maximum allowed amount current for the output contact of the PLC output module is 2A. For more that 1A load at AC 250V, a another auxiliary relay is required. (6) Care should be taken not to store or use the device under conditions below: * Humidity * Heat * Vibration * Dust * Direct sunlight

Table of Contents The Basics of PLC (Programmable Logic Controller) Chapter 1 Introduction to PLC

1 3

1-1. Control Elements

3

1-2. Definition of PLC

3

1-3. History of PLC

4

1-4. Standards and Characteristics of PLC

5

1-5. Selection and Application of PLC

8

Chapter 2 The Structure of PLC

10

2-1. Hardware Structure

10

2-2. Input and Output Structure of PLC

12

2-3. Software Structure

15

Chapter 3 PLC Program (GMWIN) Setup

21

3-1. PC Requirements

21

3-2. Installing GMWIN

22

Chapter 4 Programming Tool (GMWIN)

25

4-1. Launching GMWIN

25

4-2. User Interface

30

4-3. Project Structure

31

4-4. LD Edit

33

4-5. Upload

34

4-6. Menu

36

4-7. Toolbar

43

4-8. Files Created by GMWIN

47

4-9. Opening Files

48

4-10. Saving Files

50

Chapter 5 Data Representation

52

5-1. Variable Representation

52

Chapter 6 Execution

61

6-1. Scan Time

61

6-2. I/O Refresh

62

6-3. I/O Image Area

62

6-4. Operation Mode

62

6-5. Changing the Operation Mode

64

6-6. Restart Mode

66

Chapter 7 Programming Basics 7-1. Using the Toolbar

69 69

7-2. Sequence Operators

106

7-3. List of Functions

107

7-4. List of Function Blocks

118

Chapter 8 Basic Sequence Circuits

120

8-1. AND Circuit

120

8-2. OR Circuit

121

8-3. NOT Circuit

122

8-4. Self Holding Circuit

123

8-5. Interlock Circuit

124

8-6. On-Delay Circuit

126

8-7. Off-Delay Circuit

127

8-8. One Shot Circuit

128

Appendix Glossary

ED-4260 PLC Trainer Chapter 1 Introduction of ED-4260 PLC Trainer

129

133 135

1-1. Introduction of ED-4260

135

1-2. Basic Components of ED-4260 PLC Trainer System

136

1-3. Option System

137

1-4. ED-4260 Specifications

138

Chapter 2 Usage of ED-4260

140

2-1. The Demonstration Frame

140

2-2. I/O Module and its Connection

146

2-3. Position Control Module

152

Chapter 3 Option Modules

156

3-1. A/D Converter(AD-4260-5)

156

3-2. D/A Converter(DA-4260-6)

160

3-3. Temperature Sensor Module(SU-4260-9)

164

3-4. Photo Control SCR Circuit(PC-4260-10)

168

3-5. Power & Terminal Transfer Unit(PT-4260-7)

172

3-6. Potentiometer & Meter Unit(PM-4260-8)

175

PLC Training Using the ED-4260 Trainer

177

Exercise 1

PLC I/O(ED-4260 TRAINER) Practice

179

Exercise 2

Program Practice using Subroutine Commands

191

Exercise 3

Motor's Start/Stop Circuit Practice

197

Exercise 4

Motor's Forward/Reverse Control Program Practice

203

Exercise 5

Program Practice using SET & RESET

209

Exercise 6

Positive/Negative Transition Sensing Pulse Coil Program

215

Exercise 7

3-Phase Induction Motor's Y-△ Start Circuit Program

220

Exercise 8

Program Practice using Counter(UP)

227

Exercise 9

Program Practice using Branch JUMP Command

234

Exercise 10 Program Practice using Return Command

239

Exercise 11 Program Practice using Transmission(MOVE) Command

243

Exercise 12 Motor's Upper/Lower Limit Linear Movement Circuit Practice

249

Exercise 13 Stepping Motor Circuit Practice using Timer

254

Exercise 14 Applied PracticeⅠ (Quiz Program Practice)

259

Exercise 15 Applied PracticeⅡ (Electronic Timer Program Practice)

262

Exercise 16 Applied PracticeⅢ (Lamp Shift Lighting Program Practice)

265

Exercise 17 Applied PracticeⅣ (Timer External Control Program PracticeⅠ)

268

Exercise 18 Applied PracticeⅤ (Timer External Control Program Practice Ⅱ) Exercise 19 Applied PracticeⅥ (Die Program Practice)

272 275

Exercise 20 Applied PracticeⅦ (ONE-SHOT Circuit Practice using TP Timer)

278

www.ed.co.kr

CH1. Introduction to PLC / 3 CH2. The Structure of PLC / 10 CH3. PLC Program (GMWIN) Setup / 21 CH4. Programming Tool (GMWIN) / 25 CH5. Data Representation / 52 CH6. Execution / 61 CH7. Programming Basics / 69 CH8. Basic Sequence Circuits / 120 Appendix Glossary / 129

The Basics of PLC

Chap. 1 Introduction to PLC 1-1. Control Elements ① Input device: Composed of sensor, which converts physical signal into electric signal, and a converter, which transfers the signal to the controller. ② Output device: Converts the control signal generated by the device to operational signals to stimulate the actuator. ③ Control device: Sends output signals by executing the appropriate control method and control algorithm depending on the input condition. It is categorized into programmable controller, which has the control algorithm stored in memory as software to enabling easy modification, and hardware system, where once the control algorithm is set, it cannot be modified.

Input element

Control element Measurement

Processing

Output element Operation

(Control Device) (Algorithm) (Controller)

(Transducer)

(Actuator)

[Figure 1-1] Elements of control system

1-2. Definition of PLC PLC(Programmable Logic Controller) replaces functions such as relay, timer, counter used in old controller with semi-conductor component such as IC and transistor, adding computation abilities to the basic controlling function to make programmed control possible. National Electrical Manufacturers Association (NEMA) defines PLC as "a digital oriented electronic device which uses programmable memory to perform special functions such as logic, sequencing, timing, counting, and computation through digital or analog input/output module, and which controls variety of machines and processors."

www.ed.co.kr

The Basics of PLC

1-3. History of PLC The development of the industrial society led each manufacturing process to become larger in scale, and more advanced and complex, requiring many different forms of control systems. A lot of time and money is needed to organically interconnect and modify these control systems. Up to now, control systems for automation were connected to related electronic components, such as relay, controller, timer, counter, etc, depending on the circuit layout, which led to problems such as difficulty in the wiring process and need large amount of space for sequence control, also has a limitation of processing speed of operation. Recognizing these problems, in 1968, General Motors, the American automobile manufacturer, suggested 10 conditions for PLC, as shown in [Table 1-1], which became the starting point of PLC development. [Table 1-2] is a brief history of PLC. [Table 1-1] 10 conditions suggested by GM

(1) Should be easy to implement and modify program and sequence system. (2) Maintenance and repair must be easy and must be plug-in type. (3) Should be more reliable than relay controller. (4) Output should be able to be connected to higher level computer. (5) Should be smaller in size than relay controller. (6) Should be more cost-effective than relay controller. (7) Input should be supplied with AC115[V]. (8) Should be output AC115[V], 2[A]. (9) Should be expandable without making much modification of the entire system. (10) Should be equipped with programmable memory, which is expandable to at least 4k words.

www.ed.co.kr

The Basics of PLC

[Table 1-2] History of PLC Year

Progress

1968

The birth of the concept of PLC Introduction of logic control, 1k memory capacity and 128 I/O point handler Timer, counter, arithmetic operations, 12k memory capacity, and 1024 I/O point handling

1970 1974 1976

Introduction of remote I/O system (first standard created by the US)

1977

Introduction of microprocessor PLC Introduction of high performance I/O module, high performance communication device. high functional software; started to use microcomputer as programming tool Introduction of inexpensive small-size PLC Standardization, distributed and hierarchical control made possible by networking with computer

1980 1983 1985 1991

Fuzzy logic implemented by fuzzy module and fuzzy-only package

1-4. Standards and Characteristics of PLC 1) IEC Standard Language Until now, engineers who wished to work with PLC faced difficulties because the language and communication networks were different for many PLC makers. In order to fix this problem and bring more convenience to the user, IEC (International Electrotechnical Commission) drew up an international standard specification (IEC 1131) which, as shown in [Table 1-3], is composed of 5 parts. [Table 1-3] IEC 1131 Part

Description

Part 1

Basic features of PLC and definition of terms

Part 2

Required functions and testing conditions of the facility

Part 3

Programming language

Part 4

Notice to users

Part 5

Communication and network

www.ed.co.kr

The Basics of PLC

Some important features introduced by IEC are as follows: ① Support for many data types ② Components such as function, function block, program, etc, which made both top -down and bottom-up design and structured implementation possible ③ User programs can be made into libraries to be used in other environment ④ Support for multiple languages, from which user can choose the most optimal language for use. ⑤ The standard PLC language suggested by IEC consists of two graphic languages, two text-based languages, and SFC.

(1) Graphic Language ① LD (Ladder Diagram) : Originates from ladder in the U.S. Input and output are combined to form a program, which is a type of relay logic representation. ② FBD (Function Block Diagram) : Program represented by connecting the block functions.

(2) Text-Based Language ① IL (Instruction List) : Used in Europe. Command type language similar to assembly language. ② ST (Structured Text) : A high-level language developed to be used for real-time ap plications and is based on Pascal and C. ③ SFC (Sequential Function Chart) : Sequentially describes the flow and conditions of manufacturing process, where time, event, etc are defined as control sequence blocks.

www.ed.co.kr

The Basics of PLC

2) Characteristics of PLC [Table 1-4] lists the characteristics of PLC and other control devices, showing the strength and weakness of each. [Table 1-4] Comparison of Controllers Category

Relay Controller

Digital Logic

Computer

PLC

Price

Very inexpensive

Inexpensive

Expensive

Inexpensive

Size

Large

Very small

Moderate

Very small

Speed

Slow

Very fast

Very fast

Fast

Noise

Good

Fair

Excellent

Fair

Control

Much time for design and integration

Much time for designing

Very much time for programming

Simple

None

Supported

Supported

Supported

Very difficult

Difficult

Very simple

Very simple

Very difficult

Difficult

Very simple

Very simple

Complex Functions Usage Modification Maintenance

◈ Characteristics of PLC - Wide variety of functions - High functionality of program (easy to design control circuit) - Easy to control - Easy to maintain - Reliable - Easy to install

www.ed.co.kr

The Basics of PLC

1-5. Selection and Application of PLC 1) Selecting PLC In order to select PLC, it is necessary to have a thorough understanding of the subject of control, especially about the features, price, scalability, maintenance, whether the model will continue to exist in the market, and the user.

(1) Figuring the "Input Points" Combine the number of signal inputs, such as push button switch, limit switch, etc, with the number of sensors, such as proximity sensor, photo sensor, reed switch, to derive the input points and select a reasonable capacity. In addition, select input module with the appropriate specifications (AC or DC and voltage), taking into consideration the voltage requirements of the sensors, etc.

(2) Figuring the "Output Points" Sum up the number of power indicators, operation indicators, overload indicators, bells, etc. to derive the output points. Combine modules in point units of 8, 16, 32, etc, to derive the module count. In addition, since there are relay contact type, TR output type, SSR output type, etc, the voltage specification must be taken into account. ※ Relay contact output type, which is not restricted by the output voltage, is generally used.

(3) CPU and Support for Special Modules Generally, support for analog I/O and special cards (HSC, POP, PID, etc), in addition to digital I/O, should be taken into consideration, along with the characteristics of the CPU.

www.ed.co.kr

The Basics of PLC

2) Application of PLC The applied area of PLC is expanding as facilities are challenged to be automated more efficient. Specifically, the demand for PLC due to factory automation and FMS has added to the old role of PLC of replacing the relay controller, the role in small manufacturing machines to large scale system facilities, as the current trend is for large scale and high functionality. [Table 1-5] shows applications of PLC, organized by the subject of control. [Table 1-5] Application of PLC Field Food Steel Production Fiber & Chemical Automobile Manufacturing Machine Industry Water & Sewage Services Logistics Factory Equipment Pollution Reduction

Subject of Control Conveyer master control, automated production line control Cargo control, raw material transport control, rolling machine control Cargo control, conveyer control, dyeing machine control Transfer line control, automated assembly control Industrial robot control, manufacturing machine control, water pump control Filtration plant control, sewage disposal plant control, water pump control Automated warehouse control, cargo facility control, return line control Compressor control, etc Automated incinerator control, pollution prevention control

www.ed.co.kr

The Basics of PLC

Chapter 2 The Structure of PLC 2-1. Hardware Structure PLC is composed of the CPU, which is composed of microprocessor and memory, and is analogous to the human brain, the input and output part which takes connection with external peripheral devices, the power supply, and peripheral device which writes the program to the PLC memory. [Figure 2-1] shows the PLC structure as a whole.

Input Device ∶

Loader 󰀶 󰀶



Output Device ∶ ∶ ∶

∶ ∶ Limit Switch

I

Memory

u

n Proximity Sensor

∶ Magnetic Contactor

t

p

󰀵

u

󰀶

t Photo Sensor

O

p

Solenoid

u t

➜ Microprocessor ➜

Pilot Lamp

[Figure 2-1] The Overall Structure of PLC

1) CPU of PLC Correspond to the role of the PLC brain, which fetches programs stored in memory one by one and decodes and executes each one. This process is repeated very rapidly and all data is processed in binary form.

www.ed.co.kr

The Basics of PLC

2) The Memory of PLC CPU (1) Types of memory There are two types of IC memory, namely ROM and RAM. ROM is read only memory, as it stands for, whose content cannot be modified, and, therefore, used to store fixed data. This type of memory is said to be involatile, for it retains its content even when the power is cut off. On the other hand, it is possible to read data from and write data to RAM at any time. RAM is used to temporarily store data, but any data it contains will be lost if the power is cut off, making it a volatile type of memory, although it is possible to save a part of the RAM by using a small amount of battery power, to utilize it as involatile section of memory.

(2) Memory content The memory of PLC is divided into user program memory, data memory, and system memory. User program memory contains the program created by the user to suit the specification of the subject for control. Since user program must be able to be stored in the course of the development and need for modifications may arise later, user programs are stored in RAM. When the development of the program has been completed and the program becomes fixed, it can be stored in ROM for ROM operation. Data memory stores data such as contact status of input and output relay, auxiliary relay, and the setting & current value of the timer and counter, etc. which is subject to change dynamically, so it is stored in RAM. System memory is used to store system program provided by the PLC manufacturer. Since this kind of system program is a critical factor to determine the functionality and performance of the PLC, it is written to ROM by the PLC manufacturer.

www.ed.co.kr

The Basics of PLC

2-2. Input and Output Structure of PLC The input and output part of PLC is connects directly to the peripherals(input/output elements) at site. Although the internal circuit of PLC uses DC +5(V) power (TTL level), the input and output part operates on a different voltage(DC 24V, AC 220V etc.), therefore we must consider the interface between the inside and the outside of the PLC is a critical factor for ensuring system stability. Following is the requirements for the input and output part: ① It must match with the external device in its electronic specifications. ② Noise from the external device must not reach or affect the CPU. (use photocoupler) ③ Connection to external device must be easy. ④ It must be possible to monitor the status of each contact of input and output (add LED) [Table 2-2] shows the external device connected to the input and output part. [Table 2-2] Input and Output Devices I/O

Category

Contact Type

Installation Point

Control Part and Operation Part

Input Contactless Type

Mechanical Device

Indicator

Control Part and Operation Part

Actuator

Mechanical Device

Output

www.ed.co.kr

External Device Push-Button Switch Selector Switch Toggle Switch Level Switch(contact type) Limit Switch Reed Switch Photo Sensor Level Sensor Proximity Switch Pilot Lamp Bell(Buzzer) Electromagnetic Valve(solenoid) Electromagnetic Clutch Electromagnetic Brake Electromagnetic Switch (magnetic contact)

The Basics of PLC

1) Input Part Transfers signal from external devices to the arithmetic logic unit of the CPU. There are DC 24[V], AC 110/220[V] inputs, as well as other inputs module such as analog input (A/D) module, high speed counter module, etc. [Figure 2-3] represent an example of the input part circuit.

Device

Device

[Figure 2-3] Input part circuit

2) Output Part Transfers results of internal computation to external devices such as magnetic contactor or solenoid to drive them. Types of output includes relay output, transistor output, and SSR (Solid State Relay), and for other output modules, there are analog output (D/A) module and position control module(POP). [Figure 2-4] shows an example of transistor output module.

www.ed.co.kr

The Basics of PLC

+24V Diode

Indication LED

Internal Device

External Device

Load

Photo Coupler [Figure 2-4] Transistor Output Module

[Table 2-3] PLC Types of Output Module Supply Voltage Direct Current (DC) Alternating Current (AC)

Switch Component Less type contact Type contact (Semiconductor) Relay Transistor Relay

SSR

As shown in [Table 2-3], relay output can be used for both DC and AC, but considering the limit in the durability of mechanical components, it is recommended to use a contactless element as below SSR output in AC or the transistor output in DC. ※ Special modules ① Position control module Process rapid contact output at the designated frequency range and voltage level. ② PID control module Computes raw data received from analog input modules to reach the desired value, using optimal conditions, and outputs the result to analog output module. ③ Desired value control Control the desired value by repeatedly increasing, decreasing and sustaining the current value within predetermined amount of time. ④ Etc. Communication module, network module and specific control module.

www.ed.co.kr

The Basics of PLC

2-3. Software Structure 1) Introduction to Programming There is no fundamental difference between PLC control sequence and using relay, timer as done in the past. In order to understand and make the sequence program, the user must have knowledge in following 3 areas. ① Characteristics of the subject of control, that is electric condition of the goal of controlling, operation method, behavior, etc. ② Characteristics of the controlling device, such as relay and PLC, etc. ③ Must be aware of the rules PLC imposes for designing sequence, namely the rules concerning the symbols for diagram, device number, status, etc. There is no difference between using a PLC and relay/timer, regarding the above two issues. Therefore, in order to understand PLC control sequence, it is important that one have knowledge about the characteristics of PLC and how to use it. For example, there are hardware specifications such as nominal voltage and the number of contacts, and software aspects such as logic operation, timer, and counter. This kind of information can generally be found in the specification section of the catalog. In short, selecting the correct feature out of the many features PLC provides is the key to good design.

2) Hard-wired and Soft-wired Previous methods of relay control relied on laying out the flow of tasks on the circuit diagram and adding necessary controlling device, occasionally requiring lead wiring. This method is called hardwired logic. In hardwired logic, the hardware and the software is coupled as one, so any need for change required modifying both the hardware and the software. Consequently, much effort has been put to separating the hardware and the software, which lead to the introduction of the computer model. Computer cannot operate solely with hardware. It can do any work only if a set of instructions, i.e. a program, is loaded in its memory. The process of loading the program in the memory is called programming, which can be thought of as the equivalent of the wiring task. This method is called soft-wired logic, and PLC uses this method. www.ed.co.kr

The Basics of PLC

3) The difference between relay sequence and PLC program As PLC is a collection of electronic components such as LSI, it contains no contact such as relay sequence, or coil, and any operation requiring these components are handled in a software manner, activity of which is not visible. In addition, unlike relay sequence which is activated if the contact closes due to the induction in the coil, PLC has the program stored in memory and scans the content sequentially, and operates accordingly. This way, the user can modify the program in any way, to fit the control logic.

(1) Serial Processing and Parallel Processing The most fundamental difference between PLC control and relay sequence is serial processing and parallel processing, as shown in [Figure 2-5]. PLC takes the form of serial processing, where the program stored in the memory is sequentially computed, in relay sequence, many circuits operate simultaneously, which is called parallel processing. Therefore, PLC is doing only one thing at any moment.

(a) Serial Processing

(b) Parallel Processing [Figure 2-5] Computation Method

www.ed.co.kr

(a)

(b) [Figure 2-6] Sequence Diagram

The Basics of PLC

First of all, the operational difference between PLC and relay will be discussed, referring to the sequence diagram in [Figure 2-6(a)]. In relay sequence, if power is supplied and contacts “A” and “B”, and “D” and “E” closes at the same time, output “C” and “F” is activated and whichever was quicker to react is activated first. In contrast, “C” will be activated prior to “F” according to the execution order in PLC. To further looking at the difference between PLC and relay, refer to Figure 2-6(b), where supply of power closes the contact “J”, which activates “H” and blocks activation of “I” in Relay sequence. In PLC, however, closure of “G” causes “I” to become active and closure of “J” causes “H” to become active on the first execution. In the second execution, the output of “I” is cleared by “H,” which has been activated during the first execution.

(2) Restriction on the number of contacts used Generally, relay has a limit in the number of contacts per relay. Consequently, one must be economical in the use of contacts when designing a relay sequence. In contrast, PLC does not impose any limit in the number of contact to use, because it stores the information of each contact (ON/OFF state) in the memory and refers to the data on execution of the program.

(3) Restriction on the location of contact and coil PLC introduces restrictions, or rules, which does not exist in relay sequence, one of which is prohibiting of putting any contacts after the coil, this restriction means that the output coil must be aligned at the right side. In addition, PLC is configured to always carry its signal from left to right, prohibiting signal flow in any other direction, which is possible in relay sequence. [Figure 2-7] shows the rules imposed by PLC.

www.ed.co.kr

The Basics of PLC

[Figure 2-7] Rules in PLC Sequence

(4) Cautions for configuring PLC In case of relay circuits, the effect of malfunction of a part is restricted and other parts continue to work, but in PLC, failure of a part affects the whole system. In this light, it is not always wise to depend solely on PLC for controlling the whole system, and vital circuits, such as circuits for voltage control should be configured out of the PLC. Also, it may be dangerous if the output unit becomes ON at the moment PLC is powered up, so measures should be taken as shown below:

www.ed.co.kr

The Basics of PLC

PLC Power Supply ON

Input Unit

1. The input unit, lamp output unit must be connected in front of the emergency stop circuit, in

OFF

order to monitor the stop status of operation. 2. The output unit retains its Output Unit

ON/OFF

state

right

before

stopping. In this case, the lamp stays on if keeping relay which retains data during power failure is used. We can also make the Emergency

Operation

Stop

Ready

PLC Stop Output

lamp stays on with general rely

THR MC

using self-holding circuit. 3. Stop Output 4. Interlock Circuit: In case

Interlock

of opposing set of operations Output Unit

THR

such as cw and ccw rotation MC1

THR

and the mishandle can cause damage to both machinery

MC2

and men need a interlock. circuit for safety

www.ed.co.kr

The Basics of PLC

(5) Sequence of PLC Programming

Start

Decide Memory capacity and

System Design

the # of input and output units . Operation Flow

I/O Allocation

Independent Module Test

Ladder Design

I/O Device and PLC Wiring

Programming

Modify Program & Reiwiring

NG

Review Test OK Store in floppy disk, PROM,Type HDD.flash Memory

Store Program

Operation

www.ed.co.kr

The Basics of PLC

Chapter 3. PLC Program (GMWIN) Setup 3-1. PC Requirements The following is the hardware and software required to run GMWIN.

1) Computer and memory PC with CPU Intel Pentium or later, and minimum of 128 Megabytes of memory.

2) Serial Port In order to utilize the full functionality of GMWIN and connect with PLC, there needs to be at least two serial ports available.

3) Hard disk drive Minimum of 20 Megabytes of space must be available in the hard disk to install all the GMWIN related files and to run GMWIN smoothly.

4) Floppy disk drive If you choose to GMWIN from floppy disks or save data on floppy disks, a floppy disk drive is required. (CD drive recommended)

5) Mouse A Microsoft Windows compatible mouse is required in order to use all the features of GMWIN.

6) Printer A Microsoft Windows compatible printer is required in order to print in GMWIN.

7) Microsoft Windows Windows 95/98 or a later version is required.

www.ed.co.kr

The Basics of PLC

3-2. Installing GMWIN 1) Installation Procedures ① Insert the CD-ROM in the CD-ROM drive. ② Click[PLC] in PRODUCT INFO → GLOFA-GM → Software → GMWIN → GMWIN 4.1

③ The File Download dialog box appears, and click [Open].

www.ed.co.kr

The Basics of PLC

④ A setup dialog box with a welcome message appears. Any other application is recommended to be closed during the installation process.

⑤ Click

to move to the next step.

www.ed.co.kr

The Basics of PLC

⑥ A dialog appears, showing the path of the folder where the program will be button to choose an

installed. To install at a different folder, click the other folder. To stop the installation procedure, press the

button at any

stage of the installation. In this case, GMWIN will not be able to be launched since the installation was aborted. Click

to move to next step.

⑦ Files will start to be copied from the CD-ROM to the hard disk.

⑧ The GMWIN is successfully installed.

⑨ Before you can use the GMWIN, you must restart your computer.

www.ed.co.kr

The Basics of PLC

Chapter 4. Programming Tool (GMWIN) 4-1. Launching GMWIN 1) From the Windows Start menu, choose Programs - [LGIS], [GMWIN 4], [GMWIN 4.0]. A window in [Figure 4-1] will appear.

[Figure 4-1] GMWIN Program Window

www.ed.co.kr

The Basics of PLC

2) GMWIM start window will appear as below. Click New Project in Project menu as in [Figure 4-2].

[Figure 4-2] GMWIN Project Window

3) Project In the New Project window, project file name is the name specified by the user and if it is not specified, it takes the default project name automatically. PLC type should be set to the type of PLC which will be used. In addition, Writer and Comment are only auxiliary information of the project, so they can be omitted. Refer to [Figure 4-3].

www.ed.co.kr

The Basics of PLC

[Figure 4-3] GMWIN New Project Window

4) Define Program [Figure 4-4] shows the Define Program window. Although the user can specify a name for the program, but since cases may arise that the remembering the instance name to open the file for executing, therefore we recommend to use the default name. The task button of the select condition for run is used do define the condition under which the execution should take place, and Scan program, which executes regardless of the condition, should be selected in this case. It is convenient to give the same name for the program file as the project name, and for existing program, click the Find button and choose the desired file. (Files with different extension are generated during compilation and it is difficult to distinguish the files if the project name and the program name differ.)

www.ed.co.kr

The Basics of PLC

[Figure 4-4] GMWIN Define Program Window

www.ed.co.kr

The Basics of PLC

5) Program [Figure 4-5] shows the window for selecting the language used in the program, where the most convenient one of SFC, LD, and IL should be selected. In this chapter, LD (Ladder Diagram) will be used.

[Figure 4-5] GMWIN Add Program Window

www.ed.co.kr

The Basics of PLC

4-2. User Interface The GMWIN user interface is composed of Program Window, Toolbar, Project window, as shown in [Figure 4-6]. The Program Window and the Toolbar will be covered later.

-----Menu --Toolbar

LD Program Window

Project Window

[Figure 4-6] GMWIN User Interface

www.ed.co.kr

The Basics of PLC

4-3. Project Structure Project is the most basic element of program of GLOFA PLC, and normally there should be one Project per PLC system. Project can be divided into configuration part, parameter part, and inserted library files, where the configuration part is used to define software element such as global variable, access variable, resource content, and the parameter part has hardware related definitions such as basic parameters, I/O parameters, and link parameters. In addition, libraries can be added or removed in the inserted library files. Project structure is shown in [Figure 4-7], and functions are described in [Table 4-8].

[Figure 4-7] Project Structure

www.ed.co.kr

The Basics of PLC

[Table 4-8] Project Hierarchy Hierarchy item

Description

Project

defines the overall PLC system.

Configuration

configures several definitions for the PLC program.

Configuration Global Variable

variable list used over the configuration.

Access Variable

variable list that different configurations can access.

Resource

corresponds to the CPU module.

Resource Global Variable

variable list used over one resource.

Task Definitions

defines the running conditions of the program.

Define Program

describes each program and its running condition.

Direct Variables Comments

comments list used for the Direct Variables.

Parameter

defines the hardware contents of the PLC system.

Basic Parameters

defines basic hardware parameters.

I/O Parameters

describes the contents of the input/output modules.

High Speed Link Parameters

describes the contents of the high speed link parameters.

Inserted Library Files

list of current library files being inserted.

www.ed.co.kr

The Basics of PLC

4-4. LD Edit LD program displays PLC program with graphic symbols used in relay logic diagrams. As shown in the figure below, 'rung comment' contains the description of the corresponding rung. Rung refers to the vertically linked line formed by consecutive rows, as Row 1 to Row 4 in the example figure below, which form a rung, and row 5, is also forms a another rung. Label

Function Block

Row No.

Rung Comment

Function

Coil

Rung Subroutine Call

Contact

Vertical Link Horizontal Link

Jump Label

Subroutine Program

In the above figure, the {END} in Row 7 serves to mark the end of the main program. The rung named Abnomal process is a form of a subprogram(subroutine program), and the subroutine is called in Row 5. Selecting any element form the toolbar will change the mouse cursor to the same shape as the chosen element. Move the mouse pointer to the desired point and click to create a element for LD program.

www.ed.co.kr

The Basics of PLC

4-5. Upload Upload the program to the GMWIN from the PLC after storing the compressed project file and source file in the RAM or flash memory of the PLC.

1) Making the upload file Select in the option to make upload file when making and proceeding with make in the menu will cause to generate the upload file. Upload file contains the project, the program, and the functions and function blocks used in the program. ◆ Choose Project - Options in the menu to bring up the Option dialog box. ◆ Select Upload Program from the dialog box and click OK. It is not necessary to select the variable table (an option used to monitor variables using a separate device later).

PLC execution file and upload program will be generated.

www.ed.co.kr

The Basics of PLC

2) Writing to PLC Choose the upload program when writing to PLC. ◆ Choose Online - Write from the menu. ◆ In the write dialog, choose the parameter, the program and upload program.

Do the following depending on the program size. Program size

Program storage location

executable program size + upload program size < program RAM size

It is stored in the RAM on the CPU

Program RAM size > executable program size + upload program size

If flash memory is installed, it is stored in the flash memory after asking the user for confirmation.

www.ed.co.kr

The Basics of PLC

3) Reading from PLC (Upload) ◆ Choose Project - 'Load from PLC' in the menu. Open the project after creating the project, the program file, and the user libraries by loading the upload file from PLC. If a project with the same name already exists in GMWIN, overwrite it, or save it at another directory or save as another name as specified by the user.

4-6. Menu 1) Project Command

Description

New Project

Creates a project.

Open

Opens a existing project.

Upload Project From PLC

Uploads a project and program in the PLC.

Save

Saves the project. (program is not saved)

Save As

Saves the project as a different name.

Close

Closes the project.

Import Proiect Bundle

Opens project bundle file.

Export Proiect Bundle

Bundles all files connected to the project as one file.

Add Item

Adds new items to the project. (Define program, Resource Task, Library)

M Area Edit

Edits M area or saves it.

Preview

Show the contents which will be printed.

Print Project

Prints the contents of each corresponding point.

Print Program

Prints the contents of the activated window.

Printer Setup

Sets the print options.

Option

Sets the options for the GMWIN.

Exit

Exits the GMWIN.

www.ed.co.kr

The Basics of PLC

2) Program Command

Description

New Program (↑N)

Creates a program.

Open (↑O)

Opens a existing program.

Save (↑S)

Saves the program.

Save As

Saves the program as a different name.

Close

Closes the program.

Properties

Changes the program’s properties.

Local Variables

Edits local variables. For functions and function blocks, edits input/output Variables.

In/Out variables

3) Edit Command

Description

Undo (Ctrl+Z)

Cancels the last action at the program edit window, and returns back to the previous screen.

Redo (↑Y)

Restores the edit-canceled action again.

Cut (↑X)

Deletes the selected item, and copies it to the clipboard.

Copy (↑C)

Copies the selected item to the clipboard.

Paste (↑V)

Copies the clipboard contents to the edit window.

Delete (Del)

Deletes the selected item.

Find (↑F)

Finds out the desired string.

Replace (↑H)

Finds out the desired string, and replaces it to new one.

Replace Direct Variables

Replace the whole desired direct variables.

Find Next (↑F3)

Repeats the previous Find or Replace operation.

Go To

Moves the cursor to the desired location.

Screen Size

Controls the view size.

Delete Line

Deletes a line.

Insert Line

Inserts a line.

Insert Cell

Inserts a cell.

Toolbox

Uses the edit tool for each program.

www.ed.co.kr

The Basics of PLC

4)View Command

Description

Tool Bar

The user defines the toolbox.

Status Bar

Shows or hides the status line.

Full Screen

Enlarges the scope to indicate the program windows to the overall screen.

Project

Shows or hides the project window.

Result

Shows or hides the result window.

Variable Monitor

Shows or hides the variable monitor window.

I/O Monitor

Shows or hides I/O monitor window.

Link Parameter

Shows or hides link parameter window.

Zoom

Enlarges or reduces the screen.

Show Memory/ Comments

Shows or hides the variable comments.

Properties

Shows the registration selected items.

Monitor Array

Selects array no. Of the variable declared as array.

information

of

the

currently

5) Compile Command

Description

Compile

Compiles the program.

Compile All

Compiles all the programs in the project, and create a PLC execution file.

Memory Reference

Allows users to see the used global and direct variables.

Show Used I/O

Shows I/O use global variable or direct variable.

Check Double Coils

Shows the used doubles coil.

Previous Message

Moves to the previous message position.

Next Massage

Moves to the next message position

www.ed.co.kr

The Basics of PLC

6) Online Command Connect + Write + Run + Monitor On [Ctrl+R] Connect Read Write monitor On/Off Run

Description Connects to the PLC specified through the GMWIN and options, writes the program a user creates to the PLC and changes to the monitoring mode. Connects to the PLC specified through the GMWIN and options. Reads the PLC’s data. Writes the GMWIN’s program to the PLC. Start/finishes program monitoring. Converts PLC mode.

Stop PLC Monitor

Reset

Flash memory

Sleep Debug Master Convert Data Clear Reset Overall Reset Read Type

Converts CPU to communicate in GM1. Clears PLC data as "0". Resets PLC. Resets all data of CPU. Reads flash memory type information installed in CPU or writes data to flash memory.

Write Program Set Mode

Set Mode is only available in GM4-cpu. If the mode is set executing code is written in flash memory.

System

Shows PLC information.

Error/ Warning History PLC Info

I/O Module Fault Base Units

www.ed.co.kr

The Basics of PLC

Command I/O Info I/O Modules

I/O Forcing

Network

Description Shows/Writes PlC I/O Configuration Status. Matches PlC I/O Configuration With Project & PLC

I/O Synchronization Input Output Enable Link

Sets Forced I/O Value/Execution Allowance. Shows Link Module Type, Installed Slot, Station No.

Link Status

Shows Network Information.

Mnet Parameter

Inputs Mnet Parameter.

Comm unication Info Start Online Write Edit Cancel

Shows Sending/Receiving Information

FSM I/O Skip Fault Mask

Sets The Emergency Data Of F-Net Slave Module. Sets I/O To Skip. Sets Failure Mask.

Initialize Speacial Module

Initializes Special Module.

www.ed.co.kr

Starts To Edit Function. Writes The Edit Contents while running. Cancels The Edit Function.

The Basics of PLC

7) Debug Command

Description

Begin/End Debug

Changes to the debug mode, (Begin debugging the program / Stops debugging the program.)

Go(Ctrl+F9)

Run to the break point.

Step Over(Ctrl+F8)

Run step by step.

Step In

Debugs functions and function blocks.

Step Out

While debugging functions and function blocks, escape the present block.

Pause

Pauses the Run.

Run to Cursor(Ctrl+F2)

Runs to the cursor location.

Insert / Remove Breakpoint (Ctrl+F5)

Inserts or removes the breakpoint.

Breakpoint List/Condition

Shows the list of the breakpoints you have set, and enables you to set the break condition.

Task Enable

Enables you to change the task while debugging.

8) Tools Command

Description

Library Manager

Edits library.

Start Simulation

Starts simulator.

Data Share

Shares monitor values with excel.

www.ed.co.kr

The Basics of PLC

9) Windows Command

Description

New Window Cascade

Opens New Window Against Current Window. Cascades The Several Windows Of The GMWIN.

Tile Horizontally

Tiles The Several Windows Of The GMWIN Horizontally.

Tile Vertically

Tiles The Several Windows Of The GMWIN Vertically.

Arrange Icons

Arranges Icons In The GMWIN.

Close All

Closes All The Windows In The GMWIN.

10) Help Command GMWIN Help LGIS Homepage About GMWIN

www.ed.co.kr

Description Opens GMWIN helpdesk. Connects to LG industrial internet. Displays GMWIN information.

systems

homepage

by

The Basics of PLC

4-7. Toolbar The following is the GMWIN toolbar.

GMWIN provides frequently used features as toolbar. Choosing the desired tool with the mouse will execute the feature, as described in the chart below. Icon

Command

Description

New Project

- create a new project. - select Menu - Project - New Project

Open Project

- opens a existing project. - select Menu - Project - Open

Save Project New Program

Open Program

Save Program Local Variables

Undo(Ctrl+Z) Cut(Ctrl+X) Copy(Ctrl+C)

- saves the created project file. - select Menu - Project - Save - is used to open one or more programs included in a project. - select Menu - Program – New Program - opens a program selected from the menu. - select Menu - Program - Open [Note] - At the editing/debugging mode, two or more instances for one program are not available. For the monitor mode, you can open two or more instances for each program to monitor different positions of a long program. - saves the created program file. - select Menu - Program - Save - It allows you to edit local variables corresponding to the enabled program window. - select Program – Local Variables - Add/delete/edit each variable, and click the Close button. - cancels the last editing action during writing the program. - select Menu –Edit - Undo - specifies the item to be cut as a block. - select Menu – Edit-Cut - specifies the item to be copied as a block. - select Menu – Edit- Copy

www.ed.co.kr

The Basics of PLC

Icon

Command Paste (Ctrl+V) Delete

Search

Replace

Find Next (Ctrl+F3)

Compile

www.ed.co.kr

Description - position the cursor to a location to be pasted, after performing the Cut or Copy. - select Menu – Edit - paste - specifies a item to be deleted with the block-specifying icon, and deletes the item using the Delete icon. - searches an instruction or operand in the enabled program. - select Menu – Edit - Find - enter a desired string to the string input column in the Find dialog box. - select one of the following options, and press the OK button. 1) Both Text and contact/coil : selects the type of the desired string. 2) Range : selects the range of the search. - From Cursor : searches it from the present location of the cursor. - Entire Scope : searches it over the program. 3) Direction : selects the direction of the search. - Forward : searches it downward. - Backward : searches it upward. 4) Word : selects the match percent of the desired word. - Match whole word : searches 100% percent matching word. - Match partial word : searches any percent matching word. - Invoke the Replace dialog box, by selecting Menu – Edit Replace - Enter text to be replaced to the New text textbox. - Select a LD program component to replace at the Contact/Coil to find box. - Enter the desired text to the new name textbox. - Select a LD program component to replaced at the New Contact/Coil box. - For other options, select those equal to the options for Find, and press the OK button. - When you have already done with the Find/Replace operation before, it repeats the Find/Replace operation with the conditions equal to Find/Replace. - select Menu - Edit- Find Next - only complies the program in the enabled program window, and produces an object file. - select Menu – Compile [Note] If you only compile a program, its execution file is not created.

The Basics of PLC

Icon

Command

Description

Make Create execution file

- compiles only the programs needed to be compiled in the project programs, and creates an execution file. - select Menu – Compile - Make

Connect + Write+ Run + Monitor On

- This is a macro command to execute the written program with one menu operation. - With this command, you can connect, write a program, change the mode change(Run), and start monitoring with one operation.

Connect

- establishes the connection between GMWIN and PLC. - select Menu - Online - Connect

Run

- RUN mode : Mode to execute a program properly. - select Menu - Online – Change Mode - Run

Stop

- STOP mode : Mode to stop the program, without operating it. - select Menu - Online – Change Mode - Stop

Pause

- PAUSE mode : Mode to pause to operate the program. - select Menu - Online – Change Mode - Pause

Begin Debug

- DEBUG mode : Mode to find out errors on the program or to trace the operating process. - select Menu - Online – Change Mode -Begin Debug

Go

runs to the break point.

Over Step

runs the program step by step.

Step In

debugs functions and function blocks.

StepOut

While debugging functions escape the present block.

Pause

pauses the Run.

Run to Cursor Insert/ Remove Breakpoint

and

function

blocks,

runs to the cursor location. inserts or removes the breakpoint.

www.ed.co.kr

The Basics of PLC

Icon

Command

Description

Disconnect

- releases the connection between GMWIN and PLC. - select Menu - Online - Disconnect

Write

- writes parameters and programs of the GMWIN to the PLC. - invoke the Write dialog box, by selecting Menu – Online – Write. (after establishing the connection) - If the PLC state is on Run mode, the following screen appears. - Basic Parameters : reads only basic parameters from the PLC. - I/O Parameter : reads only I/O parameters from the PLC. - High speed Link Parameters : reads only high speed link parameters from the PLC. - Duplication Parameters : reads only duplication parameters from the PLC. (enabled only when selecting the Duplication) - Program : reads only programs from the PLC. - Parameters and Programs : reads both parameters and programs from the PLC. - Upload : reads upload programs from the PLC.

Monitor On/Off

- GMWIN allows users to monitor the status of the PLC on operation. - Online - Monitor – Monitor On ▪ Program Monitoring ▪ I/O Monitoring ▪ Variable Monitoring ▪ Time Chart Monitoring ▪ Link Parameter Monitoring

www.ed.co.kr

The Basics of PLC

4-8. Files created by GMWIN The following types of files are created when the user generates PLC executable file by creating a project and editing a program. ① * . PRJ : The project file created by the user ② * . BN0 : PLC executable file ③ * . MON: File containing the information for monitoring ④ * . CR0 : Generated when PLC executable file is created. ⑤ * . SRC : Program file created by the user ⑥ * . ASV : Periodical auto-save file of the program ⑦ * . OP? : Generated on program compilation (Program block) ⑧ * . OB? : Generated on program compilation (Function block) ⑨ * . OF? : Generated on program compilation (Function)

www.ed.co.kr

The Basics of PLC

4-9. Opening Files The user must open an existing project in order to create a program.

1) Opening a project ◈ Select Project - Open from menu.

2) Opening a program ① Select Program - Open from menu. ② Choose the drive and directory in order to find the location of the file in the list box. ③ Enter the file name directly or choose from the list box. Choose the types of files to show from the File Type. ◈ Project File : *.PRJ ④ Click the Open button.

www.ed.co.kr

Program File: *.SRC

The Basics of PLC

www.ed.co.kr

The Basics of PLC

4-10. Saving Files 1) Saving a new file ◈ Saving a file that has never been saved.

2) Saving a project ◈ Select Project - Save from menu.

3) Saving a program. (1) Select Program - Save from the menu. (2) Choose from the list box the drive and directory location to save the file. (3) Enter the desired file name in the file name field. Enter PRJ for proiect files and SRC for program files as the extension. (4) Click the Save button.

4) Saving while working (1) Saving project ◈ Choose Project - Save from menu. (2) Saving program ◈ Choose Program - Save from menu.

5) Saving by different name Changing the project name or the program name. (1) Saving Project ◈ Choose Project - Save As from menu. (2) Saving Program ① Choose Program - Save As from menu. ② Choose from the list box the drive and directory location at which to save the program. ③ Enter the file name in the file name field. Enter PRJ for project files and SRC for program files as the extension. ④ Click the Save button. www.ed.co.kr

The Basics of PLC

6) Closing File (1) Method 1: Double-click the adjustment menu at the top-left corner of the win dow to close. (2) Method 2 ① Closing Project ◈ Choose Project - Close from menu. ② Closing Program ◈ Choose Program - Close from menu.

www.ed.co.kr

The Basics of PLC

Chapter 5. Data Format 5-1. Variable Representation Data used in a program has values, which can be divided into ones that change during the course of the execution and ones that stay constant. In order to use variables in program block, function, function block, etc, the representation method of the variable must first be determined. Variables are categorized into direct variables and named variables.

① Direct variables: Do not need to be declared(conventional Method) ② Named variables: Declaration necessary

In the first method of direct variables, the user does not need to name the variable, but a memory location identifier predefined by the maker is used, where as in the second method of named variables, the user assigns the name to be used as the identifier

1) Direct Variables There are %I, %Q input and output variables and %M internal memory variables for direct variables. Direct variables always starts with the percent character(%), followed by location prefix and size prefix and one or more unsigned integer, delimited by periods.

(1) Examples of direct variable Input variable assignment: %I0.0.0, %I0.0.1, %I0.0.2 etc. Output variable assignment: %Q0.2.0, %Q0.2.1, %Q0.2.2 etc. Internal memory variable assignment: %M0, %M1, %M2 etc.

www.ed.co.kr

The Basics of PLC

(2) Location prefix No.

Prefix

Meaning

1

I

Input Location

2

Q

Output Location

3

M

Internal Memory Location

No.

Prefix

Meaning

1

X

1 bit (the X is omittable)

2

B

1 byte (8 bits)

3

W

1 word (16 bits)

4

D

1 double word (32 bits)

5

L

1 long word (64 bits)

(3) Size Prefix

※ Input and output representation of direct variables % [Location Prefix] [Size Prefix] [Base Number]. [Slot Number]. [Contact Point Number]

www.ed.co.kr

The Basics of PLC

Input

% I

X

0. 0. 0

Output

% Q X

0. 3. 0 Represents the contact point number of the I/O module Takes value between 0 and 63. Represents the slot number of the slot on which the I/O module is installed. Takes value between 0 and 7. Base number : Takes value between 0 and 3. Size prefix: X represents 1 bit. Location prefix: I(input), Q(output), M(internal memory) Reserved word for direct variable

EX)

%IX0.0.3 : Direct variable, input, 1 bit, base 0, slot 0, contact point 3 %QX0.2.7 : Direct variable, output, 1 bit, base 0, slot 2, contact point 7

(4) Internal memory NO.

Internal Memory

Meaning

1

%MX0

Represents the contact point at location 0 in bit.

2

%MB1

Represents memory location 1 in byte.

3

%MD48

Represents the memory location 48 in double words.

4

%MW20.3

Represents the third bit at the memory location 20 in words.

www.ed.co.kr

The Basics of PLC

(5) Internal Memory M b b b b b b b 15 14 13 12 11 10 9

%MW0

WORD (16Bit) Address

b 8

b 7

b 6

b 5

b 4

b 3

b 2

b 1

b 0

%MW99 %MB201

%MW100

%MB200

%MW101

%MB200

Byte(8bit) Address

7

Bit Address

6

5

4

3

2

1

0

%MX1603 %MB200.3 %MW100.3

2) Named Variable The user needs to declares the name and the type of the named variable when using. ① The name of the variable can be up to 16 characters in length(English), in case of KOREAN & characters are available. ② KOREAN Alphanumeric characters and underscore(_) can be used together. ③ There is no distinction between capital and lower case letters and all characters are considered to be capital letters. The name may not contain spaces.

(1) Examples of named variables Type Alphanumeric Characters and Underscore

Usage Example AGV_DRIVE_COMP, MOTOR2_ON, BCD_VALUE, VAL2, AUTO_EJECT_SOL

www.ed.co.kr

The Basics of PLC

(2) Types of Named Variable No.

Variable Type

Meaning

1

VAR

2

VAR_RETAIN

3

VAR_CONSTANT

Variable for reading only

4

VAR_EXTERNAL

Variable to assign external variable (VAR_GLOBAL)

General type for reading and writing Variable which retains its value even in the case of power failure

(3) Data Type of Named Variables (Represents the property of the data) ① Data types are categorized into numerical type (ANY_NUM) and bit state (ANY_BIT). ② The most common numerical type is the integer (INT) which can be used for counting and arithmetic operations. ③ Examples of integer includes the current value of a counter and A/D (analog input) conversion value. ④ Bit state includes BOOL(Boolean: 1 bit), BYTE(8 bits), WORD(16 bits), which represents ON/OFF state and is used for logical operations. ⑤ Examples of bit state includes the ON/OFF state of input switch, the illumination state of output lamp. ⑥ Since BCD is 4-bit binary code representation of decimal number, it is essentially bit state (ANY_BIT). ⑦ Arithmetic operations cannot be done on bit state type as it is, but it is possible, using type conversion function.

www.ed.co.kr

The Basics of PLC

(4) Basic Data Types Category

Numerical (ANY_ NUM)

Time

Date

Character String

Bit State (ANY_ BIT)

Data Type

Meaning

Size (bits)

Range

SINT

Short Integer

8

-128 ~ 127

INT

Integer

16

-32768 ~ 32767

DINT

Double Integer

32

-2147483648 ~ 2147483647

LINT

Long Integer

64

-9.2237×10

USINT

Unsigned Short Integer

8

0 ~ 255

UINT

Unsigned Integer

16

0 ~ 65535

UDINT

Unsigned Double Integer

32

0 ~ 4294967295

ULINT

Unsigned Long Integer

64

0 ~ 1.844×10

REAL

Real Numbers

32

-3.402823×1038 ~ -1.401298×10-45 401298×10-45 ~ 3.402823×1038

LREAL

Long Real Numbers

64

-1.7976931×10308 ~ -4.9406564×10-324 4.9406564×10-324~1.7976931×10308

TIME

Duration

32

T#0S ~ T#49D17H2M47S295MS

DATE

Date

16

D#1984-01-01 ~ D#2163-6-6

TIME_O F_DAY

Time Of Day

32

TOD#00:00:00 ~ TOD#23:59:59.999

DATE_A ND _TIME

Date And Time Of Day

64

DT#1984-01-01-00:00:00 ~ DT#2163-12-31-23:59:59.999

STRING

Character String

BOOL

Boolean

1

0,1

BYTE

Bit String Of Length 8

8

16#0 ~ 16#FF

WORD

Bit String Of Length 16

16

16#0 ~ 16FFFF

DWORD

Bit String Of Length 32

32

16#0 ~ 16FFFFFFFF

LWORD

Bit String Of Length 64

64

16#0 ~ 16FFFFFFFFFFFFFFFF

18

18

~ 9.2237×10

19

30*8 -

www.ed.co.kr

The Basics of PLC

(5) Data Type Hierarchy Data types used in GLOFA PLC can be graphically represented as the tree below. ANY ANY_NUM

LREAL

ANY STRING ANY_BIT LWORD(GM 1,2) DWORD ANY_INT WORD LINT(GM1,2) BYTE DINT BOOL

REAL

INT

ANY_REAL (GM 1,2)

ANY_DATE TIME DATE_AND_TIME DATE TIME_OF_DAY

SINT ULINT(GM1,2) UDINT UINT USINT

① ANY_REAL(LREAL, REAL) and LINT, ULINT, LWORD are applicable only to GM1 and GM2. ② From now on, it is implied that data type of ANY_NUM includes LREAL, REAL, LINT, DINT, INT, SINT, ULINT, UDINT, UINT, USINT, as shown in the hierarchy. ③ For example, if a type is said to be ANY_BIT in GM3, any of DWORD, WORD, BYTE, BOOL can be used.

www.ed.co.kr

The Basics of PLC

(6) Initial Value (If no value is specified, the variable is initialized to a value according to the following table.) Data Type

Initial Value

SINT, INT, DINT, LINT, USINT, UINT, UDINT, ULINT

0

BOOL, BYTE, WORD, DWORD, LWORD

0

REAL, LREAL

0.0

TIME

T#0s

DATE

D#1984-01-01

TIME_OF_DAY

TOD#00:00:00

DATE_AND_TIME

DT#1984-01-01-00:00:00

STRING

"(empty string)"

① Since the declaration of VAR_EXTERNAL only indirectly designates an externally declared variable, it cannot be given an initial value. ② Variables allocated using %I or %Q in declaration cannot be given initial values. Because those are Input and Output variables.

(7) Memory Allocation of Named Variables Named variables can be allocated either automatically or manually.

(8) Automatic Allocation Compiler automatically allocates the address for the variable in the memory. For example, if a variable called “VALVE_1” is declared to be automatically allocated, the memory location of this variable is determined only after the compilation of the program is done, so there is no need to worry about the location of the variable. Once declared, a variable serves, regardless of input or output, to relay signals during the computation process, temporarily save signal state(internal data), assignment of the name (the instance of the function block) of contact for timer or counter, etc.

www.ed.co.kr

The Basics of PLC

(9) User Definition The user manually defines the location, using direct variables (%I, %Q, %M). The declared variable is used as input and output (%I, %Q) variables and communication variables, which will be used as communication parameters. ※ As Data type is a very important issue, it will be covered in more detail with some examples. Much caution should be taken in using these data types for sequence control, arithmetic operation and logical comparison and conversion, etc.

www.ed.co.kr

The Basics of PLC

Chapter 6. Process of operation 6-1. Scan time PLC is first executed from the beginning of the program to the end in a sequential manner, starting at a state where the input has been refreshed, and then the output is refreshed. This process is repeated very rapidly, which is why it is called ‘repeated execution method’, and the time it takes for one execution is called ‘1 scan time.’

Operation Start

1 Scan

Input image area refresh

Contact status of input module

Scan program start ․ ․ ․ Scan program end

Execute task program

Output image area refresh

Contact status of output module

END

www.ed.co.kr

The Basics of PLC

6-2. I/O Refresh I/O refresh is the process consists of acquiring the status of the contacts from the input module and saving it in the input image area, and writing the output image altered by the program execution to the output module after the program execution is completed.

6-3. I/O Image Area GLOFA PLC executes program in a repeated fashion, so it does not change the I/O state in the course of the program execution, but performs I/O refresh on every scan. The state of each contact which change during the execution is stored in memory of the PLC, and this is called the I/O image area.

6-4. Operation Mode 1) RUN Mode Runs the program in a normal manner.

(1) Mode Change Procedure Data is initialized on the first scan.

(2) Execution Procedure Performs input/output refresh and program execution.

2) PAUSE Mode The execution of the program is paused. If the mode is changed back to RUN mode, the operation continues after the state is restored to the state immediately before stopping.

www.ed.co.kr

The Basics of PLC

(1) Mode Change Procedure The initialization of the data area and clearing of the I/O image area are skipped, and operation state is preserved as it was before the operation..

(2) Execution Procedure I/O refresh is performed.

3) STOP Mode The program execution is stopped. Only in remote STOP mode is program transfer by GMWIN possible.

(1) Mode Change Procedure Clears the output image area and performs an output refresh.

(2) Execution Procedure Performs I/O refresh to check for any problems in operation, installation, and communication service, and operation status, and other internal procedures are carried out.

4) DEBUG Mode Used to find bugs in the program or follow the line of execution. Switching to this mode is only possible at the STOP state. The execution status and data content can be verified in this mode.

(1) Mode Change Procedure Data area is initialized as specified in the restart mode, which is set in as parameters at the beginning of the mode switch, output image area is cleared, and input refresh is performed.

www.ed.co.kr

The Basics of PLC

(2) Execution Procedure ① Input refresh is performed. ② Debug operation is performed according to the setting. ③ When the debug has reached the end the program, output refresh is performed. ④ The installed module is checked for correct operation and whether it is installed correctly. ⑤ Communication and other services are performed.

6-5. Changing the Operation Mode 1) Different ways to change the mode (1) Use mode key in the CPU module (2) By connecting GMWIN to the communication port of the CPU module (3) By connecting GMWIN to other CPU module on the F-net (4) Issue user command through FAM, computer link, etc. (5) Use ‘STOP Function’ during program execution

2) Changing the mode using the mode key Mode key position

Mode

RUN

Local RUN

STOP

Local STOP

STOP

→ PAU/REM

PAU/REM → RUN * RUN

→ PAU/REM

PAU/REM → STOP

Remote STOP Local RUN Local PAUSE Local STOP

PLC continues to operate without any delay, when switching from remote RUN mode to local run mode by the mode key.

www.ed.co.kr

The Basics of PLC

3) Remote mode change Remote mode change is possible only if the mode key is set to remote STOP. (If the mode key is at STOP → PAU/REM) Location of the mode key

PAU/REM

Mode change using GMWIN

Mode change using FAM, computer link, etc.

Remote STOP → Remote RUN





Remote STOP → Remote PAUSE

×



Remote STOP → DEBUG



×

Remote RUN → Remote PAUSE





Remote RUN → Remote STOP





Remote RUN → DEBUG

×

×

Remote PAUSE → Remote RUN





Remote PAUSE → Remote STOP





Remote PAUSE → Remote DEBUG

×

×

DEBUG → Remote STOP





DEBUG → Remote RUN

×

×

DEBUG → Remote PAUSE

×

×

Mode Transition

4) Remote operation mode change permission In order to protect the system, a part of operation mode change source has been made unmodifiable, and when remote operation mode change has been disallowed, mode can be change using mode key or GMWIN. Options can be set in the ‘Allow PLC control through communication’ of the basic parameter area.

www.ed.co.kr

The Basics of PLC

6-6. Restart Mode Restart mode determines how to initialize the variables and the system before operating in RUN mode, when the power has been supplied again or after a mode change. It can be cold, warm, or hot type, and execution condition of each type is as follows.

1) Cold Restart (1) Executed if the parameter restart mode is set to cold restart. (2) All data is cleared to be 0, while variables with specified initial values are initialized to the preset value. (3) Even if the parameter is set to warm restart, the first run after any change has been made to the program will cause to restart in cold mode. (4) If the manual reset button is pressed while operation (same as issuing a reset command through GMWIN), a cold restart takes place regardless of the parameter setting.

2) Warm Restart (1) Executed if the parameter restart mode is set to warm restart. (2) Variables declared to preserve previous value retains the current value, while variables with only initial values specified is initialized to the value. All other variables are initialized to 0, clearing any previous content. (3) Even if the parameter is set to warm restart, the first operation after a program download or a halt caused by error is always a cold restart. (4) Even if the parameter is set to warm restart, a cold restart will take place in case the data has any abnormality (data is not preserved in case of power failure). → For variables with the option set to retain value in case of power failure (VAR_RETAIN), the following set of rules is followed. ① Parameter must be set as warm restart, in order to retain the value in case of power failure. ② If parameter is set as cold restart, it is initialized to the user-defined initial value or to the basic default initial value. → Variables that is not declared VAR_RETAIN is always initialized to the user-defined initial value or to the basic default initial value, for both cold and warm restart. www.ed.co.kr

The Basics of PLC

3) Hot Restart (1) If and it is the run mode when power comes back on after being cut off during a normal operation. the interval between the power off and on is shorter than the maximum allowed time for hot restart, hot restart is performed. (2) Execute after restoring all data and program execution elements to their previous state. (3) Since the program is executed in the state just before the power went off, the continuity of program execution is ensured, even in cases of momentary power failure. (4) If the time exceeds the maximum allowed time for hot restart, it is restarted, cold or warm, as defined in the parameter. (5) In case of abnormal data (data is not preserved during power failure), a cold restart is performed.

4) Data initialization depending on restart mode Each variable is initialized for each restart mode as shown in the chart below: Variable Mode

COLD

WARM

Default

Initialize to “0”

Initialize to “0”

Retain

Initialize to “0”

Retain previous value

Initialize

Initialize to user set value

Initialize to user set value

Retain & Initialize

Initialize to user set value

Retain previous value

HOT Retain previous Retain previous Retain previous Retain previous

value value value value

www.ed.co.kr

The Basics of PLC

Power On

Operation Mode

STOP

STOP Mode

Abnormal Operation Mode

Operation Mode

timeout

Within time Cold Restart Operation Mode

Warm Restart

Hot Restart

Warm Restart

Cold Restart

Hot Restart

[Flowchart for restart mode when power is resupplied during operation]

www.ed.co.kr

The Basics of PLC

Chapter 7. Programming Basics 7-1. Using the toolbar Frequently used functions, such as program editing, variable monitoring, time chart, and I/O monitoring can be accessed through toolbar. In addition, the position of the toolbar on the screen can be changed by selecting Toolbar - Toolbar Form from the menu, elements of toolbar is represented in [Figure5-1].

[Figure 5-1] Toolbar

1) Arrow (

)

Use arrow to move, edit, or delete contacts, coil, functions, function blocks etc.

2) Block Selection (

)

Use to perform edit actions such as delete or copy on multiple rows. ※ Click the block selection icon and move the cursor to the place to edit, and left button click and drag to select and edit multiple rows.

3) Normally Open Contact

(

)

Normally open contact, which can be thought of as the “a” contact in sequence control. (Shortcut key: F2) ※ After clicking the icon, and move the cursor to the desired position and left click.

www.ed.co.kr

The Basics of PLC

4) Normally Closed Contact (

)

Normally closed contact, which can be thought of as the “b” contact in sequence control. (Shortcut key: F3) ※ After clicking the icon, and move the cursor to the desired position and left click. [Note]

,

cannot be placed at the right end. (rule)

5) Positive Transition Detection Contact

(

)

Positive Transition detection contact detects the change of “0” to “1” and connects for the duration of one scan. (Shortcut key 󰍬 + 󰍟) ※ Click the icon for positive transition detection contact and move the cursor to the desired place for editing and left click.

(

6) Negative Transition Detection Contact

)

Negative Transition detection contact detects the change of “0” to “1” and connects for the duration of one scan. (Shortcut key 󰍬 + 󰍠) ※ Click the icon for negative transition detection contact and move the cursor to the desired place for editing and left click.

7) Horizontal and Vertical Lines

(

,

)

The horizontal and vertical lines are used to establish connection between two contacts, contact and coil, or branch circuits, horizontally and vertically. (Shortcut key 󰍢, 󰍣)

8) Coil and Reverse Coil (

,

)

Coil represents the output which is magnetized if the input from the left is ON, and demagnetized if it is OFF. Reverse coil work in the opposite way, being magnetized if the input from the left is OFF and demagnetized when the input is ON.

www.ed.co.kr

The Basics of PLC

If the left circuit input is ON

If the left circuit input is OFF

Coil

Magnetized

Demagnetized

Reverse Coil

Demagnetized

Magnetized

※ Directions for use and function description Below is a comparison between the case of coil and reverse coil: ◈ Coil: If %I0.0.0 is “1” then the output of the coil %Q0.2.0 produces “1” If %I0.0.0 is “0” then the output of the coil %Q0.2.0 produces “0” ◈ Reverse coil is the opposite: If %I0.0.0 is “1”the output of the reverse coil %Q0.3.0 produces “0” If %I0.0.0 is “0”the output of the reverse coil %Q0.3.0 produces “1”

9) Set Coil and Reset Coil

(

,

)

In setting coil, the state of the boolean variable becomes ON when the input at the left becomes ON and remains set state until it is reset by the RESET coil. Reset coil is use to reset a coil which is at ON on state. (Shortcut key 󰍭+󰍡, 󰍭+ 󰍢 )

www.ed.co.kr

The Basics of PLC

※ Directions for use and function description ◈ If the contact signal is ON, the output %Q0.2.0 becomes ON and remains at the magnetized state even if all the contacts are OFF. ◈ By turning the reset contact ON, the output %Q0.2.0 becomes OFF and the output becomes demagnetized.

10) Positive and Negative Transition Detection Coil

(

,

)

Positive Transition detection coil stays ON for one scan after the rising edge of input going from OFF to ON in the previous scan. Negative Transition detection coil stays ON for one scan after the falling edge of input going from ON to OFF in the previous scan. ※ Directions for use and function description ◈ Positive Transition detection coil M1 stays On for one scan from the moment the input switch %I0.0.1 becomes ON, as shown in the time chart below. It stops operating after that, so self holding circuit has been added. The magnetized output %Q0.2.1 is demagnetized by the input switch %I0.0.0. ◈ Negative Transition detection coil M2 is activated when the switch %I0.0.2 has been released after being pressed and stays magnetized by the output coil %Q0.2.2.

www.ed.co.kr

The Basics of PLC

[Positive Transition Detection Coil]

11) Function

(

[Negative Transition Detection Coil]

)

Basic functions include move function, type Transition function, comparison function, arithmetic function, logical function, bit shift function, etc. (1) Function immediately outputs the result of computation in one scan, and there is only one result. www.ed.co.kr

The Basics of PLC

(2) IN and OUT variables of the move function can have all kind of data types, but the types of data must be a same type. (3) IN1, (IN2), and OUT variables of arithmetic functions (ADD, MUL, etc) can only take the numeric data type (ANY_NUM), and all data types must be the same. (4) IN1, (IN2), and OUT variables of logical functions (AND, OR, etc) must be the bit data type (ANY_BIT), and all types must be the same. (5) IN and OUT variables of type Transition functions (INT_TO_BCD, BCD_TO_INT, etc) is bound to be the assigned data type and the functions are placed in libraries for use. (6) Usage of the move function:

MOVE (Data Transfer) Function

Description Input EN: If 1, the function is computed. IN: Data to transfer Output ENO: Same as EN OUT: Data transferred Data types of IN and OUT must be a same type. ex) if IN is %IB0.0.0, then OUT must be %QB0.2.0.

A. Program application example 1 If the execution condition (%I0.0.8) becomes ON, the MOVE function is executed and the ON/OFF information of the byte (8 bits) at 0.0.0~0.0.7 is copied to the corresponding bits in 0.2.0~0.2.7. (moved in units of byte)

www.ed.co.kr

The Basics of PLC

◈ LD confirmation using a simulator

www.ed.co.kr

The Basics of PLC

B. Program application example 2 If one of the three switches 0, 1, 2 is set to ON, the MOVE function is executed and the code value is transferred to %QW0.3.0.

◈ LD confirmation using a simulator ① Turning ON the 16#0000 (%IX0.0.0) of the first IN1 is the command to put a hexadecimal code of 0000 at the output %QW0.3.0 (hex). ② Turning ON the 16#1111 (%IX0.0.1) of the second IN1 is the command to put a hexadecimal code of 1111 at the output %QW0.3.0 (hex). ③ Turning ON the 16#FFFF (%IX0.0.2) of the third IN1 is the command to put a hexadecimal code of FFFF at the output %QW0.3.0 (hex).

www.ed.co.kr

The Basics of PLC

(7) Types and usages of type Transition functions A. BCD_TO_*** (Converts BCD to integer) Function

Description

Input EN: If 1, the function is computed. IN: ANY_BIT Input value encoded in BCD Output ENO: Same as EN OUT: Type converted data

A) Function Converts the INPUT type and writes the output on OUT. FUNCTION

Input Type

Output Type

BCD_TO_SINT

BYTE

SINT

BCD_TO_INT

WORD

INT

BCD_TO_DINT

DWORD

DINT

BCD_TO_USIN T

BYTE

USINT

BCD_TO_UINT

WORD

UINT

BCD_TO_UDIN T

DWORD

UDINT

Content

Converted correctly only if the input is encoded in BCD. (If the input data type is WORD, the conversion is valid only for values in the range of 0~16#9999)

If IN contains data which is not a valid BCD value, the output is set to “0” and _ERR (Arithmetic error flag) and _LER (Arithmetic error latch flag) are set to ON. B) Program Application Providing the BCD value 3333 as the input using %IW0.1.0 and setting %IX0.0.0 to ON will cause to produce the integer converted value on the output. www.ed.co.kr

The Basics of PLC

◈ LD confirmation using a simulator

www.ed.co.kr

The Basics of PLC

B. INT_TO_*** (INT type conversion) Function

Description

Input EN: If 1, the function is computed. IN: Integer input Output ENO: 1 if there is no error OUT: Type converted data

A) Function Converts the type of IN and writes the output on OUT. FUNCTION

Data Type

INT_TO_SINT

SINT

INT_TO_DINT

DINT

INT_TO_USINT

USINT

INT_TO_UINT

UINT

INT_TO_UDINT

UDINT

INT_TO_BOOL

BOOL

INT_TO_BYTE

BYTE

INT_TO_WORD

WORD

INT_TO_DWORD

DWORD

INT_TO_LWORD

LWORD

INT_TO_BCD

WORD

Content Appropriately converted If the input is in the range -128~127, but for values out of this range will cause error. Convert to DINT type. Appropriately converted If the input is in the range 0~255, but for values out of this range will cause error. Appropriately converted If the input is in the range 0~65535, but for values out of this range will cause error. Appropriately converted If the input is in the range 0~4294967295, but for values out of this range will cause error. Takes the lowest 1 bit and converts it to BOOL type. Takes the lowest 8 bits and converts it to BYTE type. Convert to WORD type without modifying any bits. Convert to WORD type by filling the highest bits with 0's. Convert to LWORD type by filling the highest bits with 0's. Appropriately converted If the input is in the range 0~9999, but for values out of this range will cause error.

www.ed.co.kr

The Basics of PLC

B) Error In case of conversion error, _ERR (Arithmetic error flag), _LEE (Arithmetic error latch flag) is set to ON. C) Program Application If forced variable 6666 is fed as the integer value when the input switch of %I0.0.0, the BCD value for the 6666 is written to %QW0.2.0 and if the maximum allowed integer value of 9999 or 16#270F is inputted to the INT_TO_BCD function, the BCD value of 16#9999 is written to %QW0.2.1.

www.ed.co.kr

The Basics of PLC

◈ LD confirmation using a simulator

C. GT (‘Greater than’ Comparision) Function

Description Input EN: If 1, the function is computed. IN1: Value to compare IN2: Value to compare ※ The number of inputs can be expanded to up to 8. IN1, IN2,... must be the same type. Output ENO: same as EN OUT: the result of the comparison

A) Function If the condition IN1 〉IN2 〉IN3... 〉INn holds true for the inputs, “1” is produced for OUT. If not, OUT becomes “0”,

www.ed.co.kr

The Basics of PLC

B) Program Application (a) If the execution condition %IX0.0.0 is ON, GT function executes. (b) If the input variables carry the values IN1=300, IN2=200, IN3=100, IN1 〉IN2 〉 IN3 is true, so the output %QX0.3.0 becomes “1.”

D. GE (‘Greater than or equal to’ comparison) Function

Description

Input EN: If 1, the function is computed. IN1: Value to compare IN2: Value to compare ※ The number of inputs can be expanded to up to 8. IN1, IN2,... must be the same type. Output ENO: same as EN OUT: the result of the comparison

www.ed.co.kr

The Basics of PLC

A) Function If the relationship IN1 ≥IN2 ≥IN3... ≥INn (n: the number of inputs) holds true for the inputs, OUT is set to “1.” Otherwise, OUT is set to “0.”

B) Program Application (a) GE function operates if the activation condition %IX0.0.0 is set to ON. (b) Assuming the inputs are set to IN1=300, IN2=%IW0.0.1, IN3=100, the output %QX0.3.0 is set to “1,” since result of the comparison checks that IN1 ≥ IN2 ≥ IN3 holds true, that is, if the value of IN2 is greater than or equal to 100, or if it is less than or equal to 300, %QX0.3.0 is set to “1.” C) LD confirmation using a simulator

www.ed.co.kr

The Basics of PLC

E. EQ (‘Equal to’ comparison) Function

Description Input EN: If 1, the function is computed. IN1: Value to compare IN2: Value to compare ※The number of inputs can be expanded to up to 8. IN1, IN2,... must be the same type. Output ENO: same as EN OUT: the result of the comparison

A) Function If the condition IN1 = IN2 = IN3... = INn (where n is the number of inputs) holds true for the inputs, OUT becomes “1.” If not, OUT becomes “0.” B) Program Application If BCD_TO_INT function is executed when %IX0.0.0 is ON, and %QX0.3.0 becomes “1” only if IN3 (%IW0.0.1) within is 300. ◈ LD confirmation using a simulator

www.ed.co.kr

The Basics of PLC

F. LE (‘Less than or equal to’ comparison) Function

Description Input EN: If 1, the function is computed. IN1: Value to compare IN2: Value to compare ※ The number of inputs can be expanded to up to 8. IN1, IN2,... must be the same type. Output ENO: same as EN OUT: the result of the comparison

A) Function If the condition IN1 ≤ IN2 ≤ IN3... ≤ INn (where n is the number of inputs) holds true for the inputs, OUT becomes “1.” If not, OUT becomes “0.”

B) Program Application If BCD_TO_INT function is executed when %IX0.0.0 is ON, and %QX0.3.0 becomes “1” only if IN2 (%IW0.0.1) is between 100 and 300 inclusive.

www.ed.co.kr

The Basics of PLC

◈ LD confirmation using a simulator

G. LT (‘Less than’ comparison) Function

Description Input EN: If 1, the function is computed. IN1: Value to compare IN2: Value to compare ※ The number of inputs can be expanded to up to 8. IN1, IN2,... must be the same type. Output ENO: same as EN OUT: the result of the comparison

A) Function If the condition IN1 〈 IN2 〈 IN3... 〈 INn (where n is the number of inputs) holds true for the inputs, OUT becomes “1.” If not, OUT becomes “0.”

www.ed.co.kr

The Basics of PLC

B) Program Application If BCD_TO_INT function is executed when %IX0.0.0 is ON, and %QX0.3.0 be comes “1” only if IN2 (%IW0.0.1) is between 101 and 299 exclusive. C) LD confirmation using a simulator

www.ed.co.kr

The Basics of PLC

H. NE (‘Not equal’ comparison) Function

Description Input EN: If 1, the function is computed. IN1: Value to compare IN2: Value to compare ※ The number of inputs can be expanded to up to 8. IN1, IN2,... must be the same type. Output ENO: same as EN OUT: the result of the comparison

A) Function If IN1 and IN2 is not compute to be equal, OUT becomes “1”. If they are equal, OUT becomes “0.” B) Program Application If BCD_TO_INT function is executed when %IX0.0.0 is ON, and %QX0.3.0 becomes “0” only if IN2 (%IW0.0.1) is 300, and becomes "0" otherwise.

www.ed.co.kr

The Basics of PLC

C) LD confirmation using a simulator

www.ed.co.kr

The Basics of PLC

(

12) Function Block

)

Since function block produces output accumulated through many scans, it requires memory to hold the intermediate results during the computation. Consequently, instance variable must declared for function block, similar to variables. Instance variable is the collection of variables, and the most general types of function blocks are timer and counter. ※ The user can creat function block and the created function block is added to the collection of user functions.

(1) Basic Function Block Reference ① Counter NO

Function Block

Functions

1

CTU

Up Counter

2

CTD

Down Counter

3

CTUD

Up Down Counter

NO

Function Block

Functions

1

TON

On Delay Timer

2

TOF

Off Delay Timer

3

TP

Pulse Timer

② Timer

www.ed.co.kr

The Basics of PLC

(2) Descriptions of basic function blocks and program usage A. CTU Up Counter Function

Description

Input CU: Input condition of Up Counter Pulse R: Reset PV: Preset Value Output Q: Up Counter Output CV: Current Value

A) Function (a) When the pulse input CU changes from “0” to “1” (rising edge), the value of CV is incremented by one. (b) However, CV never exceeds the integer value of 32767. (c) If the reset input R is set to “1,” CV becomes “0,” that is, it is cleared. (d) Output Q gives “1” if CV is greater than PV.

B) Time Chart R(Reset Input) CU(Up Count Input)

Maximum Coefficient (32767)

PV (Preset Value) CV(Current Value)

Q(Counter Output)

C) Program Example (a) Since CTU is a function block, instance variable must be declared in order to hold the intermediate results.

www.ed.co.kr

The Basics of PLC

(b) On declaration of a CTU instance variable in the program, the󰡒instance name.Q󰡓for counter output Q, and󰡒 instance name.CV󰡓current value are automatically created in this operation. (c) Choose

and select CTU from the windows of function block list.

(d) There is no restriction on the name of the variable, but use C1 for convenience and leave other windows as default values. (e) If rising edge pulse is introduced through the toggle switch “0”(%IX0.0.0), the current value of input increments. (f) %QW0.0.2.0 on the right will show the current value as the output. (g) If the current value exceeds 10, the counter Output (C1.Q) becomes “1” and the lamp (%QX0.3.0) lights up. (h) If the toggle switch “1”(%IX0.0.1) is turned ON, the current value and the counter output is resetted to become 0, "Zen". (i) If the current value (C1.CV) goes out of range of between 0 and 9999, the _ERR, _LER flags are turned on by the INT_TO_BCD function. (j) In the program below, the outputs %QX0.3.0 and %QX0.3.1 perform the same operation. However, %QX0.3.1 show how the operation of the counter is driven by the value of C1, Q.

www.ed.co.kr

The Basics of PLC

◈ LD confirmation using a simulator

B. CTD Down Counter Function

Description

Input CD: Input condition of Down Counter Pulse LD: Load Input PV: Preset Value Output Q: Down Counter Output CV: Current Value

A) Function (a) When the pulse input CD changes from “0” to “1” (rising edge), the value of CV is decremented by one, where the smallest possible integer value CV is allowed to take is -32768. (b) If the load input LD is set to “1,” the preset value in PV is loaded into CV. (d) Output Q gives “1” if CV is less than or equal to 0.

www.ed.co.kr

The Basics of PLC

B) Time Chart

LD (Load Input) CD (Down CountI nput) CV (Current Value)

PV (Preset Value)

Q (Counter Output)

Miinimum Coefficient (-32768)

C) Program Example (a) Since CTD is a function block, instance variable must be declared in order to hold the intermediate results. (b) On declaration of a CTD instance variable in the program, the variables󰡒instance name Q󰡓for counter output, and󰡒instance name, CV󰡓for current value are automatically created in this operation. (c) Declares the instance variable of (CTD (for Example, C2). (d) Preset value is set to 10. (e) On the initial pressing of %IX0.0.2, LD becomes “1” and PV(preset valve) is loaded to current value. (f) If rising edge pulse is introduced into CD by the toggle switch “0”(%IX0.0.1), the current value of input is decremented. (g) If the current value is less than 0, the counter Output (C2.Q) becomes “1” and the lamp (%QX0.3.0) lights up. (h) If the toggle switch “1”(%IX0.0.2) is turned ON, LD becomes “1” and the preset value is loaded to CV again.

www.ed.co.kr

The Basics of PLC

◈ LD confirmation using a simulator

C. CTUD Up Down Counter Function

Description

Input CU: Up Counter Pulse Input CD: Down Counter Pulse Input R: Reset Input LD: Load Value PV: Preset Value Output QU: Up Counter Output QD: Down Counter Output CV: Current Value

A) Function (a) CTUD is a counter where the current value CV increments by one if the CU goes from “0” to “1” and decrements by one if the CD goes from “0” to “1”, where the current value CV must be between the integer values -32768 and 32767. (b) If the load input contact LD becomes “1,” the PV is loaded to current value CV. (CV=PV) (c) If “1” is asserted on the reset input R, the current value CV is cleared to “0”. (CV=0) www.ed.co.kr

The Basics of PLC

(d) Output QU is set to “1” if CV is greater or equal to PV and QD is set to “1” if CV is less than or equal to “0.” (e) For each input signals, the operation is down in the order R>LD>CU>CD, and if multiple signals are asserted simultaneously, the only the one with the highest priority is processed.

A) Time Chart LD(Load Input) R(Reset Input) CU(Up Count Input) CD(Down Count Input) PV(Preset Value) CV(Current Value) QU(Count Up Output) QD(Count Down Output)

C) Program Example (a) Since CTUD is a function block, instance variable must be declared in order to hold the intermediate results. (b) On declaration of a CTUD instance variable in the program, the instance variables automatically created:󰡒(instance name).QU󰡓for the up count,󰡒(instance name). QD󰡓for down count, and󰡒(instance name).CV󰡓for current value. (c) Declares the instance variable of CTD(for Example, C3). (d) Preset value is set to 10. (e) If rising edge pulse is introduced into CU using the toggle switch %IX0.0.0, the current value of input is increased. (f) If rising edge pulse is introduced into CD using the toggle switch %IX0.0.1, the current value of input is decremented. (g) If the current value is greater than or equal to PV(preset value), C3, QU be comes “1” and %QX0.3.0 is set to “1.”

www.ed.co.kr

The Basics of PLC

(h) If the current value is less than or equal to “0,” C3, QD becomes “1.” (i) If %IX0.0.2 is set to ON, the current value is cleared to “0.” (j) If %IX0.0.3 is set to ON, LD becomes “1” and the preset value is loaded into the current value.

D. TON (ON Delay Timer) Function

Description

Input IN: Timer Activation Condition PT: Preset Time Output Q: Timer Output ET: Elapsed Time

A) Function (a) The time elapsed after IN became “1” is output to ET. (b) If IN becomes before the ET reaches the preset time, ET is set to “0.” (c) If IN becomes “0” after Q becomes “1,” Q is set to “0.”

www.ed.co.kr

The Basics of PLC

B) Time Chart IN Q

PT Preset Time

ET

C) Program Example (a) Since TON is a function block, instance variable must be declared in order to hold the intermediate results. (b) On declaration of a TON instance variable in a program, variables are automati cally created:󰡒(instance name).Q󰡓, for the timer output and󰡒(instance name). ET󰡓for elapsed time. (c) Declare a instance variable for TON, for example named T1. (d) Set the PT preset timer for T1 as 5 seconds (T#5S). (e) If the activation switch %IX0.0.0 is turned ON, the elapsed time (T1.ET) is displayed on the digital indicator. (f) If the elapsed time T1.ET reaches 5 seconds, the timer output T1.Q becomes ON, making the outputs %Q0.2.0 "1" and %Q0.2.1 “0.” (g) After switching T1.Q ON, switching OFF the activation switch (%IX0.0.0) makes T1.Q OFF.

www.ed.co.kr

The Basics of PLC

E. TOF (OFF Delay Timer) Function

Description

Input IN: Timer Activation Condition PT: Preset Time Output Q: Timer Output ET: Elapsed Time

A) Function (a) Asserting “1” for IN sets Q to “1” and the time elapsed since IN becoming “0” exceeds the time set in PT, Q becomes “0.” (b) The time elapsed since IN becoming “0” is output to ET. (c) If IN becomes “1” before ET reaches the preset time, elapsed time is reset to “0.”

B) Time Chart

IN

Q Preset Time

PT

ET

www.ed.co.kr

The Basics of PLC

C) Program Example (a) Since TOF is a function block, instance variable must be declared in order to hold the intermediate results. (b) On declaration of a TON instance variable in a program, variables are automati cally created:󰡒(instance name).Q󰡓, for timer output and󰡒(instance name).ET󰡓for elapsed time. (c) Declare a TOF instance variable, for example named T2. (d) Set the timer T2 to 3 seconds (T#3S). (e) Setting the activation switch %IX0.0.0 to ON makes the timer output T2.Q to become ON. (f) Setting the activation switch %IX0.0.0 to OFF causes the elapsed time T2.ET to be displayed on the digital indicator. (g) If the elapse time T2.ET reaches the preset time of 3 seconds, timer output T2.Q becomes OFF.

www.ed.co.kr

The Basics of PLC

F. TP (Pulse Timer) Function

Description

Input IN: Timer Activation Condition PT: Preset Time Output Q: Timer Output ET: Elapsed Time

A) Function (a) Asserting “1” for IN sets Q to “1” for the preset amount of time and goes back to “0” when ET reaches PT. (b) Elapsed time ET starts increment when IN becomes “1” and remains still once it reaches PT until it is reset to “0” as IN becomes “0.” (c) Even if IN changes to “0” and back to “1,” it will have no effect while ET is being incremented. B) Time Chart

IN Q PT Preset Time PT

ET

C) Program Example (a) Since TP is a function block, instance variable must be declared in order to hold the intermediate results.

www.ed.co.kr

The Basics of PLC

(b) On declaration of a TP instance variable in a program, variables are automatically created:󰡒(instance name).Q󰡓, for the timer output and󰡒(instance name).ET󰡓for elapsed time. (c) Declare a TP instance variable for example named T3. (d) Set the timer T3 to 3 seconds (T#3S). (e) Setting the activation switch %IX0.0.0 to ON makes the timer output T3.Q to become ON and stays that way for 3 seconds. (f) Setting the activation switch to OFF has no effect while T3.ET is increasing. (g) Timer output T3.Q becomes OFF after 3 seconds. D) Program Example

13) Return

(

)

[Return] is the command to terminate execution if encountered during the execution, effectively blocking the execution of any statements to follow. (Shortcut key 󰍬 + 󰍥)

(1) Function Description ※ USE UOUSE ① Choose

from the toolbar.

② Move the mouse cursor to the desired position in the LD program window and left click. ※ USE KEY BOARD ③ Move the cursor to the location to return in the LD Program. ④ Choose Return from Toolbar in the menu (Shift-F7). www.ed.co.kr

The Basics of PLC

(2) Programming Application As shown below, execution will continue up to the [Return] mark on the second row. Since encountering [Return] while executing terminates the execution, the statement in row 2 is not executed.

(

14) Branch (JUMP)

)

Jump is a way to go to the desired (labeled) location for branching in an LD program. Destination is represented by a label. The jump in the main program must be provided a label within main program as a input, and the jump in the subroutine domain can only branch to labels within the subroutine. ※ Program Example ① Choose

from the toolbar.

② Move the mouse cursor to the desired position in the LD program window and left click. ③ Double-click the

icon and enter ABC for the label name.

www.ed.co.kr

The Basics of PLC

15) Subroutine (CALL)

(

)

In LD program, the execution is terminated on encountering an END command. However, there are cases when some program which exist after the END command must be evoked, in which case the subroutine can be convenient.

※ Program Example (1) Subroutine ① Choose

from the toolbar.

② Move the mouse cursor to the desired position in the LD program window and left click. ③ Choose label name.

and double-click the created subroutine LD and enter “ABC” as the

(2) END Command ① Place the cursor at the last row of the program or desired row, for example row 2) and double-click. ② In the Label / Rung Description / End of Main Program dialog box, select “Show the end of the main program.” (3) Label ① Place the cursor at the location to be called after the END command and double-click. ② Choose the label in the Label / Rung Description / End of Main Program dialog box. ③ Name the label as “ABC” in the Add Label dialog. (Maximum label length: 16 characters)

www.ed.co.kr

The Basics of PLC

(4) Program Description The circuit shows how even if the contact of %I0.1.1 and %I0.1.2 activates, %Q0.2.0 can stay not active. This is because the call to the subroutine is located after the END command and so the call does not occur. In this circuit, if the %I0.0.1 contact activates, ABC is called by the subroutine, and after %I0.1.1 and %I0.1.2 contact activates, the output %Q0.2.0 becomes active.

16) Time Chart for Operations

Switch Input

Arithmetic Result (Assumption)

Normally Open Contact

Coil

Normally Closed Contact

Reverse Coil

Positive Transition Detection Contact

Negative Transition Detection Contact

Positive Transition Detection Coil

1 scan

1 scan

Negative Transition Detection Coil

1 scan

1 scan

Input/Output Time Chart of Operations

www.ed.co.kr

The Basics of PLC

7-2. Sequence Operators Category

Command Normally Open Contact Normally Closed Contact Positive Transition Detection Contact

Function Description

A Contact

Contact operation

B Contact

Contact on for I scan since rising edge

Contact on for I scan since falling edge

Coil

Computation Result Output

Positive Transition Detection Coil Negative Transition Detection Coil

Computation Result Reverse Output Contact on for 1 scan since rising edge

Contact on for 1 scan since falling edge

Setting Coil

Computation result set output

Reset Coil

Computation result reset output

Jump

Program Termination

www.ed.co.kr

Notes

Contact operation

Negative Transition Detection Contact

Reverse Coil Sequence Operators

Symbol

Jump to label Terminate current program on encountering RETURN command Terminate current program on encountering END command

The Basics of PLC

7-3. List of Functions Category Move Function

Command

MOVE

Symbol

Function Description

Notes

Data transfer IN 1: data source (any type) OUT: data line (any type)

***_TO_***

Data type conversion functions IN 1: data source OUT: data line Types of data type conversion functions SINT_TO_INT and 14 others INT_TO_SINT and 14 others DINT_TO_SINT and 14 others LINT_TO_SINT and 14 others USINT_TO_SINT and 14 others UINT_TO_SINT and 14 others UDINT_TO_SINT and 14 others ULINT_TO_SINT and 14 others BYTE_TO_SINT and 14 others WORD_TO_SINT and 14 others DWORD_TO_SINT and 14 others LWORD_TO_SINT and 14 others BCD_TO_SINT and 7 others REAL_TO_SINT and 7 others LREAL_TO_SINT and 7 others STRING_TO_SINT and 18 others NUM_TO_STRING TIME_TO_UDINT and 2 others DATE_TO_UINT and 2 others TOD_TO_UDINT and 2 others DT_TO_DATE and 2 others

TRUNC

Convert real numbers to integers IN 1: data source (REAL, LREAL) OUT: data line (DINT, LINT)

Conversion Functions

LINT ULINT LWORD REAL LREAL Only GM1,GM 2 allowed for related function

Only for GM1,GM 2

www.ed.co.kr

The Basics of PLC

Category

Arithmetic Operation Functions

Command

Symbol

Function Description

ADD

Add function IN1 ~ IN8: operands (Any_INT) OUT: result (Any_INT)

SUB

Subtract function IN1: value to be subtracted from (Any_INT) IN2: subtracting value (Any_INT) OUT: result (Any_INT)

MUL

Multiply function IN1 ~ IN8: operands (Any_INT) OUT: result (Any_INT)

DIV

Division (result) IN1: dividend (Any_INT) IN2: divisor (Any_INT) OUT: result (Any_INT)

MOD

Division (remainder) IN1: dividend (Any_INT) IN2: divisor (Any_INT) OUT: remainder (Any_INT)

EXPT

Exponential function IN1: base (Any_REAL) IN2: exponent (Any_REAL) OUT: result (Any_REAL)

ABS

www.ed.co.kr

Absolute value IN1: integer (Any_INT) OUT: result (Any_INT)

Notes

Only for GM1,GM 2

The Basics of PLC

Category

Command

Function Description

Notes

SQRT

Square root IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

LN

Natural logarithm IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

LOG

Common logarithm IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

EXP

Natural exponential function IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

SIN

Sine IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

COS

Cosine IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

TAN

Tangent IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

ASIN

Arch sine IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

ACOS

Arch cosine IN1: operand (Any_REAL) OUT: result (Any_REAL)

Only for GM1,GM 2

Arithmetic Operation Functions

Trigonometric Functions

Symbol

www.ed.co.kr

The Basics of PLC

Category

Command

Trigonometric Functions

ATAN

Symbol

Function Description Arch tangent IN1: operand (Any_REAL) OUT: result (Any_REAL)

SHL

Bit shift left IN: data source(Any_BIT) N: number of bits to shift (INT) OUT: data line (Any_BIT)

SHR

Bit shift right IN : data source(Any_BIT) N : number of bits to shift (INT) OUT: data line (Any_BIT)

ROL

Bit rotate left IN: data source(Any_BIT) N: number of bits to rotate (INT) OUT: data line (Any_BIT)

ROR

Bit rotate right IN: operand (Any_BIT) N: number of bits to rotate(INT) OUT: data line (Any_BIT)

AND

Logical AND IN1 ~ IN8: operand (Any_BIT) OUT: result (Any_BIT)

OR

Logical OR IN1 ~ IN8: operand (Any_BIT) OUT: result (Any_BIT)

Shift Functions

Rotate Functions

Logical Operators

www.ed.co.kr

Notes Only for GM1,GM 2

The Basics of PLC

Category

Command

Symbol

Function Description

Notes

XOR

Exclusive OR IN1 ~ IN8: operand (Any_BIT) OUT: result (Any_BIT)

NOT

Logical Negation IN1, IN2: operand (Any_BIT) OUT: result (Any_BIT)

SEL

Select from 2 G : output selector (BOOL) IN1: value to be chosen when G is off (Any) IN1: value to be chosen when G is on (Any) OUT: output value (Any)

MAX

Maximum IN1~IN8: candidate values (Any_NIT) OUT: maximum value (Any_INT)

MIN

Minimum IN1~IN8: candidate values (Any_NIT) OUT: minimum value (Any_INT)

Logical Operators

Selection Functions

LIMIT

Lower and upper bound MN: lower bound (Any_NIT) IN : data source (Any_INT) MX: upper bound (Any_NIT) OUT: output value (Any_INT)

www.ed.co.kr

The Basics of PLC

Category

Command

Selection Functions

Symbol

Function Description

MUX

Select one of 7 values K: selector value IN0: data source 0 (Any) IN1: data source 1 (Any) IN2: data source 2 (Any) IN3: data source 3 (Any) IN4: data source 4 (Any) IN5: data source 5 (Any) IN6: data source 6 (Any) OUT: output value (Any)

GT(>)

Comparison function IN1 ~ IN8: data to compare (Any) OUT: output (BOOL) If IN1>IN2>...IN7>IN8 is satisfied, OUT is set to ON

GE(≥)

Comparison function IN1 ~ IN8: data to compare (Any) OUT: output (BOOL) If IN1≥IN2≥...IN7≥IN8 is satisfied, OUT is set to ON

EQ(〓)

Comparison function IN1 ~ IN8: data to compare (Any) OUT: output (BOOL) If IN1〓IN2〓...IN7〓IN8 is satisfied, OUT is set to ON

Comparison Functions

LE(≤)

www.ed.co.kr

Comparison function IN1 ~ IN8: data to compare (Any) OUT: output (BOOL) If IN1≤IN2≤......IN7≤IN8 is satisfied, OUT is set to ON

Notes

The Basics of PLC

Category

Command

Symbol

Function Description

Notes

LT(
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF