215
-1- Mitsubishi Melsec PLC Ladder Logic Application

2MitsubishiMelsecPlcLadderLogicApplication

Embed Size (px)

Citation preview

Page 1: 2MitsubishiMelsecPlcLadderLogicApplication

- 1 -

Mitsubishi Melsec PLCLadder Logic Application

Page 2: 2MitsubishiMelsecPlcLadderLogicApplication

- 2 -

ContentI. The Structure and Understanding of PLC.

The Instruction and History of PLC.▷

Digital Input Module.▷

Digital Output Module.▷

Terminologies of Ladder Logic.▷

The Relationship between PLC Hardware and Software▷

Numeric System of PLC.▷

▷ Karnaugh Map

II. Application Examples for Logical Command.

Logical AND▷

Logical OR▷

Logical NAND▷

Logical NOR▷

Logical Exclusive OR▷

1 Scan-time Oscillator▷

Self-Holding, 0 or 1 Dominant SR/RS Flip-Flop▷

Detect Rising Edge / Falling Edge, Differentiation▷

Dual action Pushbutton▷

Trouble Acknowledge/ Reset▷

III. Application Example for Sequential Command.

On Delay / Off Delay Timer▷

One Shot Multi-vibrator▷

Multi-Vibrator▷

Speed Monitor using OFF Delay Timer▷

Preventing Chattering Noise for Mechanical Contacts▷

Finding Stable Value by TIME Filter from Analog Input Hunting▷

Measuring Time for Continuous Production.▷

Optimizing Surveillance Timer of Speed Monitor▷

Surveillance of Motor Drive System▷

Detecting Value Changed▷

Page 3: 2MitsubishiMelsecPlcLadderLogicApplication

- 3 -

IV. Application Example for Flow Sequential Command.

Sequence Control with BSFL Command▷

Sequence Control with SFTP Command▷

Call Subroutines and Return Processing▷

Sorting Data of Table in Maximum Order▷

V. Application Example for MUX-DEMUX.

Parallel Driving for▷ 7 Segment DisplayEconomic Discrete Input Multiplexing-Demultiplexing▷

VI. Application Example for Calculation Command.

Analog Input/Output Module▷

A1S68AD/ A1S68DAV,DAI Analog Input Module Set-up▷

Scaling for Analog Input PV▷

Schmitt Threshold ON-OFF▷

Peak Value Hold▷

On / Off Controller for Analog PV▷

Analog Value Clamping, Limitation▷

Bit Shift by Calculation Command▷

Analog Drive Speed Control▷

Finding Stable Value by SUM from Analog Input Hunting▷

Drive Multi-stage Control by Encoder Feedback▷

Ratio Control for Material Mixing▷

Trickle Control for Truck Loading▷

Rate Sampler for Single Counter▷

Analog Scaling for X 0 Shifted Signal▷

Analog Scaling for Y 0 Shifted Signal▷

Piecewise for Proportional Non-Linear Curve▷

Piecewise for Inverse Proportional Non-Linear Curve▷

Linear Profiler▷

Page 4: 2MitsubishiMelsecPlcLadderLogicApplication

- 4 -

VII. Application Example Data Manipulation Command.

Clear to 0 Or Set to 1 All Bits▷

Set All Bits to 1 by 2's Complement▷

Binary Counter▷

Assembling/ Disassembling of Bits▷

Acceleration/Deceleration Control With Linearity for Set-point▷

Individual ON/OFF Operation by Thumb-wheel Switch Set▷

Ring Counter▷

Display of Trouble Flag Number▷

Que Buffer and First-in/First-out▷

LIFO(Last In First Out) Using Stack Memory▷

Load/Save Data for 2-3 Dimensional Database▷

Data Save/ Sort/ Search for Optimization▷

VIII. Application Example for Computer Link Module.

Non-form Communication for Computer Link Module▷

CPU Direct Access via Computer Link Module▷

CPU Access via Dedicated MODEM and Computer Link Module▷

CPU Access via Dial-up MODEM and Computer Link Module▷

Proface GP577R Touch Screen Access via Computer Link▷

ModuleFix 32 Access via Computer Link Module▷

Intouch 5.6 Access via Computer Link Module▷

Appendix

MODICON Concept Version 2.1 PID Simulation Function Block Diagram▷

Bit Division for MMI Analog tag▷

SIMATIC TI545 PLC PID Simulation▷

SIMATIC TI545 PLC vs Intouch 8.0▷

Modicon E785 PLC vs Intouch 7.1 PID Simulation▷

Page 5: 2MitsubishiMelsecPlcLadderLogicApplication

- 5 -

I. The Structure and Understanding of PLC.

The Instruction and History of PLC.▷

Digital Input Module.▷

Digital Output Module.▷

Terminologies of Ladder Logic.▷

The Relationship between PLC Hardware and Software▷

Numeric System of PLC.▷

Karnaugh Map▷

Page 6: 2MitsubishiMelsecPlcLadderLogicApplication

- 6 -

Mitsubishi Melsec PLC Ladder LogicApplication

The Instruction and History of PLC.

1. Specfication and Unit of PLC.- PLC is an abbireviation of "Programmable Logic Controller".

. The existing relay control box can be replaced to PLC.. PLC performs logic solving and circulating beginning and end of program in the memory.

- The background of PLC is that,. The end of 1960s, GM(General Motor) Company announced conditions of electronicsequential control equipment proposed to apply to automotive assembly line, andequipment manufacturer developed and distributed sequential control equipment suitedto these conditions.

- The function of these PLC is that. Sequence control. PID control, Analog control, Positioning control.

- Most of PLC has. Basic operation function like AND, OR Contacts and Timer/Counter operation. Practical Application operation like Subroutine, SHIFT, MASTER CONTROL, DATACalculation.

In the beginning, PLC could perform simple control by program as logic controller, highperformance function like arithmetic operation, output device control, communicationfunction were added. Also PLC could guarantee and complement high reliability that relaycontrol box couldn't have and flexibility to modify control system. By this way, time and coststo needed to perform inspection, test-run could be minimize and save. After the time, thedevelopment of integrated software for the communication between PLC and Computer couldmake user program easily and provided more familiar environment and ability to build sitemonitoring using graphic and graphic processing for the data as well as ability to analyzedifficult process problem with collected datum and information. Recently PLC aremanufactured more compact and lower cost and applied to almost industrial fields. Whenusers control the machine or equipment with PLC, users ought to make a program so thatPLC can decide memory content of control algorism. The standards Methods of PLCProgramming are presented but there are many differences according to Manufacturers andkinds. IEC 1131-3(International Electro-technical Commission- Standard for ProgrammableControllers-Part 3: Programming Languages) defined international standards of PLClanguage as belows;

- LD(:Ladder diagram)- IL(mnemonic :Instruction List)- SFC(Sequential Function Charts)

Page 7: 2MitsubishiMelsecPlcLadderLogicApplication

- 7 -

- FBD(Function Block Diagram)- ST(Structured Text).

PLC(Programmable Logic Controller) consists of Input & Output Interface, Memory,Programming terminal, CPU, Power supply structurally.

2. The structure of PLCA. CPU Unit

The CPU part of PLC is similar to structure of PC(Personal Computer) and the function arealso same. The main part of CPU is consisted as belows;

- Micro Processor( CPU) - System Memory - Program Memory - Data Memory.(1) Program method.

In-build Program type stores all Sequence Program in the memory and call individually,CPU analyzes and executes program.

(2) Control method.- Constant cyclic repetition execution method solves and performs program stored memoryfrom first to end sequentially and return to first.- Interrupt control method solves and performs interrupt execution program when theinternal or external interrupt demands.

(3) I/O control methodFirst, Processor reads input status from input module, and base on this data, solves logicprogram from first to end. Finally processor writes results calculated from logic solving tooutput module. This job processing is called "SCAN". The polling for I/O modules will beindirect method and it should be executed before execution of Program 0 Step. This methodis represented as belows;

Input Polling

Output Processing

System Processing

LOGIC SCAN

Page 8: 2MitsubishiMelsecPlcLadderLogicApplication

- 8 -

(4) Program CommandPLC command described in the specification is not for using CPU but for user commanddesigned by PLC manufacturer when user can make sequence program. Each command canbe different according to PLC manufacturer but it's not make so much different and functionis similar in every PLC's. Program command can be represented to two groups.

- Basic Command, Sequence Command : Basic Command is to perform sequencediagram for relay circuits in the PLC, and consisted of basic logical operationcommand like I/O Command for control signal, AND, OR.

- Applied Command : Applied Command provides various functions so that makepossible to perform transferring, calculation, comparison, data manipulation andconversion, advanced sequential control program. By using applied command usercan save the programming and debugging time, use high speed, high performancefunction.

B. Digital Input UnitDigital input module of PLC is used to get the ON/OFF status from input device. This ismainly used to get information from the machine. For each input device uses different powerconsumption and different voltage when the pushbutton of operator panel and various kinds ofsensor is connected to input module, users should choose suitable input module to each inputdevices.Digital input module of PLC can be divided to DC input, AC input according to input voltagetype and isolated type or non-isolated type. The isolated type is meaning that there existsphoto-coupler at input part to isolate external and internal side and this is designed to endurenoise in the harsh industrial environment.

C. Digital Output UnitDigital Output module of PLC outputs internal ON/OFF status of PLC and operates themachine. Output devices can be connected are mainly lamps, magnet contactor, relays. Aftermagnet contactor(MC) and relay actuators are connected like motor or solenoid valve that canoperates the machine. For each output device uses different power consumption and differentvoltage users should chooses the output module appropriate to output devices.Digital Output module of PLC can be divided to relay output, transistor output, SSR(SolidState Relay) unit according to output contact types.

D. Analog SignalAnalog value is meaning that physical quantity that varies continuously changing to time likevoltage, current, temperature, pressure, flow, velocity. Analog signal can not be connected tocomputer or PLC that can connect only digital signal. So these physical quantities shouldcoverts to electrical signal like DC voltage, current and convert to digital amount again. Alsodigital amount PLC inside should convert to analog signal to operate Servo-motor. DC/ACspeed control device that can be controlled by analog signal.

E. Analog Input Unit (A/D Converter)This is for Analog/Digital conversion Unit and to use analog signal in the CPU. The principal

Page 9: 2MitsubishiMelsecPlcLadderLogicApplication

- 9 -

to convert from analog value to digital value is represented as the figure shows that digitalvalue corresponding to analog voltage signal as below. The input voltage range, output bits ofA/D converter are different according to kinds. The resolution of AD converter is determinedby output bits.

The resolution of AD converter is determined by formula as next.

Resolution ability = 2N (N = Output Bit Number)

Therefore, The resolution will be larger as larger as output bits and discriminal minimumvariation voltage can be expressed as next;

Analog voltage range(V) / 2N ( N = Output Bit Number)

For example, when analog input between 0-5V is converted by 8 Bits output, analog inputvoltage is 2V, we can find digital value,

Resolution= 28 = 256If analog input voltage varies from 0V to 5V, output digital value will be varied from 0 to 255.discriminal minimum variation voltage to change Digital value is;

VIMIN = 5 / 256 = 0.019531 , andDigital value= 2V / 0.019531V = 102.4 = 102

F. Analog Output Unit (D/A Converter)This unit is for Digital/Analog conversion and used to output analog signal form CPU tooutside. The principal to convert from analog value to digital value is that output digital valueis corresponded to analog value. The resolution is proportional to the bit numbers to input(2N),the output digital value will be converted to analog value from 0V to maximum referencevoltage.Let's find analog value corresponding to digital value 102 if analog value is 0-5V voltage, theresolution is 256, the voltage difference is 5V. Therefore the variation of digital 1 resultsvariation of analog signal 0.019531V(5/ 256). and we find 102 x 0.019531V 2 V calculationresult.

256

5V2V

102

0V

0

Analog DC Voltage

Digital Value

Page 10: 2MitsubishiMelsecPlcLadderLogicApplication

- 10 -

G. PID Control UnitPID Control Unit has function of feed-back control so that system output make referencevoltage balance and maintain based on deviation between control variable and reference input,recently this control type is mostly used in the industrial facilities.(1) Proportional action - P Action

Controller Unit will control to decrease deviation between reference input and processvariable. At this time, when operation signal Z(t) is given, and if manipulated amount isgotten, the relationship that manipulated quantities is proportional to operation signal Z(t)is as belows;

y(t) = K Z(t)We call this "Proportional action". And K, gain, will determine whether makeproportional action strong or weak.

If K, gain is high, the process variable will approach to reference signal rapidly, butoutput can be fluctuated and this result make ill influence to total control stability. On thecontrary, if K, gain is low, the process variable will approach to reference signal slowly,and there is possibility to that residual deviation occurs.

(2) Integral control action - I ActionIntegral control action can be represented as action The variation velocity of manipulatedvalue given to control object is proportional to operation signal. Using this factor, we cancontrol integral control action. If integral time is longer, manipulated amount will be smalland the time to approach to reference signal is longer. On the contrary, if integral time isshorter, manipulated amount will be large and the time to approach to reference signal isshorter. The relationship of integral control action is as belows;

y(t) = K ∫ Z(t) dt

The integral control action is not used alone, by combination to P action or D action but canbe used to PI, PID action. The integral control action can eliminate residual deviation. Ifintegral time is to short, uncontrolled state can be occurred.

(3) Derivative action - D ActionManipulated amount y(t) contributes to operation signal Z(t) by Derivative action.Derivative action calculates manipulated value corresponding to deviation rate so thatsuppress variation of deviation. The relation ship of derivative action is as follows;

y(t) = K dZ(t)/dtDerivative action is not used alone, by combination to P action or D action but can be usedto PI, PID action. If derivative action is used to controller, process variable will approach toreference signal rapidly and suppress the fast variation of process variable and externaldisturbance.

(4) PID Control UnitThe relationship combined proportional, integral, derivative action described as above,

y(t) = K ( Z + 1/Ti ∫ Z(t) dt + Td dZ(t)/dt )

Page 11: 2MitsubishiMelsecPlcLadderLogicApplication

- 11 -

PID Unit is not used alone, but used together with analog input unit and analog output unit.H. High speed Counter Unit

The counter in the CPU has nearly scan time below several ms for the CPU is scanning theprogram. For this reason, CPU cannot count the pulse shorter than this scan time. Thereforehigh speed counter unit operates separately with CPU, counts pulse as dedicated I/O unit. Alsohigh speed Counter Unit has comparing output function between set value and present value ofcounter. It provides up and down counter and is used to detect position like the CNC machine.

I. Positioning UnitThe positioning Unit is used for precise motor control like Servo-Motor, Stepping Motor. Thisunit will be applied to positioning decision of X-Y table, provides various operation patternslike constant speed, acceleration, deceleration.

3. Data Link Methods.It is commonly demanded the PLC has data exchanges between distributed remote I/O group,different PLC system, high level computer. The data link unit can reduce or eliminate I/O pointsand bulk cable installation, intends to build distributed control, data centralization andmanagement, monitoring system. The data link unit has function for data collecting of PLC,extended I/O group.

M a n a g e m e n t L e v e l

C e l l L e v e l

F ie ld L e v e l

Page 12: 2MitsubishiMelsecPlcLadderLogicApplication

- 12 -

Mitsubishi Melsec PLC Ladder LogicApplication

Digital Input Module

1. Types of Digital Input Module.A. Digital Input Module of Sink Type .

For the digital Input Module of Sink Type, the current driving input point flows from pilotsignaler connected, like push-button switch, limit switch, proximity switch, to module inside,the common point at the module will be N pole(N pole common). And if proximity switch isconnected, sensor Switch of PNP Open-Collector Type should be used. We calls this typemodule Input Module of "Sink Type".

Sink Type Digital Input Module

A

P24

N24

B. Digital Input Module of Source Type.For the source Type of Digital Input Module, the current already passes the wet point(forexample, photo-coupler) from power of P phase connected to module and flows to pilotsignaler connected to PLC input module, like push-button switch, limit switch, proximityswitch and the input point will be excited. the common point at the module will be P pole(Ppole common). And if proximity switch is connected, sensor Switch of NPN Open-CollectorType should be used. We calls this type module input module of "Source Type".

Page 13: 2MitsubishiMelsecPlcLadderLogicApplication

- 13 -

Source Type Digital Input Module

A

N24

P24

C. In case of that proximity switch of PNP Open-Collector Type is connected to sink typedigital input module .

Sink Type Digital Input Module

A

N24

P24

N24

PNP Open-Collector Type 의 근접Switch

ProximitySwitchof PNPOpenCollectorType

Page 14: 2MitsubishiMelsecPlcLadderLogicApplication

- 14 -

D. In case of that proximity switch of NPN Open-Collector Type is connected to source typedigital input module .

2. Digital AC Input Module.For the Digital AC Input Module, additional rectifying circuit that from AC to DC and voltagereducing circuit to fit to TTL or CMOS are exist in the input stage. The rest basic circuit is not somuch different with digital DC input module. Users should consider and select the sensor typeand common type of power in case of the digital DC input module.

P24

N24

NPN Open-Collector Type 의 근접Switch

Source Type Digital Input Module

A

P24

ProximitySwitchof NPNOpenCollectorType

Page 15: 2MitsubishiMelsecPlcLadderLogicApplication

- 15 -

Mitsubishi Melsec PLC Ladder LogicApplication

Digital Output Module1. Types of Digital Output Module.

A. Sink Type of Digital Output Module.For the Sink Type of Digital Output Module, the current from power source of P pole flowsoutput device like Relay, Solenoid Coil that move Actuators and the load are driven bysemi-conductor switching device in the PLC, the common point of load is + terminal(P PoleCommon) and semi-conductor switching device will be NPN Type. We calls this type moduleoutput module of "Sink Type".

Sink Type Digital Output Module

A

P24

N24

B. Source Type of Digital Output Module.For the Source Type of Digital Output Module. the power source of P pole already connects toPLC output module, the output device like Relay, Solenoid Coil that move Actuators is drivenby semi-conductor of PNP type. In case of this, the current drives output device comes outfrom PLC inside to loads, the common of loads is N pole (N Pole Common). We calls thistype module output module of "Source Type".

Page 16: 2MitsubishiMelsecPlcLadderLogicApplication

- 16 -

Source Type Digital Output Module A

P24

N24

C. Digital Relay Output Module.For the Digital Relay Output Module, the relay contact(dry contact) driven by electroniccircuits and miniature relay drives output devices. therefore there exists not polarities and wecan use DC or AC power source within a electric capacity of internal relay.

Relay Type Digital Output Module

A

AC HOT

NEUT

Page 17: 2MitsubishiMelsecPlcLadderLogicApplication

- 17 -

D. Digital SSR Output Module.Digital Relay Output Module can be used in the DC or AC, but Digital SSR Output Modulecan not be used in the DC power source but can be used only AC power source.

SSR Type Digital Output Module

A

AC HOT

NEUT

This module includes TRIAC(a kind of semiconductor with large electric capacity) what wecall "SSR (Solid State Relay)", this semiconductor drives output device, once input signalexcites to signal gate, even gate signal is removed, turn-on state of SSR in the main drivingline will go on until main line current driving output device is ZERO. Therefore we cannot usein the DC current that not to return to Zero current but can use in the AC current that crossingzero voltage.

Gate 신호

Page 18: 2MitsubishiMelsecPlcLadderLogicApplication

- 18 -

Mitsubishi Melsec PLC Ladder LogicApplication

Terminologies of Ladder Logic

1. Terminologies of Ladder Logic.A. Ladder Logic example

2. I/O Address and InstructionA. Device I/O Address

Type of DeviceAddress Description Remarks

X ExternalAddress

Input module address related to real hardware inputmodule

BitAddress

Y ExternalAddress

Output module address related to real hardwareOutput module

BitAddress

M InternalAddress

Internal Coil address used to contact and coilinternally

BitAddress

L InternalAddress

Internal Coil address used to contact and coilinternally. Even power supply go out, Status of bit is

maintained.(Retentive Coil)

BitAddress

S InternalAddress Internal Coil address to perform sequential control Bit

Address

B InternalAddress

Communication Link relay when the data exchangeamong the several PLC's

BitAddress

F InternalAddress

Internal Coil Address used as annunciator detectingexternal faults.

BitAddress

DInternal &

ExternalAddress

Word address for calculating, manipulation, storingdata, for using internally and externally

WordAddress

and

and

Page 19: 2MitsubishiMelsecPlcLadderLogicApplication

- 19 -

Device I/O Address can be divided to internal address and external address. The external isallocated and related to real hardware I/O module, the internal address is used only in theprogram logic.

B. Identification of Device I/O Address.Device I/O Address consists of Identifier and decimal number or hexadecimal number. Forexample,

X000, Y1F, M058, D103, N001

C. Allocation of Device I/O Address.Allocation of Device I/O address to PLC Hardware can be performed as follows;

- Assigned X OR Y address sequentially.- Started from first slot excluded CPU module.- assigned memory address size that I/O modules needed.

CPU

UC

24

DI 32pt

DO

32pt

DO

16pt

DI 16pt

NU

LL

X060-Y07F

Y040-Y05F

Y030-Y03F

X010-X02F

X000-X00F

POW

ER

3. Symbolization of Ladder Logic.A. Power Rail Left

The Left side of ladder logic is starting point of power energy. This regards as start of controlpower line of sequence circuit. Power flow can proceed from left side of ladder logic to rightside of ladder logic, from here, ladder logic(Instruction) like logical contact, sequentialcommand, data manipulation, calculation command can be built.

B. Power FlowFrom Power Rail Left, each command and instruction can be built and this will make inputcondition and decision making and execution. According to input condition, power flow willpass to the right side along the possible routes. When reaching to output command, executionwill be perform. So command related to execution will be located in the right side.

C. Power Rail RightThis regards as end line of control power supply in the sequence and power flow will be endedat this point.

Page 20: 2MitsubishiMelsecPlcLadderLogicApplication

- 20 -

D. RungRung can be represented to grouping of input condition and output task. If this group iscontinuous, not separated, this group can be called " Rung".

E. StepThe step is represented to Word Number consisting of Instruction, and we can calculate totalprogram memory size.

Page 21: 2MitsubishiMelsecPlcLadderLogicApplication

- 21 -

Mitsubishi Melsec PLC Ladder LogicApplication

Relation between PLC Hardware and Software1. In case of Digital Input Module.

The how act external electrical excitation to PLC inside ladder logic is represented as next. Tospeak exactly, When we press the push-button switch connected to PLC input module, let'consider what is happened to the PLC internal logic corresponding to the push-button switchcontact.The figure as next is represented before pressing the push-button switch has A contact.

The current from power P pole cannot flow to PLC input module address X000 because ofopening of pushbutton switch(NO: Normal Open state) in the electrical circuit. This is to say, atthe input point addressed to X000 of input module, there exists not external electrical excitation,we can say this "Electrically Dry State". Otherwise, in the PLC inside, NO(Normal Opened)contact of un-identified X000(not excited because of opening of pushbutton switch) can notmake power flow proceed, so this NO contact is electrically OFF state. But in the PLC inside,NC(Normal Closed) contact of un-identified X000 can proceed power flow, so this contact iselectrically ON state.

X000

P24

N24

X000

X000

PLC 내부 Logic PLC 외부 회로

Y010

Power Flow

Power Rail

Left

Power Rail

Right

Instruction

PLC External Circuit PLC Internal Logic

Page 22: 2MitsubishiMelsecPlcLadderLogicApplication

- 22 -

Now by pressing the A contact of Push-Button Switch, there exists electrical excitation at theX000 and we can say this "Electrically Wet State". In the PLC Logic, NO(Normal Opened)contact of identified X000(excited because of closing of pushbutton switch) can proceed powerflow and change to closed state, so this NO contact is electrically ON state. But in the PLCinside, NC(Normal Closed) contact of identified X000 can not make power flow proceed andchanged to opened state, so this contact is electrically OFF state.Totally, we can say them as follows;

Electrical State

corresponding to PLC

INPUT point

Lamp Status

corresponding to PLC

INPUT point

Contact state in the

PLC Internal Logic

Possibility to pass

the Power Flow

Electrically Dry StateOFF NO(Normal Open) No

OFF NC(Normal Close) Yes

Electrically Wet StateON NO(Normal Open) Yes

ON NC(Normal Close) No

X000

P24

N24

X000

X000

PLC 내부 Logic PLC 외부 회로

Y010

Power Flow

Power Rail

Left

Power Rail

Right

Instruction

PLC External Circuit PLC Internal Logic

Page 23: 2MitsubishiMelsecPlcLadderLogicApplication

- 23 -

2. In case of Digital Output Module.The how act internal ladder logic variation to PLC outside hardware is represented as next incase of Digital Output Module.

If Y010 Coil Instruction in the PLC internal Logic is Energized, the Relay 010 connected toaddressed Y010 of Digital Output Module is also Energized. Otherwise if Y011 Coil Instructionin the PLC internal Logic is De-energized, the Relay 011 connected to addressed Y011 of DigitalOutput Module is also De-energized.

Source Type Digital Output Module

P24

N24

X000

X000

PLC 내부 Logic

Y010

Power Rail

Left

Power Rail

Right

Instruction

Y010 Relay 010

Y011

Y011 Relay 011

PLC External CircuitPLC Internal Logic

Page 24: 2MitsubishiMelsecPlcLadderLogicApplication

- 24 -

Mitsubishi Melsec PLC Ladder LogicApplication

Numeric System of PLC.

1. Numeric System and DATA

The numeric system based on 10(Decimal) is developed naturally and used generally butconsidering logic system of ON and OFF state, this will be numeric system based on2(Binary numeric system). In the computer system, binary numeric system based on 2is generally used, and also 4,8,16 or 32 numeric system is used.

Numbering Systems

Numbers in Decimal, Binary, Octal and Hexadecimal

In the each numeric system, even it's basic numeric system is different, existing realvalue will not be changed. Now from here, let's consider for numeric system andconversion between the different systems needed to understanding the instruction usedin the PLC(Programmable Logic Controller).

Base Name Data Unit2 Binary Bit8 Octal Nibble

10 Decimal Digit16 Hexadecimal Byte

Decimal Binary Octal Hexadecimal0 0 0 01 1 1 12 10 2 23 11 3 34 100 4 45 101 5 56 110 6 67 111 7 78 1000 10 89 1001 11 9

10 1010 12 A11 1011 13 B12 1100 14 C13 1101 15 D14 1110 16 E15 1111 17 F16 10000 20 1017 10001 21 1118 10010 22 1219 10011 23 1320 10100 24 14

Page 25: 2MitsubishiMelsecPlcLadderLogicApplication

- 25 -

2. Numeric System

A. Binary Numeric System

Binary number is commonly used in the computer. 1 digit of binary number will beregarded as the state of 1 electric wire, if the voltage on the wire is ON state, it's bitvalue is 1, if the voltage on the wire is OFF state, it's bit value is 0. If two wiresare used, bits will be generated asa well as wires number used. The following figureis represented that 10 decimal number equivalent to each binary numbers, minimumnumber is positioned from right side. Minimum number is 1, and position number is0. The way to find from binary number to decimal number is changing the positionnumber to exponent number of 2 and converting to decimal number, adding all eachvalues. As this way, the conversion from other numeric system to decimal number ispossible.

26=64 25=32 24=16 23=8 22=4 21=2 20=1

1 1 1 0 0 0 1

1(26)= 641(25)= 321(24)= 161(23)= 81(22)= 41(21)= 21(20)= 1

------113

Conversion of a Binary Number to a Decimal Number

In every numeric system, theLSD(Least significant digit) islocated at most right side, theMSD(Least significant digit) islocated at most left side.

Page 26: 2MitsubishiMelsecPlcLadderLogicApplication

- 26 -

Decimal number can be converted to binary number by dividing as next example. Thismethod is also applied to convert from decimal number to any numeric system. Thequota value after dividing decimal number by 2 will be MSD(Most significantnumber), after dividing remained decimal number by 2 again will be next significantdigit fo binary number. With this way, until total number becomes zero final binarynumber will be found.

to begin decimalnumber 932

9322

4662

233 = 116 5 2(0.5)=12

116 = 58 0 2(0.0)=02

58 = 29 0 2(0.0)=0 11101001002

29 = 14 5 2(0.5)=12

14 = 7 0 2(0.5)=02

7 = 3 5 2(0.5)=12

3 = 1 5 2(0.5)=12

1 = 0 5 2(0.5)=12

Conversion from Decimal to Binary

The binary number can be represented to BIT, BYTE, WORD. BYTE consists of 8digits, WORD consists of 16 digits. And in order of LSD(Least Significant Bit), bitwill be positioned in order of right side. WORD consists of 2 BYTE, LSD(LeastSignificant Bit)will be positioned in the right side.

= 466 0 2(0.0)=0

= 233 0 2(0.0)=0

calculateend

to binary(Base 2)

Page 27: 2MitsubishiMelsecPlcLadderLogicApplication

- 27 -

BYTE WORDMSB LSB MSB LSB

01101011 0110101101000010

Bytes and Words

Binary: 101.011

1(22)= 4 0(21)= 0 1(20)= 1 0(2-1)= 0 1(2-2)= 1/4 1(2-3)= 1/8

= 4+0+1+0+1/4+1/8 = 5.375 Decimal

Using a Boolean algebra, the calculation of binary number can be performed as nextshown;

Boolean Operations on Binary NumbersB. Calculation of binary number.

The calculation for the negative binary number needs for special calculation method,the numeric system for negative binary number used generally is shown as next 3 typemethod. One of them, Unsigned binary number can be used, represents only positivenumber. When signed and 2's complement method is used, the maximum number canbe represented is reduced to half size. 2's complement method is generally used for thecalculation of addition and subtraction is simple and fast on the hardware andsoftware. In the PLC system, all of methods of calculation are used.

Signed binary numeric systems are shown as next. the MSD is used to sign Bit whendisplay negative binary number.

Name Example ResultAND 0010*1010 0010OR 0010+1010 1010

NOT 0010 1101EOR 0010EOR1010 1000

NAND 0010*1010 1101Shift Left 111000 110001

Shift Right 111000 011100

Decimal Binary Byte2 000000101 000000010 00000000-0 10000000-1 10000001-2 10000010

cf: two 0 numbers exists

MostSignificantByte

LeastSignificantByte

Page 28: 2MitsubishiMelsecPlcLadderLogicApplication

- 28 -

Signed Binary Numbers

2's complement method to represent negative binary number are shown as next.Basically if binary number to represent is positive number, binary number isrepresented to normal binary number. But if binary number to represent is negativenumber, after performing the complement calculation(inverting of all bits) for binarynumber to represent and add 1 to it. Otherwise to get normal binary number fromnegative binary number represented by 2's complement method, subtract 1 andperform the complement calculation(inverting of all bits).

2s Compliment Numbers

2's complement method to represent negative binary number, comparing to signedbinary numeric systems, reserved zero of binary number isn't needed, so 2'scomplement method is generally used for the calculation of addition and subtraction issimple and fast on the hardware and software. In the all of PLC system, this methodare generally used.

Integer has limited range to represent by 16bit(1 word), the range is from -32,768 to32,768. In the some case, the result of calculation can be out of range, then overflowbit will be set.

01111111=127 10000001=-127 10000001=-127+00000011=3 +11111111=-1 +11111110=-2

10000010=-126 10000000=-1 01111111=127C=0 C=1 C=1O=1(Error) O=0(No Error) O=1(Error)

Carry and Overflow Bits

Decimal Binary Byte2 000000101 000000010 00000000-1 11111111-2 11111110

method to get negative binary number

1. find absolute number.for -30 to 30=00011110

2. perform the inverting of all bits.00011110 becomes 11100001

3. add 1 to it.11100001 + 00000001 = 11100010

Page 29: 2MitsubishiMelsecPlcLadderLogicApplication

- 29 -

C. Example of other numeric system.

other numeric systems are basically converted to binary number for mathematicalcalculation and storage. 16(Hexadecimal) numeric system can be represented simply andused generally, because of the inconvenience comparing to binary number that longdisplay consisted of 0 and 1. 8(Octal) numeric system is generally used, for calculationof 8 unit is used to represent input and output. The conversion methods betweenbinary and hexadecimal, octal numeric system are shown as next;

163=4096 162=256 161=16 160=1

F 8 A 3

15(163)= 614408(162)= 2048

10(161)= 1603(160)= 3

63651

Conversion of a Hexadecimal Number to a Decimal Number

5724 =357.75 16(0.75)=12(C)16

357 =22.3125 16(0.3125)=516

22 =1.375 16(0.375)=6 1 6 5 C16

1 =0.0625 16(0.0625)=116

Conversion from Decimal to Hexadecimal

Page 30: 2MitsubishiMelsecPlcLadderLogicApplication

- 30 -

3. Binary Coded Decimal.

In the Binary Coded Decimal(BCD), four binary digits is required to represent to 1 digitof decimal number. this is not a numeric system but one of method to representdecimal number. 1 byte of binary can display value from 0 to 255, otherwise 1 byte ofBinary Coded Decimal can display value from 0 to 99. The method to represent BinaryCoded Decimal is shown as next. 16 binary digits is required to represent to 4 digit ofdecimal number.

1 2 6 3 Decimal

0001 0010 0110 0011 BCD

A BCD Encoded Number

Page 31: 2MitsubishiMelsecPlcLadderLogicApplication

- 31 -

4. Data Characterization.

A. ASCII (American Standard Code for Information Interchange)

To handle character, not number, identification number are given to each character andstring. And we can store to memory and interpret again. ASCII (American StandardCode for Information Interchange) is most generally used to character coding systemand represented as next table. This table represents not only character but also specialsymbol and control code. At each codes, identification number are given, for example,65 are given to character A.

ASCII Character Table

ASCII Character Table

Char Hex Oct Dec Char Hex Oct Dec Char Hex Oct Dec Char Hex Oct Dec

Ctrl-@NUL

00 000 0 Space 20 040 32 @ 40 100 64 ` 60 140 96

Ctrl-A SOH 01 001 1 ! 21 041 33 A 41 101 65 a 61 141 97

Ctrl-B STX 02 002 2 " 22 042 34 B 42 102 66 b 62 142 98

Ctrl-C ETX 03 003 3 # 23 043 35 C 43 103 67 c 63 143 99

Ctrl-D EOT 04 004 4 $ 24 044 36 D 44 104 68 d 64 144 100

Ctrl-E ENQ 05 005 5 % 25 045 37 E 45 105 69 e 65 145 101

Ctrl-F ACK 06 006 6 & 26 046 38 F 46 106 70 f 66 146 102

Ctrl-G BEL 07 007 7 ' 27 047 39 G 47 107 71 g 67 147 103

Ctrl-H BS 08 010 8 ( 28 050 40 H 48 110 72 h 68 150 104

Ctrl-I HT 09 011 9 ) 29 051 41 I 49 111 73 i 69 151 105

Ctrl-J LF 0A 012 10 * 2A 052 42 J 4A 112 74 j 6A 152 106

Ctrl-K VT 0B 013 11 + 2B 053 43 K 4B 113 75 k 6B 153 107

Ctrl-L FF 0C 014 12 , 2C 054 44 L 4C 114 76 l 6C 154 108

Ctrl-M CR 0D 015 13 - 2D 055 45 M 4D 115 77 m 6D 155 109

Ctrl-N SO 0E 016 14 . 2E 056 46 N 4E 116 78 n 6E 156 110

Ctrl-O SI 0F 017 15 / 2F 057 47 O 4F 117 79 o 6F 157 111

Ctrl-P DLE 10 020 16 0 30 060 48 P 50 120 80 p 70 160 112

Ctrl-Q DCI 11 021 17 1 31 061 49 Q 51 121 81 q 71 161 113

Ctrl-R DC2 12 022 18 2 32 062 50 R 52 122 82 r 72 162 114

Ctrl-S DC3 13 023 19 3 33 063 51 S 53 123 83 s 73 163 115

Ctrl-T DC4 14 024 20 4 34 064 52 T 54 124 84 t 74 164 116

Ctrl-U NAK 15 025 21 5 35 065 53 U 55 125 85 u 75 165 117

Ctrl-V SYN 16 026 22 6 36 066 54 V 56 126 86 v 76 166 118

Ctrl-W ETB 17 027 23 7 37 067 55 W 57 127 87 w 77 167 119

Ctrl-X CAN 18 030 24 8 38 070 56 X 58 130 88 x 78 170 120

Ctrl-Y EM 19 031 25 9 39 071 57 Y 59 131 89 y 79 171 121

Ctrl-Z SUB 1A 032 26 : 3A 072 58 Z 5A 132 90 z 7A 172 122

Ctrl-[ ESC 1B 033 27 ; 3B 073 59 [ 5B 133 91 { 7B 173 123

Ctrl-₩ FS 1C 034 28 3C 074 60 ₩ 5C 134 92 | 7C 174 124

Ctrl-] GS 1D 035 29 = 3D 075 61 ] 5D 135 93 } 7D 175 125

Ctrl-^ RS 1E 036 30 > 3E 076 62 ^ 5E 136 94 ~ 7E 176 126

Ctrl_ US 1F 037 31 ? 3F 077 63 _ 5F 137 95 DEL 7F 177 127

Page 32: 2MitsubishiMelsecPlcLadderLogicApplication

- 32 -

In this ASCII Character Table, code number is used from 0 to 127, but morecomplicated special figure symbol or international character are generally used andhandled. The character is combined to string and LF or CR code is located at the endof line.

B. Parity

When data is transmitted or stored the error often happen. In the harsh environment, especiallyin the factory or plants, there exists some mis-occurrence in the data transmission line andtelephone due to noise. To prevent to occur errors, parity bit can be added to end of dataframe to detect data transmission error. If error is detect after parity checking, the data will betransmitted again or ignored.

Parity Bit is located at the additional 9th bit to data byte 8 Bit. When the data is encoded,communication device counts active data bits number. And parity bit is calculated whethertotal active data bits has odd or even number. Transmitted data byte is confirmed with paritybit, whether total active data bits has odd or even number. If error is detect after paritychecking, the data will be ignored and re-transmission is required. There are two types ofparity check methods, odd parity check and even parity check.

Parity Bits on a Byte

C. Check-sums

Parity Bit is favorable to combination of a few datum, otherwise Checksum is advantageousfor more complicate and large data transmission check. Checksum is simple algebraical sum oftotal datum. Before perform a transmission, total bytes of datum is added. and this checksum issent with datum together. The checksum of received datum is calculated by addition andchecksum compared with checksum sent. If result of checksum comparing is concurrent, thedatum is accepted. The example of checksum calculation is shown as belows:

DATA1244325592747

CHECKSUM505

Data Bit Parity BitOdd

Parity1010111010111000

10

EvenParity

0010101010111101

01

Page 33: 2MitsubishiMelsecPlcLadderLogicApplication

- 33 -

D. Gray Code

Parity Bit and Checksum is possible to check for every data values. Gray Code is usedto check data that should be accordance with binary order. Gray code is generallyused to measure angular value for encoders. The basic is that 1 bit changes oncewhen the binary number increase or decrease by 1. By this way, it's easier to checkthe error of data bit. The example of Gray code is represented as belows:

Gray Code for a Nibble

Decimal Gray Code0 00001 00012 00113 00104 01105 01116 01017 01008 11009 1101

10 111111 111012 101013 101114 100115 1000

Page 34: 2MitsubishiMelsecPlcLadderLogicApplication

- 34 -

Mitsubishi Melsec PLC Ladder LogicApplication

Karnaugh Map

1. Introduction of Karnaugh Map.

Karnaugh map makes possible to convert directly from complicated boolean algebra tosimplified boolean algebra without simplifying calculation using a truth table.

Before converting from truth table to boolean algebra, truth table can be shown as next.Row and column can be determined form input variable. we may select arbitrarily whichvariable will be used to row or column, we can find the same solution even Karnaughmap are shown differently. The variables is assigned to both of row and column torepresent bit value considering also NOT. The assignment order of bits is the same as00, 01, 11, 10. Describe bit status of true value for output variable A from truth tableto the Karnaugh map.

Step1 : Making of truth table for S,M,W,Q,A.

Step2 : Selecting SQ and MW, assign to input variable.Step3 : According to input variable, write truth status to Karnaugh map.

The Karnaugh Map

S M W Q A0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 00 1 0 0 00 1 0 1 00 1 1 0 00 1 1 1 01 0 0 0 01 0 0 1 11 0 1 0 01 0 1 1 01 1 0 0 01 1 0 1 11 1 1 0 01 1 1 1 1

MW(=00) MW(=01) MW(=11) MW(=10)SQ(=00)SQ(=01)SQ(=11) 1 1 1SQ(=10)

M is common.

All is in SQ row.

W is common.

Page 35: 2MitsubishiMelsecPlcLadderLogicApplication

- 35 -

After written truth status to Karnaugh map, we can find typical identity of pattern for1's(True state). When two or more bits exists on the in the same column or row, makea circling these identity. Also after putting left side to right side or upper side to lowerside like a belt, two or more bits exists on the in the same column or row will appear.this identity has to make circling.

These patterns is to be expressed to boolean algebra, the fact that all truth bits islocated at 3th line is meaning that SQ will be expressed to AND relation. Also in the3th line, two pattern with common M and W exists. These pattern will be appeared torelationship of boolean result and it can be converted to ladder logic.

Step4: Observe Map Pattern.

Step5: Make boolean relation according to Pattern.A = S*Q*(M+W)

Step6: Make Ladder Logic with this result.

Karnaugh map is alternative method that simplify the boolean algebra, is the way toverify the calculation result of boolean algebra. In this example, there are four inputvariables, two variables exists in row, also two variables exists in column. It is alsopossible for more input variables, if 5 input variable exists, 3 input variables patternsfor row or column can be made like 000, 001, 011, 010, 110, 111, 101, 100. Ifoutput variable exists two or more, Several karnaugh maps can be exist as well asnumber of output variables.

M is common.

All is in SQ row.

W is common.

Page 36: 2MitsubishiMelsecPlcLadderLogicApplication

- 36 -

2. Practical Example.

A. Express the following truth table to Karnaugh map.

Result:

B. Express to ladder logic after simplifying truth table using Karnaugh map.

A B C D Result

0 0 0 0 0

0 0 0 1 0

0 0 1 0 0

0 0 1 1 1

0 1 0 0 1

0 1 0 1 1

0 1 1 0 1

0 1 1 1 1

1 0 0 0 0

1 0 0 1 0

1 0 1 0 1

1 0 1 1 1

1 1 0 0 0

1 1 0 1 0

1 1 1 0 1

1 1 1 1 1

AB AB AB ABCD 1 1 1 1CD 1 1 0 1CD 0 0 0 1CD 0 0 0 1

A B C D X0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 00 1 0 0 00 1 0 1 00 1 1 0 10 1 1 1 11 0 0 0 01 0 0 1 01 0 1 0 01 0 1 1 01 1 0 0 01 1 0 1 01 1 1 0 11 1 1 1 1

Page 37: 2MitsubishiMelsecPlcLadderLogicApplication

- 37 -

CD

C. Simplify using next Karnaugh map.

D. Express to ladder logic after simplifying truth table using Karnaugh map.

00 01 11 1000 0 0 0 001 0 0 1 111 0 0 1 110 0 0 0 0

CD CD CD CDAB 1 0 0 1AB 0 0 0 0AB 0 0 0 0AB 0 1 1 0

A B C D X Y0 0 0 0 0 00 0 0 1 0 10 0 1 0 0 00 0 1 1 0 00 1 0 0 0 00 1 0 1 0 00 1 1 0 0 10 1 1 1 0 11 0 0 0 1 01 0 0 1 1 11 0 1 0 0 01 0 1 1 0 01 1 0 0 1 01 1 0 1 1 01 1 1 0 0 11 1 1 1 0 1

ABX = BC

B is true for allsection.

B =(AD+AD)

Page 38: 2MitsubishiMelsecPlcLadderLogicApplication

- 38 -

For X

For Y

E. Express to ladder logic after simplifying truth table using Karnaugh map.

00 01 11 1000 0 0 0 001 0 0 0 011 1 1 0 010 1 1 0 0

D E F G Y0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 00 1 0 0 00 1 0 1 10 1 1 0 00 1 1 1 11 0 0 0 01 0 0 1 11 0 1 0 01 0 1 1 11 1 0 0 01 1 0 1 11 1 1 0 01 1 1 1 1

CD

AB

Page 39: 2MitsubishiMelsecPlcLadderLogicApplication

- 39 -

G. Express to ladder logic using Karnaugh map without finding relation of BooleanAlgebra.

00 01 11 1000 0 0 0 001 0 1 1 011 0 1 1 010 0 1 1 0

ABC ABC ABC ABC ABC ABC ABC ABCDE 1 1 0 1 0 0 0 0DE 1 1 0 0 0 0 0 0DE 1 1 0 0 0 0 0 0DE 1 1 0 1 0 0 0 0

FG

Y = G(E+D)DE

AB ABCE Output=AB+ABCE

Page 40: 2MitsubishiMelsecPlcLadderLogicApplication

- 40 -

II. Application Examples for Logical Command.

Logical AND▷

Logical OR▷

Logical NAND▷

Logical NOR▷

Logical Exclusive OR▷

1 Scan-time Oscillator▷

Self-Holding, 0 or 1 Dominant SR/RS Flip-Flop▷

Detect Rising Edge / Falling Edge, Differentiation▷

Dual action Pushbutton▷

Trouble Acknowledge/ Reset▷

Page 41: 2MitsubishiMelsecPlcLadderLogicApplication

- 41 -

Mitsubishi Melsec PLC Ladder LogicApplication

Logical AND

1. Ladder Logic exampleLogical AND

X0 is Input Switch A and X1 Input Switch B. This Logic is equivalent to the next electricalcircuit.

Input Switch A Input Switch B

Pilot Lamp

In this circuit, Pilot Lamp Y10 is ON When Input Switch A and Input Switch B is closed state.We call this circuit AND, the output state according to each input switch is represented as nextTruth Table and Boolean Equation.

A * B = C or A x B = C

Input Switch A X0 Input Switch B X1 Pilot Lamp Y100(OFF) 0(OFF) 0(OFF)0(OFF) 1(ON) 0(OFF)1(ON) 0(OFF) 0(OFF)1(ON) 1(ON) 1(ON)

Page 42: 2MitsubishiMelsecPlcLadderLogicApplication

- 42 -

Mitsubishi Melsec PLC Ladder LogicApplicationLogical OR

1. Ladder Logic exampleLogical OR

X0 is Input Switch A and X1 Input Switch B. This Logic is equivalent to the next electricalcircuit.

Input Switch A

Input Switch B Pilot Lamp

In this circuit, Pilot Lamp Y10 is ON When Input Switch A or Input Switch B is closed state.We call this circuit OR, the output state according to each input switch is represented as nextTruth Table and Boolean Equation.

A + B = C

Input Switch A X0 Input Switch B X1 Pilot Lamp Y100(OFF) 0(OFF) 0(OFF)0(OFF) 1(ON) 1(ON)1(ON) 0(OFF) 1(ON)1(ON) 1(ON) 1(ON)

Page 43: 2MitsubishiMelsecPlcLadderLogicApplication

- 43 -

Mitsubishi Melsec PLC Ladder LogicApplication

Logical NAND

1. Ladder Logic exampleLogical NAND

X0 is Input Switch A and X1 Input Switch B. This Logic is equivalent to the next electricalcircuit.

Input Switch A

Input Switch B Pilot Lamp

In this circuit, Pilot Lamp Y10 is OFF When Input Switch A and Input Switch B is opened state.But Pilot Lamp Y10 will be not OFF When only one of Input Switch A and Input Switch B isopened state. We call this circuit NAND, the output state according to each input switch isrepresented as next Truth Table and Boolean Equation.

A + B = C

This Logic is equivalent to the next ladder logic.

Input Switch A X0 Input Switch B X1 Pilot Lamp C Y100(OFF) 0(OFF) 1(ON)0(OFF) 1(ON) 1(ON)1(ON) 0(OFF) 1(ON)1(ON) 1(ON) 0(OFF)

Page 44: 2MitsubishiMelsecPlcLadderLogicApplication

- 44 -

This logic is also represented as next Boolean Equation.

(A + B)= A * B = C or A x B = C

Page 45: 2MitsubishiMelsecPlcLadderLogicApplication

- 45 -

Mitsubishi Melsec PLC Ladder LogicApplication

Logical NOR

1. Ladder Logic exampleLogical NOR

X0 is Input Switch A and X1 Input Switch B. This Logic is equivalent to the next electricalcircuit.

Input Switch A Input Switch B

Pilot Lamp

In this circuit, Pilot Lamp Y10 is OFF When Input Switch A or Input Switch B is opened state.But Pilot Lamp Y10 will be ON When both of Input Switch A and Input Switch B is closedstate. We call this circuit NOR, the output state according to each input switch is represented asnext Truth Table and Boolean Equation.

A * B = C or A x B = C

Input Switch A X0 Input Switch B X1 Pilot Lamp C Y100(OFF) 0(OFF) 1(ON)0(OFF) 1(ON) 0(OFF)1(ON) 0(OFF) 0(OFF)1(ON) 1(ON) 0(OFF)

Page 46: 2MitsubishiMelsecPlcLadderLogicApplication

- 46 -

This Logic is equivalent to the next ladder logic.

This logic is also represented as next Boolean Equation.

(A + B)= A * B = C or A x B = C

Page 47: 2MitsubishiMelsecPlcLadderLogicApplication

- 47 -

Mitsubishi Melsec PLC Ladder LogicApplication

Logical Exclusive OR1. Ladder Logic example

Logical Exclusive OR

X0 is Input Switch A and X1 Input Switch B. This Logic is equivalent to the next electricalcircuit.

Input Switch A Input Switch B

Pilot Lamp

In this circuit, Pilot Lamp Y10 is ON When only one of Input Switch A or Input Switch B ispressed. But Pilot Lamp Y10 will be OFF When both of Input Switch A and Input Switch B ispressed or not pressed state. We call this circuit Exclusive OR, the output state according to eachinput switch is represented as next Truth Table and Boolean Equation.

A + B = A * B + A * B = C

Input Switch A X0 Input Switch B X1 Pilot Lamp C Y100(OFF) 0(OFF) 0(OFF)0(OFF) 1(ON) 1(ON)1(ON) 0(OFF) 1(ON)1(ON) 1(ON) 0(OFF)

Page 48: 2MitsubishiMelsecPlcLadderLogicApplication

- 48 -

Mitsubishi Melsec PLC Ladder LogicApplication

1 Scan-time Oscillator

1. Ladder Logic example1 Scan Oscillator

Output M100

The total scan time is 2 scan including on duty(1 scan)and off duty(1 scan).2 Scan Oscillator

Output M100

The total scan time is 4 scan including on duty(2 scan)와 off duty(2 scan).2. Explanation.

This 1 Scan Oscillator used special characteristic of PLC I/O batch processing that updates I/Odevice and reference Image and solves logic. 2 scan oscillator also can be made using specialcharacteristic of PLC referring to I/O status table. The order of PLC logic solving proceed fromleft to right and from top to bottom.

Page 49: 2MitsubishiMelsecPlcLadderLogicApplication

- 49 -

In case of 2 Scan Oscillator, I/O status table are as following.

Scan-time 1st Scan 2nd Scan 3rd Scan 4th Scan 5th Scan 6th Scan 7th ScanContact M100 Pass Disconnect Pass Disconnect Pass Disconnect Pass

SolvingResult of

Coil M100On Off On Off On Off On

Scan-time 1st Scan 2nd Scan 3rd Scan 4th Scan 5th Scan 6th Scan 7th Scan 8th scanM100 On On Off Off On On Off OffM101 Off On On Off Off On On OffM102 Off On On Off Off On On Off

Page 50: 2MitsubishiMelsecPlcLadderLogicApplication

- 50 -

Mitsubishi Melsec PLC Ladder LogicApplication

Self-Holding, 0 or 1 Dominant SR/RS Flip-Flop

1. Ladder Logic example

2. Explanation.The self holding circuit is generally used and there are two type of self holding circuit, 0Dominant Self Holding circuit and 1 Dominant Self Holding circuit. This circuit can be alsoregarded as SR Flip-Flop and RS Flip-flop and has two inputs and one or two outputs. Whentwo input are 1(truth state), The next truth table are shown that output Y0 becomes 0 in case of 0Dominant Self Holding and output Y0 becomes 1 in case of 1 Dominant Self Holding.

Page 51: 2MitsubishiMelsecPlcLadderLogicApplication

- 51 -

Mitsubishi Melsec PLC Ladder LogicApplication

Detect Rising Edge / Falling Edge, Differentiation

1. Ladder Logic examplePulse Detection for Rising / Falling Edge

Time ChartX0 X1

Y10 Y11

The scan times of Y10, Y11 are each 1 scan.

The equivalent circuit of PLS Y10.

The equivalent circuit of PLS Y11.

2. Explanation.The scan time of output of PLS command is 1 scan time at the moment when input is ON(at therising edge). The scan time of output of PLF command is 1 scan time at the moment when inputis OFF(at the falling edge). These command is used to detect synchronized task for inputtingevent.The equivalent circuit can be used in PLC that PLS /PLF command is not supported, M100,M101 is auxiliary contact.

Page 52: 2MitsubishiMelsecPlcLadderLogicApplication

- 52 -

Mitsubishi Melsec PLC Ladder LogicApplication

Dual action Pushbutton

1. Ladder Logic example

2. Explanation.In the above ladder logic, SET/RESET command has a function of Flip-Flop, adding it's invertedoutput to the input of the SET/RESET, total circuit acts as Toggle Flip-Flop by excitation of PLSM30. Whenever input X9 is excited(like pushbutton), Output M31 will repeat ON/OFF action.Generally, Actuator has each ON switch and OFF switch, in this case, this switch can operateON/OFF action of output by 1 switch.

X9

M31

Page 53: 2MitsubishiMelsecPlcLadderLogicApplication

- 53 -

Mitsubishi Melsec PLC Ladder LogicApplication

Trouble Acknowledge/ reset

1. Ladder Logic example

2. Explanation.If Level low-low Trouble occurs, M100 is latched, pilot lamp Y20 blinks slowly. Whenpush-button switch X11 is pressed, M101 is latched, pilot lamp stop flickering action, keep onbeing ON state. If trouble occurs again, acknowledge state is broken by PLS M102, annunciatorreturns to initial state. If pushbutton X10 is pressed, trouble annunciating state is re-scanned.

Page 54: 2MitsubishiMelsecPlcLadderLogicApplication

- 54 -

III. Application Example for Sequential Command.

On Delay / Off Delay Timer▷

One Shot Multi-vibrator▷

Multi-Vibrator▷

Speed Monitor using OFF Delay Timer▷

Preventing Chattering Noise for Mechanical Contacts▷

Finding Stable Value by TIME Filter from Analog Input Hunting▷

Measuring Time for Continuous Production.▷

Optimizing Surveillance Timer of Speed Monitor▷

Surveillance of Motor Drive System▷

Detecting Value Changed▷

Page 55: 2MitsubishiMelsecPlcLadderLogicApplication

- 55 -

Mitsubishi Melsec PLC Ladder LogicApplication

On Delay / Off Delay Timer

1. Ladder LogicOn delay Timer

X0

Y105 sec

Off Delay Timer

Page 56: 2MitsubishiMelsecPlcLadderLogicApplication

- 56 -

X1

Y11 5 sec

2. Explanation.Timer function of Mitsubishi Melsec PLC is basically On Delay Timer. After Input X0 isactivated, output Y10 of On delay timer T50 will be ON after 5 sec. If T51 Timer is activated byinverted input X1 and output Y11 is activated by inverted timer contact T51, Off Delay TimerT51 is represented. Even X1 is OFF, output Y11 of timer T51 hold ON state during 5 sec.

Page 57: 2MitsubishiMelsecPlcLadderLogicApplication

- 57 -

Mitsubishi Melsec PLC Ladder LogicApplication

One Shot Multi-vibrator

1. Ladder LogicOne Shot Timer

X0

Y10 5 sec

Re-triggerable One shot Timer

X1

Y11

2. Explanation.One Shot Timer as described above consists of self holding logic and 1 timer. After Input X0 isactivated, output Y10 of timer T50 hold ON state during 5 sec. To perform Re-triggerable timer,adding RST T50 Logic makes it possible.

Page 58: 2MitsubishiMelsecPlcLadderLogicApplication

- 58 -

Mitsubishi Melsec PLC Ladder LogicApplicationMulti-Vibrator

1. Ladder Logic

2. Explanation.By inverted feedback of activated T51 timer at the initial time, this circuit begins oscillation. T50Timer determines on duty time, T51 Timer determines off duty time. Real output Y10 uses T51Flicker Contact, total blinking will be 1 sec.

Y10 0.5S 0.5S

Page 59: 2MitsubishiMelsecPlcLadderLogicApplication

- 59 -

Mitsubishi Melsec PLC Ladder LogicApplication

Speed Monitor using OFF Delay Timer

1. Ladder Diagram Example

Before Trouble Occurs.(Normal State)

After Trouble Occurred(Trouble State)

Page 60: 2MitsubishiMelsecPlcLadderLogicApplication

- 60 -

MOTOR

Proximity

Switch

2. Explanation.Using a TOF(Off Delay Timer), we can monitor continuous revolution state of motor or rotator.Whatever motor or rotator have any forms, by installation of proximity switch and actuator atshaft of motor or rotator, continuous surveillance of speed or belt, bearing can be possible. Wecan adjust the excitation period of proximity switch and actuator at the logic, this can be thesetting time of TOF(Off Delay Timer). To prevent happening of trouble, the excitation periodtime of proximity switch and actuator is within a TOF Preset time so that power flow of troublelogic isn't discontinuous.

Page 61: 2MitsubishiMelsecPlcLadderLogicApplication

- 61 -

Mitsubishi Melsec PLC Ladder LogicApplication

Preventing Chattering Noise for Mechanical Contacts

1. Ladder Logic

ChatteringInput X0

Filtered

Input M100

ChatteringInput X0

Considering +Edge

Input M101

Page 62: 2MitsubishiMelsecPlcLadderLogicApplication

- 62 -

2. Explanation.For contact of mechanical Switches, if it becomes obsoleted, this will cause electrical transitionnoise. These chattering noise will cause mal-function of the machine. This can be prevented byPLC logic. Using a TON logic, the noise can be suppressed at the transition of rising edge ofelectrical signal. Also using a TOF logic, the noise can be suppressed at the transition of fallingedge of electrical signal. But programmer should accept the result asynchronous timing signalby delaying of TON and TOF.

Page 63: 2MitsubishiMelsecPlcLadderLogicApplication

- 63 -

Mitsubishi Melsec PLC Ladder LogicApplication

Finding Stable Value by TIME Filter from Analog Input Hunting

1. Ladder Diagram Example

A. Ratio Control Ladder Logic Example

2 Explanation.Sometimes Analog Input value is hunted by noise or process problem to be impossible to findcomparing point. In this case this logic make hunting analog input value stable. It is possible tomake rapidly changing input value so dull by constant time increasing and decreasing. Timeconstant should adjust to fit to site situation.

D500 : Simulated Input for HuntingD20 : Time Filtered Input

Page 64: 2MitsubishiMelsecPlcLadderLogicApplication

- 64 -

Mitsubishi Melsec PLC Ladder LogicApplication

Measuring Time for Continuous Production.

1. Ladder Logic exampleExample 1.

Example 2.

Page 65: 2MitsubishiMelsecPlcLadderLogicApplication

- 65 -

2. Explanation.This program is for measuring of production time, total operation time is stored at D100-D103.At below 60 sec, this will be cut down and not included to total operation time. To prevent this,programmer should use time base of 1 second, not a 1 minute.

Page 66: 2MitsubishiMelsecPlcLadderLogicApplication

- 66 -

Mitsubishi Melsec PLC Ladder LogicApplication

Optimizing Surveillance Timer of Speed Monitor

1. Ladder Logic example

2. Explanation.Drive system of AC General Motor has function of surveillance for operation state of magnetswitch and feedback signal of speed monitor of motion System. But for more delicatesurveillance of speed monitor, this example will be applicable.M300 is Trouble Flag, this can be reset by Pushbutton Switch X0 at any time. T50 Timer is usedto maintain time until the motor has the normal speed and torque after overcome inertia.At this time, T150 is OFF Delay timer by excitation of input X9 of proximity switch forsurveillance of speed monitoring .

Page 67: 2MitsubishiMelsecPlcLadderLogicApplication

- 67 -

At first, we make Dual Action Switch Logic to measure excitation period from the proximityswitch, let timers T151 AND T152 operate by it's A/B contact. T151 is regarded as oddexcitation period, T152 is regarded as even excitation period.

Page 68: 2MitsubishiMelsecPlcLadderLogicApplication

- 68 -

Using Falling Edge of M31, we store instant value of odd and even excitation period to D52register. By using X3 pushbutton, when motor drive system is stable, this value can be reflectedto preset value of running surveillance timer.

Page 69: 2MitsubishiMelsecPlcLadderLogicApplication

- 69 -

Mitsubishi Melsec PLC Ladder LogicApplication

Surveillance of Motor Drive System

1. Ladder Logic example

2. Explanation.This example is for surveillance and operation of general Motor Drive System. For Manualmode or Auto Mode, the things to have to be monitored and checked is the ON state of magnetswitch supplying power to motor and motor system is operated with normal speed within a settime after magnet switch is ON. By this means, normal condition should be also checkedwhether mechanical power transferring device of motor drive system is in good condition.Driving belt, looseness of chain belt and speed reducer will be included.Seeing ladder logic, after PLC Output Y10 is On, two timer will be operated. Before first timer isdone, Return Signal(X30) of magnet switch should be returned and cut the operation of T30

Page 70: 2MitsubishiMelsecPlcLadderLogicApplication

- 70 -

timer. Before second timer is done, Return Signal(X31) of speed monitor should be returned andcut the operation of T31 timer. If it's not, cutoff of trouble flag M300, M301 cause motor trip bytimer operation.The trouble flag in trip can be reset by pressing the reset pushbutton Switch. The preset value ofsurveillance timer should be optimized during test-run.

Y10

PLC Output

Module RST

PLC Input

Module

X30

X31

Motor Fan

Magnet

Return

Signal

Speed

Monitor

Return

Signal

Page 71: 2MitsubishiMelsecPlcLadderLogicApplication

- 71 -

Mitsubishi Melsec PLC Ladder LogicApplication

Detecting Value Changed

1. Ladder Logic example

2. Explanation.Seeing command Move D100 D101 after M9036, Analog value 01(D100) is transferred to D101to compare at next scan. At next scan if new Analog value 01(D100)is different with Analogvalue 01(D101) stored at the previous scan, One shot timer annunciate that the value is changed.

Page 72: 2MitsubishiMelsecPlcLadderLogicApplication

- 72 -

IV. Application Example for Flow Sequential Command.

Sequence Control with BSFL Command▷

Sequence Control with SFTP Command▷

Call Subroutines and Return Processing▷

Sorting Data of Table in Maximum Order▷

Page 73: 2MitsubishiMelsecPlcLadderLogicApplication

- 73 -

Mitsubishi Melsec PLC Ladder LogicApplication

Sequence Control with BSFL Command

1. Ladder Logic example

2. Explanation.Sequence Control generally can be performed by consisting of NO/NC Contact Coil andprogramming of AND/OR/NOT. At this time, the ladder logic example of batch manufacturingprocess that has constant processing cycle is shown.Bit Shift command is initiated by energizing of X0 Input. After this each process step of Event

Page 74: 2MitsubishiMelsecPlcLadderLogicApplication

- 74 -

are proceeded by sensor or switch from the bit M48 to M54, total process cycle completes bybits Shifting. At the end of ladder logic, [MOV H0 K4M40] is for initial reset and programrestart after 1cycle completion.

This sub-routine will be initiated by bit start of M49 from main logic and completed from the bitM80 to M83. After completion of Sub-routine processing, program flow return to main logic byenergizing of M84 and all bits related Sub-routine Bit will be initialized.

Page 75: 2MitsubishiMelsecPlcLadderLogicApplication

- 75 -

Finally actuators are driven by M Coil.

Page 76: 2MitsubishiMelsecPlcLadderLogicApplication

- 76 -

3. Sequence Block Diagram

Material

Reached

Belt

Conveyor

Stop

Material

Reached

Tool move

To 1st

Position

Drill

Advance

Drilling

Drill

Retract

Tool

Change

Blower

Advance

Cleaning

Blower

Retract

Belt

Conveyor

Start

Page 77: 2MitsubishiMelsecPlcLadderLogicApplication

- 77 -

Mitsubishi Melsec PLC Ladder LogicApplication

Sequence Control with SFTP Command

1. Ladder Logic example

2. Explanation.Sequence Control generally can be performed by consisting of NO/NC Contact Coil andprogramming of AND/OR/NOT. At this time, the ladder logic example of batch manufacturingprocess that has constant processing cycle is shown.Bit Shift command is initiated by energizing of X0 Input. After this each process step of Eventare proceeded by sensor or switch from the bit M48 to M58, total process cycle completes bybits Shifting. At the end of ladder logic, [MOV H0 K4M40] is for initial reset and programrestart after 1cycle completion.

Page 78: 2MitsubishiMelsecPlcLadderLogicApplication

- 78 -

All bits will be initialized by energizing of M58 bit.

Page 79: 2MitsubishiMelsecPlcLadderLogicApplication

- 79 -

3. Sequence Block Diagram

Material

Reached

Belt

Conveyor

Stop

Material

Reached

Tool move

To 1st

Position

Drill

Advance

Drilling

Drill

Retract

Tool

Change

Blower

Advance

Cleaning

Blower

Retract

Belt

Conveyor

Start

Page 80: 2MitsubishiMelsecPlcLadderLogicApplication

- 80 -

Mitsubishi Melsec PLC Ladder LogicApplication

Call Subroutines and Return Processing

1. Ladder Logic

In case that calling Subroutine 1

2. Explanation.This example is to process sub-routine using a CALL/RET command. Subroutine is generallyused to substitute repetition of the same, will prevent to re-edit ladder logic and make logicsimple, save the program memory by reduce program step number.X2 and X3 is to SET/RESET Y30 at each Subroutine of P1 and P2. If these two switch are ONand X0 is ON, Y30 will be SET by calling subroutine1. If X1 is On, Y30 will be RESET bycalling subroutine2.

Page 81: 2MitsubishiMelsecPlcLadderLogicApplication

- 81 -

In case that calling Subroutine 2

Page 82: 2MitsubishiMelsecPlcLadderLogicApplication

- 82 -

Mitsubishi Melsec PLC Ladder LogicApplication

Sorting Data of Table in Maximum Order

1. Ladder Logic

Page 83: 2MitsubishiMelsecPlcLadderLogicApplication

- 83 -

2. Explanation.Using a For/Next command, the ladder logic example that sort number in the data table by orderof maximum number. The outer loop of For/Next command is to store found maximum value tonew table D40-D49, The inner loop of For/Next command is to find maximum value. At thistime, Index Register z acts as Pointer of Sorted Table , Index Register v acts as pointer that takeout the data from table to sort. Also this Pointer substitute pointer value to D101 register forstoring zero value to register of maximum value already found.

The first part of his logic is to initialize all register value.

Page 84: 2MitsubishiMelsecPlcLadderLogicApplication

- 84 -

Data Table Before Sorting

Sorted Data Table

Page 85: 2MitsubishiMelsecPlcLadderLogicApplication

- 85 -

V. Application Example for MUX-DEMUX.

Parallel Driving for▷ 7 Segment DisplayEconomic Discrete Input Multiplexing-Demultiplexing▷

Page 86: 2MitsubishiMelsecPlcLadderLogicApplication

- 86 -

Mitsubishi Melsec PLC Ladder LogicApplication

Parallel Driving for 7 Segment Display

1. Concept.This Application Note is for simplifying of ladder logic to display BCD value to 7 SegmentDisplay units and minimize hardware to be used, using parallel Data line of 7 Segment Displayunits and Latch Signal line.

2. Testing Equipments : Autonics 7 Segment Display Unit3. 7 Segment Jumper setting:

4. Schematic Wiring Diagram.Melsec Discrete OutputTransistor DC24V 7 Segment Display Units

8 8 8 8Y21

Y22

Y23

Y24

Y25

Y26

Y27

Y28

4 Data lines

4 Latch lines

5. Used Ladder logicsAt first, Binary value to display is converted to BCD numeric system, this value is moved to eachregister as much as 1digit, thrown to 4 data line via output module from Y21 to Y24 and latchstrobe signal is thrown to 7segment display. sequentially this action is repeated for 1 digit by1digit.

M9038 , special contact, is ON for only 1scan when PLC start RUN , is used to make Data andStrobe Train. The bit of D0 written by M9038 will be shifted to left side for 1 bit when m100 isON by SFL command. This bit will be moved from M0 to M15 and used data and strobe(latch)output signal

Jumper Item SettingsDecimal/ Hexa-decimal Select DecimalLatch Active High/Low Select Active lowDynamic(Serial)/ Parallel Select Parallel

Page 87: 2MitsubishiMelsecPlcLadderLogicApplication

- 87 -

Output from Y28 to Y2B is used to transfer data to 7 Segment Unit. If Data/ Strobe Train andMove Logic is add, user can add any number of 7 Segment Unit as far as speed limit.

Page 88: 2MitsubishiMelsecPlcLadderLogicApplication

- 88 -

Page 89: 2MitsubishiMelsecPlcLadderLogicApplication

- 89 -

Mitsubishi Melsec PLC Ladder LogicApplication

Economic Discrete Input Multiplexing-Demultiplexing

1. Concept.This Application Note is for simplifying and saving of digital input module. Each groups of pilotsignaler and sensing device with diodes installed is connected to digital input module. and powercommon line of each group is connected to digital output module and driven with sequentialstrobe. Synchronizing strobe of digital output, each group of signaler will give their datainformation to digital input module and this will act as multiplexing with TDM(Time DivisionModulation). Otherwise in the PLC, synchronizing strobe of digital output, data information ofgroup of signaler from digital input module is stored in the buffer memory one by one and thiswill act as de-multiplexing.

2. Schematic Wiring Diagram.Melsec Discrete Input/OutputTransistor DC24V

3. Used Ladder LogicsThe output from Y2C to Y2F is to output strobe for multiplexing sequentially, and 1 strobe isneeded per the group of multi-input. Multi-input group should consist of dry contact typesignaler like Push-button Switch, Limit Switch, Thumb-wheel Switch, semi-conductor typesignaler like proximity switch is not suitable for this application considering fast speed response.The strobe output should be synchronized to data train in the ladder logic. In the practical

Y2C

Y2D

Y2E

Y2F

X01

X02

X03

X04

:

:

:

:

X16

:

:

:

:

:

:

:

:

:

:

:

:

:

:

:

Multi-input Group Signaler

16 core

X00X01X02X03X04:::::

::X0F

Page 90: 2MitsubishiMelsecPlcLadderLogicApplication

- 90 -

example, At first scan of PLC RUN start, Strobe train(MOV H2 K4M0) and DATA Train(MOVH7 K4M16) is synchronized. The meaning of hexa-decimal value H2 and H7 is as next figure;

Strobe train M15 M00 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0

Data train M32 M160 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1

These data/strobe train are shifted by 1 bit when M9036 is scanned and thrown to commonpower line of multi- input group. In the PLC, the data information of multi input group is acceptto internal coil group(M64-M79, M80-M95) by "Safe in time" action. This results simplifyingand saving of digital input module.

Page 91: 2MitsubishiMelsecPlcLadderLogicApplication

- 91 -

Page 92: 2MitsubishiMelsecPlcLadderLogicApplication

- 92 -

VI. Application Example for Calculation Command.

Analog Input/Output Module▷

A1S68AD/ A1S68DAV,DAI Analog Input Module Set-up▷

Scaling for Analog Input PV▷

Schmitt Threshold ON-OFF▷

Peak Value Hold▷

On / Off Controller for Analog PV▷

Analog Value Clamping, Limitation▷

Bit Shift by Calculation Command▷

Analog Drive Speed Control▷

Finding Stable Value by SUM from Analog Input Hunting▷

Drive Multi-stage Control by Encoder Feedback▷

Ratio Control for Material Mixing▷

Trickle Control for Truck Loading▷

Rate Sampler for Single Counter▷

Analog Scaling for X 0 Shifted Signal▷

Analog Scaling for Y 0 Shifted Signal▷

Piecewise for Proportional Non-Linear Curve▷

Piecewise for Inverse Proportional Non-Linear Curve▷

Linear Profiler▷

Page 93: 2MitsubishiMelsecPlcLadderLogicApplication

- 93 -

Mitsubishi Melsec PLC Ladder LogicApplication

Analog Input/Output Module

1. Analog Input Module.

Analog input module is used to convert electrical continuous signal like voltage or current fromphysical or chemical amount to quantified digital amount. There exists resolution in theconversion processing from analog to digital. According to resolution the quality of analog inputmodule is determined and raw values after conversion are as follows at each output types;

The output type ofAnalog Input Module 210 212 215

0-20mA (0-5V): without offset, unipolar4-20mA (1-5V): with offset, unipolar

0-10V: Elevated, unipolar1-10V: with offset, Elevated, unipolar

-10V - +10V: Elevated, bi-polar

0~1023204~1023

-1023~+1023

0~4095817~4095

-4095~+4095

0~163831638~16383

-16383~+16383

Page 94: 2MitsubishiMelsecPlcLadderLogicApplication

- 94 -

2. The External Circuit of Analog Input Module.

The external circuit of analog input module are consisted of power supply, signal transmitter thatmake possible to convert physical or chemical amount to electrical continuous signal likevoltage or current.The schematic diagram is as follows;

(In case of that Power Supply is connected to source of module)

(+) Sink A

Chassis Shield

DC4-20mA

(+)

Signal Transmitter

(-) Source

Shield PowerSupply

(-)(+)

(-)

Page 95: 2MitsubishiMelsecPlcLadderLogicApplication

- 95 -

(In case of that Power Supply is connected to sink of module)

(+) Sink A

Chassis Shield

DC4-20mA

(+)Signal

Transmitter (-) Source

Shield

PowerSupply

(-)

(+)

(-)

3. Analog Output Module.Analog output module is used to convert PLC internal numeric value to electrical continuoussignal like voltage or current. There exists resolution in the conversion processing from digital toanalog.

210 212 215 The output type ofAnalog Input Module

0~1023204~1023

-1023~+1023

0~4095817~4095

-4095~+4095

0~163831638~16383

-16383~+16383

0-20mA (0-5V): without offset, unipolar4-20mA (1-5V): with offset, unipolar

0-10V: Elevated, unipolar1-10V: with offset, Elevated, unipolar

-10V - +10V: Elevated, bi-polar

Page 96: 2MitsubishiMelsecPlcLadderLogicApplication

- 96 -

4. The External Circuit of Analog Output Module.

(+) Sink

ChassisShield

DC4-20mA (+) Signal

Transmitter(-) Source

Shield

(-)

Page 97: 2MitsubishiMelsecPlcLadderLogicApplication

- 97 -

Mitsubishi Melsec PLC Ladder LogicApplication

A1S68AD/ A1S68DAV,DAI Analog Input Module Set-up

1. Ladder Logic exampleA. Analog Input Program.

(1) READ from A1S68AD using FROM Command.N1: The first 2 digit when the head I/O number is allocated to A1S68AD in three digits of

hexa-decimal.N2: Head address of buffer memory in which data is stored.D: Head number of the device in which read data is stored.N3: Number of words of read data.

(2) WRITE from A1S68AD using TO Command.N1: The first 2 digit when the head I/O number is allocated to A1S68AD in three digits of

hexa-decimal.N2: Head address of buffer memory in which data is stored.

Page 98: 2MitsubishiMelsecPlcLadderLogicApplication

- 98 -

S: Number or constant of head device in which data is stored.N3: Number of words of write data.

B. Analog Output Program.

(3) READ from A1S68DAV/DAI using FROM Command.N1: The most significant 2 digit when the head I/O number is allocated to A1S68DAV/DAI

is expressed as three digits of hexa-decimal.N2: Head address of buffer memory in which date is stored.D: Head number of the device in which read date is stored.N3: Number of words of read data.

(4) WRITE from A1S68DAV/DAI using TO Command.N1: The most significant 2 digit when the head I/O number is allocated to A1S68DAV/DAI

is expressed as three digits of hexa-decimal.N2: Head address of buffer memory in which date is stored.D: Head number of the device in which read date is stored or constant.N3: Number of words of write data.

Page 99: 2MitsubishiMelsecPlcLadderLogicApplication

- 99 -

Mitsubishi Melsec PLC Ladder LogicApplication

Scaling for Analog Input PV

1. Ladder Logic example

2. Explanation.Let Register D1 Raw Value 32767 ~ +32767 from Analog Input Module. When the electricsignal has a value between 10V ~ +10V, and Process Variable has a value between 1000rpm ~+1000rpm, The "Scaling" is expressed as this value make value Register D1 return to processvariable. K constant of Long Decimal Format in the Double Precision Multiplication/Division isdefined as Scaling ratio. K1000 is defined value to scale raw value to Engineering Unit RPM,dividing by input range after multiplying Engineering Unit is to prevent bad deformity ofresolution.

Analog Input

Module

+10V~-10V

+1000 RPM

-1000 RPM

+10 V

-10 V

+32767

-32767

+1000 RPM

-1000 RPM

Tacho

Generator

PLC 내부 Logic

* 1000

/ 32767

Page 100: 2MitsubishiMelsecPlcLadderLogicApplication

- 100 -

Mitsubishi Melsec PLC Ladder LogicApplication

Schmitt Threshold ON-OFF

1. Ladder Logic example

2. Explanation.If analog value 01(D1) is value over than 800, the output Y10 is ON. If analog value 01(D1) isvalue below than 600, the output Y10 is OFF. As this matter, transit ON-OFF control thatoverlapped ON point and OFF point is called "Schmitt Circuit".

ON

OFF 600 800

Y10

D1

Page 101: 2MitsubishiMelsecPlcLadderLogicApplication

- 101 -

Mitsubishi Melsec PLC Ladder LogicApplication

Peak Value Hold

1. Ladder Logic example

2. Explanation.If new value Analog value 01(D100) is bigger than Analog value 01(D101) stored before, newvalue Analog value 01(D100) is transferred to D101. Therefore, The highest value analog value01 up to now is stored to D200.

Minimum peak Hold function is represented as next:

Page 102: 2MitsubishiMelsecPlcLadderLogicApplication

- 102 -

Mitsubishi Melsec PLC Ladder LogicApplication

On / Off Controller for Analog PV

1. Ladder Logic example

2. Explanation.D100 is Scaled PV(Process variable), also temperature value in the tank. By means of comparingcommand, if D100 is below than 70 , Heating Coil is On. If D100 is value over than 80 ,℃ ℃heating Coil is Off. Therefore, this system will have dead band of 10 .℃

Page 103: 2MitsubishiMelsecPlcLadderLogicApplication

- 103 -

Mitsubishi Melsec PLC Ladder LogicApplication

Analog Value Clamping, Limitation

1. Ladder Logic example

2. Explanation.If new value Analog value 01(D100) is bigger than Analog value 01(D101) stored before andthis value is bigger than 1000 and is smaller than 5000, new value Analog value 01(D100) istransferred to D101. Therefore, The analog value 01 smaller than 1000 and bigger than 5000 isclamped.

to clamp only lower limit, the logic is as follow:

to clamp only upper limit, the logic is as follow:

Page 104: 2MitsubishiMelsecPlcLadderLogicApplication

- 104 -

Mitsubishi Melsec PLC Ladder LogicApplication

Bit Shift by Calculation Command

1. Ladder Logic example

2. Explanation.Bit Shift can be performed by Bit Shift command, also by multiplying or dividing by binaryweight. In this example, dividing Hexadecimal value HFF00( Binary 1111 1111 0000 0000) by32 results bit shifting to right side as 4 bits is shown. Also multiplying Hexadecimal valueH00FF(Binary (0000 0000 1111 1111) with 32 results bit shifting to left side as 4bits is shown.

Page 105: 2MitsubishiMelsecPlcLadderLogicApplication

- 105 -

Mitsubishi Melsec PLC Ladder LogicApplication

Analog Drive Speed Control

1. Ladder Logic example

2. Explanation.When the slow acceleration and deceleration of motor speed drive is performed, The next logiccan be shown. Acceleration is preset at D30, T50 and deceleration is preset at D31, T51 bythumb-wheel switches.

Page 106: 2MitsubishiMelsecPlcLadderLogicApplication

- 106 -

Mitsubishi Melsec PLC Ladder LogicApplication

Finding Stable Value by SUM from Analog Input Hunting

1. Ladder Diagram ExampleA. Ratio Control Ladder Logic Example

Page 107: 2MitsubishiMelsecPlcLadderLogicApplication

- 107 -

2. Explanation.Sometimes Analog Input value is hunted by noise or process problem to be impossible to findcomparing point. In this case this logic make hunting analog input value stable. It is possible tomake rapidly changing input value so dull by sampling data at every constant period and storingto Q buffer and calculating datum . And calculation can be perform by adding all sampled datumand finding its average.

D500 : Simulated Input for HuntingD200 D205 : Queue BufferD400 : Averaged Value for Simulated Input for Hunting

Page 108: 2MitsubishiMelsecPlcLadderLogicApplication

- 108 -

Mitsubishi Melsec PLC Ladder LogicApplication

Drive Multi-stage Control by Encoder Feedback

1. Ladder Logic example

2. Explanation.Suppose stacker crane run on the rail in the warehouse. The logic is for this stacker crane iscontrolled by motor drive of multi-stage speed control with encoder feedback.D1 is corresponding to input Feedback of encoder. D3 is target position that stacker crane isstopped. At that time of start, the position information will be stored to D110-D111 (doubleprecision Format). PLC calculates elapsed value(D120-121) of encoder and remained value totarget position(D130-131). This is useful when PLC get flags for multi-stage speed control at thenext logic.

Page 109: 2MitsubishiMelsecPlcLadderLogicApplication

- 109 -

After Stacker-Crane start, if the elapsed value of encoder is over than 5000, motor drive isentered to 1st speed stage, if the elapsed value of encoder is over than 10000, motor drive isentered to 2nd speed stage, if the elapsed value of encoder is over than 15000, motor drive isentered to 3rd speed stage. And if the elapsed value of encoder is remained below than 15000,motor drive is entered to 3rd speed stage, if the elapsed value of encoder is remained below than10000, motor drive is entered to 2nd speed stage, if the elapsed value of encoder is remainedbelow than 5000, motor drive is entered to 1st speed stage.

Start Point Stop Point

Speed

Page 110: 2MitsubishiMelsecPlcLadderLogicApplication

- 110 -

Mitsubishi Melsec PLC Ladder LogicApplication

Ratio Control for Material Mixing

1. Ladder Diagram ExampleA. Ratio Control Ladder Logic Example

Page 111: 2MitsubishiMelsecPlcLadderLogicApplication

- 111 -

B. Device Data Monitoring

2. Explanation.In case of that blending and mixing control of liquid or powder by ratio should be performed,this logic can be applied. For example, color combination of dyeing line or painting line,ingredients mixing of foods or pharmacies, whatever it is weight or volume, this can beperformed to continuous or batch control.At the ladder logic, If 5 component(D100-D104) is entered plasmo-nozzle or analogvalve(D200-D204) will be act by each ratio. The 100 percent scaling of analog valve is 4000 ofregisters value.

FACTOR

FACTOR

FACTOR

FACTOR

FACTOR

Page 112: 2MitsubishiMelsecPlcLadderLogicApplication

- 112 -

Mitsubishi Melsec PLC Ladder LogicApplication

Trickle Control for Truck Loading

1. Ladder Diagram ExampleA. Before Trickle Control

B. After Trickle Control

Page 113: 2MitsubishiMelsecPlcLadderLogicApplication

- 113 -

C. When reached to Full

2. Explanation.For the Batch Control, loading of liquid or powder by measuring the volume or weight withscale or encoder pulse signal is often performed. At this time, loading speed should bemaximized for job efficiency, but if loading valve is simply opened and closed, when the loadingaction is about to end, the excessive loading sometimes happens. To avoid this malfunction,Before the loading end, left several percent loading job, by opening valve quite little bit, this canbe prevented . This action is called trickle or drizzle control.

Loading speedor valve openstate

TricklePoint

LoadingEnd

Weight

Page 114: 2MitsubishiMelsecPlcLadderLogicApplication

- 114 -

Mitsubishi Melsec PLC Ladder LogicApplication

Rate Sampler for Single Counter

1. Ladder Diagram ExampleA. Counter Simulation Logic and Preparation for Rate Sample

B. Find Counter Difference For Plus Index Sector

Page 115: 2MitsubishiMelsecPlcLadderLogicApplication

- 115 -

C. Find Counter Difference For Minus Index Sector

D. Sampling Counter Rate

2 Explanation.In case of that the rotator drives incremental encoder of simple counting (Uni-directionalCounting) for finding R.P.M.(Revolution Per Minute) of rotator, we can get simple count fromonly 1 register, this value will be value from 32767 to 32767. To make calculation easier,Adding +32767 to real count value for the minus value. By this way, we find the difference afterstoring count variation during constant time, calculate sampled counting rate. In case of that,sampling period should be shorter than 32767 counting time at the maximum speed of rotator.

Page 116: 2MitsubishiMelsecPlcLadderLogicApplication

- 116 -

Page 117: 2MitsubishiMelsecPlcLadderLogicApplication

- 117 -

Mitsubishi Melsec PLC Ladder LogicApplication

Analog Scaling for X 0 Shifted Signal

1. Ladder Diagram Example

2 Explanation.When scaling for zero point shifted analog signal to X axis as figure shown is performed, theformula as next can be applied.

(X-A) * CY= --------------------

(B-A)

A B

C

Page 118: 2MitsubishiMelsecPlcLadderLogicApplication

- 118 -

At this time each section and register allocation of X and Y can be shown as next:

X: D500Y: D510

A: D2000 C: D4000B: D2010

Page 119: 2MitsubishiMelsecPlcLadderLogicApplication

- 119 -

Mitsubishi Melsec PLC Ladder LogicApplication

Analog Scaling for Y Axis Shifted Signal

1. Ladder Diagram Example

2. Explanation.When scaling for zero point shifted analog signal to Y axis as figure shown is performed, theformula as next can be applied.

(C-B) * XY= -------------------- + B

A

A

C

B

Page 120: 2MitsubishiMelsecPlcLadderLogicApplication

- 120 -

At this time each section and register allocation of X and Y can be shown as next:

X: D500Y: D510

B: D2000 A: D4000C: D2010

Page 121: 2MitsubishiMelsecPlcLadderLogicApplication

- 121 -

Mitsubishi Melsec PLC Ladder LogicApplication

Piecewise for Proportional Non-Linear Curve

1. Ladder Diagram Example

2. Explanation.The simplifying method of non-linear characteristic curve is the way that sectional dividing ofnon-linear characteristic curve to be indicated piecewise. At any formula curve of non-linearcharacteristic, if we accept its deviation, we can represent non-linear characteristic curve tosectional linear curve.At this ladder logic example, dividing non-linear characteristic curve into 2 section linear curveand representing to math logic is shown.When a proportional line is shown to mathematic formula, the expression is as next;

(E-D) * (x-A)Y= -------------------- + E

(B-A)

Page 122: 2MitsubishiMelsecPlcLadderLogicApplication

- 122 -

At this time each section and register allocation of X and Y can be shown as next:

X: D500Y: D510

A: D4000 F: D2000B: D4010 E: D2010C: D4020 D: D2020

Page 123: 2MitsubishiMelsecPlcLadderLogicApplication

- 123 -

Mitsubishi Melsec PLC Ladder LogicApplication

Piecewise for Inverse Proportional Non-Linear Curve

1. Ladder Diagram Example

2. Explanation.The simplifying method of non-linear characteristic curve is the way that sectional dividing ofnon-linear characteristic curve to be indicated piecewise. At any formula curve of non-linearcharacteristic, if we accept its deviation, we can represent non-linear characteristic curve tosectional linear curve.At this ladder logic example, dividing inverse non-linear characteristic curve into 2 section linearcurve and representing to math logic is shown.When a inverse proportional line is shown to mathematic formula, the expression is as next;

Page 124: 2MitsubishiMelsecPlcLadderLogicApplication

- 124 -

(F-E) * (x-A)Y=[ (F-E) - -------------------- ] + E

(B-A)

At this time each section and register allocation of X and Y can be shown as next:

X: D500Y: D510

A: D4000 F: D2000B: D4010 E: D2010C: D4020 D: D2020

Page 125: 2MitsubishiMelsecPlcLadderLogicApplication

- 125 -

Mitsubishi Melsec PLC Ladder LogicApplication

Linear Profiler

1. Ladder Diagram ExampleA. Ratio Control Ladder Logic Example

B. Device Data Monitoring

Page 126: 2MitsubishiMelsecPlcLadderLogicApplication

- 126 -

C. Device Data Monitoring

2. Explanation.This example shows linear profiler that Y Analog Output(D3000) varies to X time axis (D1000).There are total 6 section that perform acceleration, constant speed, deceleration.

Page 127: 2MitsubishiMelsecPlcLadderLogicApplication

- 127 -

VII. Application Example Data Manipulation Command.

Clear to 0 Or Set to 1 All Bits▷

Set All Bits to 1 by 2's Complement▷

Binary Counter▷

Assembling/ Disassembling of Bits▷

Acceleration/Deceleration Control With Linearity for Set-point▷

Individual ON/OFF Operation by Thumb-wheel Switch Set▷

Ring Counter▷

Display of Trouble Flag Number▷

Que Buffer and First-in/First-out▷

LIFO(Last In First Out) Using Stack Memory▷

Load/Save Data for 2-3 Dimensional Database▷

Data Save/ Sort/ Search for Optimization▷

Page 128: 2MitsubishiMelsecPlcLadderLogicApplication

- 128 -

Mitsubishi Melsec PLC Ladder LogicApplication

Clear to 0 Or Set to 1 All Bits

1. Ladder Logic exampleLogic Diagram 1

Logic Diagram 2

Logic Diagram 3

2. Explanation.If the exclusive OR is performed for source register with destination register having the sameaddress to source register's, the result cause that all bits in the register makes to 0. Logic diagram1 is shown before performing Exclusive OR, Logic diagram 2 is shown after performingExclusive OR, Logic diagram 3 is shown after performing Exclusive NOR, the result cause thatall bits in the register makes to 1.

Page 129: 2MitsubishiMelsecPlcLadderLogicApplication

- 129 -

Mitsubishi Melsec PLC Ladder LogicApplication

Set All Bits to 1 by 2's Complement

1. Ladder Logic

2. Explanation.Generally 2's complement is performed for all the register, this results that makes opposite sideof the register, using this, we can makes all bit of the register to set to 1 as the ladder logicexample above.There is data of Hex value HFF0000FF in the D100 and D101, by performing 2's complement,inverted data H00FFFF00 is generated to D102, D103 registers. Also by performing ANDoperation, this result that makes all bit of the register to reset to 0.

Page 130: 2MitsubishiMelsecPlcLadderLogicApplication

- 130 -

Mitsubishi Melsec PLC Ladder LogicApplication

Binary Counter

1. Ladder Logic example

2. Explanation.Once X0 is excited, D100 is increased by 1. If we make this value moved to DiscreteOutput(K4Y10). This can be regards as binary counter that the output has each binary weightvalue. If D100 is increase to 212, by [= HFFF D100] command, D100 is to reset. Therefore, thiscan be regards as 212binary counter.

Page 131: 2MitsubishiMelsecPlcLadderLogicApplication

- 131 -

Mitsubishi Melsec PLC Ladder LogicApplication

Assembling/ Disassembling of Bits

1. Ladder LogicBits Assembling

Page 132: 2MitsubishiMelsecPlcLadderLogicApplication

- 132 -

Bits Disassembling

2. Explanation.Assembly and disassembly of bits is represented as the example using FMOV and BMOVcommand, there exists numbers from 1 to 4 in D100-D103. When we want these number tooutput to 7 segment display device, we make these numbers Assemble and disassemble usingBMOV command.If we want the number 1234 stored in D130 disassemble and move to each registers, FMOVEcommand can be used.

Page 133: 2MitsubishiMelsecPlcLadderLogicApplication

- 133 -

D100

D101

D102

D103

1

2

3

4 4 3 2 1

Bits Assemble

D130

D131

D132

D133

4

3

2

1

1 2 3 4

Bits Disassemble

K4Y20 / D120

Page 134: 2MitsubishiMelsecPlcLadderLogicApplication

- 134 -

Mitsubishi Melsec PLC Ladder LogicApplication

Acceleration/Deceleration Control With Linearity for Set-point

1. Ladder Logic

2. Explanation.When we give Analog Set-point to control program and set-point is rapidly changed, the controlsystem can be unstable or damaged. To prevent this, using a ramp function, set-point can bemade to linear signal, we can get stable control characteristicD100 is raw analog set-point. is compared to filtered set-point D0. By bigger or smaller, filteredset-point D0 can be increased or decreased by INCP or DECP command. Acceleration Rate andDeceleration Rate can be determined by each timer.

Page 135: 2MitsubishiMelsecPlcLadderLogicApplication

- 135 -

Mitsubishi Melsec PLC Ladder LogicApplication

Individual ON/OFF Operation by Thumb-wheel Switch Set

1. Ladder Logic example

::

Page 136: 2MitsubishiMelsecPlcLadderLogicApplication

- 136 -

::

2. Explanation.For proper operation, BCD Data of 2digit Thumb wheel Switch from X0 to X8 can be convertedto binary data. using DECO command, we can control from M100 to M124.If Thumb wheel switch is set to 12, corresponding decoded M Bit will be M112 andSET(Valve13 Cylinder).Available M Bit Flag number will be 100sets(Cylinders of 100sets ).

Page 137: 2MitsubishiMelsecPlcLadderLogicApplication

- 137 -

1 2 0 0 0 0 1 1 0 0

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

0 0 0 0 0 0 0 00

M124

M115

M116

M100 M112

D100

Thumbwheel Switch

Using this M Bit Flags, several actuator can be control to on and off in manual mode. The logicfrom Step23 to Step58 are dual action pushbutton logic, once X10 pushbutton switch isactivated, corresponding cylinder will be repeat on/off operation.

Page 138: 2MitsubishiMelsecPlcLadderLogicApplication

- 138 -

Mitsubishi Melsec PLC Ladder LogicApplication

Ring Counter

1. Ladder Logic

2. Explanation.At initial scan of M9038, M0, first positioned coil of Ring Counter, will be set. By timer T50having K10 period, Coil from M0 to M33 will be operated as Ring Counter. M9012 as CarryFlag, this Escape Bit will be returned to set M0 coil.

T50

M0

M1

M2

M3

M4

M5

M6

M7

M8

M9

:

:

:

:

:

1sec

Page 139: 2MitsubishiMelsecPlcLadderLogicApplication

- 139 -

Mitsubishi Melsec PLC Ladder LogicApplication

Display of Trouble Flag Number

1. Ladder Logic

2. Explanation.Trouble Flag of total 64 from M800 to M863 are registered to this logic. Trouble Number fromtrouble flag will be displayed to 7 Segment Display Unit. Seeing logic at 33Step, this logic haslike the function. If M800 Trouble is occurred, The trouble number displayed at 7 SegmentDisplay Unit is 1. Also M804 Trouble is occurred, The trouble number displayed at 7 SegmentDisplay Unit is 5, M860 Trouble is occurred, The trouble number displayed at 7 SegmentDisplay Unit is 61.

Page 140: 2MitsubishiMelsecPlcLadderLogicApplication

- 140 -

Input X10~X13 is for simulation for trouble occurrence. In practical use, this should be replacedto timer contact monitoring trouble, contact element determining defectives. Input X3 is acted astrouble reset switch, set trouble flag.

Page 141: 2MitsubishiMelsecPlcLadderLogicApplication

- 141 -

Mitsubishi Melsec PLC Ladder LogicApplication

Que Buffer and First-in/First-out

1. Ladder Logic exampleLogic Diagram 1

There are typical 2 memory Buffer, FIFO(First-in/First-out) and LIFO(Last-in/First-out). Theformer is called Queue Buffer, the latter is called Stack Buffer.For this example, the program of First-in/First-out is represented.M40 is collective contact for all quality selection Push-Button Switch. If product is entered tobuffer area, product quality information is pushed to memory.

Logic Diagram 2

This logic is for drawing out the last saved quality information from Queue Buffer Memory

Page 142: 2MitsubishiMelsecPlcLadderLogicApplication

- 142 -

using a Index Pointer Z. At this time, Physical Buffer Area is located from M1 Roller Conveyorto M2 Roller Conveyor.

Logic Diagram 3This logic is to determining product quality and storing to Starting Memory to Queue Memory.

Page 143: 2MitsubishiMelsecPlcLadderLogicApplication

- 143 -

Mitsubishi Melsec PLC Ladder LogicApplication

LIFO(Last In First Out) Using Stack Memory

1. Ladder Diagram ExampleA. Ladder Logic Example

B. Device Data Monitoring

Page 144: 2MitsubishiMelsecPlcLadderLogicApplication

- 144 -

Page 145: 2MitsubishiMelsecPlcLadderLogicApplication

- 145 -

2. Explanation.This PLC ladder logic represents LIFO (Last In First Out) operation of stack memory. Byenergizing Input X0, the data of D500 Register is pushed to Stack Memory register havingstarting address D200. By energizing Input X7, The datum 100, 200, 300, 400, 500 pushedcontinuous are moved to D510 Register with POP operation. This ladder logic can be performedsimply by Index Register V, Z.

D500 : Source Data RegisterD200 D205 : Stack MemoryD510 : Destination Data RegisterXO : PUSH OperationX7 : POP Operation

Page 146: 2MitsubishiMelsecPlcLadderLogicApplication

- 146 -

Mitsubishi Melsec PLC Ladder LogicApplication

Load/Save Data for 2-3 Dimensional Database

1. Ladder Diagram ExampleA. Load Data for Simulation

B. Calculating Final Pointer for Load/Save from/to Database

Page 147: 2MitsubishiMelsecPlcLadderLogicApplication

- 147 -

Page 148: 2MitsubishiMelsecPlcLadderLogicApplication

- 148 -

C. Load/Save Data from or to Database

Monitoring Database Partially

D10 : Source Register to be input data at Database.D20 : Destination Register to be output data from DatabaseD100 : Page Index PointerD110 : Row Index PointerD120 : Column Index PointerD230 : Final Cell Index PointerD1000 : Starting address of 1st Page DatabaseD1200 : Starting address of 2nd Page DatabaseD1400 : Starting address of 3rd Page DatabaseD1600 : Starting address of 4th Page DatabaseD1800 : Starting address of 5th Page Database

Page 149: 2MitsubishiMelsecPlcLadderLogicApplication

- 149 -

2. Explanation.When process Data needs to be managed by cell unit, The memory space that data is saved andloaded to or from 2-dimensional or 3-dimensional database is required. When various tags orlabels of Data are loaded or saved, this is to say, when the management or distribution of goodstock is performed in the PLC logic, we can refer to this logic.If Input X0 is pressed, data is stored to database by final cell index pointer V that calculatesPAGE, column, row. In this example, data is stored to cell of database corresponding to page 2,row number 4, column number 11.If Input X1 is pressed, data is loaded from database by final cell index pointer V that calculatesPAGE, column, row. In this example, data is loaded to D20 from the cell of databasecorresponding to page 2, row number 4, column number 11.

Page 150: 2MitsubishiMelsecPlcLadderLogicApplication

- 150 -

Mitsubishi Melsec PLC Ladder LogicApplication

Data Save/ Sort/ Search for Optimization

1. Ladder Logic example

This ladder logic example is to entry/save/sort/ load data to the data base memory to searchoptimized data. Data register of PLC state RAM is used as Data memory space for database thathave 2 dimensional assignment.The logic above is that Factor datum from D90 to D99 is entered from MMI is to be saved toPLC memory having starting address D100. At this time, index pointer V is varied by INCcommand.

Page 151: 2MitsubishiMelsecPlcLadderLogicApplication

- 151 -

Index Register V is the Pointer of 1st assignment element. D30 Register is the Pointer of 2ndassignment element.M80 will be the Save Button after MMI Value Entry.

Page 152: 2MitsubishiMelsecPlcLadderLogicApplication

- 152 -

The Logic above is for discrete control with MMI to sort the saved datum. M81 will be SearchCommand Button from MMI, initialize for sorting by triggering of this button coil. D51 isinterlocking pointer to stop the sorting after counting sorted record up to 20 record fromdata-base. D55 is interlocking pointer to stop the sorting after counting sorted record up to lastrecord from data-base.

Page 153: 2MitsubishiMelsecPlcLadderLogicApplication

- 153 -

This logic is that move datum to register from D80 to D89 by 1 record( 10 cell register ) withstarting address D100 from data-base for sorting.

Page 154: 2MitsubishiMelsecPlcLadderLogicApplication

- 154 -

This logic is that move datum to register from D80 to D89 by 1 record( 10 cell register ) withstarting address D100 from data-base for sorting.

Page 155: 2MitsubishiMelsecPlcLadderLogicApplication

- 155 -

At this time, we need to check whether record is within positive and negative tolerance gettingfrom D70 to D79 from the MMI. For this operation, we make threshold value form this by mathlogic.

Page 156: 2MitsubishiMelsecPlcLadderLogicApplication

- 156 -

The positive threshold is made to register D60-D69, The negative threshold is made to registerD40-D49 for comparing with tolerance.

Page 157: 2MitsubishiMelsecPlcLadderLogicApplication

- 157 -

We determine by comparison flag if record placed to buffer from database is within tolerance.The flags from M90 to M99 are by-pass flag to be selected from MMI for sorting.

Page 158: 2MitsubishiMelsecPlcLadderLogicApplication

- 158 -

When the determined Flag(from M200 to M206) are satisfied, this record is moved to sorted dataarea(with starting address D8000).

Page 159: 2MitsubishiMelsecPlcLadderLogicApplication

- 159 -

This logic is for displaying sorted data table to MMI displaying table has 7 row's cells and 8column cell. For the reason of space limitation of MMI table, we can't display all sorted datum toMMI table and we should make a Scroll-up(M55), Scroll-down(M59) Key. In this logic, for thesaving area of Record is located from D200 to D299(total 20 records), the interlock is neededafter grasping the point number by comparison command before these flags. As the same way,the interlock M40 is needed to limit moving operation when the last record saved is moved toMMI buffer table after sorting operation is ended.

Page 160: 2MitsubishiMelsecPlcLadderLogicApplication

- 160 -

8 records, 800 cells will be moved from the data table with D8000 starting address after sortingended to the table with D300 starting address and end address D379.

Page 161: 2MitsubishiMelsecPlcLadderLogicApplication

- 161 -

This is the last part of the logic.

Page 162: 2MitsubishiMelsecPlcLadderLogicApplication

- 162 -

MMI Design Screen

Page 163: 2MitsubishiMelsecPlcLadderLogicApplication

- 163 -

VIII. Application Example for Computer Link Module.

Non-form Communication for Computer Link Module▷

CPU Direct Access via Computer Link Module▷

CPU Access via Dedicated MODEM and Computer Link Module▷

CPU Access via Dial-up MODEM and Computer Link Module▷

Proface GP577R Touch Screen Access via Computer Link▷

ModuleFix 32 Access via Computer Link Module▷

Intouch 5.6 Access via Computer Link Module▷

Page 164: 2MitsubishiMelsecPlcLadderLogicApplication

- 164 -

Mitsubishi Melsec PLC A1SJ71UC24-R2 RS-232CApplication

Non-form Communication for Computer Link Module

1. Protocol: IA Robot protocol2. Module Dip switch setting:

3. Cable interconnection

4. Used messageTest Protocol: ?99TST0123456789@@(CR)(LF)

5. ETC.(1) Transmission method: Half Duplex type (DTR/DSR Control: Don't use CD Signal)

Cf: DTR/DSR Control or X on/off Control(2) Need to set at the buffer memory address 10BH

Page 165: 2MitsubishiMelsecPlcLadderLogicApplication

- 165 -

6. Used Ladder logicsUsed ladder logics are as bellows ;

Page 166: 2MitsubishiMelsecPlcLadderLogicApplication

- 166 -

Page 167: 2MitsubishiMelsecPlcLadderLogicApplication

- 167 -

Mitsubishi Melsec PLC A1SJ71UC24-R2 RS-232CApplication

CPU Direct Access via Computer Link Module

1. Testing Software :GPPWin2. Module의 Dip switch setting:

3. Cable interconnection

4. ETC.Transmission Method: Full Duplex (X on/off Control)

5. Used Ladder logics- Inserted slot of UC24-R2 : Don't care.- There was no ladder logic to be needed for setting up the communication.- Located station no. : Station 0- Transmission Setup on Online menu of PC Loader.

Page 168: 2MitsubishiMelsecPlcLadderLogicApplication

- 168 -

PC Side: Com1, 9600 BaudPLC Side: UC24 RS-232 Module 9600bps, odd parity, 1 stop bit.

6. Schematic Diagram.

Melsec A2SH CPU

CPU

UC24

GPPWin

Page 169: 2MitsubishiMelsecPlcLadderLogicApplication

- 169 -

Mitsubishi Melsec PLC A1SJ71UC24-R2 RS-232CApplication

CPU Access via Dedicated MODEM and Computer Link Module

1. Testing Software :GPPWin2. Module Dip switch setting:

3. Cable interconnection

4. Used MODEM: Dedicated Line MODEM-96-LS-CTS.5. Used MODEM Setting

Page 170: 2MitsubishiMelsecPlcLadderLogicApplication

- 170 -

6. GPPWin Setting(1) PC Side; COM1, 9600 bps(2) PLC Side; 9600 bps, 1 Stop bit, Odd parity, Using Sum-check, 10 sec Time-out delay.

Via UC24, Host Target, Module Unit no. 1.7. ETC.

- Inserted slot of UC24-R2 : Don't care.- There was no ladder logic to be needed for setting up the communication.- Located station no. : Station 0

8. Schematic DiagramMelsec A2SH PLC

CPU

UC24

4 WIRES

MODEM MODEM

GPPWin

COM1

Page 171: 2MitsubishiMelsecPlcLadderLogicApplication

- 171 -

Mitsubishi Melsec PLC A1SJ71UC24-R2 RS-232CApplication

CPU Access via Dialup MODEM and Computer Link Module

1. Testing Software :GPPWin2. Module Dip switch setting:

3. Cable interconnection

4. Used MODEM: US Robotics 56k FAX MODEM.5. Used MODEM Command String: AT&F &D0 &K0 Q1 E0 S0=1 &W

AT : Instructs modem that command follow&F : Reset modem parameter to factory defaults&D0 : Ignore DTR( Data Terminal Ready)&K0 : Disable data compression 9US Robotics modem only)

Page 172: 2MitsubishiMelsecPlcLadderLogicApplication

- 172 -

Q1 : Suppress results codeE0 : Echo offS0=1 : Set auto answer on 1 ring&W : Save Settings to Non volatile RAM

6. Settings of Used Dial-up Software PROCOMM

7. GPPWin Setting(1) PC Side; COM1, 9600 bps(2) PLC Side; 9600 bps, 1 Stop bit, None parity, Using Sum-check, 15 sec Time-out delay.

Via UC24, Host Target, Module Unit no. 0.8. ETC.

- Inserted slot of UC24-R2 : Don't care.- There was no ladder logic to be needed for setting up the communication.- Located station no. : Station 0

9. Schematic Diagram

Melsec A2SH PLC

CPU

UC24

Phone Lines

MODEM MODEM

GPPWin

COM1

PWR SP

Page 173: 2MitsubishiMelsecPlcLadderLogicApplication

- 173 -

Mitsubishi Melsec PLC A1SJ71UC24-R2 RS-232CApplication

Proface GP577R Touch Screen Access via Computer Link Module

1. Testing Software : Proface GPP2. Module Dip switch setting:

3. Cable interconnection

4. ETC.Transmission method: Full Duplex (DTR/ER)

5. Used Ladder logics- Inserted slot of UC24-R2 : Don't care.- There was no ladder logic to be needed for setting up the communication.- Located station no. : Station 0

Page 174: 2MitsubishiMelsecPlcLadderLogicApplication

- 174 -

Melsec A2SH CPU

CPU

UC24

GP577R

Page 175: 2MitsubishiMelsecPlcLadderLogicApplication

- 175 -

Mitsubishi Melsec PLC A1SJ71UC24-R2 RS-232CApplication

Fix 32 Access via Computer Link Module

1. Testing Software :Fix 32 MMI Software2. Module Dip switch setting:

3. Cable interconnection

4. ETC.Transmission method: None

5. Used Ladder logics- Inserted slot of UC24-R2 : Don't care.- There was no ladder logic to be needed for setting up the communication.- Located station no. : Station 0

Page 176: 2MitsubishiMelsecPlcLadderLogicApplication

- 176 -

Melsec A2SH CPU

CPU

UC24

Fix 32

6. Settings up of Fix MMI Software(1) Set-up installed Mitsubish MelsecA Serial Communication Driver as follows;

Invoke SCU by entering to Application> Configuration.

Page 177: 2MitsubishiMelsecPlcLadderLogicApplication

- 177 -

(2) Confirm Mitsubish Melsec A Communication Driver as follows;

(3) Invoke the MIT Driver and Set-up as I/O Server as follows;

Page 178: 2MitsubishiMelsecPlcLadderLogicApplication

- 178 -

(4) Establish the opening COM1 Serial COMM parameter.

Page 179: 2MitsubishiMelsecPlcLadderLogicApplication

- 179 -

(5) Design and draw as what you want and define MACRO and tag names.

Page 180: 2MitsubishiMelsecPlcLadderLogicApplication

- 180 -

(6) Run "View" task if you confirm the performance.

Page 181: 2MitsubishiMelsecPlcLadderLogicApplication

- 181 -

Mitsubishi Melsec PLC A1SJ71UC24-R2 RS-232CApplication

Intouch 5.6 Access via Computer Link Module

1. Testing Software :Intouch 5.6 MMI Software2. Module Dip switch setting:

3. Cable interconnection

4. ETC.Transmission method: None

5. Used Ladder logics- Inserted slot of UC24-R2 : Don't care.- There was no ladder logic to be needed for setting up the communication.- Located station no. : Station 0

Page 182: 2MitsubishiMelsecPlcLadderLogicApplication

- 182 -

Melsec A2SH CPU

CPU

UC24

Intouch

6. Settings up of Intouch 5.6 MMI Software(1) Invoke Mitsubish MelsecA Serial Communication Driver.(2) Enter Menu Configure> Port Settings>. And set up Serial Communication

parameter as follows;

(3) Enter again Configure> Topic definition>. And set up I/O Server as follows;

Page 183: 2MitsubishiMelsecPlcLadderLogicApplication

- 183 -

(4) Invoke Window maker. Enter Menu Specials> DDE Access Name>. And setupparameter as follows;

Page 184: 2MitsubishiMelsecPlcLadderLogicApplication

- 184 -

Appendix

MODICON Concept Version 2.1 PID Simulation Function Block Diagram▷

Bit Division for MMI Analog tag▷

SIMATIC TI545 PLC PID Simulation▷

SIMATIC TI545 PLC vs Intouch 8.0▷

Modicon E785 PLC vs Intouch 7.1 PID Simulation▷

Page 185: 2MitsubishiMelsecPlcLadderLogicApplication

- 185 -

MODICON Concept Version 2.1Application

PID Simulation Function Block Diagram Example

1. Function Block example

2. Description.The PID function is actually controlling the process simulated by this logic. The processsimulator is comprised of two Lead/Lag function that act as a filter and input to a delay queuethat is also a Concept CLC_PRO function block. This arrangement is the equivalent of asecond-order process with dead time. The solution interval for the DELAY queue is set at1000ms with a delay of 5 interval-i.e. 5s.The LLAG Filters each have lead term of 4s and lag terms of 10s. The gain for each is 1.0.

In process control terms the transfer function can be expressed as;(4s+1)(4s+1) e^-5s

Gp(s)= --------------------(10s+1)(10s+1)

3. PID parameters.The PID controller is tuned to control this process at 20.0 using the Ziegler-Nichols tuningmethod. The resulting controller gain is 2.16 equivalent to a proportional band of 46.3 percentsThe integral time is set at 12.5 s/repeats/min). The derivative time is initially 3s, then reduced to0.3s to de-emphasize the derivative effect.

Page 186: 2MitsubishiMelsecPlcLadderLogicApplication

- 186 -

Bit Division for MMI Analog tagby Script Text

Sub Script1()While 1

Val1 = GetTagVal("WORD1")if ( Val1 >= 32768 ) thenSetTagVal "PL15", 1Val1=Val1 - 32768

elseSetTagVal "PL15", 0

End ifif ( Val1 >= 16384 ) then

SetTagVal "PL14", 1Val1=Val1 - 16384

elseSetTagVal "PL14", 0

End ifif ( Val1 >= 8192 ) then

SetTagVal "PL13", 1Val1=Val1 - 8192

elseSetTagVal "PL13", 0

End ifif ( Val1 >= 4096 ) then

SetTagVal "PL12", 1Val1=Val1 - 4096

elseSetTagVal "PL12", 0

End ifif ( Val1 >= 2048 ) then

SetTagVal "PL11", 1Val1=Val1 - 2048

elseSetTagVal "PL11", 0

End ifif ( Val1 >= 1024 ) then

SetTagVal "PL10", 1Val1=Val1 -1024

elseSetTagVal "PL10", 0

End ifif ( Val1 >= 512 ) then

SetTagVal "PL9", 1Val1=Val1 - 512

elseSetTagVal "PL9", 0

End ifif ( Val1 >= 256 ) then

SetTagVal "PL8", 1Val1=Val1 - 256

else

Page 187: 2MitsubishiMelsecPlcLadderLogicApplication

- 187 -

SetTagVal "PL8", 0End if

if ( Val1 >= 128 ) thenSetTagVal "PL7", 1Val1=Val1 - 128

elseSetTagVal "PL7", 0

End ifif ( Val1 >= 64 ) then

SetTagVal "PL6", 1Val1=Val1 - 64

elseSetTagVal "PL6", 0

End ifif ( Val1 >= 32 ) then

SetTagVal "PL5", 1Val1=Val1 - 32

elseSetTagVal "PL5", 0

End ifif ( Val1 >= 16 ) then

SetTagVal "PL4", 1Val1=Val1 - 16

elseSetTagVal "PL4", 0

End ifif ( Val1 >= 8 ) then

SetTagVal "PL3", 1Val1=Val1 - 8

elseSetTagVal "PL3", 0

End ifif ( Val1 >= 4 ) thenSetTagVal "PL2", 1

Val1=Val1 - 4else

SetTagVal "PL2", 0End if

if ( Val1 >= 2 ) thenSetTagVal "PL1", 1Val1=Val1 - 2

elseSetTagVal "PL1", 0

End ifif ( Val1 = 1 ) thenSetTagVal "PL0", 1

elseSetTagVal "PL0", 0

End ifWend

End Sub

Page 188: 2MitsubishiMelsecPlcLadderLogicApplication

- 188 -

SIMATIC TI545 PLCApplication

PID Simulation

1. Used Software

Page 189: 2MitsubishiMelsecPlcLadderLogicApplication

- 189 -

2. PLC Configuration

Page 190: 2MitsubishiMelsecPlcLadderLogicApplication

- 190 -

3. PID Configuration Screen

4. System Function Program.

Page 191: 2MitsubishiMelsecPlcLadderLogicApplication

- 191 -

Page 192: 2MitsubishiMelsecPlcLadderLogicApplication

- 192 -

5. PLC Ladder Diagram

Page 193: 2MitsubishiMelsecPlcLadderLogicApplication

- 193 -

Page 194: 2MitsubishiMelsecPlcLadderLogicApplication

- 194 -

6. PID Status Values.

======== Address Comments ========

V100: LEAD/LAG1 Input of PID SimulatorV200: LEAD/LAG1 Output & LEAD/LAG2 Input of SimulatorV300: LEAD/LAG2 Output of SimulatorV301: 1st 0.1ms Delayed ValueV302: 2nd 0.1ms Delayed ValueV303: 3rd 0.1ms Delayed ValueV304: 4th 0.1ms Delayed ValueV305: 5th 0.1ms Delayed ValueV306: 6th 0.1ms Delayed ValueV310: Integer PV at PID Loop OutsideV320: Integer SP at PID Loop OutsideV340: Integer MV at PID Loop OutsideV312: Engineering PV Value at PID Loop OutsideV322: Engineering SP Value at PID Loop OutsideV342: Engineering MV Value at PID Loop OutsideV090: 1st Set-point MoveV092: 2nd Set-point Move

Page 195: 2MitsubishiMelsecPlcLadderLogicApplication

- 195 -

SIMATIC TI545 PLC vs Intouch 8.0Application

Communication setup

1. Testing Software :Intouch 8.0 MMI Software2. Module Dip switch setting:

3. Cable interconnection

4. ETC.

Transmission method: NoneUsed Ladder logics

- TI545 CPU should be in RUN state.- There was no ladder logic to be needed for setting up the communication.

TI545 CPU I/O

TI545

Intouch

Page 196: 2MitsubishiMelsecPlcLadderLogicApplication

- 196 -

5. Settings up of IntouchA. Executes TIDIR .EXE and Invoke Settings>Communication Port Settings.

B. Enter menu New, Define "TIPLC" and Set Topic Definition.

C. Set TIDIR Topic Definition.

Page 197: 2MitsubishiMelsecPlcLadderLogicApplication

- 197 -

D. Set menu Server Settings

E. Invoke InTouch Windows maker and enter Main Menu>Specieals. Define "AccessNames".

F. Modify "Access Names". Leave Node Name to blank if system is stand-alone.

Page 198: 2MitsubishiMelsecPlcLadderLogicApplication

- 198 -

G. Make New Tags selecting Access name to "PLC1".

Page 199: 2MitsubishiMelsecPlcLadderLogicApplication

- 199 -

In case of defining Integer Tag, Result is as below.

In case of defining Real Tag, you will add period after following Item number last.Result is as below.

H. Result of communication between TI545 CPU and Intouch 8.0 through serial cable.

Page 200: 2MitsubishiMelsecPlcLadderLogicApplication

- 200 -

Page 201: 2MitsubishiMelsecPlcLadderLogicApplication

- 201 -

Modicon E785 PLC vs Intouch 7.1Application

PID Simulation and Communication setup

1. Testing Software :Intouch 7.1 MMI Software MODSOFT V2.6.

2. CPU Port1 communication memory setting:Address No.: 19,600 bps, RTU 8data bits, 1stop bit, Even parity,

3. Cable interconnection

4. ETC.Transmission method: None

5. Used Ladder logics- E785 CPU should be in RUN state.- There was used PCFL ladder logic to be needed for PID simulation.

Modicon E785 CPU

I/O

984-E785

Intouch

Page 202: 2MitsubishiMelsecPlcLadderLogicApplication

- 202 -

6. Settings up of IntouchA. Executes MODBUS .EXE and Invoke Settings>Communication Port Settings.

B. Enter menu New, Define "MODBUS" and Set Topic Definition.

Page 203: 2MitsubishiMelsecPlcLadderLogicApplication

- 203 -

C. Set "Server Setting" as belows.

D. Invoke InTouch Windows maker and enter Main Menu>Specials. Define "AccessNames". Leave Node Name to blank if system is stand-alone.

Page 204: 2MitsubishiMelsecPlcLadderLogicApplication

- 204 -

E. Make New Tags selecting Access name to belong to "PLC1".

Page 205: 2MitsubishiMelsecPlcLadderLogicApplication

- 205 -

F. Result of communication between E785 CPU and Intouch 7.1 through serial cable.

Page 206: 2MitsubishiMelsecPlcLadderLogicApplication

- 206 -

7. Setting up PCFL Ladder Logic in E785 for PID Simulation.A. PCFL Ladder Logic1.

B. PCFL Ladder Logic 2.

Page 207: 2MitsubishiMelsecPlcLadderLogicApplication

- 207 -

C. Lead/Lag PCFL Ladder Logic.

D. Delay PCFL Ladder Logic

Page 208: 2MitsubishiMelsecPlcLadderLogicApplication

- 208 -

E. AOUT PCFL Ladder Logic

Page 209: 2MitsubishiMelsecPlcLadderLogicApplication

- 209 -

F. AIN PCFL Ladder Logic

G. Lookup PCFL Ladder Logic

Page 210: 2MitsubishiMelsecPlcLadderLogicApplication

- 210 -

H. Mode PCFL Ladder Logic

I. Ramp PCFL Ladder Logic

Page 211: 2MitsubishiMelsecPlcLadderLogicApplication

- 211 -

J. AOUT PCFL Ladder Logic

K. PID PCFL Ladder Logic.

Page 212: 2MitsubishiMelsecPlcLadderLogicApplication

- 212 -

J. Used PLC Software MODSOFT V2.6.

Page 213: 2MitsubishiMelsecPlcLadderLogicApplication

- 213 -

If you have any question, feel free contact me as [email protected] M.P.: 82-16-236-6416REMARK:

Page 214: 2MitsubishiMelsecPlcLadderLogicApplication

- 214 -

REMARK:

Page 215: 2MitsubishiMelsecPlcLadderLogicApplication

- 215 -

REMARK:

- END -