54
TRAINING MANUAL FOR MODICON MICRO PLC

Modicon PLC Manual

Embed Size (px)

DESCRIPTION

it is very

Citation preview

Page 1: Modicon PLC Manual

TRAINING MANUAL FOR MODICON MICRO PLC

Page 2: Modicon PLC Manual

GENERAL INTRODUCTION

Page 3: Modicon PLC Manual

General information:

A PLC can be divided into four main sections : Inputs Outputs The memory - where the user program instructions and data are stored The processor-which reads the input data and controls the outputs according to the user program instructions.

The programming terminal is the tool used to : Create and transfer the user program to program memory Debug the user program and control system start-up Perform installation diagnostics.

Page 4: Modicon PLC Manual

INTRODUCTION MICRO TSX37 PLC

Page 5: Modicon PLC Manual
Page 6: Modicon PLC Manual
Page 7: Modicon PLC Manual
Page 8: Modicon PLC Manual
Page 9: Modicon PLC Manual
Page 10: Modicon PLC Manual
Page 11: Modicon PLC Manual
Page 12: Modicon PLC Manual

ACS TRG Div Tel Nos Pune : 020-7119405 / 505 & Mumbai 022-8883737 email:[email protected]

Page 13: Modicon PLC Manual

Addressable objects Definition of main Boolean objects Input/output bits These bits are the "logical images" of the electrical state of the I/O. They are stored in the data memory and are updated on each scan of the task in which they are configured. Internal bits Internal bits %M0 to %M255 are used to store intermediate states during execution of the program. System bits System bits %S0 to %S127 monitor correct operation of the PLC as well as progression of the application program. Function block bits : Function block bits correspond to the outputs of blocks. These outputs can be either wired directly, or used as objects. Word extract bits : Using PL7 software it is possible to extract one of the 16 bits from a word object._ Addressing I/O module objects Addressing of the main word and bit objects in I/O modules is defined by the following characters :

� Type of object

I and Q : the physical inputs and outputs of modules exchange this information implicitly on each scan of the task to which they are attached.

Page 14: Modicon PLC Manual

Note : Other types of data (status, command words, etc) can also be exchanged if

requested by the application � Format (Size)

For objects in Boolean format, the X can be omitted. It is used in other types of format such as byte, word and double word

� Channel position and number

The base modularity of the TSX 37 is 1/2 format. The positions for each type of TSX37

PLC (base and extension) are shown in the diagram below.

tandard format modules are addressed as two superposed 1/2 format modules S

Page 15: Modicon PLC Manual

Addressing words Words in PL7 language are addressed in the following way :

Type of object ds which store values during execution of the program. They

data zone within a single memory zone. K alphanumeric messages.

ir content can only be written or modified by the terminal. They are stored in

the same as the program. They can therefore use the EPROM memory as

their su words. These words perform several functions :

reading %SWi words

�M :internal worare stored

in the:constant words which store constant values or

The

e placpport.

S :system- some provide information on the status of the system by

(system and application operating time, etc).

Page 16: Modicon PLC Manual

- others are used to perform operations on the application (operating mode, etc). � Format Objects words can be addressed by PL7 software in four different formats : B byte : this format is used exclusively for operations on character strings. W single length : these 16 bit words can contain an algebraic value between -32 768 and 32 767.

double length : these 32 bit words can contain an algebraic value between - 2

147 483 647. These words are stored in the memory on two

floating point (1) : the floating point format used is that of the IEEE standard.

verlay between objects : nd floating point words are stored within the data

D147 483 648 and

2 consecutive single length words.

FWords are 32 bits long, which corresponds to single length floating point numbers. Example of floating point values : 1285.28

12.8528E2

OBytes, single, double length azone in a single memory zone. Thus, there is overlay between :

Page 17: Modicon PLC Manual

� double length word %MDi and single length words %MWi and %MWi+1 (word %MWi containing the least significant bits and word %MWi+1 containing the most significant bits of word %MDi). � single length word %MWi and bytes %MBj and %MBj +1 (with j=2.i).

xamples : ponds to %MW0 and %MW1.

544.

E%MD0 corres%MW3 corresponds to %MB7 and %MB6. %KD543 corresponds to %KW543 and %KW

resentation of Ladder language

rinciple written in Ladder language consist of a series of rungs which are

by the PLC. et of graphic elements bounded on the left and right by

nt : ushbuttons, sensors, relays, indicator lamps, etc).

cted by horizontal and vertical links. Each

and 11 columns, which are divided into 2 zones : ute the

tion zone which contains the actions to be executed according to the

P PProgramsexecuted sequentially A rung consists of a spower rails. They represe� The PLC I/O (p� Standard control system functions (timers, counters, etc). � Arithmetic, logic and specific operations. � The internal variables of the PLC. The graphic elements are interconnerung consists of a maximum of 7 lines� The test zone which contains the logic conditions necessary to execactions. � The acresults of the test zone. MAIN

Page 18: Modicon PLC Manual

A

Page 19: Modicon PLC Manual

B

Page 20: Modicon PLC Manual

Presentation of basic instructions General The instructions described in this section comply with the main basic instructions defined in IEC standard 1131.3. These instructions always produce the same effect, irrespective of the language used. Only their presentation in the program changes. Example of load instruction In Ladder language :

%I1.0 This instruction is equivalent to a closed contact when the respective input is at state 1. Basic instructions include : • Boolean instructions (processing bits). • Predefined control system timer and counter function blocks. • Numerical instructions on integers (processing words and double words). • Program instructions. Boolean instructions Presentation of Boolean instructions Boolean instructions act on all bit type data (I/O bits, internal bits etc). • Test elements, example : N/O contact, N/C contact %I1.0 This instruction is equivalent to a closed contact when the respective input is at state 1. %M0 This instruction is equivalent to a open contact when the internal bit M0 is at state 1. • Action elements, example : direct coil. %Q2.2

Page 21: Modicon PLC Manual

The associated bit object takes the logical value of the logical result of the test element.

• Boolean equation :

%Q2.%I1.1 %I1.0 The Boolean result of test elements is applied to the action element. Ie. If %I1.0 AND %I1.1 are at state 1 then %Q2.0 will be at state 1. • Rising and falling edges Rising This teor on in Load in Boolea These • N/O c• N/C c• Rising• Fallin Authori Code

P

N

%I1.

P

edge detection contact F

st instructions can be used to detect risingternal bits.

structions

n instructions are described in the followin

instructions correspond to : ontacts : contact closed when the bit objeontacts : contact open when the bit object edge contacts : detects a change of the

g edge contacts : detects a change of the

zed operands

Operand

%I,%Q,%M,%S,%BLK,%•:X

%I,%Q,%M,%S,%BLK,%•:X

%I,%Q,%M

%I,%Q,%M

%I1.

N

alling edge detection contact

or falling edges on PLC I/O bits

g way :

ct which controls it is at state 1. which controls it is at state 1. controlling bit from 0 to 1. controlling bit from 1 to 0.

k, (1)

k, (1)

Page 22: Modicon PLC Manual

List of operands 0/1 Immediate value 0 (false) or 1 (true) %I PLC input %Ix.i %Q PLC output %Qx.i %M Internal bit %Mi %S System bit %Si %BLK Function block bit, eg : %TMi.Q %•:Xk Word extract bit, eg : %MWi:Xk Assignment instructions These instructions correspond to : • Direct coils : the associated bit object takes the value of the result of the equation. • Inverse coils : the associated bit object takes the inverse value of the result of the equation. • Set coils : the associated bit object is set to 1 when the result of the equation is at 1. • Reset coils : the associated bit object is set to 0 when the result of the equation is at 1. AuCo

%I1.

thorized operands de Operand

%I,%Q,%M

%Q2.

%Q2.

,

2%Q2.

%

.

%Q2S R %I1.

S,%•:Xk

Page 23: Modicon PLC Manual

%I,%Q,%M,%S,%•:Xk

S

R

%I,%Q,%M,%S,%•:Xk %I,%Q,%M,%S,%•:Xk

Predefined function blocks Programming principles for predefined function blocks The function blocks use bit objects and specific words. Control system function blocks are pre-programmed in the PLC and therefore occupy a particular zone of the user memory. In order to optimize memory occupation, the type and number of function blocks used must be defined at the outset, within the limits imposed by the system (via the Configuration and Data editors). There are six types of control system function block : Type of block Maximum number See section Timer %TMi 64* Up/down counter %Ci 32 Monostable %MNi 8 Register %Ri 4 Drum controller %DRi 8 Timer (Series 7) %Ti 64* (1) the total number of %TMi + %Ti timers must be less than or equal to 64. Timer function block %TMi

MODIF:Y TM.P:9999

MODE:TON TB: 1mn

IN Q

Page 24: Modicon PLC Manual

Timers have three operating modes : � TON : This mode is used to control on-delay actions. This delay is programmable and can be modified via the terminal. � TOF : This mode is used to control off-delay actions. This delay is programmable and can be modified via the terminal. � TP : This mode is used to create a pulse of an exact duration. This duration is programmable and can be modified via the terminal. Characteristics Timer number %TMi 0 to 63 Mode TON On-delay (default)

TOF Off-delay TP Monostable

Time base TB 1min (default), 1s, 100ms, 10ms (max of 16 timers when 10ms). The smaller the

time base, the greater the accuracy of the

timer. Current value %TMi.V Word which increments from 0 to %TMi.P when

the timer is running. Can be read and tested

but not written by the program (1). Preset value %TMi.P 0<=%TMi.P≤9999. Word which can be read,

tested and written by the program. It is set to

9999 by default. The time period or delay

generated is equal to %TMi.P x TB. Edit via the terminal Y/N Y : possibility of changing the preset value (MODIF) %TMi.P in the adjustment mode.

N : no access in the adjustment mode. Setting input IN The timer starts on a rising edge (TON or TP (or instruction) mode) or a falling edge (TOF mode). Timer output Q Associated bit %TMi.Q is set to 1 depending on

the function performed TON, TOF or TP.

Page 25: Modicon PLC Manual

Using as an on-delay timer : TON mode The timer is started on a rising edge at input IN : its current value %TMi.V increases from 0 to %TMi.P by one unit on each pulse of the time base TB. Output bit %TMi.Q changes to 1 when the current value reaches %TMi.P and then remains at 1 as long as input IN is at 1. When input IN is at 0, the timer is stopped, even if its value is still changing : %TMi.V takes the value 0.

Using as an off-delay timer : TOF mode The current value %TMi.V is set to 0 on a rising edge at input IN (even if the timer is still running). The timer is started on a falling edge at input IN. The current value increases to %TMi.P by one unit on each pulse of the time base TB. Output bit %TMi.Q changes to 1 when a rising edge is detected on input IN and the timer returns to 0 when the current value reaches %TMi.P.

Page 26: Modicon PLC Manual

Using as a monostable : TP mode The timer is started on a rising edge at input IN : (if the timer has not already started) its current value %TMi.V increases from 0 to %TMi.P by one unit on each pulse of the time base TB. Output bit %TMi.Q changes to 1 when the timer is started and returns to 0 when the current value reaches %TMi.P. When input IN and output %TMi are at 0, TMi.V takes the value 0. This monostable cannot be reset.

rogramming and configuration

imer function blocks are programmed in the same way, irrespective of the mode

d. TON, TOF or TP mode can be chosen in the variables editor.

P Tof use selecte

Page 27: Modicon PLC Manual

� Configuration

meters must be entered in the variables editor :

0ms.

Programming

ter function block %Ci he up/down counter function block is used to up/down count events. These two

The following para- Mode : TON, TOF or TP. - TB : 1min, 1s, 100ms or 1- %TMi.P : 0 to 9999. - MODIF : Y or N. �

Up/down counToperations can be simultaneous.

Page 28: Modicon PLC Manual

Operation � Upcount : when a rising edge appears at the upcounting input CU, the current value is incremented by one unit. When this value is equal to the preset value %Ci.P, the "preset reached" output bit %Ci.D assigned to output D changes to state 1. Output bit %Ci.F (upcount overflow) changes to state 1 when %Ci.V changes from 9999 to 0, and is reset to 0 if the counter continues to upcount. � Downcount : when a rising edge appears at the downcounting input CD, the current value %Ci.V is decremented by one unit. Output bit %Ci.E (downcount underflow)

Page 29: Modicon PLC Manual

changes to state 1 when %Ci.V changes from 0 to 9999, and is reset to 0 if the counter continues to downcount. � Up/down count : to use both the upcount and the downcount functions simulta-neously, the two corresponding inputs CU and CD must be controlled. These two inputs are then scanned in succession. If they are both at 1 simultaneously, the current value remains unchanged. � Reset : when input R is set to state 1, the current value %Ci.V is forced to 0, and outputs %Ci.E, %Ci.D and %Ci.F are at 0. The reset input has priority. � Preset : if preset input S is at state 1 and the reset input R is at state 0, the current value %Ci.V takes the value %Ci.P, and output %Ci.D is set to 1. Configuration and programming Counting of a number of items = 5000. Each pulse on input %I1.2 (when internal bit %M0 is at 1) increments the upcounter %C8 up to its final preset value (bit %C8.D=1). The counter is reset by input %I1.1. � Configuration The following parameters must be entered via the variables editor : - %Ci.P, set to 5000 in this example, - MODIF : Y. � Programming

Page 30: Modicon PLC Manual

B Numerical processing on integers General The numerical instructions described in this section apply to objects of the following type :

� bit tables. � words. � double words.

Numerical instructions are entered in blocks :

� located in the test zone for comparison blocks. � located in the action zone for operation blocks.

These blocks can contain :

� a simple expression, eg : OP3:=OP1+OP2, � a complex expression, eg : OP5:=(OP1+OP2)*OP3-OP4.

Page 31: Modicon PLC Manual

Comparison instructions Comparison instructions are used to compare two operands. > : Test if operand 1 is greater than operand 2. >= : Test if operand 1 is greater than or equal to operand 2. < : Test if operand 1 is less than operand 2. <= : Test if operand 1 is less than or equal to operand 2. = : Test if operand 1 is equal to operand 2. <> : Test if operand 1 is different from operand 2. The result is 1 when the comparison requested is true. Structure

Comparison blocks are programmed in the test zone. Syntax Operators : >,>=,<,<=,=,<>

Page 32: Modicon PLC Manual

Assignment instructions These are used to load operand Op2 into operand Op1. Syntax :

he following assignment operations can be performed :

ouble words. s can be linked within the same block :

ssignment of bit

he following operations on bit tables can be performed :

uble word (indexed)

ssignment of words

T� On bit tables � On words or dSeveral assignment instructionOp1:=Op2:=Op3:=Op4:=... A T� Bit table -> bit table � Bit table -> word or do� Word or double word (indexed) -> bit table

A

Page 33: Modicon PLC Manual

The following assignment operations onto words can be performed :

word -> word

double word

ble word

rithmetic instructions on integers

hese instructions are used to perform arithmetic operations between two

INC : increment of an operand : multiply two operands DEC : decrement of an operand

perand

�� word -> double word � double word ->� double word -> word � immediate value -> word � immediate value -> dou

A Toperands or on one operand. + : add two operands SQRT : square root of an operand - : subtract two operands* / : divide two operands ABS : absolute value of an o

Page 34: Modicon PLC Manual

Syntax Operators � +,-,*,/ Op1:=Op2 Operator Op3 � SQRT, ABS Op1:=Operator(Op2) � INC, DEC Operator Op1

ogic instructions

he associated instructions are used to perform a logic operation between two

L Toperands or on one operand.

Page 35: Modicon PLC Manual

AND : AND (bit-wise) between two operands nds

ds OR : Logic OR (bit-wise) between two operaXOR : Exclusive OR (bit-wise) between two operanNOT : Logic complement (bit-wise) of an operand

rogram instructions

P Subroutine call

Page 36: Modicon PLC Manual

Subroutine call instructions are used to call a subroutine module located in the

called : i (number from 0 to 253).

ubroutine return instructions are reserved for subroutine modules and are used

turn to the calling module, if the Boolean result of the preceding test instruction

ump instructions allow connection to a line of programming identified by a label Li :

MP : unconditional program jump,

tion is 1, MPCN : program jump if the Boolean result of the preceding test

de (i number from 1 to 999 with up to 256 labels).

same task.

SRi represents the subroutine module Subroutine return Sto reis 1.

Program jumps J% JJMPC : program jump if the Boolean result of the preceding test instrucJinstruction is 0,

%Li represents the label of the line to which the connection is ma

Page 37: Modicon PLC Manual

xecution of an application program can be stopped using the instruction HALT tops all tasks). This freezes the variable objects in this program. A program

topped in this way must be initialized to restart it (using the PL7 Micro command ctions following the instruction HALT will therefore not be

xecuted.

Stop program E(ssINIT). Any instrue

Page 38: Modicon PLC Manual

NOP instruction

he NOP instruction does not perform any operation. It is used for "reserving"

program which allow the user to insert instructions later without modifying the

he monostable function block is used to create a pulse of an exact duration. an be modified via the terminal.

Tlines in aline numbers. Advanced predefined function blocks Monostable function block %MNi TThis duration is programmable and c

Page 39: Modicon PLC Manual

Register function block %Ri A register is a memory block which is used to store up to 255 words of 16 bits in two different ways :

� Queue (first in, first out) known as FIFO stack (First In, First Out). � Stack (last in, first out) known as LIFO stack (Last In, First Out).

Page 40: Modicon PLC Manual
Page 41: Modicon PLC Manual

The programming example shows word %MW34 being loaded into %R2.I at the storage request %I1.2, if register R2 is not full (%R2.F=0). The storage request in the register is made by %M1. The retrieval request is made by input %I1.3 and %R2.O is loaded into %MW20 if the register is not empty (%R2.E=0). Configuration The following parameters must be entered in the variables editor of the register block :

� Numbers : 1 to 4. � Mode : FIFO or LIFO. � Length : 1 to 255.

Drum controller function block %DRi The drum controller operates on a similar principle to an electromechanical drum controller, which changes step according to external events. On each step, the high point of a cam gives an order which is executed by the control system. In the case of a drum controller, these high points are symbolized by state 1 for

Page 42: Modicon PLC Manual

each step and are assigned to output bits %Qi.j or internal bits %Mi, known as control bits. Drum controller block

rogramming and configuration

this example, the first 5 outputs %Q2.0 to %Q2.4 are activated in succession

onfiguration formation is defined in the variables editor :

tputs (control bits) for each step of the drum

Step Assignment of control bits

4 %Q2.0

P Ineach time input %I1.1 is set to 1. Input I1.0 resets the outputs to step 0. CThe following in

� Step number : 5. � The state of the oucontroller.

0 1 2 30 : 1 0 0 0 0

Page 43: Modicon PLC Manual

1 : 0 1 0 0 0 %Q2.1 Bit

Time base.

imer function block %Ti (Series 7)

sed to provide control for time-delayed actions. The value of this delay is

2 : 0 0 1 0 0 %Q2.2 3 : 0 0 0 1 0 %Q2.3 4 : 0 0 0 0 1 %Q2.4 �

T This timer function block, which is compatible with Series 7 PL7-2/3 blocks is uprogrammable and can be modified via the terminal.

Page 44: Modicon PLC Manual

tandard operations block can be pro-grammed to perform the following func-tions

SThe Timer function :

Page 45: Modicon PLC Manual
Page 46: Modicon PLC Manual

ertical comparison blocks

ertical comparison blocks are used to compare two operands (OP). These two

V Voperands are either 16-bit words (possibly indexed) or immediate values.

Page 47: Modicon PLC Manual

peration mmand input is set to 1, the two operands are compared and the

Example of use shows the comparison of word %MW2 indexed by word

e al

OWhen the cofour outputs are activated according to the result of the comparison. Setting thecommand input to 0 resets the activated outputs. �The program below %MW40 with the immediate value 150. If the contents of %MW2[%MW40] argreater than 150 and %I1.3 = 1, coil %Q2.7 is activated. If the contents are equto 150, coil %MW10:X4 is activated. Coil %M5 is only controlled if the contents are different from 150 (< or >).

Page 48: Modicon PLC Manual

Shift instructions Shift instructions consist of moving bits of a word or double word operand a certain number of positions to the right or to the left. � Logic shift :

- SHL(op2,i) logic shift of i positions to the left. - SHR(op2,i) logic shift of i positions to the right.

� Rotate shift : - ROL(op2,i) rotate shift of i positions to the left. - ROR(op2,i) rotate shift of i positions to the right.

Page 49: Modicon PLC Manual

loating point instructions

F General

Page 50: Modicon PLC Manual

PL7 Micro software is used to perform operations on floating point objects. The

1.175494E-38, and

+38. urate to 2 -24 . When viewing floating point numbers, no

n be displayed after the comma.

otes

The value "1285" is interpreted as an integer value. To be considered as a

g Point are used to change

ossibility of overlap between objects :

he single and double length and floating point words are stored within the data

umeric conversion instructions

CD <--> Binary conversion instructions :

floating point object format used is that of the IEEE standard. Words are 32 bits long, which corresponds to single length floating point numbers. Examples of floating point values : 1285.28 1.28528E3 Floating point values are between -3.402824E+38 and -1.175494E-38 and 3.402824ERepresentation is accmore than six digits ca N �floating point value it must be written : "1285.0", � The conversion instructions Integer <--> Floatinfrom one format to the other. P Tarea in a single memory zone. Thus, floating point word %MFi corresponds to single length words %MWi and %MWi+1 (word %MWi containing the least significant bits and word %MWi+1 containing the most significant bits of word %MFi).

N BThere are two types of conversion instruction� BCD_TO_INT : BCD --> Binary conversion.

Page 51: Modicon PLC Manual

� INT_TO_BCD : Binary --> BCD conversion.

Integer <--> Floating point conversion instructions

here are four conversion instructions : rsion.

--> floating point word conversion. ion (the result is

TO_DINT : floating point word --> integer double word conversion (the

T� INT_TO_REAL : integer word --> floating point conve� DINT_TO_REAL : integer double word� REAL_TO_INT : floating point word --> integer word conversthe next lowest integer value). � REAL_result is the next lowest integer value).

Page 52: Modicon PLC Manual
Page 53: Modicon PLC Manual
Page 54: Modicon PLC Manual