minitrainerschool - lovato · pdf filebasics of ladder diagram and function block diagram...

87
MiniTrainerSchool For the MicroPLC from Lovato Electric Basics of Ladder Diagram and Function Block Diagram programming with the Lovato software LRXSW with many practical exercises on Lovato-MiniTrainer Zeitrelais T1 Ti me r ela y T1 LA D4 Enable Reset Output I2 Start Q2 I4 MOD E T01 LR D 12 Sil o / Tan k IA1 Q1 Q3 PWM Silo / tank LR D12 FBD14 I1 Start/ Stopp Voll Enable M

Upload: vodung

Post on 06-Mar-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

MiniTrainerSchool

For the MicroPLC from Lovato Electric Basics of Ladder Diagram and Function Block Diagram programming with

the Lovato software LRXSW with many practical exercises on Lovato-MiniTrainer

Zeitrelais T1 Time relay T1 LAD4

Enable

Reset

Output

I2 Start

Q2

I4

��������� ���������������� ������������

�������� ��������������� ����������

������� � �������������� ���� �������������

MODE

T01

LRD 12

���������������������� �����������

Silo / Tank

IA1

Q1

Q3

PWM

Silo / tank

LRD12

FBD14I1 Start/Stopp

Voll

Enable

M

Page 2: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

2

Page 3: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

3

This exercise book serves as an introduction to the world of MicroPLC

LRD12 and LRD20 of Lovato Electric.

It provides a modern small controller that offers many ways to implement a customer-

centric automation.

Thanks to the various programming languages the LRD… provides something for

everyone. Along with the MiniTrainer, it offers an ideal practice and learning platform

for education and training.

In this exercise book, the basic building blocks of the ladder diagram and function

block programming can be learned with many training examples.

Of course, individuals are free to reshape the exercises or expand.

On the enclosed CD there is a proposed solution offered to each exercise. The

exercise cards for the MiniTrainers are enclosed in two versions. On one hand, the

Lovato-MiniTrainer with the LRD12 and on the other hand for the Lovato-

MiniTrainerXL with the LRD120, with more I / O points.

Lovato Electric GmbH (Germany) Im Ermlisgrund 30, 76337 Waldbronn Tel.: +49 (0) 72 43.76 69 37-0 Fax: +49 (0) 72 43.76 69 37-9 E-Mail: [email protected] Web-Site from Lovato-Electric: www.lovato.co.uk Author: Klaus Machalek 1 Edition 2014 (02/14) All rights, including translation, are reserved. No part of this book may be reproduced in any form (print, photocopy, microfilm or any other process) without the written permission of the author or processed using electronic systems, duplicated or distributed. Of these, which expressly referred to in § 53, 54 of the Copyright Act except the cases are not affected.

Page 4: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

4

Table of Contents

1. Hardware construction 7

1.1 Exercise equipment 7 1.2 Technical data of the exercise equipment 7 1.2.1 MicroSPS: LRD12TD024 7

1.2.2 MicroPLC: LRD20TD024 8 1.3 Lovato-MiniTrainer 8 1.3.1 Assignment of inputs and outputs on the Lovato-MiniTrainer 9 1.4 Lovato-MiniTrainerXL 9

1.4.1 Assignment of inputs and outputs on the Lovato-MiniTrainerXL 10 1.5 Selecting the programming software 11

2. Ladder diagram (LAD) 12 2.1 circuit diagram window 15 2.2 Creating a circuit diagram 15 2.3 Series circuit 17 2.4 Parallel circuit 17

2.5 Digital outputs Q/Y and markers M/N 18 2.6 Boolean algebra as a basis 19

2.6.1 Logical combinations in the LAD Editor 20 2.6.1.1 AND-operation 20 2.6.1.2 OR-operation 21 2.6.1.3 AND- before OR operation 22

. 2.6.1.4 OR before AND operation 23 Exercise: Basic circuits with the LAD Editor: LAD 1a / LAD 1b / LAD 1c 24

2.6.1.5 Latching 25 Exercise: Latching: LAD2, LAD3 26

2.6.1.6 Priority processing - dominant 27 2.7 Simulation 28 2.7.1 Simulation on the virtual controller 29 2.8 Der Online-Test 30

2.8.1 Coupling 30 2.8.2 Program transfer 31

2.9 Time relay (timer) T 32 2.9.1 Configuration window of time relay (timer) 32 2.9.2 Setpoint input at time relay 34 2.9.3 Presentation of the timer in the circuit diagram LAD 35 2.9.4 Display of the timer on the display of LRD… 35 2.9.5 Change the setpoint on display?. 36

Exercises: Time Relay T: LAD4, LAD4a, LAD4b, LAD5a, LAD5b, LAD6, LAD7 37 2.10 Differential Instruction D 39 2.11 Counter C 40 Exercises: Counter C: LAD8, LAD8a, LAD8b, LAD9 42

2.12 Shift register S01 43 Exercises: shift register S01:LAD10, LAD11, 44 2.13 Analog comparator G 45 Exercises: Analog comparator G: LAD12, LAD13, 46

2.14 Real Time Clock R 47 Exercise: Real Time Clock R : LAD14 48

2.15 Arithmetic blocks AS (ADD / SUB) and MD (MUL / DIV) 49 Exercise arithmetic AS: LAD15 50

2.16 Data register DR 51 Exercise: Data register DR: LAD9a 51

2.17 Multiplexer MX 52

Page 5: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

5

2.18 Text display H 53 Exercise: Text display H:LAD16 55

2.19 Comments for coil and contacts 56 2.20 Headlines and comments in the Ladder Diagram 57

3. Function block diagram FBD 58

3.1 Creating a function block diagram 60 3.1.1 draw connections 61

3.2 Logic sets in the FBD-Editor 62 3.2.1 AND operation 62 3.2.2 AND NOT-operation (NAND) 63

3.2.3 OR operation 64 3.2.4 AND before OR operation 65 3.2.5 OR before AND function 66 3.2.6 OR-NOT operation (NOR) 67 3.2.7 Exclusive-OR (XOR) 68

Exercises: Logic blocks: FBD1a, FBD1b, FBD1c 69 3.2.8 Latching function 70

Exercise: latching function:FDB2a, FDB2b, 71 3.3 Selection menu of the Function Blocks 72

3.3.1 Timing relay T 72 3.3.2 Pulse relay 74

Exercise: Timer relay: FBD3, FBD4a, FBD5 75 3.3.3 Counter C 76

Exercise: Counter: FBD6a, FBD6b, FBD6c, FBD7a, FBD7b 78 3.3.4 Shift register S01 79

Exercise: Shift register: FBD8a, FBD8b 79 3.3.5 Analog comparator G 80

Exercise: Analog comparator: FBD9a, FBD9b, FBD9c 81 3.3.6 Multiplexer MX 82

Exercise Multiplexer: FBD10 82 3.3.7 Boolean function BL 83

Exercise Boolean function BL: FBD11, FBD12 83 3.3.8 Pulse-width modulation (PWM) P 85

Exercise PWM: FBD13, FBD13a, FBD14 85 3.3.9 Text H 87 3.3.10 Display backlight 87

4. Useful information 88

Page 6: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

6

Contents of the CD

Solutions In LADDER diagram (LAD) in Function block diagram (FBD)

Page 7: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

7

1. Hardware construction 1.1 Exercise equipment Lovato Electric GmbH, the manufacturer of MicroPLC LRD12 and LRD20, offers a wide range of different devices. Starting on the number of input and output points of extensibility to the different supply voltages. In this basic course, the devices LRD12 and LRD20 will apply. Once the low cost LRD12 with the small Lovato-MiniTrainer and another with the LRD20 and the Lovato-MiniTrainerXL for more inputs and outputs. Thus, both versions offer a simple and inexpensive way to implement the exercises here used in the book and also to supplement. 1.2 Technical data of the exercise equipment

1.2.1 The MicroPLC LRD12TD024 This MicroPLC provides eight digital 24 VDC inputs in addition to the 24 VDC supply. Of these, the inputs A1 and A2 can be alternatively used as analog inputs.

Note: For the MiniTrainer can either be used the LRD12TD024 with 4 relay- or 4 transistor outputs.

The display offers the representation of LAD, FBD and text.

Power supply 24 VDC

8 inputs 24 VDC A1 and A2 digital and alternatively usable as analog inputs 0 ... 10V

4 relay or 4 transistor outputs

USB interface to PC

Cursor key activated as Z inputs

Figure 1.1 LRD12TD024

Page 8: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

8

1.2.2 MicroPLC: LRD20TD024

Firstly, this exercise utilises the larger design controller. This makes it possible to use more inputs and outputs and thus to make the exercise offer interesting and varied. The MiniTrainer now has the designation Lovato-MiniTrainerXL.

Preferably, the transistor variant LRD20TD024 should be used, that way you can also use the PWM functionality better.

1.3 Lovato-MiniTrainer

Figure 1.3 Lovato MiniTrainer

Figure 1.2 LRD20TD025

Page 9: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

9

1.3.1 Assignment of inputs and outputs on the Lovato-MiniTrainer:

1.4 Lovato-MiniTrainerXL The MiniTrainerXL offers in addition to the 8 latching / momentary switches (I1 to I6 / I9 and A1) or 2 push buttons (red) as the changer inputs I7 / I8 and IB / IC operate. They are as shown in the sketch, wired: Latching/momentary switches By using the buttons X1 - X4 as real wire break simulations, start-stop functions can be implemented.

I7 I8 IB IC

24 VDC-power supply

The NC I8 and IC can be switched off via the slide switch. Thus all inputs via the interface connector are available and have no default

I9 IA

Figure 1.4 MiniTrainer simulation field Figure 1.5 I/O assignment of LRD12

Figure 1.6 addition button on the Lovato-MiniTrainersXL

Page 10: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

10

1.4.1 Assignment of inputs and outputs on the Lovato-MiniTrainerXL:

Lovato-MiniTrainer XL

I9 IA IB IC

Figure 1.7 MiniTrainerXL simulation field

Figure 1.8 I/O assignment of LRD20

Figure 1.9 Lovato-MiniTrainerXL

Page 11: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

11

1.5 Selecting the programming software The first part of this book deals with the ladder diagram programming. In the second part of the function block is handled. The software offers comfortable implementation of control and regulation functions in the standard PLC languages: Ladder Diagram (LAD) and function block diagram (FBD). To create a new project, first the desired programming language must be selected. Either ladder programming (LAD) or function block programming (FBD).

LAD=LadderDiagram=(LD) FBD = Function Block Diagram language

LAD (LADDER) FBD

Note: A ladder diagram (LAD) is not in a function block diagram (FBD), or convertible and vice versa!

Figure 1.10 LAD- and FBD-Button

Page 12: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

12

2. The Ladder diagram (LAD) (in the Software called „LADDER“) The corresponding button is clicked to reach the LAD Editor. The next step is to select the right MicroPLC. This is necessary in order to assign the right program of the controller. For this purpose, the "NEW" button is clicked.

LADDER LAD

Picture 2.1 Start-Menu of the LRXSW for opening LAD

Picture 2.2 Start-Button

Page 13: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

13

The selection is based on the device type identifier: Note: This choice is also possible later on in the "Operation" -> "Module System Set" Is the correct device selected via the pull-down button will be confirmed with OK and the LAD Editor opens. The Ladder Editor is divided into the following areas: circuit diagram window Information on the circuit diagram Operations

Selection of contacts and coil

Assignment list of contacts and coils

It appears in the device selection window:

Picture 2.3 device Selection

Page 14: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

14

In order to interpret correctly the symbols you place the mouse on the icon, and after a moment the icon's function appears. The symbol for the outputs Q/Y and the markers M/N again shows the contact and once the coils function. Cursor keys (Z) on the MicroPLC

External inputs (X) digital (extension) inputs (I) In the left window of the editor, the contacts and coils used are displayed. Clicking the button opens the complete selection table. Note: The individual short names (Y, M, T, C, R, G, H, ..) are explained in the relevant exercises.

Picture 2.5 Contact- and coil function

Picture 2.6 Occupancy list

Page 15: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

15

1 2 3 4 5 6 7 8 9 etc.

2.1 Circuit diagram window The ladder program is created in the circuit diagram window. It can be constructed of a maximum of 300 rungs with a maximum of three contacts and one coil. If you need more than 3 contacts in a rung you need a temporary result memory, a marker M or N.

2.2 Creating a circuit diagram Use the mouse pointer to select the contact icon. As an example, we select the input. When the icon is left appears as a crayon. Using the mouse, now the contact to the right position is out in the rung. This is the "pen" and as long as provided with a prohibitory sign, as long as no contact inserted, the field is reached. Only when the prohibition sign is gone, the contact can be set. If the position is reached, the contact with the left mouse button "placed". It opens directly the selection window "Edit contact" through which you enter the parameter.

Indication of the remaining open spots

Picture 2.7 The Schematic window

Picture 2.8 describe contact

Page 16: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

16

This window will also determine whether the contact is normally open or normally closed. A subsequent correction is possible in this menu. With OK the configured contact in the ladder diagram is visible. Note: Unless the right mouse button or the ESC key is pressed, the "pen" is retained and it may be the next position to be selected. In the toolbar, there are a lot of contacts and coils of different functions. In this book, some are handled. But experience shows that many functions even tell if you have worked through the book.

Note: In the circuit diagram the name of contacts appears different: NO (normally open) NC (normally closed)

Picture 2.9 Toolbar

Picture 2.10 N.O.-contact Picure 2.11 N.C.-contact

Page 17: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

17

2.3 Series circuit As a first example to three NO contacts switch the output Q01 in series:

If you want to associate less than 3 contacts in series, one needs an "AND-Line". This function is as an icon button in the bottom toolbar: AND-Line

Note: This connection is used instead of a contact!

2.4 Parallel circuit For this example, we use the previous example of the series circuit and add this with two parallel contacts I04 and I05. For this purpose, the software in the toolbar “OR-Line” button for the parallel branch: OR-Line Example of a parallel circuit:

Shows the occupied contacts and coils with a star

Picture 2.12 First line

Pictue 2.13 AND-Line

Picture 2.14 OR-Line

Picture 2.15 parallel circuit

Page 18: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

18

2.5 Digital outputs Q/Y and markers M/N The digital outputs and markers of MicroPLC can be set in different functions. As standard the selected output or marker is used as a dynamic coil. This means that the output or marker behaves as a contactor. Further functions are:

Set-function Reset-function

P = puls-function These different opportunities are illustrated in the circuit diagram as follows: Dyn. coil: -[ = Set-coil = Reset-coil = Puls-coil =

Note: The function of the output can be changed at any time by double clicking on the corresponding coil function.

Picture 2.16 discribe coils

Pictur 2.17 coils

Page 19: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

19

2.6 Boolean algebra as a basis The primary task of MicroPLC LRD is the linking of several NO and NC contacts after a certain logic. This logic corresponds to a series (AND circuit) or a parallel (OR circuit) in a wired contactor or relay control. The link can be specified in the LRD either

Ladder Diagram = LAD or function block diagram = FBD.

This plan is stored in non-volatile semiconductor memory of the LRD. It is important to note that the MicroPLC cannot detect whether an incoming signal from the outside of a make or break comes. The LRD "remembers" only if the 24 VDC voltage is applied to the inputs or not. In the circuit diagram or logic diagram, the logic state of the inputs is always queried and not the function of the actuator.

Page 20: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

20

Picture 2.18 AND-operation Picture2.19 Wiring to the PLC

Picture 2.20 AND-operation in LAD

2.6.1 Logical combinations in the LAD Editor

2.6.1.1 AND-operation

The AND-operation corresponds to the series circuit in a conventional wired contactor control that means the output is switched on when all switches are closed. The following example shows a better understanding of how an AND-operation takes place in old fashion wired contactor technology and how the implementation of the LRD12. Example: Logical AND-operation with three switches: Realization in wired contactor circuit Realization with the LRXSW:

The output signal (H1), an AND-operation is then logic "1" when all the input signals (S. ..) have the state "1". The "1" stands for an actuated normally open or a normally closed contact is not actuated. True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 1 1 1 Presentation in the LRXSLAD:

ZelioLogic2

H1 H1

S1

S2

S3

Relay 1

AND

S1 S2 S3

H1

H1 = S1 & S2 & S3

LAD

S1 S2 S3

I1 I2 I3

LRD12

Q1

Page 21: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

21

Picture 2.21 OR-operation Picture2.22 Wiring to the PLC

Picture 2.23 OR-operation in LAD

2.6.1.2 OR-operation The OR-operation corresponds to the parallel circuit in a conventional wired relay control, that is, the output is then turned on when at least one of the switches is closed. The following example shows a better understanding of how an OR operation in old fashioned wired contactor technology and how the implementation of the LRD 12 takes place. Example: logic OR-operation with three switches Realization in wired contactor circuit Realization with the LRXSW: The output signal (H1), an OR operation is then logic "1" if at least one or more input signals (S. ..) have the state "1". The "1" stands for an actuated normally open contact or a non-actuated normally closed contact. True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 0 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1 Presentation in the LRXSLAD:

S1 S2 S3

Relay1

H1 H1

OR

S1 S2 S3

H1 H1 = S1 V S2 V S3

LAD

S1 S2 S3

I1 I2 I3

LRD 12

Q1

Page 22: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

22

Picture 2.24 AND before OR operation Picture2.25 Wiring to the PLC

Picture 2.26 AND before OR operation in LRXSLAD

2.6.1.3 The AND- before OR operation

The three switches to be logically combined in AND and OR. The input of this logic is based on the basic rule of Boolean algebra:

Point are performed before addition and subtraction

In the implementation in the wiring logic, this means:

Series circuit is going on parallel circuit The following example shows the implementation a combined AND-OR circuit according to the rule above mentioned: Realization in wired contactor circuit Realization with the LRXSW: S1 S3

True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1

Relay1 H1

H1

H1 = S1 & S2 V S3

AND

S1 S2

S3

H1 OR

LAD

S1 S2 S3

S2

Q1

I1 I2 I3

LRD 12

Page 23: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

23

Picture2.28 Wiring to the PLC Picture2.27 OR before AND operation

2.6.1.4 The OR before AND operation

Four switches will be connected in logic OR and logic AND: The input of this logic is also called conjunctive form. Since the Boolean rule applies here, it must be used with braces. Thus, it specifies that the OR operation is processed first. The representation in the application program corresponds to the international standard IEC 61131. The following example shows the implementation a combined AND-OR circuit following the rule above mentioned: Realization in wired contactor circuit Realization with the LRXSW

True list: FBS: Logic algebra: S1 S2 S3 S4 H1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 1 0 1 1 0 1 1 1 1 0 1 0 0 0 1 0 1 0 0 1 1 0 1 0 1 1 1 1 0 1 1 0 0 1 1 0 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1

Relay1

LRD 12

I1 I2 I3 I4

Q1

H1

H1

S1 S2 S3 S4

S1 S2

S3 S4

H1 = (S1 V S2) & ( S3 V S4)

OR

OR

AND H1

S1 S2 S3 S4

Page 24: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

24

Picture2.29 OR before AND operation in LAD

Presentation in the LRXSLAD:

Exercise: Basic circuits with the LAD Editor LAD 1a / LAD 1b / LAD 1c

LAD

I1 I2 I3

I4

I5 I6

I9 I0A

Q1

Q2

Q3

Q4

LAD 1a

LRD12

I1 I2 I0A

I3

I4 I6

I5 I9

Q1LAD1b

LRD 12

I1 I2

I3

I4

I5 I6

I9 I0A

Q1LAD 1c

LRD12

Q2

Picture 2.30 Exercise card LAD1a

Picture 2.31 Exercise card LAD1b

Picture 2.32 Exercise card LAD1a

Page 25: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

25

Picture 2.33 dyn. latching in LAD

Picture 2.34 static latching in LAD

2.6.1.5 Latching In control engineering, the function of latching is often use, especially when using buttons will execute a stored function. A typical task is the turning on and off of a motor. The ON button is always a normally open and the OFF button always normally closed. Why the OFF button is normally closed, has something to do with the wire breakage. The VDE regulations state that in the event of a wire break in the relevant section a motor must be switched off immediately and must not be turned on. To realize a latching in the LRD12 and LRD20 the MicroPLC offers two variants. 1. The dynamic control of the output: If the result of logic operation (RLO) is on , the output is on, too. If the RLO is low , the output is low, too.

2. The static control of the output Latching function with SET and RESET commands. Both commands work with the rising edge.

Page 26: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

26

Picture 2.35 Exercise card LAD2

Picture 2.36 Exercise card LAD3

Exercise: Latching

Exercise LAD2: Latching with dynamic triggering of Q2 (Like the classic relay and contactor control)

Exercise LAD3: Latching with static triggering of Q2 (Like classical electronic controls via flip-flops)

With these exercise cards the topic of wire breakage is practiced. For all programmable logic controllers (PLCs) you must make sure which switch or push button is installed on the machine or plant. Is it a N.O. or N.C. contact? This is important because according to VDE 0113 turn off must be by opening a circuit. By using an N.C. to the input terminal of a PLC, this always has power at the input terminal in the non-actuated state. If you were to now integrate the input by an N.C. in the schematic, so you return the signal of the external switch. This has the consequence that e.g. a motor off by opening the circuit at the input of the PLC. This can be life-threatening. Thus, we conclude that one must always think twice when you include one outside the PLC wired N.C. in the program as N.O. or N.C. to be failsafe.

I5

I3

I4Q2

Selbsthal teschal tung seal-in circui t LAD 2

Start Stop Bimetall

Q2

Bei der Programmerstellung ist auf die Drahtbruchsicherheit zu achten!

In case of programming pay attentionto the fail-save c ircuit

LRD 12

I6

I3

I5

Q2

Selbsthal teschal tung mit SET und RESET Seal-in circui t wi th SET and RESET LAD 3

Start

Bei der Programmerstellung ist auf

S

R

die Drahtbruchsicherheit zu achten!

In case of programming pay attentionto the fail-save c ircuit

LRD 12

Page 27: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

27

1a

1b

1c

1b

1c

1a

Picture 2.37 Priority processing in LAD

2.6.1.6 Priority processing - dominant Another important overview is the priority of functions. The program processing is always from top to bottom, is in the ascending line numbering. The example shows how important it is in which line the output or marker are standing. This is also important with respect to the priority in the setting and reset command. If I1 and I2 are pressed simultaneously, the RESET command has priority. I3 and I4 are pressed simultaneously, the SET command has priority. If a coil is several times assigned,it is also true that the ascending line numbers, the last assign which affects the coil to the outside. Internally, the coil of the output or marker "1" or "0" as long as no change is made in the following lines.

Page 28: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

28

Picture 2.38 Tools in LAD

Picture 2.39 View menue

Picture 2.40 OR-Line and AND-Line

2.7 Simulation After the last link is ready, this is simulated with the help of LRXSW, i.e. tested without control (off-line). For this we change into the SIMULATION MODE:

Depending on the settings more windows are opened simultaneously. Since we are interested only in the inputs, the other windows can be closed. This takes place using the "View" “ By clicking on the fields, tools can show or hide!

By clicking the button icons in the "Input Status Tool", the corresponding switch in the LAD is displayed in green. If the rung is virtually closed, that is, from left to right is a continuous green line, then the output is also available in green. (The connecting lines "OR-Line" and "AND-Line" always appear in green)

Page 29: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

29

Picture 2.41 keypad button

Picture 2.42 Keypad-Simulator

2.7.1 Simulation on the virtual controller In addition to simulating the circuit diagram, the controller also provides a pictorial representation of LRD12 with the connected switches and lamps. You can reach this simulation by clicking the "keypad"

By clicking the "Run" button, the program can now be tested on the simulator. Click switch Current paths, the bold appear to be "flown through" virtual power!

Outputs

With the mouse, you can also use the cursor buttons to operate virtually and thus retrieve the LRD12 the menu and use. Note: In this virtual control simulator parameters can be changed, but the function of a function block cannot.

Run

Page 30: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

30

Picture 2.43 Cuppling to the PC

Picture 2.44 Link Com Port…

Picture 2.45 Select Link Com Port…

Picture 2.46 Connect successfully

2.8 The Online Test 2.8.1 Coupling Before the transfer of a program can be done in the controller, some settings must be checked, or set. These settings, bring the selected control to meet the actual control system. If this is not the case, the LRXSW recognizes and cannot connect. The USB programming cable is plugged into one of the USB ports of the PC. If the connection is made, and power is connected, then the coupling of the software can be made: 1. Click "Operation"

2. Click "Link COM Port" 3. Select the interface "COM port"

4. Click Connect "link"!

If the coupling was successful, this is indicated by a message on the screen.

The exact type of control can be found on the left side wall! example: LRD12TD024

The protective cover should be pulled out and the plug inserted carefully. The cable goes from the left.

Page 31: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

31

Picture 2.47 Read and Write Button

Picture 2.48 Message

Picture 2.49 Transfer o.k.

Picture 2.50 Run and Stop Button

Picture 2.51 Message

2.8.2 Program transfer The next step is to transfer the program into the controller. For this the LAD editor provides two buttons. One to write the program into the control "write" and another to read the program again from the controller back to the PC "read". Read from the LRD… write into the LRD… After a safety prompt with the hint that you could possibly overwrite a program in the control (clear).

If you confirm with "Yes", the program is transferred to the controller. Then you acknowledged with the “OK” for transfer: With the "Run" button the program starts in the controllerand with the "Stop" button, the program can be stopped anytime from the PC. If you click "Run", the system asks whether the program should be read back from the controller. This makes sense if you just want to see the online status display.

Page 32: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

32

Picture 2.52 Tools

Picture 2.53 Timer select

Picture 2.54 Timer mode1

Picture 2.55 Timer mode2

2.9 Time relay (timer) T The MicroSPS LRD… provides 30 timing relays with different possible functions. The button "T" is chosen from the lower function selection panel to open the configuration window for the functions and their settings.

2.9.1 Configuration window of time relay (timer):

Selection of 30 possible timer addresses: 01…09, 0A…0F, 10…19,1A…1F

Function of the output coil of the timer (Output Type):

–[ = Dynamic coil (in the example selected) P = Pulse output

Function of the timer depending on the output coil

(Output Type): Mode 0 – 6 for : –[ Mode 7 for : P

Mode 0: internal coil (like a marker)

Mode 1: On-delay timer

Flow diagram

Mode 2: ON-delay timer with reset input. If the enable is off, the timer stops. Only if the Enable is "ON" the time is running on again.

Page 33: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

33

Picture 2.56 Timer mode3

Picture 2.57 Timer mode4

Picture 2.58 Timer mode5

Picture 2.59 Timer mode6

Picture 2.60 Timer mode7

Mode 3: OFF-delay timer.If the rising edge of Enable (0 -> 1), the output is "ON". Time is running only when the Enable flank falls (1 -> 0). If Enable is turned on again during the running time, the actual value is set to "0". The timer can be restarted.

Mode 4: OFF-delay timer. When a falling edge of Enable (1 -> 0), the output is "ON" and the time is running out. If Enable is turned on again during the running time, the Actual value of the timer is reset to "0". The timer can be restarted.

Mode 5: Synchronous flasher (1:1) (ON-time = OFF-time) The output of the timer flashes while the Enable "ON".

D Mode 6: Synchronous flasher (1:1) M (ON-time = OFF-time) The output of the

Ö timer flashes once to Enable an edge G change from 0 - done> 1. The output D flash until an edge change from 0 -> 1 F at the Reset input is done.

Mode 7: Asynchronous flasher (1: n) (ON-time is not equal the OFF-time) The output of the timer flashes while the Enable "ON".

Page 34: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

34

Picture 2.61 Timer parameter

Picture 2.62 Timer mode7

2.9.2 Setpoint input at time relay The input for the time functions are also included in the menu window of the timer corresponding to the mode that is set.

By default, the time base is set to 10ms. That the smallest default value for the timer is 10 ms.

„PresetValue“ Setpoint input with consideration of the time base (SEConds or MINuntes)

"Preset Type" is used when the target value from another block comes. So, for example, is "A" for analog input or "C" for a counter output. If setpoint "Preset Value" is specified, the Preset Type = "N" (Not)

For the asynchronous flasher (Mode 7) Two setpoints are required. Accordingly, two setting ranges (T01 and T02) are provided.

The time base

from … to 0,01 … 999,9 s 0,1 … 9999 s 1 … 9999 s 1 … 9999 min

Page 35: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

35

Picture 2.63 Timer in LAD

Picture 2.64 Timer in Run

Picture 2.66 LRD… Menue

Picture 2.67 LRD-Display Timer in Run

2.9.1 Presentation of the timer in the circuit diagram LAD If the timer is configured, it is shown in the circuit diagram as follows: Mode (0…7)

Current value Setpoint

In the run status of the timer is displayed as follows: Current value

2.9.4 Display of the timer on the display of LRD… In addition to the status display on the screen, it is particularly convenient when for example you can read the value of the timer and the controller. This is often a great help for setup or troubleshooting. For this purpose, proceed as follows: If the controller is in Run mode, it comes with pressing the button in the following menu: The cursor key leads to the circuit diagram. There you go using the arrow keys on the corresponding block and confirm . Use the key to get back into the schematic.

��������

������������

������������

�������

Page 36: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

36

Picture 2.67 LRD-Display: in Stop mode

2.9.5 Change the setpoint on display? Many times it happens in the everyday life of a machine or system that a value needs to be adjusted, but there is no PC for set-point modification. For this the controller offers, thanks to its built-in display among other things, the possibility to change settings. The change is ALWAYS in STOP mode. With the keys is now the timer component T1 called:

1. Press the key.

2. Go with the Cursor-key up and confirm.

3. Use the cursor button to repeatedly tap to the left until the position is reached at which point the value is to be changed.

4. Pressing the button, the position is confirmed and the cursor line below the number flashes.

5. Use the cursor keys and now the new value can be set.

6. If the value is correct, you confirmed with and leave the menu with

Page 37: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

37

Picture 2.68 Exercise card LAD4

Picture 2.69 Exercise card LAD4a+b

Picture 2.70 Exercise card LAD5a+b

Exercises: Time Relay T

LAD4: With the exercise card " Time relay T1" first we test all the modes of a timer!

LAD 4a: Based on the adjacent exercise card is a reflector light barrier (I02) four monitoring lights (Q1 ... Q4) switch for 10s. To switch on it is enough if, for example, a person shortly interrupts the light barrier. With each new interruption of the photocell, the timer is restarted. Which mode is useful here? LAD 4b: The interrupt pulse of the light barrier is to be fixed at 0.2 s.

LAD 5 a: A toilet light and fan control is to be implemented using the LRD…. If someone enters the bathroom and switched on the light, after 4s the fan runs on as well. Only when the toilet is left and the light is switched off, the fan runs for 8s and then switches off.

LAD 5b: In addition to LAD 5a, the fan should now run after 20 s, when the toilet is used for longer than 20 seconds and the light is longer than 24s on.

?

Zeitre lais T1 Time relay T1 LAD4

Enable

Reset

Output

I2 Start

Q2

I4

��������� ���������������� ������������

�������� ��������������� ����������

������� � ������������������ �������������

MODE

T01

LRD 12

���������������������� �����������

Toi letten -Licht-LüftersteuerungToi let -Light-and-Fan Control

Controlador de la luz y el venti lador de un bano

S5

Licht

lampluz

Lüfter

fanventi lador

Schalterswi tchin terruptor

Q1

Q2

~

LRD 12

LAD 5a + b

Page 38: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

38

Picture 2.72 Exercise card LAD7

Picture 2.71 Exercise card LAD6

0 1 2 3 4 5 6 15s

LAD 6 - Lighthouse: On the North Sea coast are navigation beacons for safe orientation. These can be seen from a distance and in the dark they have different identifiers to see which beacon is which. They are the broken fire (Oc), the common-mode fire (iso) and the flashing light (LFI). These three identifiers will now be realized with the help of exercise LAD6 card. 1) Lighthouse from Westerheversand - Oc(3) 15:

3 dark phases of 1s and the two pauses of 1 s. Then is permanent light. The repeat is done every 15s. 2) Lighthouse from Büsum- Iso 6s: 0 3 6s

On 3s and off 3s 3) Lighthouse from Helgoland- LFI 5s: 0 5s

all 5s a flash fire <1s (600ms)

LRD 12

Q1

Leuchtfeuer / Navigational l ight

Q2

Q3

I1

I2

I3

Westerheversand

Büsum

Helgoland

LRD12

Ampel / Traffic light LAD 7 LAD7:

In metropolitan areas, side road access to highways is controlled in heavy traffic with a traffic light. The traffic light shows RED when the main switch I01 is turned on. An induction loop in the road surface before the traffic light detects an incoming vehicle. With 1s delay starts the traffic light cycle, which also takes 1 sec each for the individual phases. At the end of the traffic light cycle the lights are back on RED. If the induction loop is connected constantly, so the traffic lights cycle runs through the 1 sec intervals.

Page 39: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

39

Picture 2.73 D puls when ON

Picture 2.74 D-puls when OFF

2.10 Differential Instruction D The "positive" pulse is for one program cycle "ON" if the series contact switches from OFF -> ON.

The same function but with the opposite sign is the inverse of the "D" contact.

Page 40: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

40

Picture 2.75 counter parameter

Picture 2.76 counter in LAD

Picture 2.77 Reset Input of the counter

2.10 Counter C

Like the timer, the counter is also a function block that needs to be configured only. The MicroPLC offers 30 counter blocks, each with 8 different modes.

Mode 0: internal coil (like a marker) Mode 1: up-down counter without overflow. If the setpoint = actual counting up is blocked. The counting is stopped if the actual value = 0. The actual value is non-retentive. It loses its value when you turn off the controller. Setpoint input (0 ... 999999) Variables specification (for example: the result of arithmetic) Note: In LAD circuit diagram ONLY be linked the counting coil and the switching output of the counter. The specification of the counting direction (Direction set) and the reset Input of the counter value can be selected in the configuration window and displayed as in the example:

"Low" = "0" = no specification The representation in the LAD editor provides the following information:

If you want to reset the counter and / or changing direction, then the menu offers various options: Low = not specified for example: Reset Input

I = Input base unit X = Input expansion unit Z = cursor keys (arrows) as inputs etc

Counting coil

Switching output of the counter

Mode

Direction

Reset Input

Setpoint

Actual value

Page 41: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

41

Picture 2.78 counter mode2 Picture 2.79 counter in stop

Picture 2.80 counter in Run mode

Mode 2: up-down counter with overflow.

If the setpoint = actual value of the count input is not locked. The counter continues to count. The actual value is non-retentive. It loses its value when you turn off the controller.

Example, in the LAD representation:

Note to "reset input" and "Direction Set" in Mode 2:

• "Reset input" has two functions. When pressed while counting the reset, the current value of the counter is set to "0". When pressed while counting down the reset, then the setpoint "Preset Value" is set!

• If the setpoint is reached when counting, the output switches the counter to "ON". Now, if the direction is switched, the output switches to "OFF" and again until the actual value = "0", the output is switched to "ON". Now, if the direction switched again, the output switches back to "OFF" until the setpoint is reached again.

Mode 3: Like Mode 1, but the actual value is retentive. It stores its actual value when you turn off the controller. Mode 4: Like Mode 2, but the actual value is retentive. It stores its actual value when you turn off the controller. Mode 5: Like Mode 2, but with the reset value is always set to "0", irrespective of the direction. Mode 6: Like Mode 5 but retentive. Mode 7: High-speed counter, which is used either as pure up counter on the high- speed counter inputs I1 or I2.

Mode 8: 1 KHz-speed counter, which is used either as pure up counter on the high- speed counter inputs I1 or I2.

Page 42: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

42

Picture 2.82 Exercise card LAD8a+b

Picture 2.81 Exercise card LAD8

Picture 2.83 Exercise card LAD9a+b

Exercises: Counter C

LAD8 Should be tested before the following exercises are done with the exercises card "counter C01", all modes.

LAD9: A car park entrance is controlled by display. A total of 20 parking spaces available. If all are occupied, the display shows "Busy". Otherwise, the display is set to "FREE". The caretaker also has the option, regardless of the allocation to close the driveway with a roller door. Is the roller door down, the display shows "CLOSED" on. Contact entrance : I01 Contact exit : I02 Contact door below : I03 Display “FREE“ : Q01 Display „BUSY“ : Q02 Display „CLOSED“ : Q03

LRD12

Parkhaus / Park ing garage LAD 9

Ein fahrtentranceI1

Ausfahrtexi tI2

I3

FREI / FREE

BELEGT / BUSY

Geschlossen /closed

LAD8a: Using an up-down counter of the setpoint value for a timer from 0 to 50 sec ... be adjustable. As the setting buttons Z keys are used. With Z01 is forward (UP), with Z03 backward (DOWN) counted. LAD8b: Extension The setpoint and the actual value of the timer should be displayed on the display of the LRD. Setpoint

Actual value

Q1I2

I3Reset

Direction

I1 Puls

Mode

Preset Value

Zähler C01 counter C01

LAD8

Counter

UP

DOWN

Min=0

Max=50

Timer 2

START

I1 Q1

LRD20

Preset Value

Sollwertvorgabe mit Vor-Rückwärtszähler setpoint via up-down counter LAD8a/8b / FBD7a /7b

Page 43: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

43

Picture 2.84 Shift register in LAD

Picture 2.85 Parameter of S01

2.12 Shift register S01 The function block "shift register" is a bit shift register and is available once. It can max. be 8 steps high. The start-coil defines the first step in the shift register. It can be an output (Q, Y) or relays (M, N). If you have chosen a variable, all outputs or markers that are defined with "Select 1-8", assigned. The clock-coil "Pulse Coil" defines the shift clock. It can be any variable in NO or NC function. In this example, the outputs Q1-Q4 are occupied by the shift register. The shift register operates as a shift register ring. This means in this example that the fourth time clock with the output Q01 I02 back "ON".

„Start Coil“

Q01 Q02 Q03 Q04

Number of shift increments „Select 1-8“

„Pulse Coil“

„Start Coil“

Page 44: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

44

Picture 2.86a Exercise card LAD10 for LRC20

Picture 2.86b Exercise card LAD10 for LRC12

Picture 2.87 Exercise card LAD11

Exercises: shift register S01

LAD10: We have a shift register with eight steps. The training card shows all necessary variables. The shift register shifts first from M01 to M08. The markers then drive the outputs Q1 ... Q8. Since the LRD12 has only 4 physical outputs, the remaining 4 outputs are virtually visible on the display. The shift clock (T1) of 1s becomes active when I1 is actuated. After 8 steps of shift clock starts again while I1 is switched off.

LAD11: In this exercise, the shift register is to be extended from LAD10 as traffic light control. Once I1 is turned on runs the traffic lights cycle from according to the diagram. 1 2 3 4 5 6 7 sec.

LRD20

Schieberegiste r / Shiftregister LAD 10

I1 Start Q1

Q2

Q3

Q4

Pulsecoil

Start Coil

S01

M01

M02

M03

M04

M05

M06

M07

M08

T1

Q5

Q6

Q7Q8

LRD12

Schieberegister / Shiftregister LAD 10

I1 Start

Q1

Q2

Q3

Q4

Pulsecoil

Start Coil

S01

M01

M02

M03

M04

M05

M06

M07

M08

T1

Dis

p lay

LRD12

Ampel mit SchieberegisterTraffic light with shiftregister

LAD 11

I1 Start

S01

Page 45: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

45

Picture 2.88 Parameter of Ax

Picture 2.89 Parameter of Ay

2.13 Analog comparator G The 24VDC base unit LRD12 provides two analog inputs A1 and A2. The analog value from 0 to 10V is applied to an analog to digital converter on the inputs, and converted into a binary number. The converted value can be compared via the analog-comparator block G with different values. The analog comparator values offers 8 modes

Mode 0: is always an internal coil. Mode 1: (Ay-Ref.) <= Ax <= (Ay+Ref.)

Ax and Ay can be assigned differently. With the direct assignment to the potentiometer of the MiniTrainer we can easily try out the formula. Ax = e.g.: A01 Ay = e.g.: A02 Example:

If the reference value is set to 03:00 and the potentiometer A2 to 6V, the output of the analog comparator switched on by turning the potentiometer A1 of at 3V and at 9V.

Mode 2: (Ax <= Ay) The output of the block "G" is "1", if the analog value of A1 is less than or equal to the value of A2.

Ax = Adjustable example: A1 Ay = A2

The other functions: Mode 3: (Ax> = Ay) Ax greater than, equal Ay Mode 4: (Ax <= Ref.) Ax less than, equal a fixed value Mode 5: (Ax >= Ref.) Ax greater than, equal a fixed

value Mode 6: (Ax = Ref.) Ax equal a fixed value

Mode 7: (Ax> <Ref.) Ax smaller or larger but not equal to a fixed value.

Page 46: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

46

Picture 2.90 Exercise card LAD12

Picture 2.91 Exercise card LAD13/15

Exercises: Analog comparator G

Note: If you use LRD20 , the outputs are differently:

LRD12 LRD20 Q1 = Q1 Q2 = Q3 Q3 = Q5

Mode 1

A1 A2

Q1Analogwertevergleicher Analog comparator LAD12

LRD12

LAD12: Using the analog comarator G in mode 1, to switch Q1 when the difference between A01 and A02 is <= 3V. For checking the status display is used to display the LRD...

LRD12

Wassertank Water tank LAD 13 /15

A1

Q2

Q3

50°C

Q1

ON/OFF

Heizungheating

Alarm

LAD13: The temperature of a water tank is to be kept at 50 ° C -2 ° C. I1 is used as the main switch. The heating is controlled by Q2. The temperature curve of the sensor corresponds to the sketch. If the temperature is above 55 ° C or below 45 ° C then the alarm rings (Q3).

°C 90 55

50 45

0 ? ? ? 10V

Page 47: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

47

Picture 2.95 RTC – Mode 3

2.14 Real Time Clock R The clock module in small controllers, such as the MicroPLC represents a fixed function in many applications. It can be used to realize time-, and date-dependent switching functions. The Real Time Clock (RTC) provides in MicroPLC LRD… four different modes:

Mode 1: weekly timer The daily set on and off time applies for the set period every day. The entry is in hours and minutes (00:00 to 23:59)

MO TU WE TH FR SA SU Picture 2.93 RTC mode 1

Mode 2: weekly timer The selected on time may be at a different day than the off time. The set period applies max. for one week. The input is as in Mode 1 MO TU WE TH FR SA SU

Picture 2.92 RTC menu

Picture 2.94 RTC mode 2

Mode 3: Year time switch The set switch-on is on a day and is always at 00:00 clock. The off time is usually on a different day at 23:59 clock. The period may extend over several years.

ON OFF

Page 48: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

48

Picture 2.96 RTC – Mode 4

Picture 2.97 Exercise card 14

Mode 4: pulse clock

On Thursday (TU) at 16:25 clock for a period of 14 sec, the output of the real-time clock is switched "ON".

Exercise: Real Time Clock R

LAD14:

The outdoor advertising (Q1) of a shoe shop will be switch on and off automatically over the real time clock. The times are set as follows: Mon-Fri at 7:00 A.M. ON and at 6:30 P.M. OFF Thu additionally at 7:00 P.M. ON and at 10:30 P.M. OFF

LRD20

Real Time Clock RTC LAD14

Q1

Day ON OFFMonday 7:00 a.m. 6:30 p.m.Tuesday 7:00 a,m, 6:30 p.m.Wednesday 7:00 a.m. 6:30 p.m.Thursday 7:00 a.m. 6:30 p.m. 8:00 p.m 10:30 p.m.Friday 7:00 a.m. 6:30 p.m.

Page 49: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

49

Result = = V1 * V2 / V3

Picture 2.98 Tools

Picture 2.99 MD function

Picture 2.100 AS function

2.15 Arithmetic blocks AS (ADD / SUB) and MD (MUL / DIV) If you want to compare different values or limit values in a particular area, then you have to rely on the arithmetic. The four basic arithmetic operations are divided into two functional blocks. First, the addition (ADD) and subtraction (SUB) and on the other hand, the multiplication (MUL) and the division (DIV).

ADD / SUB MUL / DIV Example: The example shows a timing of a timing relay that between 10 and 50 seconds over the potentiometer A1 should be adjustable: If we assume that the analog input A01 from 0 ... 1023 has been set, then the result for the delta of 40s (10 ... 50s), the following formula (MD01): A1 x 10 256 Analog input A1 multiplied (MUL) with 10, divided (DIV) by 256 V1 * V2 / V3 This requires the MD01 module with the entries for V1, V2 and V3: With the next formula (AS01) is added to the offset of 10s the result of MD01 added:

Page 50: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

50

Picture 2.101 Simulation of arithmetic

Picture 2.102 Exercise card LAD13/15

The result is now as required between 10 .... 50. If we now have the time base of the timer set to "sec", then the task is complete and can be tested with the simulator:

Exercise arithmetic AS

LAD15: In addition to LAD13 the temperature is shown on the online display on the PC's screen. In the next step, if the chapter "Text display" has been processed, the temperature should be displayed on the display of the LRD (LAD16).

°C 90 50 0 ? ? ? 10V

LRD12

Wassertank Water tank LAD 13/15

A1

Q2

Q3

50°C

Q1

ON/OFF

Heizungheating

Alarm

Picture 2.103 Online status display

Picture 2.104 What is the voltage at which Temperature at the analog input?

Page 51: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

51

2.16 Data register DR In contrast to markers (M and N) in which one can store only one bit (0/1), max offer. 225 data register values also with the option to save. These data registers are to be parameterized in other blocks. Example: The result of an arithmetic calculation is to be displayed on the screen of the controller.

1 Step: The result is stored in the data register DR01.

2. Step: In the HMI / Text editor of this DR01 is included in the display

Exercise: Data register DR

LAD9a: Is in addition to the display of the LAD9 now LRD... take over the display and the remaining free parking spaces is shown

Note: Display of remaining free parking

LRD12

Parkhaus / Park ing garage LAD 9

Ein fahrtentranceI1

Ausfahrtexi tI2

I3

FREI / FREE

BELEGT / BUSY

Geschlossen /closed

FREE

Picture 2.105 DR menu

Picture 2.106 Content of DR to the text display

Exercise 2.108 Text on the Display of the LRD…

Picture 2.107 Exercise card LAD9 Picture 2.109 Online display

Page 52: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

52

2.17 Multiplexer MX Each of the 30 Multiplexer blocks offers the possibility to assign up to 4 variables to a setpoint input. The query of the variables is binary, using two bits. Example: A timer T01 to run at 4 different times depending on the application. The four variables (setpoints) are to be pre-selected by the two inputs I1 and I2. Prefix: I1 I2 Setpoint 0 0 1 1 0 10 0 1 100 1 1 200 I Depending on the combination of the switches I1 and I2 corresponding to the setpoint, it is assigned to the timer. The timer module T01 at the setpoint input, the reference to the multiplexer module is entered MX01.

Picture 2.110 Multiplexer Menu

Bild 2.111 Multiplexer in LAD

Page 53: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

53

2.18 Text display H The MicroPLC offers the possibility of process-dependent texts with and without displaying variables together with the built-in display. For this the text module H is called in the program. Mode 1: MicroPLC with display Mode 2: MicroPLC without display, that means for an external display To enter text you will see in the menu bar of the software, the button "HMI / text" to be "clicked". It opens the following menu: Note: The display of the LRD ... offers 4 lines with 16 characters each.

Picture 2.112 Text block

Block-No.: 1 up 1F = 30 Text displays

Picture 2.113 To enter Text

Picture 2.114 Text input menu

Page 54: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

54

If the display is activated (hook set), the user can view the SEL button to select the text. Use the ESC key, the text is cut off again. Here, the variable can be with their unit select (Timer / counter / clock and analog comparator). Here, the coil state of I, M, X and Z are shown. If you select the representation with the operand, then it is displayed as follows:

e.g.: I01(unit)

If no operands are selected e.g. "I01", only the state is shown:

„Analog Display Set“ : Here, another menu opens in

which the amplification factor (gain) (1 ~ 999) and / or the offset (-50 ~ +50) is set.

1

2

3

4

1

2

3 4

Picture 2.115 Text input

Picture 2.116 a+b Variable input

Page 55: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

55

a)

b)

The example will now show how the analog input A1, with a gain of 100, and an offset of 50 in the display is visible. With the input I1, the variable to be displayed on the display of LRD12. The program is as follows: Once the program is created, the HMI / Text window is opened and provided with the following entries: 1. step The gain and offset of A1 defined: (e.g. Gain = 100 and Offset = 50) 2. step a) Where the value should appear in the "HMI / Text" menu, enter text and click the cursor to the position. b) Then click on the selection window of the analog inputs and "A1" to select. 3. step Possibly one more text to add. 4. step Transfer and storage in the control Exercise: Text display LRD 16: As a supplement to LAD13 and LAD15 the temperature is shown in addition to the display of the LRD.

Picture 2.117 Text block in LAD

Picture 2.118 Analog Set - menu

Picture 2.119 Embed variable in the text

Picture 2.120 Display in the LRD…

Page 56: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

56

2.19 Comments for coil and contacts In practice, it often is not appropriate to use the coil and contacts with the names in the schematic. An appropriate comment increases the clarity and the reference to the machine and plant. Under the menu item "Edit" you will find the "Symbol ..." If you click on "Symbol ..." you open a selection window in which you can select the desired coil and contacts and provide comments. These then appear on the LAD chart below the contact and the coil.

Text input

Picture 2.121 open Text Input Picture 2.122 Text Input

Picture 2.123 Text representation

Page 57: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

57

2.20 Headlines and comments in the Ladder Diagram In a project it is very important that some program sections are commented. This makes the start-up and later troubleshooting much easier, thus saving costly downtime of a machine or system. For commenting the software offers the button "Note"

If you have clicked this button, it will be like a coil or a contact to the location of the circuit diagram set. Then open the window for entering the text. There are 4 lines of 50 characters each available to you. Note: Each comment is always uses one line in the ladder diagram.

Pictures 2.124 Comment Input Button

Pictures 2.125 Comment Input Menu

Picture 2.126 Comment representation

Page 58: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

58

3. Function block diagram FBD If you want to create this project in function block language you have to click the button "FBD" just after opening the software. One comes directly into the selection menu for the control. As in the LAD editor, we select the correct device LRD12TD024

Function block diagram FBD

Picture 3.1 Start Menu of the LRXSW to FBD

Picture 3.2 Device selection menu

Page 59: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

59

Click "OK" to return into the FBD editor. If the operating window is too small, it can be adjusted either under the "View" menu, "Zoom In" or drag the "Zoom Out" larger or smaller, or you can use the zoom function button:

To make all the icons visible click the button

Picture 3.5 All symbols Like in the LAD editor most of the symbols in the respective chapters are explained.

Working window

If the operating windows are multiplied, that is made possible by on-click of the button.

Picture 3.3 Zoom function

Picture 3.4 Customize the working window

Page 60: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

60

3.1 Creating a function block diagram With the mouse pointer you select a logic symbol. As an example, we select the input. When the icon is selected it will appear on the field of work on mouse-pointer following logic symbol . When it is directed to the appropriate location, click on the left mouse button and the proper logic symbol is "stored". This is now stored with each click until you press the right mouse button or selecting a different icon. If you want to delete a logic icon again, it is clicked with the right mouse button. The following menu appears: Or can be deleted with the "delete" key. With a double click of the left mouse button on the icon, a menu selection where one operand number appears. May change (input number) and store an operand text (icon).

Picture 3.6 Delete

Picture 3.7 Parameter Input

Page 61: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

61

In addition to the operand text, it is possible to store a general comment and to displace it with the mouse. To do this click with the right mouse button in the free field of work. The following window appears: If you click "Insert Comments" first appears next to the mouse pointer a "T". You position it by clicking the left mouse button, the input window appears: This comment is always displaced by clicking it with the left mouse button. It is marked with four red corners and can be moved around now. If you want to delete it again one uses the "Del" key on the PC keyboard. This also applies to all the logic symbols and connections. 3.1.1 Draw connections If you have placed at least two logic modules, you can connect them logically. For this, the link button is clicked and dragged to the field of work. Now you go with the mouse pointer to the quasi-dependents of the wiring to the module input or output. Whether you have "hit" the corresponding input or output can be recognized by a small square. One click and the connection can be drawn.

Note: If you have a straight logic symbol placed you can directly drag the link without having to click on the link button.

Picture 3.8 To comment entry

Picture 3.9 Comment Input

Picture 3.10 Draw connections

Page 62: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

62

3.2 Logic sets in the FBD-Editor

3.2.1 AND operation

The AND operation corresponds to the series circuit in a conventional, wired contactor control, the output is switched on when all switches are closed. Example: Logical AND operation with three digital inputs

The output signal (H1), an AND operation is then "1" when all the input signals (S. ..) have the state "1". The "1" stands for an actuated normally open N.O. or a normally closed N.C. contact is not actuated.

True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 1 1 1

S1 S2 S3

H1

H1 = S1 & S2 & S3

FBD

This "AND" supplies at the output (H1) for a cycle length a "1". The block can also be used as pulsemodule!

H1

Picture 3.11 AND-operation

Picture 3.12 AND operation in FBD

Page 63: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

63

3.2.2 AND NOT-operation (NAND) The NAND operation corresponds to the series circuit in a conventional-wired contactor control, the output is turned off when all the switches are closed. Example: Logical NAND with three digital inputs The output signal (H1) of a NAND is always "0" if all the input signals (S. ..) have the state "1". The "1" stands for an actuated normally open or a normally closed contact is not actuated. True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 1 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0

S1 S2 S3

H1

H1 = S1 & S2 & S3

This "NAND" the output only delivers a "1" if a pulse of the input "0".

FBD

Picture 3.13 NAND operation

Picture 3.14 NAND operation in FBD

Page 64: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

64

3.2.3 OR operation The OR operation corresponds to the parallel circuit in a conventional wired voltage control, that is, the output is turned on when at least one of the three switches is closed.

Example: Logical OR operation with three digital inputs The output signal (H1), an OR operation is then logic "1" if at least one or more input signals (S. ..) have the state "1". The "1" stands for an actuated normally open contact or a non-actuated normally closed contact.

True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 0 1 0 0 1 0 1 0 1 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1

S1 S2 S3

H1

H1 = S1 V S2 V S3

FBD

Picture 3.15 OR operation

Picture 3.16 OR operation in FBD

Page 65: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

65

3.2.4 AND before OR operation

The three switches to be logically combined in AND and OR: The input of this logic is based on the fundamental rule of Boolean algebra:

Point are performed before addition and subtraction

In the implementation in the wiring logic, this means:

Series is going on in parallel Example: It shows the implementation of a combined AND-OR circuit according to the rule mentioned above: True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 1

H1 = S1 & S2 V S3

S1 S2

S3

H1

Picture 3.17 AND before OR operation

Picture 3.18 AND before OR operation in FBD

FBD

Page 66: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

66

3.2.5 OR before AND function The four switches to be logically combined in OR and AND: The input of this logic is also called conjunctive form. Since the Boolean rule applies here, must be used with braces. Thus, it specifies that the OR operation is processed first. The representation in the application program corresponds to the international standard IEC 61131. Example: It shows the implementation of a combined AND-OR circuit according to the rule mentioned above: True list: FBS: Logic algebra: S1 S2 S3 S4 H1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 0 0 0 0 0 1 0 0 1 0 1 0 1

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

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

H1 = (S1 V S2) & ( S3 V S4)

FBD

H1

S1 S2 S3 S4

Picture 3.19 OR before AND operation

Picture 3.20 OR before AND operation in FBD

Page 67: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

67

3.1.4 OR-NOT operation (NOR) Three switches should be logically linked in NOR: The representation in the application program corresponds to the international standard IEC 61131. Example: It shows the implementation of a combined NOR circuit according to the truth table: True list: FBS: Logic algebra: S1 S2 S3 H1 0 0 0 1 1 0 0 0 S2 0 1 0 0 1 1 0 0 0 0 1 0 1 0 1 0 0 1 1 0 1 1 1 0

H1 = S1 V S2 V S3

S1 S3

H1

FBD

Picture 3.21 OR-NOT operation

Picture 3.22 OR-NOT operation in FBD

Page 68: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

68

3.2.7 Exclusive-OR (XOR) The most used exclusive OR circuit, the Exclusive-OR circuit having two inputs. It differs to the OR operation to the effect that the output only becomes "1" when one of the two inputs are "1". If both inputs are "1", the output is "0". With such a circuit you can realize an interlocking of two input signals very simply. Example: Logical Exclusive-OR operation with two switches True list: FBS: Logic algebra: S1 S2 H1 0 0 0 1 0 1 0 1 1 1 1 0

H1 = (S1 & S2) V ( S1 & S2)

H1 S1 S2

Picture 3.23 Exclusive-OR operation

Picture 3.24 Exclusive-OR operation in FBD

FBD

Page 69: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

69

Exercises: Logic blocks FBD1a, FBD1b, FBD1c: These logical links provides a good introduction to the FBD language of LRD12 or LRD20 from Lovato Electric

FBD 1c

LRD12

I2

I3

I4

I5

I6

NAND

NOR&

Q2

FBD 1b

LRD12

I2

I3

I4

I5

I6

>=1

&

=1

Q1

LRD12

I2

I3

I4

I5

I6

I1&

>=1

>=1

&Q2

Picture 3.25 Exercise card FBD1a

Picture 3.26 Exercise card FBD1b

Picture 3.27 Exercise card FBD1c

Page 70: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

70

3.2.8 Latching function In control engineering, the latching function is often used. Especially when using buttons will execute a stored function. A typical task is the on and off of a motor. The ON button is always a contact and the OFF button always an opener. Why the OFF button is normally closed, has something to do with the wire breakage. The VDE regulations state that in the event of a wire break, the relevant section (e.g. a motor) must be switched off immediately and must not be turned on. To realize a latching function in the MicroSPS offers the LRD ... two variants. 1. The dynamic control of the output: If the result of logic operation (RLO) = 1, then the output = 1 If the RLO = 0, the output = 0. 2. The static control of the output: Latching function with commands SET and RESET . Both commands work with the positive edge. In both examples, it is ensured that while pressing both buttons ON and OFF, the output = 0. The wire breakage is protected , as in the case of a wire break in the "OFF" line drops the output in any case.

Picture 3.28 Dyn. latching function

Picture 3.29 Static latching function

Page 71: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

71

Exercise: latching function

FBD2a: Latching with dynamic control of Q2. (As in the contactor technology)

FBD2b: Latching static drive of Q3. (As with the conventional electronic controls on the flip-flops)

LRD12

Selbsthal tung /seal-in-circu it

I3

I4

I5

I6

>=1

&Start

StoppQ2

S

R

Q3

Bei der Programmerstellung ist auf die Drahtbruchsicherheit zu achten!

In case of programming pay attentionto the fail-save circuit

Picture 3.30 Exercise card FBD2a+b

Page 72: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

72

3.3 Selection menu of the Function Blocks In the FBD editor, the MicroPLC provides the same function as building blocks in the LADDER editor. Timer(Tx) Counter(Cx) RTC(x) ADD/SUB(AS) MUL/DIV(MD) PID controller(PID) multiplexer(MX) Analog ramp(AR) data register(DR)

3.3.1 Timing relay T Start (Enable) input switching output Setpoint input "t" actual value actual value: setpoint value:

Double-click on the block to reach the following window: The timer offers 8 modes: Time base: 0,01s / 0,1s / 1s / 1 Min. Setpoint time: 0,01s up 9999 Min. Note: The setpoint "Preset Value" of a timer can also come from an analog input or other device. More in "processing analog values"

time base actual value setpoint value

Picture 3.31 Function blocks in FBD

Picture 3.32 Timer-Function block in FBD

Picture 3.33 Timer-Function block

Page 73: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

73

Mode 0: Internal coil (like a marker) Mode 1: On-delay timer

Mode 2: On-delay timer with reset input. If the enable is off, the timer stops. Only if the enable is switch "ON" again the timer continues to run. Mode 3: OFF-delay timer. The rising edge of Enable (0 -> 1), the output is "ON". Time is running out only when the enable the edge falls (1 -> 0). If enable is turned on again during the running time, the value is set to "0". The timer can be restarted. Mode 4: OFF-delay timer. If a falling edge of Enable (1 -> 0), the output is "ON" and the time is running out. If enable is activated again during the elapsed time, the actual value of the timer is reset to "0". The timer can be restarted.

Picture 3.34a Timer Mode 1

Picture 3.34b Timer Mode 2

Picture 3.34c Timer Mode 3

Picture 3.34d Timer Mode 4

Enable Output

Enable Output Reset

Enable Output Reset

Enable Output

Page 74: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

74

Mode 5: Synchronous clock generator The synchronous clock starts with the rising edge (0->1) and stops at the LOW edge (1 -> 0) to enable. The ON-time and OFF-time on the output are the same.

Mode 6: Synchronous clock generator with reset Mode 7: Asynchronous clock generator

The asynchronous clock starts with the rising edge (0 ->1) and stops at the LOW edge (1 -> 0) to enable. The ON-time "t1" and the OFF-time "t2" at the output are equal.

3.3.2 Pulse relay A special function of the timing relay is the pulse relays or latching relay. This function is shown in the diagram of the button: Example: With the switch I1 can be the output by briefly pressing on Q1. A new brief press of I1 Q1 turns off again. Q1= ON Q1= OFF Q1

t1 t2

Picture 3.34e Timer Mode 5

Enable Output

Enable Output Reset

Picture 3.34f Timer Mode 6

Picture 3.34g Timer Mode 7

Enable Output

ON

ON ON ON OFF

OFF OFF

OFF OFF OFF

Picture 3.35 Pulse relay

Page 75: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

75

Exercise: Timer relay

FBD3: With this exercise card all the modes of the timing relay with internal setpoint (e.g. 10 s) should be implemented.

FBD4a: This motor controller uses information given on the training card inputs and outputs. The change from clockwise to anti-clockwise rotation is only about stop and vice versa. The time is 5 seconds.

I2

I4

Q2

Enable

Mode 1... 7

Pre Value: 10.00 Cur Value

Reset

LRD12

Wende-Stern-Dreieckscha lter reversing star-delta swi tch FBD 4

I1 Sicherungfuse

I2 STOPPStop

I3Rechtsright turn

I4Linksleft turn

Rechtslauf

Q1

clockwise

Stern

star

Dreieck

delta

Linkslaufanti-clockwise

Q3

Q2

Q4

FBD5 (like exercise LAD7):

In metropolitan areas, side road access to highways is controlled in heavy traffic with a traffic light. The traffic light shows RED when the main switch I01 is turned on. An induction loop in the road surface before the traffic light detects an incoming vehicle. With 1s delay starts the traffic light cycle, which also takes 1 sec each for the individual phases. At the end of the traffic light cycle the lights are back on RED. If the induction loop is connected constantly, so the traffic lights cycle runs through the 1 sec intervals.

LRD12

Ampel / Traffic light LAD 7

Picture 3.36 Exercise card FBD3

Picture 3.37 Exercise card FBD4a

Picture 3.38 Exercise card FBD7/5

Page 76: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

76

3.3.3 Counter C As with the timer the counter is a system component that needs to be configured simply. The MicroPLC offers a total of 30 counter blocks, each with 8 different modes. The presentation in the FBD editor provides the following information: Counting input Counting direction switching output Setpoint actual value actual value setpoint value Counter-No.: The counter of LRD... Offers, like in the Ladder diagram, 8 different modes: Mode 0: internal coil (like a marker) Mode 1: up-down counter without overflow. If the setpoint = actual value the counting input is disabled. The actual value is non-retentive. It loses its value when you turn off the controller. Setpoint input (0 ... 999999) Variables specification (e.g.: the result of arithmetic) Note: Compared with the LAD circuit diagram, the counting coil, the output of the counter, the counting direction and reset of the counter value in the FBD program be linked as shown in the example:

Picture 3.39 Counter in FBD

Picture 3.40a Counter mode1

Page 77: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

77

Mode 2: up-down counter with overflow. If the setpoint = actual value of the count input is not locked. The counter continues to count. The actual value is non-retentive. It loses its value when you turn off the controller. Note to "Reset Input" and "Direction Set" in Mode 2

• "Reset input" has two functions. During counting up the reset is switched on, the current value of the counter is set to "0". When pressed while counting down the reset, then the setpoint "Preset Value" is set!

• If the setpoint is reached when counting up the output switches of the counter. Now, if the direction is switched, the output switches to "OFF" and again until the actual value = "0", the output is switched to "ON". If the direction is switched on again, the output switches back to "OFF" until the setpoint is reached again.

Example: Mode 2 Mode 3: Like Mode 1, but the actual value is non-volatile. It stores its actual value when you turn off the controller. Mode 4: Like Mode 2, but the actual value is non-volatile. It stores its actual value when you turn off the controller. Mode 5: Like Mode 2, but with the reset value is always set to "0", regardless of the direction. Mode 6: Like Mode 5, but non-volatile. Mode 7: High-speed counter, which is used either as pure forward counter of the fast inputs I1 or I2. Mode 8: 1 KHz-speed counter, which is used purely as an up-counter on the inputs I1 and I2.

Picture 3.40b Counter Mode 2

Page 78: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

78

Exercise: Counter

FBD6a: The counter C1 is to be counted on the input I2 forward. If the value reaches 12, the counting should be interrupted. Only after the counter is reset by I6, I2 can be recounted again. Which mode is used to set? FBD6b: The exercise FBD6a is extended by the I3. With I3 can change the direction of the counter.

a) How does Q3 behave when changing direction at the switching output of the counter?

b) What happens if it is actuated while counting the reset?

FBD6c: Like the exercise FBD6b, now to be automated changes of direction. If the counter reaches the value 12, it automatically switches to count down. If the counter value reaches the value "0", it switches back to counting up. It is changing until the count clock of 0.5 Hz is switched off by I02.

FBD7a: Using an up-down counter of the target value for a timer from 0 to 50 sec ... To be adjustable. As the adjustment buttons Z keys are used with Z01 is forward (UP), with Z03 backward (DOWN) counted. FBD7b: Extension The setpoint and the actual value of the timer should be displayed on the display of the LRD.

Picture 3.41 Exercise card FBD6a/6b/6c

Zähler / counter FBD 6a/6b/6c

zählen

Richtung

Q3

Count

Direction

löschen

Reset

Sollwertpre = 12

value

C1

I2

I4

I6

CNT

C1

LRD12

Mode1 ... 8

Counter

UP

DOWN

Min=0

Max=50

Timer 2

START

I1 Q1

LRD20

Preset Value

Sollwertvorgabe mit Vor-Rückwärtszähler setpoint via up-down counter LAD8a/8b / FBD7a /7b

Picture 3.42 Exercise card FBD7a+b

Page 79: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

79

3.3.4 Shift register S01 The function block "shift register S01" is a bit shift register and is available once. It can maximum be 8 steps high. Enable Sift input The start-coil "Start Coil" defines the first step in the shift register. It can be an output (Q, Y) or relays (M, N). If you have decided on a variable, all outputs or marker that have been defined with "Select 1-8", assigned. In this example, the outputs Q1-Q4 are occupied by the shift register The shift register operates as a ring shift register. This means in this example that the fourth time clock with the the input I02 the output Q01 is "ON" again. Exercise: Shift register

„Start Coil“

Q01 Q02 Q03 Q04

FBD8b: Create accordance with the exercise FBD5 with shift register.

Picture 3.43 Shift register in FBD

Picture 3.44 Shift register menu

Picture 3.45 Exercise FBD8a

Page 80: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

80

3.3.5 Analog comparator G The 24VDC base unit LRD ... offers two analog inputs A1 and A2. The analog value of from 0 to 10V is applied to an analog to digital converter on the inputs, and converted into a binary number. The converted value can be compared over the analog values to comparator block G with different values. The analog comparator values offers 8 modes, the mode 0 is always an internal coil. Mode 1: (Ay-Ref.) <= Ax <= (Ay+Ref.)

Ax and Ay can be assigned different. With the direct assignment to the potentiometer of the MiniTrainer you can easily try out the formula. Example: Ax = A01(0…10V) Ay = e.g.: 7V Ref.= 2V d.h.: 5V <= Ax <= 9V

If the reference value is set to 2V and you turn the potentiometer A1, then the output of the analog comparator is switch on at 5V, and switch off at 9V again.

Mode 2: (Ax <= Ay) The output of the block "G" is "ON" when the analog value of A1 is less than or equal to the value of A2. A1 A2 Ax = Adjustable example via the potentiometer A1 Ay = Adjustable example via the potentiometer A2 Additional functions: Mode 3: (Ax> = Ay) Ax greater than, equal Ay Mode 4: (Ax <= ref) Ax less than, equal a fixed value. Mode 5: (Ax >= Ref.) Ax greater than, equal a fixed value. Mode 6: (Ax = Ref.) Ax equal a fixed value. Mode 7: (Ax> <ref) Ax smaller or larger but not the same.

Picture 3.46 Example Analog comparator

Picture 3.47 Potentiometer on the MiniTrainer(XL)

Page 81: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

81

Exercise: Analog comparator

FBD9a+b: a) Two analog values to be compared. Once the

comparator output is ON, Q2 is on and Q1 flashing at 0.5 Hz.

Ax >= Ay (Mode …)

b) In this exercise AI01 should be compared to a

constant value of 25 according to the sketch (mode ....).

Ai01

500

Q2=“1“ 0 value= 25

FBD9c: This motor controller is using the informations given from the training card inputs and outputs. The change from clockwise to anti-clockwise rotation is only about stop and vice versa. The star to delta transition time is variably adjustable via the analog input A1 between 5 and 20s. Note: Since the potentiometer A1 is not of MiniTrainer very accurate, the maximum value in result cannot be achieved exactly 20s.

Q1Analogwerteverg leicher Analog comparator FBD 9a+b

01 02

LRD12

Ai01 >= Ai02

0,5Hz

Q2

LRD12

Wende-Stern-Dreieckscha lter reversing star-delta swi tch FBD 9c

I1 Sicherungfuse

I2 STOPPStop

I3Rechtsright turn

I4Linksleft turn

Rechtslauf

Q1

clockwise

Stern

star

Dreieck

delta

Linkslaufanti-clockwise Q3

Q2

Q4

A1

5 20s

Picture 3.48 Exercise card FBD9a+b

Picture 3.49 Exercise card FBD9c

Page 82: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

82

3.3.6 Multiplexer MX Each of the 30 multiplexers provide the ability to assign up to 4 variable to a setpoint input. The query variable is binary, using two bits. The program example will illustrate this: The timer T01 to run at 4 different times depending on the application. The four variables (setpoints) are to be preselectable by the two inputs I2 and I3. Prefix: (Vorwahl) I2 I3 Setpoints V1…3 0 0 10 1 0 15 0 1 20 1 1 25

Depending on the switch combination of I2 and I3 the corresponding setpoint is assigned to the timer T01. The setpoint input of the timer module T01 is connected to the output of the multiplexer block MX01.

Picture 3.50 MX function block

Picture 3.51 Exercise Multiplexer FBD10

Page 83: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

83

3.3.7 Boolean function BL The MicroPLC offers a Boolean logic unit. The standard block can be 4 digital input signals combined (16 possibilities). The 16 possibilities are represented in binary code: The output of the block is one bit and can be optionally specified with "1" or "0". Example: Using the BL block to create a code lock. The code consists of a number between 0 and 9 (1 decade). If the code is correct, the output Q01 of 0.5 s will be "ON".

Output Input 1 Input 2 Input 3 Input 4

0

2 = 2 1

2 = 4 2

2 = 8 4

Picture 3.52 BL function block in FBD

Picture 3.53 BL Binary code

Picture 3.54 Exercise code lock FBD11

Page 84: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

84

Exercise: Boolean Functions

FBD12 Based on the training card you will be programming a Boolean block for an exclusive OR with 4 inputs. That is, the output of Q01 is "1" if only one input is "1".

I3

I4

I5

Q3

I2

=1

XOR mit 4 Eingängen XOR with 4 inputs

FBD12

LRD20

Picture 3.55 Exercise card FBD12

Page 85: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

85

3.3.8 Pulse-width modulation (PWM) P The MicroSPS with transistor outputs offers the option of the digital output Q01 via the pulse width modulation block (P) to drive. The PWM block offers two modes: Mode 1:

Pulse width modulation is a convenient way to have a digital output, e.g. a frequency converter to control a motor in the speed or control.

To get to know this function, you can realize a simple link. It performs both analog signals A1 and A2 of the MiniTrainers as set values (preset value) to the module. This is done by setting the variable type "A" by selecting the "Preset Type". Where A1 is the time in milliseconds (ms) for the frequency and A2, the time indication for the high signal also in milliseconds.

Selection of profiles

Note: "T" must be always greater than "t" and can not be "0", that is, A01 must always be greater than A02.

If you choose, however, the variable Type "N" then constant values can be used (0. 32767) for the profile of "T" and "t" to enter. Select 1 is always the profile that is activated by enable. The two inputs Sel1 and Sel2 of the PWM module allow an additional two profiles retrieve.

Enable Sel 1 Sel 2 Level 0

Q01

FBD 13: I1 = Enable = Select 1 = T= 200ms t=50ms I2 = Select 2: T= 400ms t=50ms I3 = Selekt 3: T= 400ms t=10ms I4 = Stop

Picture 3.57 P function block in FBD (Mode 1)

Picture 3.56 P Menu Mode 1

Picture 3.58 P Menu Mode 1

Page 86: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

86

Mode 2: In Mode 2, a frequency PF is output (in Hz) for a predetermined time period PN. FBD 13a For testing the function both analog inputs of the MiniTrainers are used: Exercise: PWM

FBD14: This exercise is to regulate a pump for filling a tank. The level is recorded as a measure via the analog input IA1. The tank is emptied through the manual outlet, the filling level and the analog value is lowered and falls to 0V. With the input I1, the system is switched on and off. The pump controller consists of the release of Q3 and the PWM - output Q1. If the level reading reached IA1 the value of 9.5 V, the release of Q3 is removed. The fuller the tank, the slower the pump. If the tank is empty, the pump runs at full speed. If the tank is full, the speed is zero. IA1= ~10V 0V ~0,5Hz …………………….~500Hz (PWM)

Enable Q01

Silo / Tank

IA1

Q1

Q3

PWM

Silo / tank

LRD12

FBD14I1 Start/Stopp

Voll

Enable

M

Picture 3.59 P function block in FBD (Mode 2)

Picture 3.60 PWM funktions

Picture 3.61 Exercise card FBD14

Page 87: MiniTrainerSchool - Lovato · PDF fileBasics of Ladder Diagram and Function Block Diagram programming with ... 1.4.1 Assignment of inputs and outputs on the Lovato ... 2.17 Multiplexer

87

3.3.9 Text H The text block can be used 30x. Mode1 means with display and Mode2 means without display Enable The editor for text entry is located, as in the LAD editor, in the "Edit" menu -> "HMI / Text"

3.3.10 Display backlight The display of the LRD ... can remain switched on for the program. For this, the menu offers "Operation" in the stop mode or in offline mode from the submenu: "Module System Set ..." the possibility of program-related backlight

Picture 3.62 H Text block

Picture 3.63 Text Input

Picture 3.65 Display backlight

Picture 3.64 To adjust the backlight