This action might not be possible to undo. Are you sure you want to continue?
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.
INTRODUCTION MICRO TSX37 PLC
The positions for each type of TSX37 PLC (base and extension) are shown in the diagram below. Word extract bits : Using PL7 software it is possible to extract one of the 16 bits from a word object. command words._ 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. etc) can also be exchanged if requested by the application Format (Size) For objects in Boolean format. . word and double word Channel position and number The base modularity of the TSX 37 is 1/2 format. Note : Other types of data (status. the X can be omitted. It is used in other types of format such as byte. Function block bits : Function block bits correspond to the outputs of blocks. They are stored in the data memory and are updated on each scan of the task in which they are configured. or used as objects. Internal bits Internal bits %M0 to %M255 are used to store intermediate states during execution of the program. These outputs can be either wired directly.Addressable objects Definition of main Boolean objects Input/output bits These bits are the "logical images" of the electrical state of the I/O. System bits System bits %S0 to %S127 monitor correct operation of the PLC as well as progression of the application program.
Standard format modules are addressed as two superposed 1/2 format modules .
others are used to perform operations on the application (operating mode.Addressing words Words in PL7 language are addressed in the following way : Type of object :internal words which store values during execution of the program. Their content can only be written or modified by the terminal. They can therefore use the EPROM memory as their support.some provide information on the status of the system by reading %SWi words (system and application operating time. These words perform several functions : . K :constant words which store constant values or alphanumeric messages. They are stored in the data zone within a single memory zone. . etc). W single length : these 16 bit words can contain an algebraic value between -32 768 and 32 767. D double length : these 32 bit words can contain an algebraic value between . . These words are stored in the memory on two consecutive single length words.2 147 483 648 and 2 147 483 647. etc). M 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. S :system words. They are stored in the same place as the program.
Examples : %MD0 corresponds to %MW0 and %MW1. The internal variables of the PLC. Thus. %MW3 corresponds to %MB7 and %MB6. which are divided into 2 zones : The test zone which contains the logic conditions necessary to execute the actions. Arithmetic. Standard control system functions (timers. Words are 32 bits long. double length and floating point words are stored within the data zone in a single memory zone. A rung consists of a set of graphic elements bounded on the left and right by power rails. single. logic and specific operations.i). relays. etc). The action zone which contains the actions to be executed according to the results of the test zone.8528E2 Overlay between objects : Bytes. %KD543 corresponds to %KW543 and %KW544. Each rung consists of a maximum of 7 lines and 11 columns. etc). which corresponds to single length floating point numbers. Presentation of Ladder language Principle Programs written in Ladder language consist of a series of rungs which are executed sequentially by the PLC. The graphic elements are interconnected by horizontal and vertical links. indicator lamps. single length word %MWi and bytes %MBj and %MBj +1 (with j=2. counters.28 12. sensors.F floating point (1) : the floating point format used is that of the IEEE standard. . They represent : The PLC I/O (pushbuttons. there is overlay between : 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). Example of floating point values : 1285.
MAIN A .
• Boolean equation : %I1. • Program instructions. %M0 This instruction is equivalent to a open contact when the internal bit M0 is at state 1. N/C contact %I1.0 The Boolean result of test elements is applied to the action element. example : direct coil. Example of load instruction In Ladder language : %I1. internal bits etc). irrespective of the language used. • Test elements.B Presentation of basic instructions General The instructions described in this section comply with the main basic instructions defined in IEC standard 1131. Basic instructions include : • Boolean instructions (processing bits).0 %I1. • Predefined control system timer and counter function blocks. If %I1.1 %Q2. Ie.0 This instruction is equivalent to a closed contact when the respective input is at state 1. • Numerical instructions on integers (processing words and double words).1 are at state 1 then %Q2. %Q2. example : N/O contact. Boolean instructions Presentation of Boolean instructions Boolean instructions act on all bit type data (I/O bits.0 will be at state 1. These instructions always produce the same effect.0 This instruction is equivalent to a closed contact when the respective input is at state 1. Only their presentation in the program changes. • Action elements.3. .2 The associated bit object takes the logical value of the logical result of the test element.0 AND %I1.
(1) P N List of operands 0/1 %I %Q %M %S %BLK %•:Xk %I.%S. • Inverse coils : the associated bit object takes the inverse value of the result of the equation. eg : %MWi:Xk Assignment instructions These instructions correspond to : • Direct coils : the associated bit object takes the value of the result of the equation.%BLK. • Reset coils : the associated bit object is set to 0 when the result of the equation is at 1.• Rising and falling edges %I1.%•:Xk. eg : %TMi.%Q.%Q.i PLC output %Qx. • Set coils : the associated bit object is set to 1 when the result of the equation is at 1.%BLK. • N/C contacts : contact open when the bit object which controls it is at state 1.%S. (1) %I.%M. Load instructions Boolean instructions are described in the following way : These instructions correspond to : • N/O contacts : contact closed when the bit object which controls it is at state 1.0 %I1. .Q Word extract bit. • Rising edge contacts : detects a change of the controlling bit from 0 to 1.%M Immediate value 0 (false) or 1 (true) PLC input %Ix.%M %I.i Internal bit %Mi System bit %Si Function block bit.%Q. • Falling edge contacts : detects a change of the controlling bit from 1 to 0.%Q.%•:Xk.%M.0 P Rising edge detection contact N Falling edge detection contact This test instructions can be used to detect rising or falling edges on PLC I/O bits or on internal bits. Authorized operands Code Operand %I.
%•:Xk S S %I.%M. In order to optimize memory occupation. the type and number of function blocks used must be defined at the outset.0 %Q2.0 S R Authorized operands Code Operand %I.%M.%•:Xk %I.%Q.%S. . Control system function blocks are preprogrammed in the PLC and therefore occupy a particular zone of the user memory.%•:Xk %I.%•:Xk R Predefined function blocks Programming principles for predefined function blocks The function blocks use bit objects and specific words.2 %Q2. within the limits imposed by the system (via the Configuration and Data editors).%S.%S.%Q.%M.%Q.%M. 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.4 S %Q2.4 %I1.%S.%Q.3 %Q2.%I1.
P≤9999.Q is set to 1 depending on the function performed TON. 10ms (max of 16 timers when 10ms). Word which increments from 0 to %TMi. TOF or TP.P x TB. the greater the accuracy of the timer. The time period or delay generated is equal to %TMi. 100ms. Word which can be read. Can be read and tested but not written by the program (1).P when the timer is running. The smaller the time base. 0<=%TMi. Associated bit %TMi. TP : This mode is used to create a pulse of an exact duration. tested and written by the program. Time base Current value Preset value %TMi.Timer function block %TMi IN MODE:TON TB: 1mn TM.V 0 to 63 On-delay (default) Off-delay Monostable 1min (default). 1s. This delay is programmable and can be modified via the terminal. It is set to 9999 by default. Y : possibility of changing the preset value %TMi.P in the adjustment mode. This duration is programmable and can be modified via the terminal. The timer starts on a rising edge (TON or TP mode) or a falling edge (TOF mode).P Edit via the terminal (MODIF) Setting input (or instruction) Timer output Y/N IN Q . N : no access in the adjustment mode. Characteristics Timer number Mode %TMi TON TOF TP TB %TMi.P:9999 MODIF:Y Q 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.
the timer is stopped. Output bit %TMi. even if its value is still changing : %TMi. When input IN is at 0. The timer is started on a falling edge at input IN. . Using as an off-delay timer : TOF mode The current value %TMi.P by one unit on each pulse of the time base TB.V is set to 0 on a rising edge at input IN (even if the timer is still running).P by one unit on each pulse of the time base TB.V increases from 0 to %TMi.V takes the value 0.Q changes to 1 when the current value reaches %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 and then remains at 1 as long as input IN is at 1.P. Output bit %TMi.Using as an on-delay timer : TON mode The timer is started on a rising edge at input IN : its current value %TMi. The current value increases to %TMi.
When input IN and output %TMi are at 0. Configuration The following parameters must be entered in the variables editor : .P.V increases from 0 to %TMi. TMi.MODIF : Y or N. TOF or TP mode can be chosen in the variables editor. . 100ms or 10ms.P by one unit on each pulse of the time base TB.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. Programming .P : 0 to 9999. Programming and configuration Timer function blocks are programmed in the same way. TON.Mode : TON. Output bit %TMi. TOF or TP. irrespective of the mode of use selected. 1s.Q changes to 1 when the timer is started and returns to 0 when the current value reaches %TMi.TB : 1min.V takes the value 0. This monostable cannot be reset. .%TMi. .
Up/down counter function block %Ci The up/down counter function block is used to up/down count events. These two operations can be simultaneous. .
Preset : if preset input S is at state 1 and the reset input R is at state 0.V takes the value %Ci. Reset : when input R is set to state 1. the current value %Ci. These two inputs are then scanned in succession. Configuration and programming Counting of a number of items = 5000.E (downcount underflow) changes to state 1 when %Ci.Operation Upcount : when a rising edge appears at the upcounting input CU.D assigned to output D changes to state 1. Programming .D=1).D and %Ci.F are at 0. the two corresponding inputs CU and CD must be controlled.%Ci. the current value is incremented by one unit.V changes from 9999 to 0.2 (when internal bit %M0 is at 1) increments the upcounter %C8 up to its final preset value (bit %C8. Output bit %Ci.1. The reset input has priority.E. and outputs %Ci. the current value %Ci.MODIF : Y. Output bit %Ci.P. and is reset to 0 if the counter continues to upcount. and is reset to 0 if the counter continues to downcount. set to 5000 in this example. the "preset reached" output bit %Ci. and output %Ci.D is set to 1. If they are both at 1 simultaneously.P.P. Configuration The following parameters must be entered via the variables editor : . %Ci.V changes from 0 to 9999. The counter is reset by input %I1.V is decremented by one unit. Each pulse on input %I1. When this value is equal to the preset value %Ci. the current value remains unchanged. the current value %Ci. .F (upcount overflow) changes to state 1 when %Ci. Downcount : when a rising edge appears at the downcounting input CD.V is forced to 0. Up/down count : to use both the upcount and the downcount functions simulta-neously.
eg : OP3:=OP1+OP2. a complex expression. Numerical instructions are entered in blocks : located in the test zone for comparison blocks. <= : Test if operand 1 is less than or equal to operand 2. words. . located in the action zone for operation blocks. eg : OP5:=(OP1+OP2)*OP3-OP4. < : Test if operand 1 is less than operand 2. Comparison instructions Comparison instructions are used to compare two operands. >= : Test if operand 1 is greater than or equal to operand 2. <> : Test if operand 1 is different from operand 2. = : Test if operand 1 is equal to operand 2. > : Test if operand 1 is greater than operand 2.B Numerical processing on integers General The numerical instructions described in this section apply to objects of the following type : bit tables. These blocks can contain : a simple expression. The result is 1 when the comparison requested is true. double words.
>=.Structure Comparison blocks are programmed in the test zone. Syntax Operators : >.<. Assignment of bit The following operations on bit tables can be performed : Bit table -> bit table Bit table -> word or double word (indexed) Word or double word (indexed) -> bit table . Several assignment instructions can be linked within the same block : Op1:=Op2:=Op3:=Op4:=. Syntax : The following assignment operations can be performed : On bit tables On words or double words..<> Assignment instructions These are used to load operand Op2 into operand Op1.=.<=..
Assignment of words The following assignment operations onto words can be performed : word -> word word -> double word double word -> double word double word -> word immediate value -> word immediate value -> double word .
-. DEC Op1:=Op2 Operator Op3 Op1:=Operator(Op2) Operator Op1 . ABS INC.*.Arithmetic instructions on integers These instructions are used to perform arithmetic operations between two operands or on one operand. + * / : add two operands : subtract two operands : multiply two operands : divide two operands SQRT : square root of an operand INC : increment of an operand DEC : decrement of an operand ABS : absolute value of an operand Syntax Operators +./ SQRT.
AND OR XOR NOT : AND (bit-wise) between two operands : Logic OR (bit-wise) between two operands : Exclusive OR (bit-wise) between two operands : Logic complement (bit-wise) of an operand .Logic instructions The associated instructions are used to perform a logic operation between two operands or on one operand.
Program instructions Subroutine call Subroutine call instructions are used to call a subroutine module located in the same task. Subroutine return Subroutine return instructions are reserved for subroutine modules and are used to return to the calling module. . Program jumps Jump instructions allow connection to a line of programming identified by a label %Li : JMP JMPC JMPCN : unconditional program jump. : program jump if the Boolean result of the preceding test instruction is 1. %Li represents the label of the line to which the connection is made (i number from 1 to 999 with up to 256 labels). if the Boolean result of the preceding test instruction is 1. : program jump if the Boolean result of the preceding test instruction is 0. SRi represents the subroutine module called : i (number from 0 to 253).
It is used for "reserving" lines in a program which allow the user to insert instructions later without modifying the line numbers. Any instructions following the instruction HALT will therefore not be executed. .Stop program Execution of an application program can be stopped using the instruction HALT (stops all tasks). A program stopped in this way must be initialized to restart it (using the PL7 Micro command INIT). NOP instruction The NOP instruction does not perform any operation. This freezes the variable objects in this program.
This duration is programmable and can be modified via the terminal. .Advanced predefined function blocks Monostable function block %MNi The monostable function block is used to create a pulse of an exact duration.
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). Stack (last in. First Out). first out) known as LIFO stack (Last In. first out) known as FIFO stack (First In. .
The retrieval request is made by input %I1. these high points are symbolized by state 1 for each step and are assigned to output bits %Qi.3 and %R2. Configuration The following parameters must be entered in the variables editor of the register block : Numbers : 1 to 4. Length : 1 to 255. if register R2 is not full (%R2. The storage request in the register is made by %M1. In the case of a drum controller. the high point of a cam gives an order which is executed by the control system. which changes step according to external events.O is loaded into %MW20 if the register is not empty (%R2. On each step. Drum controller function block %DRi The drum controller operates on a similar principle to an electromechanical drum controller.E=0). known as control bits.The programming example shows word %MW34 being loaded into %R2.I at the storage request %I1.2. Mode : FIFO or LIFO.F=0).j or internal bits %Mi. Drum controller block .
The state of the outputs (control bits) for each step of the drum controller.1 %Q2.4 Bit . Input I1.0 to %Q2. Configuration The following information is defined in the variables editor : Step number : 5. the first 5 outputs %Q2.Programming and configuration In this example. Step 01234 0:10000 1:01000 2:00100 3:00010 4:00001 Time base.4 are activated in succession each time input %I1.3 %Q2.1 is set to 1. Assignment of control bits %Q2.0 %Q2.2 %Q2.0 resets the outputs to step 0.
. which is compatible with Series 7 PL7-2/3 blocks is used to provide control for time-delayed actions. The value of this delay is programmable and can be modified via the terminal.Timer function block %Ti (Series 7) This timer function block.
Standard operations The Timer function block can be pro-grammed to perform the following func-tions : .
. the two operands are compared and the four outputs are activated according to the result of the comparison. Example of use The program below shows the comparison of word %MW2 indexed by word %MW40 with the immediate value 150. If the contents of %MW2[%MW40] are greater than 150 and %I1. Operation When the command input is set to 1.3 = 1. If the contents are equal to 150.7 is activated. coil %MW10:X4 is activated. Setting the command input to 0 resets the activated outputs. coil %Q2. Coil %M5 is only controlled if the contents are different from 150 (< or >).Vertical comparison blocks Vertical comparison blocks are used to compare two operands (OP). These two operands are either 16-bit words (possibly indexed) or immediate values.
.SHL(op2.i) rotate shift of i positions to the right.i) logic shift of i positions to the left. .ROR(op2.i) rotate shift of i positions to the left.ROL(op2.i) logic shift of i positions to the right.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. Rotate shift : . . Logic shift : .SHR(op2.
28528E3 Floating point values are between -3. no more than six digits can be displayed after the comma. To be considered as a floating point value it must be written : "1285. 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). and 1. .0". Thus. Possibility of overlap between objects : The single and double length and floating point words are stored within the data area in a single memory zone.402824E+38 and -1.28 1.402824E+38. The floating point object format used is that of the IEEE standard. which corresponds to single length floating point numbers.175494E-38 and 3.175494E-38. Representation is accurate to 2 -24 . Notes The value "1285" is interpreted as an integer value. Words are 32 bits long.Floating point instructions General PL7 Micro software is used to perform operations on floating point objects. The conversion instructions Integer <--> Floating Point are used to change from one format to the other. When viewing floating point numbers. Examples of floating point values : 1285.
INT_TO_BCD : Binary --> BCD conversion. REAL_TO_DINT : floating point word --> integer double word conversion (the result is the next lowest integer value).Numeric conversion instructions BCD <--> Binary conversion instructions There are two types of conversion instruction : BCD_TO_INT : BCD --> Binary conversion. . DINT_TO_REAL : integer double word --> floating point word conversion. REAL_TO_INT : floating point word --> integer word conversion (the result is the next lowest integer value). Integer <--> Floating point conversion instructions There are four conversion instructions : INT_TO_REAL : integer word --> floating point conversion.
This action might not be possible to undo. Are you sure you want to continue?