Mitsubishi Melsec PLC Ladder Logic Application

Embed Size (px)

DESCRIPTION

Mitsubishi Melsec PLC Ladder Logic

Citation preview

  • - 1 -

    Mitsubishi Melsec PLCLadder Logic Application

  • - 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 SoftwareNumeric System of PLC.

    Karnaugh Map

    II. Application Examples for Logical Command.

    Logical ANDLogical ORLogical NANDLogical NORLogical Exclusive OR1 Scan-time OscillatorSelf-Holding, 0 or 1 Dominant SR/RS Flip-FlopDetect Rising Edge / Falling Edge, DifferentiationDual action PushbuttonTrouble Acknowledge/ Reset

    III. Application Example for Sequential Command.

    On Delay / Off Delay TimerOne Shot Multi-vibratorMulti-VibratorSpeed Monitor using OFF Delay TimerPreventing Chattering Noise for Mechanical ContactsFinding Stable Value by TIME Filter from Analog Input HuntingMeasuring Time for Continuous Production.Optimizing Surveillance Timer of Speed MonitorSurveillance of Motor Drive SystemDetecting Value Changed

  • - 3 -

    IV. Application Example for Flow Sequential Command.

    Sequence Control with BSFL CommandSequence Control with SFTP CommandCall Subroutines and Return ProcessingSorting 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 ModuleA1S68AD/ A1S68DAV,DAI Analog Input Module Set-upScaling for Analog Input PVSchmitt Threshold ON-OFFPeak Value HoldOn / Off Controller for Analog PVAnalog Value Clamping, LimitationBit Shift by Calculation CommandAnalog Drive Speed ControlFinding Stable Value by SUM from Analog Input HuntingDrive Multi-stage Control by Encoder FeedbackRatio Control for Material MixingTrickle Control for Truck LoadingRate Sampler for Single CounterAnalog Scaling for X 0 Shifted SignalAnalog Scaling for Y 0 Shifted SignalPiecewise for Proportional Non-Linear CurvePiecewise for Inverse Proportional Non-Linear CurveLinear Profiler

  • - 4 -

    VII. Application Example Data Manipulation Command.

    Clear to 0 Or Set to 1 All BitsSet All Bits to 1 by 2's ComplementBinary CounterAssembling/ Disassembling of BitsAcceleration/Deceleration Control With Linearity for Set-pointIndividual ON/OFF Operation by Thumb-wheel Switch SetRing CounterDisplay of Trouble Flag NumberQue Buffer and First-in/First-outLIFO(Last In First Out) Using Stack MemoryLoad/Save Data for 2-3 Dimensional DatabaseData Save/ Sort/ Search for Optimization

    VIII. Application Example for Computer Link Module.

    Non-form Communication for Computer Link ModuleCPU Direct Access via Computer Link ModuleCPU Access via Dedicated MODEM and Computer Link ModuleCPU Access via Dial-up MODEM and Computer Link ModuleProface GP577R Touch Screen Access via Computer LinkModuleFix 32 Access via Computer Link ModuleIntouch 5.6 Access via Computer Link Module

    Appendix

    MODICON Concept Version 2.1 PID Simulation Function Block DiagramBit Division for MMI Analog tagSIMATIC TI545 PLC PID SimulationSIMATIC TI545 PLC vs Intouch 8.0Modicon E785 PLC vs Intouch 7.1 PID Simulation

  • - 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 SoftwareNumeric System of PLC.Karnaugh Map

  • - 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)

  • - 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

  • - 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

  • - 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

    0V0

    Analog DC Voltage

    Digital Value

  • - 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) dtThe 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 )

  • - 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

  • - 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".

  • - 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

  • - 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

  • - 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".

  • - 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

  • - 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

  • - 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 ExternalAddressInput module address related to real hardware input

    moduleBit

    Address

    Y ExternalAddressOutput module address related to real hardware

    Output moduleBit

    Address

    M InternalAddressInternal Coil address used to contact and coil

    internallyBit

    Address

    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 controlBit

    Address

    B InternalAddressCommunication Link relay when the data exchange

    among the several PLC'sBit

    Address

    F InternalAddressInternal Coil Address used as annunciator detecting

    external faults.Bit

    Address

    DInternal &

    ExternalAddress

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

    WordAddress

    and

    and

  • - 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.

    ????

    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.

  • - 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.

  • - 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

  • - 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 Statecorresponding to PLC

    INPUT point

    Lamp Statuscorresponding to PLC

    INPUT point

    Contact state in thePLC Internal Logic

    Possibility to passthe Power Flow

    Electrically Dry State OFF NO(Normal Open) NoOFF NC(Normal Close) YesElectrically Wet State ON NO(Normal Open) YesON 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

  • - 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

  • - 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

  • - 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.

  • - 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)

  • - 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

  • - 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

  • - 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

  • - 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

  • - 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 DecCtrl-@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 97Ctrl-B STX 02 002 2 " 22 042 34 B 42 102 66 b 62 142 98Ctrl-C ETX 03 003 3 # 23 043 35 C 43 103 67 c 63 143 99Ctrl-D EOT 04 004 4 $ 24 044 36 D 44 104 68 d 64 144 100Ctrl-E ENQ 05 005 5 % 25 045 37 E 45 105 69 e 65 145 101Ctrl-F ACK 06 006 6 & 26 046 38 F 46 106 70 f 66 146 102Ctrl-G BEL 07 007 7 ' 27 047 39 G 47 107 71 g 67 147 103Ctrl-H BS 08 010 8 ( 28 050 40 H 48 110 72 h 68 150 104Ctrl-I HT 09 011 9 ) 29 051 41 I 49 111 73 i 69 151 105Ctrl-J LF 0A 012 10 * 2A 052 42 J 4A 112 74 j 6A 152 106Ctrl-K VT 0B 013 11 + 2B 053 43 K 4B 113 75 k 6B 153 107Ctrl-L FF 0C 014 12 , 2C 054 44 L 4C 114 76 l 6C 154 108Ctrl-M CR 0D 015 13 - 2D 055 45 M 4D 115 77 m 6D 155 109Ctrl-N SO 0E 016 14 . 2E 056 46 N 4E 116 78 n 6E 156 110Ctrl-O SI 0F 017 15 / 2F 057 47 O 4F 117 79 o 6F 157 111Ctrl-P DLE 10 020 16 0 30 060 48 P 50 120 80 p 70 160 112Ctrl-Q DCI 11 021 17 1 31 061 49 Q 51 121 81 q 71 161 113Ctrl-R DC2 12 022 18 2 32 062 50 R 52 122 82 r 72 162 114Ctrl-S DC3 13 023 19 3 33 063 51 S 53 123 83 s 73 163 115Ctrl-T DC4 14 024 20 4 34 064 52 T 54 124 84 t 74 164 116Ctrl-U NAK 15 025 21 5 35 065 53 U 55 125 85 u 75 165 117Ctrl-V SYN 16 026 22 6 36 066 54 V 56 126 86 v 76 166 118Ctrl-W ETB 17 027 23 7 37 067 55 W 57 127 87 w 77 167 119Ctrl-X CAN 18 030 24 8 38 070 56 X 58 130 88 x 78 170 120Ctrl-Y EM 19 031 25 9 39 071 57 Y 59 131 89 y 79 171 121Ctrl-Z SUB 1A 032 26 : 3A 072 58 Z 5A 132 90 z 7A 172 122Ctrl-[ ESC 1B 033 27 ; 3B 073 59 [ 5B 133 91 { 7B 173 123Ctrl- FS 1C 034 28 3C 074 60 5C 134 92 | 7C 174 124Ctrl-] GS 1D 035 29 = 3D 075 61 ] 5D 135 93 } 7D 175 125Ctrl-^ RS 1E 036 30 > 3E 076 62 ^ 5E 136 94 ~ 7E 176 126Ctrl_ US 1F 037 31 ? 3F 077 63 _ 5F 137 95 DEL 7F 177 127

  • - 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

  • - 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

  • - 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.

  • - 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.

  • - 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 Result0 0 0 0 00 0 0 1 00 0 1 0 00 0 1 1 10 1 0 0 10 1 0 1 10 1 1 0 10 1 1 1 11 0 0 0 01 0 0 1 01 0 1 0 11 0 1 1 11 1 0 0 01 1 0 1 01 1 1 0 11 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

  • - 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)

  • - 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

  • - 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

  • - 40 -

    II. Application Examples for Logical Command.

    Logical ANDLogical ORLogical NANDLogical NORLogical Exclusive OR1 Scan-time OscillatorSelf-Holding, 0 or 1 Dominant SR/RS Flip-FlopDetect Rising Edge / Falling Edge, DifferentiationDual action PushbuttonTrouble Acknowledge/ Reset

  • - 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)

  • - 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)

  • - 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)

  • - 44 -

    This logic is also represented as next Boolean Equation.

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

  • - 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)

  • - 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

  • - 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)

  • - 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.

  • - 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

  • - 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.

  • - 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.

  • - 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

  • - 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.

  • - 54 -

    III. Application Example for Sequential Command.

    On Delay / Off Delay TimerOne Shot Multi-vibratorMulti-VibratorSpeed Monitor using OFF Delay TimerPreventing Chattering Noise for Mechanical ContactsFinding Stable Value by TIME Filter from Analog Input HuntingMeasuring Time for Continuous Production.Optimizing Surveillance Timer of Speed MonitorSurveillance of Motor Drive SystemDetecting Value Changed

  • - 55 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    On Delay / Off Delay Timer

    1. Ladder LogicOn delay Timer

    X0

    Y105 sec

    Off Delay Timer

  • - 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.

  • - 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.

  • - 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

  • - 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)

  • - 60 -

    MOTOR

    ProximitySwitch

    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.

  • - 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

  • - 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.

  • - 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

  • - 64 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    Measuring Time for Continuous Production.

    1. Ladder Logic exampleExample 1.

    Example 2.

  • - 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.

  • - 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 .

  • - 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.

  • - 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.

  • - 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

  • - 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

    X30X31

    Motor Fan

    Magnet Return Signal

    Speed Monitor Return Signal

  • - 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.

  • - 72 -

    IV. Application Example for Flow Sequential Command.

    Sequence Control with BSFL CommandSequence Control with SFTP CommandCall Subroutines and Return ProcessingSorting Data of Table in Maximum Order

  • - 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

  • - 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.

  • - 75 -

    Finally actuators are driven by M Coil.

  • - 76 -

    3. Sequence Block Diagram

    Material Reached

    Belt ConveyorStop

    Material Reached

    Tool moveTo 1st Position

    Drill

    Advance

    Drilling

    Drill

    Retract

    Tool

    Change

    Blower Advance

    Cleaning

    Blower Retract

    Belt Conveyor Start

  • - 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.

  • - 78 -

    All bits will be initialized by energizing of M58 bit.

  • - 79 -

    3. Sequence Block Diagram

    Material Reached

    Belt ConveyorStop

    Material Reached

    Tool moveTo 1st Position

    Drill

    Advance

    Drilling

    Drill

    Retract

    Tool

    Change

    Blower Advance

    Cleaning

    Blower Retract

    Belt Conveyor Start

  • - 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.

  • - 81 -

    In case that calling Subroutine 2

  • - 82 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    Sorting Data of Table in Maximum Order

    1. Ladder Logic

  • - 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.

  • - 84 -

    Data Table Before Sorting

    Sorted Data Table

  • - 85 -

    V. Application Example for MUX-DEMUX.

    Parallel Driving for 7 Segment DisplayEconomic Discrete Input Multiplexing-Demultiplexing

  • - 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 8Y21Y22Y23Y24 Y25Y26Y27Y28

    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

  • - 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.

  • - 88 -

  • - 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

  • - 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.

  • - 91 -

  • - 92 -

    VI. Application Example for Calculation Command.

    Analog Input/Output ModuleA1S68AD/ A1S68DAV,DAI Analog Input Module Set-upScaling for Analog Input PVSchmitt Threshold ON-OFFPeak Value HoldOn / Off Controller for Analog PVAnalog Value Clamping, LimitationBit Shift by Calculation CommandAnalog Drive Speed ControlFinding Stable Value by SUM from Analog Input HuntingDrive Multi-stage Control by Encoder FeedbackRatio Control for Material MixingTrickle Control for Truck LoadingRate Sampler for Single CounterAnalog Scaling for X 0 Shifted SignalAnalog Scaling for Y 0 Shifted SignalPiecewise for Proportional Non-Linear CurvePiecewise for Inverse Proportional Non-Linear CurveLinear Profiler

  • - 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 2

    10 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

  • - 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

    (-)(+)

    (-)

  • - 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 Module0~1023

    204~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

  • - 96 -

    4. The External Circuit of Analog Output Module.

    (+) Sink

    ChassisShield

    DC4-20mA (+) Signal

    Transmitter(-) Source Shield

    (-)

  • - 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.

  • - 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.

  • - 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 InputModule +10V~-10V

    +1000 RPM

    -1000 RPM

    +10 V

    -10 V

    +32767

    -32767

    +1000 RPM

    -1000 RPM

    Tacho Generator

    PLC Logic

    * 1000 / 32767

  • - 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

  • - 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:

  • - 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 .

  • - 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:

  • - 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.

  • - 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.

  • - 106 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    Finding Stable Value by SUM from Analog Input Hunting

    1. Ladder Diagram ExampleA. Ratio Control Ladder Logic Example

  • - 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

  • - 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.

  • - 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

  • - 110 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    Ratio Control for Material Mixing

    1. Ladder Diagram ExampleA. Ratio Control Ladder Logic Example

  • - 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

  • - 112 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    Trickle Control for Truck Loading

    1. Ladder Diagram ExampleA. Before Trickle Control

    B. After Trickle Control

  • - 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

  • - 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

  • - 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.

  • - 116 -

  • - 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

  • - 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

  • - 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

  • - 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

  • - 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)

  • - 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

  • - 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;

  • - 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

  • - 125 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    Linear Profiler

    1. Ladder Diagram ExampleA. Ratio Control Ladder Logic Example

    B. Device Data Monitoring

  • - 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.

  • - 127 -

    VII. Application Example Data Manipulation Command.

    Clear to 0 Or Set to 1 All BitsSet All Bits to 1 by 2's ComplementBinary CounterAssembling/ Disassembling of BitsAcceleration/Deceleration Control With Linearity for Set-pointIndividual ON/OFF Operation by Thumb-wheel Switch SetRing CounterDisplay of Trouble Flag NumberQue Buffer and First-in/First-outLIFO(Last In First Out) Using Stack MemoryLoad/Save Data for 2-3 Dimensional DatabaseData Save/ Sort/ Search for Optimization

  • - 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.

  • - 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.

  • - 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.

  • - 131 -

    Mitsubishi Melsec PLC Ladder LogicApplication

    Assembling/ Disassembling of Bits

    1. Ladder LogicBits Assembling

  • - 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.

  • - 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

  • - 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 characteristic