Home
Unity Pro - Program Languages and Structure
Contents
1. e BOOL TO BYTE BOOL TO DINT BOOL TO INT BOOL TO REAL BOOL TO TIME BOOL TO UDINT BOOL_TO_UINT BOOL_TO WORD BOOL TO DWORD e BYTE TO BOOL BYTE TO DINT BYTE TO INT BYTE TO REAL BYTE_TO TIME BYTE_TO UDINT BYTE TO _UINT BYTE TO WORD BYTE_TO DWORD BYTE _TO BIT e DINT_TO BOOL DINT_TO BYTE DINT TO INT DINT TO REAL DINT_TO TIME DINT TO UDINT DINT_TO UINT DINT_TO WORD DINT_TO DWORD DINT_TO DBCD DINT_TO STRING e INT TO BOOL INT_ TO BYTE INT_ TO DINT INT_TO REAL INT_TO TIME INT TO _UDINT INT_TO UINT INT_TO WORD INT_TO BCD INT_TO DBCD INT TO DWORD INT TO STRING e REAL TO BOOL REAL TO BYTE REAL TO DINT REAL TO INT REAL TO TIME REAL TO UDINT REAL TO _UINT REAL TO WORD REAL TO DWORD REAL TO STRING e TIME TO BOOL TIME TO BYTE TIME TO DINT TIME TO_INT TIME TO REAL TIME TO UDINT TIME TO _UINT TIME TO WORD TIME TO DWORD TIME TO STRING e UDINT_TO BOOL UDINT_TO BYTE UDINT TO DINT UDINT_TO_INT UDINT_TO_REAL UDINT_TO_TIME UDINT_TO_UINT UDINT_TO WORD UDINT_TO_ DWORD e UINT_TO BOOL UINT_TO BYTE UINT_TO DINT UINT_TO_INT UINT_TO_REAL UINT_TO_TIME UINT_TO_UDINT UINT_TO_WORD UINT_TO_DWORD e W
2. S_5_10 a a s_5_11 _5 12 _5_13 be el fs el b c d S_5_14 S _5 15 S_5_16 el e S_5_17 If Then If s_5_10 is active and transition condition a which belongs to the common transition is also true then a sequence runs from s 5 10toS 5 11 S 5 12 and s_5_13 If steps s_ 5 11 S 5 12ands_5 13 are activated then the strings run independently of one another lfs 5 14 S 5 15ands 5 16 are active at the same time and transition condition e which belongs to the common transition is true then a sequence is run from s_5_14 S_5_15 and Ss 5 16tos 5 17 35006144 07 2012 465 SFC Sequence Language Terminating a Parallel Branch with an Alternative Merge Terminating a parallel branch can also be done with an alternative merge instead of a parallel merge with Multi Token Terminating a Parallel String with an Alternative Branch variation 1 a a _5_1 52 ay Ss b c S_5_3 If Then If the transition condition a is true then a sequence runstoS 5 lands 5 2 IfstepsS_5 lands 5 2 are activated then the strings run independently of one another If transition condition b is true and c is false then a sequence runs to s_5_3 A second token is created by the sequence running on the alternative merge out of the parallel string The two to
3. Table No Feature No Description of Feature 36 la CTU Up counter function block 1b CTU_DINT function block 1d CTU_UDINT function block 2a CTD Down counter function block 2b CTD_DINT function block 2d CTD_UDINT function block 3a CTUD Up down counter function block 3b CTUD_DINT function block 3d CTUD_UDINT function block 37 1 TP Pulse function block 2a TON On delay function block 3a TOF Off delay function block 39 19 Use of directly represented variables 40 1 Step and initial step Graphical form with directed links 3a Step flag General form Step elapsed time General form 41 Use of transition name 7a Transition condition linked through transition name using LD language 7b Transition condition linked through transition name using FBD language 7C Transition condition linked through transition name using IL language 7d Transition condition linked through transition name using ST language 42 1 Any Boolean variable declared in a VAR or VAR_OUTPUT block or their graphical equivalents can be an action 2l Graphical declaration of action in LD language 2f Graphical declaration of action in FBD language 3s Textual declaration of action in ST language 3i Textual declaration of action in IL language 43 1 Action block physically or logically adjacent to the step Note 7 page 676 2 Concatenated action blocks physically or logically adjacent to the step Note 8
4. Step Step Types The following types of steps exist Type Representation Description Normal Step i A step becomes active when the previous step becomes inactive a delay S_1_2 that may be defined must pass and the upstream transition is satisfied A step normally becomes inactive when a delay that may be defined passes and the downstream transition is satisfied For a parallel joint all previous steps must satisfy these conditions Zero or more actions belong to every step Steps without action are known as waiting steps Initial step i The initial status of a sequence string is characterized by the initial step S_1_1 After initializing the project or initializing the sequence string the initial step is active Initial steps are not normally assigned with any actions With Single Token Conforming with IEC 61131 3 only one initial step is allowed per sequence With Multi Token a definable number 0 to 100 of initial steps are possible Macro Step L See Macro Step page 424 MS_1_1 Input ste see Input Step page 424 j MS_1_1_IN K Popea Output step see Output Step page 425 MS_1_1_OU Step Names When creating a step it is assigned with a suggested number The suggested number is structured as follows S_i 4 whereas i is the internal current number of the section and j is the internal current step number in the current section You can change the suggested numbers to give y
5. Quantum example Premium example z 5 P C INAIRI IV i i ll yi fi IW 1 4 1 5 IW0 4 1 5 rack 1 module 4 channel 1 data 5 rack 0 module 4 channel 1 data 5 P C NAIRI V W JW iW fi fd Local rack g Be RIO No 3 a ZZ ba P RIJ JV W fo Bus No 2 IW 2 7 0 5 1 5 bus module 5 channel 1 data 5 E G a SIW 3 2 1 4 1 5 E xa bus 3 drop device 2 rack 1 module 4 eco sees pee channel 1 data 5 geo ooa gO gaon E J DIO No 2 Available for Unity versions higher than V1 0 IW 2 1 1 3 4 5 bus 2 drop device 1 rack 1 module 3 channel 4 data 5 35006144 07 2012 325 Data Instances 326 35006144 07 2012 Data References 10 What s in this Chapter This chapter provides the references of da
6. EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex O_PHYS E_EFB_NO_ F 30185 16 8A17 Internal error MEASURING_RANGE O_PHYS E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE O_PHYS E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE O_PHYS E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration O_PHYS_WARN E_EFB_NO_ F 30185 16 8A17 Internal error MEASURING_RANGE O_PHYS_WARN E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE O_PHYS_WARN E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE O_PHYS_WARN E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration O_RAW E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE O_RAW E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration O_SCALE E_INPUT_VALUE_OUT_ F 30183 16 8A19 Input value is out of range OF_RANGE O_SCALE E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE O_SCALE E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE O_SCALE E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration O_SCALE_WARN E_INPUT_VALUE_OUT_ F 30183 16 8A19 Input value is out of range OF_RANGE O_SCALE_WARN E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE O_SCALE_WARN E_EFB_NEG_OVER F 3018
7. ADD EN ENO ADD a EN ENO BE 35006144 07 2012 409 Ladder Diagram LD Positioning of Objects The position of objects can only have an influence on the execution order if several inputs left link of Contacts Coils FFB inputs are linked with the same output of the object to be called right link of Contacts Coils FFB outputs see also Original Situation page 407 Original situation 3 ADD _ fe EN ENO A 2 4 ADD EN ENO B c J 1 1 1 Nd D 3 4 11 12 ADD ADD p _ env ENO EN ENO _ E 5 13 ADD EN ENO 14 Es ADD EN ENO G In the first network block positions 0 1 and 0 2 are switched In this case common origins for both block inputs the execution sequence of both blocks is switched as well processed from top to bottom The same applies when switching coils c and D in the second network 410 35006144 07 2012 Ladder Diagram LD In the third network block positions 0 4 and 0 5 are switched In this case different origins for the block inputs the execution sequence of the blocks is not switched processed in the sequence that the block outputs are called in The same applies when switching coils G and H in the last network 1
8. Representation 2 1X20 MX50 Normally Horizontal Boolean Link Coil 0X100 EN A ae MX60 Vertical Boolean Link Ae Nomally QX100 NEXT Jum x p P gt s Contact for detecting positive transitions Label Jump target P Jump target NEXT EN Input ENO Output Inversion ST Expression FFB Link Variable AND OR AND Error1 EN ENO EN ENO EN ENO IN1 gt O A lt BP gt Resultl TRUE gt _ IX1 54b c DP Va 1 gt IX1 5 5 gt s ga Va Crossing Literals Topological Link Addresses XOR Error2 EN ENO Rg P Result2 IN4 gt Left Power Rail Right Power Rail 35006144 07 2012 371 Ladder Diagram LD Objects Section Size The objects of the LD programming language help to divide a section into a number of e Contacts see page 373 e Coils see page 374 e EFs and EFBs Elementary Functions see page 376 and Elementary Function Blocks see page 377 DFBs Derived Function Blocks see page 378 Procedures see page 379 Control Elements see page 387 and Operation and Comparison blocks see page 388 that represent an extension to IEC 61131 3 These objects can be connected with each other by means of e Links see page 390 or e Actual Parameters see page 379 FFBs only Comments regarding the section logic can be provided using text objects see Text Object page 393 One LD section consists of a window containing a single page
9. Word Function Description Initial state Symbol SW98 CRA Meaning of the different bits of the word SW98 0 CRA_COMPAT LOW compatibility e SW98 0 is not used and is set to 0 by default low status SW98 1 to SW98 15 register e 0 sets the drop 2 to 16 is not compatible e 1 sets the drop 2 to 16 is compatible SW99 CRA Meaning of the different bits of the word SW99 0 CRA_COMPAT HIGH compatibility e SW99 0 to SW99 15 high status e 0 sets the drop 17 to 32 is not compatible register e 1 sets the drop 17 to 32 is compatible SW100 CCOTF Meaning of the different bits of the word SW100 0 CCOTF_COUNT counting e XXYY status e XX increments each time an I O configuration is done in register RUN state in a RIO drop e YY increments each time an I O configuration is done in RUN state in the Local rack NOTE On a RUN to STOP mode transition SW100 is reset to 0 NOTE When a byte reaches its maximum value of 255 the counter is reset to 1 SW101 ERIO Meaning of the bytes of the word SW101 0 ERIO_ CCOTF e XXYY CCOTF_COUNT counting e XX Reserved status e YY increments each time an Ethernet I O configuration register changes NOTE When the counter reaches its maximum value of 255 it is reset to 1 NOTE On a cold start warm start or application download SW101 is reset to 0 SW108 Forced bit Word SW108 0 FORCED DISCRETE_ counting increments each time an discrete bit 1 Q or M is forced COUNT st
10. 192 35006144 07 2012 System Objects Description of System Words SW70 to SW100 Detailed Description Description of system words 3SW70 to 3SW100 Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW70 WEEKOF YEAR Real time clock function System word containing the number of the week in the year 1 to 52 in BCD YES YES YES SW71 KEY SWITCH Position of the switches on the Quantum front panel This word provides the image of the positions of the switches on the front panel of the Quantum processor This word is updated automatically by the system e SW71 0 1 switch in the Memory protected position SW71 1 1 switch in the STOP position SW71 2 1 switch in the START position SW71 8 1 switch in the MEM position SW71 9 1 switch in the ASCII position SW71 10 1 switch in the RTU position e SW71 3to7 andi11to15 are not used NO NO YES SW75 TIMEREVTNB Timer type event counter This word contains the number of timer type events in the queue 1 Not available on the following processors TSX 57 1 20 3 4e 5e This word is not available on Quantum Safety PLCs YES YES 1 YES except for Safety PLCs SW76 DLASTREG Diagnostics function recording Result of the last registration e 0 if the record
11. Topic Page General Information about the LD Ladder Diagram Language 370 Contacts 373 Coils 374 Elementary Functions Elementary Function Blocks Derived Function Blocks 376 and Procedures FFBs Control Elements 387 Operate Blocks and Compare Blocks 388 Links 390 Text Object 393 Edge Recognition 394 Execution Sequence and Signal Flow 403 Loop Planning 405 Change Execution Sequence 407 35006144 07 2012 369 Ladder Diagram LD General Information about the LD Ladder Diagram Language Introduction This section describes the Ladder Diagram LD according to IEC 61131 3 The structure of an LD section corresponds to a rung for relay switching The left power rail is located on the left hand side of the LD editor This left power rail corresponds to the phase L ladder of a rung With LD programming in the same way as in a rung only the LD objects which are linked to a power supply that is to say connected to the left power rail are processed The right power rail corresponds to the neutral wire However all coils and FFB outputs are linked with it directly or indirectly and this creates a power flow A group of objects which are linked together one below the other and have no links to other objects excluding the power rail is called a network or a rung 370 35006144 07 2012 Ladder Diagram LD Representation of an LD Section
12. 174 35006144 07 2012 System Objects Bit Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum S94 SAVECURRVAL Saving adjustment values Normally at 0 this bit can be set to 1 by the user to replace the initial values of the declared variables with a Save attribute e g DFB variables with the current values For Modicon M340 on a S94 rising edge the internal RAM and the memory card content are different S96 0 and the CARDERR LED is on On cold start the current values are replaced by the most recent initial values only if a save to memory card function Backup Save or S66 rising edge was done The system resets the bit S94 to 0 when the replacement has been made Note this bit must be used with care do not set this bit permanently to 1 and use the master task only This bit is not available on Quantum safety PLCs When used with the TSX MFP e or TSX MCP eflash PCMCIA memory the saving adjustment values is not available 0 YES YES YES except for safety PLCs S96 BACKUP PROGOK Backup program OK This bit is set to O or 1 by the system e Set to 0 when the card is missing or unusable bad format unrecognized type etc or the card content is inconsistent with Internal Application RAM e Setto 1 when the card is correct and the application is consistent with CPU Internal Application
13. File Types STU STA XEF ZEF Binary applications Yes Yes No No Source applications Yes Yes Yes Yes Internal database Yes No No No Comparative file size 10 see 1 0 03 see 1 3 3 Comparative time to save 10 1 6 6 6 Comparative time to open 1 10 10 10 Connection to the PLC in Equal Possible Possible Not possible Not possible Online mode see 2 see 2 File backup Possible Possible Possible Possible see 3 1 Compressed files 2 The project needs to be first uploaded into the PLC 3 The project can be saved only if it has been generated NOTE The values in the table represent a ratio between file types where the STU value is the reference 32 35006144 07 2012 Presentation Configurator Configurator Window The configurator window is split into two windows e Catalog window A module can be selected from this window and directly inserted in the graphical representation of the PLC configuration by dragging and dropping Bus e Graphical representation of the PLC configuration Representation of the Configurator window Local Quantum Bus 1 140 CPU 67160 01 00 X BE a Local Quantum Bus Analog o Comm 40 AC1 030 00 01 00 40 ACI 040 00 01 00 40 ACO 020 00 01 00 40 ACO 130 00 01 00 40 All 330 00 01 00 40 A1330 10 01 00 40 AIO 330 00 01 00 40 AMM 090 00 01 00 40 ARI 030 10 01 00 40 ATI 030 00 01 00 40 AVI030 00 01
14. Task Controle tiie sin 4 wee wie bev ee We ce es BE Assignment of Input Output Channels to Master Fast and Auxiliary Tasks Management of Event Processing 0 02000ee eee eeee Execution of TIMER type Event Processing 2 55 Input Output Exchanges in Event Processing How to Program Event Processing 2000ee eee eeee Application Memory Structure 200000 Memory Structure of the Premium Atrium and Modicon M340 PLCs Memory Structure of Modicon M340 PLCs 200000 Memory Structure of Premium and Atrium PLCs Detailed Description of the Memory Zones 200000 Memory Structure of Quantum PLCs 2 00 0c e ee eeeee Memory Structure of Quantum PLCs 0 00 0c e eee Detailed Description of the Memory Zones 20 000 Operating Modes cece eee eee eee eee Modicon M340 PLCs Operating Modes 2000 eee eaee Processing of Power Outage and Restoral of Modicon M340 PLCs Processing on Cold Start for Modicon M340 PLCs Processing on Warm Restart for Modicon M340 PLCs Automatic Start in RUN for Modicon M340 PLCs Processing of State RAM on STOP Mode for Modicon M340 PLCs Premium Quantum PLCs Operating Modes 2 005 Processing of Power Outage and Restoral for Premium Quantum PLCs Processing on Cold Start f
15. Chapter Chapter Name Page 16 Overview of User Function Blocks DFB 583 17 Description of User Function Blocks DFB 589 18 User Function Blocks DFB Instance 601 19 Use of the DFBs from the Different Programming Languages 607 20 User Diagnostics DFB 625 35006144 07 2012 581 DFB 582 35006144 07 2012 Overview of User Function Blocks DFB 16 Subject of this Chapter This chapter provides an overview of the user function blocks DFB and the different steps in their implementation What Is in This Chapter This chapter contains the following topics Topic Page Introduction to User Function Blocks 584 Implementing a DFB Function Block 586 35006144 07 2012 583 Overview of DFBs Introduction to User Function Blocks Introduction Unity Pro software enables you to create DFB user function blocks using automation languages A DFB is a program block that you write to meet the specific requirements of your application It includes one or more sections written in Ladder LD Instruction List IL Structured Text ST or Functional Block Diagram FBD language e input output parameters e public or private internal variables Function blocks can be used to structure and optimize your application They can be used whenever a program sequence is repeated several times in your application or to set a standard programming operation for example
16. Type Address Write access Internal words MW lt i gt L Yes MD lt i gt L MF lt i gt L Constant words KW lt i gt L No KD lt i gt L KF lt i gt L System words SW50 4 Yes Examples e M2 65 Defines an EBOOL table from M2 to M66 e M125 30 Defines an INT table from MW125 to MW154 336 35006144 07 2012 Data References Data Naming Rules Introduction What is a Domain Rules In an application the user chooses a name to e define a type of data e instantiate a data item symbol e identify a section Some rules have been defined in order to avoid conflicts occurring This means that it is necessary to differentiate between the different domains of application of data It is an area of the application from which a variable can or cannot be accessed such as e the application domain which includes e the various application tasks e the sections of which it is composed e the domains for each data type such as e structures tables for the DDT family e EFB DFBs for the function block family This table defines whether or not it is possible to use a name that already exists in the application for newly created elements Application Section SR DDT O FB FB EF Variable Content gt DDT type Instances New elements below Section No No Yes Yes Yes Yes Yes SR No No Yes Yes No 1 No DDT IODDT No No No No 4 No No 4 No FB type Yes Yes No No 3
17. ADD _ EN ENO L A 2 4l ADD EN ENO B Cc EN 1 1 Mood D 3 5 ADD 5 FA p _S nw ENO RS ADD EN ENO 4 6 12 ADD 14 a EN ENO EN ENO G 411 Ladder Diagram LD 412 35006144 07 2012 SFC Sequence Language 13 Overview This chapter describes the SFC sequence language which conforms to IEC 611311 What Is in This Chapter This chapter contains the following sections Section Topic Page 13 1 General Information about SFC Sequence Language 414 13 2 Steps and Macro Steps 420 13 3 Actions and Action Sections 428 13 4 Transitions and Transition Sections 435 13 5 Jump 440 13 6 Link 441 13 7 Branches and Merges 442 13 8 Text Objects 447 13 9 Single Token 448 13 10 Multi Token 459 35006144 07 2012 413 SFC Sequence Language 13 1 General Information about SFC Sequence Language Overview This section contains a general overview of the SFC sequence language What Is in This Section This section contains the following topics Topic Page General Information about SFC Sequence Language 415 Link Rules 419 414 35006144 07 2012 SFC Sequence Language General Information about SFC Sequence Language Introduction The sequence language SFC Sequential Function Chart which conforms to IEC 61131 3 is described in this section Str
18. Expand all Collapse all The network configuration windows allow among others e Creation of networks e Network analysis e Printout of the network configuration 36 35006144 07 2012 Presentation Ethernet_1 A window for configuring a network r Model Family Module Address k Module Channel Rac TCP IP 10 100 Regular connection v Module IP Address P Address Subnetwork Mask Gateway Address ORTON 205a 0 0g Wee tO Module Utilities 10 Scanning Global Data SNMP Address Server NTP IP Configuration Messaging IO Scanning Global Data SNMP Address Server c IP address configuration Configured IP address Subnetwork mask Gateway address O From a server r Ethernet configuration Ethernet II 0802 3 NTP Bandwidth After configuration the network is assigned a communications module 35006144 07 2012 37 Presentation Data Editor Introduction Variables The data editor offers the following features e Declaration of variable instances e Definition of derived data types DDTs e Definition of Device derived data types Device DDTs e Instance declaration of elements and derived function blocks EFBs DFBs e Definition of derived function block DFBs parameters The following functions are available in
19. If FLAG has the value 0 SUM will be 15 following the execution of the instructions If FLAG has the value 1 SUM will be 6 following the execution of the instructions SUM 0 FOR I 1 TO 3 DO FOR J 1 TO 2 DO IF FLAG 1 THEN EXIT END IF SUM SUM J END FOR SUM SUM I END_FOR CASE see page 547 WHILE see page 551 REPEAT see page 552 35006144 07 2012 553 Structured Text ST Subroutine Call Subroutine Call A subroutine call consists of the name of the subroutine section followed by an empty parameter list Subroutine calls do not return a value The subroutine to be called must be located in the same task as the ST section called Subroutines can also be called from within subroutines For example SubroutineName Subroutine calls are a supplement to IEC 61131 3 and must be enabled explicitly In SFC action sections subroutine calls are only allowed when Multitoken Operation is enabled 554 35006144 07 2012 Structured Text ST RETURN Description RETURN instructions can be used in DFBs derived function blocks and in SRs subroutines RETURN instructions can not be used in the main program e Ina DFB a RETURN instruction forces the return to the program which called the DFB e The rest of the DFB section containing the RETURN instruction is not executed e The next sections of the DFB are not execut
20. DFB Input DFB VAR_IN_OUT EFB Output 2 EF Input EF VARIN_OUT EF Output z g k g Procedure Input Procedure VAR_IN_OUT Procedure Output F Actual parameter required Actual parameter not required not applicable FFBs that use actual parameters on the inputs that have not yet received any value assignment work with the initial values of these actual parameters If no value is allocated to a formal parameter then the initial value will be used for executing the function block If no initial value has been defined then the default value 0 is used If a formal parameter is not assigned a value and the function block DFB is instanced more than once then the subsequent instances are run with the old value 35006144 07 2012 381 Ladder Diagram LD Public Variables Private Variables In addition to inputs outputs some function blocks also provide public variables These variables transfer statistical values values that are not influenced by the process to the function block They are used for setting parameters for the function block Public variables are a supplement to IEC 61131 3 The assignment of values to public variables is made using their initial values Public variables are read via the instance name of the fu
21. Table No Feature No Feature description 53 la CAL of Function Block with non formal argument list 1b CAL of Function Block with formal argument list 2 CAL of Function Block with load store of arguments 4 Function invocation with formal argument list 5 Function invocation with non formal argument list In DFB only 678 35006144 07 2012 IEC Compliance ST language elements ST language elements IEC compliance table for ST language elements Note Table No Feature No Feature description 55 1 Parenthesization expression Function evaluation functionName listOfArguments Exponentiation Negation Complement NOT Multiply Divide Modulo MoD o o NI OD oO AJ OIN Add fo Subtract a Comparison lt gt lt gt N Equality wo Inequality lt gt A Boolean AND amp oa Boolean AND AND e O Boolean Exclusive OR XOR en N Boolean OR OR 56 Assignment Function block invocation and function block output usage RETURN statement Note page 679 IF statement CASE statement FOR statement WHILE statement REPEAT statement oOo NI OD oO AJOIN EXIT statement fo Empty statement In DFB only 35006144 07 2012 679 IEC Compliance Common graphical
22. m COMPARE _ lt obj1 OP obj2 gt Horizontal compare blocks used to execute a compare expression lt gt lt gt lt gt in the ST programming language Note The same functionality is also possible using ST expressions see page 529 A compare block performs an AND of its left In pin and the result of its compare condition and assigns the result of this AND unconditionally to its right Out pin For example if the state of the left link is 1 and the result of the comparison is 1 the state of the right link is 1 A horizontal matching block can contain up to 4096 characters If not all characters can be displayed then the beginning of the character sequence will be followed by suspension points A horizontal matching block takes up 1 line and 2 columns Example Int In2 Out1 _ Comparet H H Comparez HK 4 In the example Compare is executed if Inl 1 Compare2 is executed if In1 1 In2 1 a the result of Compare1 1 Out1 becomes 1 if In1 1 In2 1 the result of Compare1 1 and the result of Compare2 1 35006144 07 2012 389 Ladder Diagram LD Links Description Links are connections between LD objects contacts coils and FFBs etc There are 2 different types of links e Boolean Links Boolean links consist of one or more segments linking Boolean objects contacts coils with one another There are different types of Boolean links
23. 196 35006144 07 2012 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW86 MSGCNT6 Message management This word is updated by the system and can also be reset using S80 For Premium e Number of messages refused by the system For Modicon M340 e Number of messages refused by the system not treated because of lack of resources for example f the message is refused by Modbus Server then it corresponds to Modbus exception messages sent by the CPU to the remote Modbus client 0 YES YES NO SW87 MSTSERVCNT Communication flow manage ment Number of requests processed by synchronous server per master MAST task cycle The requests processed may come from all communication ports having access to the server Modbus UNI TE each of them having its own limitation This means also that requests from other clients then communication EFs like IO Scanner connected HMI and so on should be counted YES YES YES 35006144 07 2012 197 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW88 Premium Com For Premium 0 YES YES NO ASNSERVCNT munication flow sw88 Number of requests SW89 management processed by asynchronous APPSERVCNT Modicon M340 server per master MAST
24. 366 35006144 07 2012 Function Block Language FBD Loop Planning Non Permitted Loops Configuring loops exclusively via links is not permitted since it is not possible to clearly specify the signal flow the output of one FFB is the input of the next FFB and the output of this one is the input of the first Non permitted Loops via Links 5 6 OR AND INL E N2 Generating Via an Actual Parameter This type of logic must be resolved using feedback variables so that the signal flow can be determined Feedback variables must be initialized The initial value is used during the first execution of the logic Once they have been executed the initial value is replaced by the actual value Pay attention to the two different types of execution sequences number in brackets after the instance name for the two blocks Loop generated with an actual parameter Type 1 Fo 6 OR AND N1 OUTI OUTI N2 Loop generated with an actual parameter Type 2 5 6 OR AND IN1 OUT2 OUT IN2 M 35006144 07 2012 367 Function Block Language FBD 368 35006144 07 2012 Ladder Diagram LD 12 Overview This chapter describes the ladder diagram language LD which conforms to IEC 611311 What Is in This Chapter This chapter contains the following topics
25. 35006144 07 2012 189 System Objects Description of system words SW36 to SW47 Word Function Description Initial Modicon Premium Quantum Symbol state M340 SW36 Auxiliary Those words indicate the execution NO YES 1 YES 1 AUXOCURRTIME task time of the last cycle of the AUX different SW39 execution 0 3 tasks in ms function in AUX1CURRTIME time NOTE SW36 and SW39 words Safety SW42 have a different function in PLCs AUX2CURRTIME Quantum Safety PLCs and the SW45 other words are not available on AUX3CURRTIME Quantum safety PLCs SW37 Maximum Those words indicate the longest NO YES 1 YES 1 AUXOMAXTIME auxiliary task task execution time of AUX 0 3 different SW40 execution tasks since the last cold start in function in AUX1MAXTIME time ms Safety SW43 NOTE SW37 word has a PLCs AUX2MAXTIME different function in Quantum SW46 Safety PLCs and the other words AUX3MAXTIME are not available on Quantum safety PLCs SW38 Minimum Those words indicate the shortest NO YES 1 YES 1 AUXOMINTIME auxiliary task task execution time of AUX 0 3 different SWA41 execution tasks since the last cold start in function in AUX1MINTIME time ms Safety SW44 NOTE SW38 word has a PLCs AUX2MINTIME different function in Quantum SW47 Safety PLCs and the other words AUX3MINTIME are not available on Quantum safety PLCs 1 Only on 140 CPU 6
26. FOR with Increment not Equal to 1 If an increment other than 1 is to be used it can be defined by By The increment the initial value the end value and the control variable must be of the same data type DINT or INT The criterion for the processing direction forwards backwards is the sign of the BY expression If this expression is positive the loop will run forward if it is negative the loop will run backward Example Counting forward in Two Steps Counting forward in two steps Control variable Start value End value Increment ee 1 TO 10 BY 2 DO BY gt 0 Forwards loop a COS B Loop is 5 x executed END_FOR FOR i co QI Example Counting Backwards Counting backwards FOR i 10 TO 1 BY 1 DO BY lt 0 Backwards loop C C COS B Instruction is executed 10 x END_FOR Example Unique Loops The loops in the example are run exactly once as the initial value end value In this context it does not matter whether the increment is positive or negative FOR i 10 TO 10 DO Unique Loop C C COS B END_FOR or FOR i 10 TO 10 BY 1 DO Unique Loop C C COS B END_FOR 35006144 07 2012 549 Structured Text ST Example Critical Loops If the increment is j gt 0 in the example the instruction is executed If j lt is 0 the instructions are not executed because the situation initial value lt only allows the end valu
27. 35006144 07 2012 305 Data Types 8 10 Compatibility Between Data Types Compatibility Between Data Types Introduction The following is a presentation of the different rules of compatibility between types within each of the following families the Elementary Data Type EDT family the Derived Data Type DDT family the Generic Data Type GDT family The Elementary Data Type EDT Family The Elementary Data Type EDT family contains the following sub families the binary format data type sub family the BCD format data type sub family the Real format data type sub family the character string format data type sub family the bit string format data type sub family There is no compatibility whatsoever between two data types even if they belong to the same sub family Derived Data Type DDT Family The Derived Data Type DDT family contains the following sub families the table type sub family the structure type sub family e structures concerning input output data IODDT e structures concerning input output device Device DDT e structures concerning other data Rules concerning the structures Two structures are compatible if their elements are e of the same name e of the same type e organized in the same order 306 35006144 07 2012 Data Types There are four types of structure ELEMENT 1 My Element INT Other Element BOOL ELEMENT_1 type structure ELEMENT 2 My Elemen
28. 98 35006144 07 2012 Program Structure Subroutine limitations Precautions In Unity Pro version 6 0 of higher subroutines can only be used in one task For example MASK subroutines cannot be called from TIMER and EVENT tasks CAUTION UNEXPECTED MULTITASK APPLICATION BEHAVIOR The sharing of Inputs Outputs between different tasks can lead to unforeseen behavior by the application We specifically recommend you associate each output or each input to one task only Failure to follow these instructions can result in injury or equipment damage NOTE During an update of M linked to FAST task I O you must either e do them at the same time in the FAST task e mask the FAST task S31 while updating 35006144 07 2012 99 Program Structure Sequencing of Tasks in a Multitasking Structure General The master task is active by default The fast and auxiliary tasks are active by default if they have been programmed Event processing is activated when the associated event occurs Operation The table below describes the execution of priority tasks this operation is also illustrated in the diagram below Phase Description Occurrence of an event or start of the fast task cycle Execution of lower priority tasks in progress stopped Execution of the priority task AJOJ N The interrupted task takes over again when processing of the priority task is c
29. oa Single byte character strings Single byte typed string literals Dollar sign Single quote Line feed New line Form feed page Carriage return Tab Double quote olo INI OD oO AIT WwW NM w 35006144 07 2012 665 IEC Compliance Table No Feature No Description of Feature 7 la Duration literals without underlines short prefix 1b long prefix 2a Duration literals with underlines short prefix 2b long prefix 8 1 Date literals long prefix 2 Date literals short prefix 3 Time of day literals long prefix 4 Time of day literals short prefix 5 Date and time literals long prefix 5 Date and time literals short prefix 10 1 Data type BOOL 3 Data type INT 4 Data type DINT 7 Data type UINT 8 Data type UDINT 10 Data type REAL 12 Data type TIME 13 Data type DATE 14 Data type TIME OF DAY or TOD 15 Data type DATE AND TIME or DT 16 Data type STRING 17 Data type BYTE 18 Data type WORD 19 Data type DWORD 12 4 Array data types 5 Structured data types 14 4 Initialization of array data types 6 Initialization of derived structured data types 666 35006144 07 2012 IEC Compliance Table No Feature No Description of Feature 15 1 Input location Output location Memory location Single bit size X Prefix
30. Element Meaning LD Clear Load instruction to load the Clear value into a register ST Cpt_1 Reset Assign instruction to assign the contents of the register to the input parameter Cpt_1 Reset CAL Cpt_1 Call instruction for the DFB Cpt_1 622 35006144 07 2012 Use of DFBs Use of a DFB in a Program in Function Block Diagram Language Principle In FBD Function Block Diagram language the user function blocks are represented in the same way as in Ladder language and are called graphically The inputs of the user function blocks may be connected or assigned a value an immediate object or an expression In any case the type of external element must be identical to that of the input parameter Only one object can be assigned link to another block with the same variable to an input of the DFB However several objects may be connected to a single output A DFB block must have at least one connected Boolean input and an output if necessary For this you can use an EN input parameter and an ENO output parameter It is compulsory to connect or assign the ANY_ARRAY type inputs the generic data type outputs ANY_ and the input outputs of a DFB block Graphic Representation of a DFB Block The following illustration shows a simple DFB programming example Control_port_1 1 Function block Control 2 Delta 3 gt Deviation 6 Accel 7 Q1 2 1 8 10000 4 E gt Speed 6 5 Enab
31. If EN of FUNCBLOCK_1 is set to 0 the link on output OUT of FUNCBLOCK_1 maintains the old status it had during the last correctly executed cycle 35006144 07 2012 351 Function Block Language FBD EN ENO handling with function blocks that have one variable and one link as output parameters FUNCBLOCK 1 FUNCBLOCK 2 EN ENO EN ENO INI1 OUT OUTI IN1 OUT IN2 IN2 If EN of FUNCBLOCK_1 is set to 0 the link on output OUT of FUNCBLOCK_1 maintains the old status it had during the last correctly executed cycle The OUT1 variable on the same pin either retains its previous status or can be changed externally without influencing the link The variable and the link are saved independently of each other e Functions Procedures As defined in IEC61 131 3 the outputs from deactivated functions EN input set to 0 are undefined The same applies to procedures Here nevertheless an explanation of the output statuses in this case e EN ENO handling with function procedure blocks that only have one link as an output parameter FUNC PROC 1 FUNC PROC 2 EN ENO EN ENO IN1 OUT IN1 OUT IN2 IN If EN of FUNC_PROC_1 is set to 0 the value of the link on output OUT of FUNC_PROC_1 depends on the project setting Maintain output links on disabled EF available since Unity Pro 4 1 If this project setting is set to
32. Instruction List IL 14 Overview This chapter describes the programming language instruction list IL which conforms to IEC 61131 What Is in This Chapter This chapter contains the following sections Section Topic Page 14 1 General Information about the IL Instruction List 476 14 2 Calling Elementary Functions Elementary Function Blocks 500 Derived Function Blocks and Procedures 35006144 07 2012 475 Instruction List IL 14 1 General Information about the IL Instruction List Overview This section contains a general overview of the IL instruction list What Is in This Section This section contains the following topics Topic Page General Information about the IL Instruction List 477 Operands 481 Modifier 484 Operators 486 Subroutine Call 496 Labels and Jumps 497 Comment 499 476 35006144 07 2012 Instruction List IL General Information about the IL Instruction List Introduction Instructions Using the Instruction list programming language IL you can call function blocks and functions conditionally or unconditionally perform assignments and make jumps conditionally or unconditionally within a section An instruction list is composed of a series of instructions Each instruction begins on a new line and consists of e an Operator see page 486 e if necessary with a Modifier see page 484 and e if necessary o
33. d If Then If the transition condition a is true then a sequence runstos 4 lands 4 2 If steps S_4_1 and s_4_2 are activated then the strings run independently of one another If transition condition b is true then a sequence runs tos 4 3 If the transition condition c is true then a jump is madetos 4 1 S 4 3andSs 4 1 are active at the same time A second token is created by the jump out of a branch string Both tokens are running parallel to one another i e 35006144 07 2012 471 SFC Sequence Language Token 1 S_4_ 3 Token 2 S_4 1 If Then If Then Step Ss 4 3 is processed Step S 4 1 is processed If transition condition b is then a sequence runs to true S_4 3 If step S_4 3 is still active token 1 during the activation by token 2 then token 2 is ended and the string will continue to be processed as Single Token If step S_4 3 is no longer active token 1 because of the activation by token 2 then it is reactivated by token 2 and both tokens continue running parallel Multi Token In both cases true transition condition d causes the parallel string to be left Leaving a Parallel String with an Alternative Branch Leaving a Parallel String with an Alternative Branch a I S_3_1 32 b c S_3_4 S_3_5 Sa d e S_
34. 35006144 07 2012 713 Glossary SFC SFC objects Single token ST STRING Structure Subroutine SFC is the abbreviation of Sequential Function Chart SFC enables the operation of a sequential automation device to be represented graphically and in a structured manner This graphic description of the sequential behavior of an automation device and the various situations which result from it is performed using simple graphic symbols An SFC object is a data structure representing the status properties of an action or transition of a sequential chart Operating mode of an SFC chart for which only a single step can be active at any one time ST is the abbreviation of Structured Text language Structured Text language is an elaborated language close to computer programming languages It enables you to structure series of instructions A variable of the type STRING is an ASCII standard character string A character string has a maximum length of 65534 characters View in the project navigator with represents the project structure Program module belonging to a task Mast Fast Aux which can be written in the language chosen by the programmer FBD LD ST or IL A subroutine may only be called by a section or by another subroutine belonging to the task in which it is declared 714 35006144 07 2012 Glossary Task TIME Time literals Time Out TIME_OF_DAY TOD A group of sections a
35. 530 35006144 07 2012 Structured Text ST Error Behavior IEC Conformity The following conditions are handled as an error when executing an expression e Attempting to divide by 0 e Operands do not contain the correct data type for the operation e The result of a numerical operation exceeds the value range of its data type If an error occurs when executing the operation the corresponding Systembit S is set if supported by the PLC being used For a description of IEC conformity for the ST programming language see IEC Conformity see page 667 35006144 07 2012 531 Structured Text ST Operands Introduction An operand can be an address a literal a variable a multi element variable an element of a multi element variable a function call an FFB output Data Types Data types which are in an instruction of processing operands must be identical Should operands of various types be processed a type conversion must be performed beforehand In the example the integer variable i1 is converted into a real variable before being added to the real variable r4 r3 r4 SIN INT TO REAL il As an exception to this rule variables with data type TIME can be multiplied or divided by variables with data type INT DINT UINT or UDINT Permitted operations e timeVarl timeVar2 dintVarl e timeVarl timeVar2 intVarl e timeVar 10 time 10s This function is list
36. End of sequence symbol Argument separation symbol 618 35006144 07 2012 Use of DFBs Use of a DFB in an Instruction List Program Principle In Instruction List a user function block is called by a CAL instruction followed by the name of the DFB instance as an operand and a list of arguments optional Arguments are displayed in the list between brackets and separated by commas In Instruction List there are three possible ways of calling a DFB e The instruction CAL DFB_ Name is followed by a list of arguments that are assignments parameter value In this case the order in which the arguments are entered in the list is not important The EN input parameter can be used to control the execution of the function block e The instruction CAL DFB_Name is followed by a list of arguments that are values expression object or immediate value In this case the order in which the arguments are entered in the list must follow the order of the DFB input parameters including for non assigned inputs the argument is an empty field It is not possible to use EN and ENO parameters e The instruction CAL DFB_Name is not followed by a list of arguments In this case this instruction must be preceded by the assignment of the input parameters via a register loading of the value Load then assignment to the input parameter Store The order of assignment of the parameters LD ST is not important however you must
37. See table Common Floating Point Errors page 660 PID1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number PID1 E_ERR_PID_MAX_MIN F 30104 16 8A68 YMAX lt YMIN PID1 FP_ERROR See table Common Floating Point Errors page 660 PIDP1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number PIDP1 E_ERR_PID_MAX_MIN F 30104 16 8A68 YMAX lt YMIN PIDP1 FP_ERROR See table Common Floating Point Errors page 660 35006144 07 2012 653 EFB Error Codes and Values EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex SMOOTH_RATE E_ERR_DEN F 30152 16 8A38 Not a valid floating point number SMOOTH_RATE FP_ERROR F See table Common Floating Point Errors page 660 THREE_STEP_CON1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number THREE_STEP_CON1 W_WARN_DSR_TN T 30101 16 7595 ITN 0 THREE_STEP_CON1 W_WARN_DSR_TSN _ T 30102 16 7596 TSN 0 THREE_STEP_CON1 W_WARN_DSR_KP T 30103 16 7597 KP lt 0 THREE_STEP_CON1 E_ERR_DSR_HYS F 30105 16 8A67 2 IUZI lt IHYSI THREE_STEP_CON1 FP_ERROR F See table Common Floating Point Errors page 660 THREEPOINT_CON1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number THREEPOINT_CON1 W_WARN_ZDR_XRR_ F 30105 16 7599 DR XRR lt 100 or XRR gt 100 THREEPOINT_CON1 W_WARN_ZDR_T1T2
38. Single bit size No Prefix Word 16 bits size Double word 32 bits size Long quad word 64 bits size 17 w ol o NIA AJOIN Declaration of locations of symbolic variables Note 5 page 674 Array location assignment Note 5 page 674 Automatic memory allocation of symbolic variables Array declaration Note 11 page 676 Retentive array declaration Note 11 page 676 oN I Oo ajA Declaration for structured variables 18 Initialization of directly represented variables Note 11 page 676 Location and initial value assignment to symbolic variables Array location assignment and initialization Initialization of symbolic variables Array initialization Note 11 page 676 NIOJ AJ Retentive array declaration and initialization Note 11 page 676 Initialization of structured variables Initialization of constants Initialization of function block instances 19 Negated input Negated output 19a formal function function block call non formal function function block call 20 Use of EN and ENO shown in LD Usage without EN and ENO shown in FBD 35006144 07 2012 667 IEC Compliance Table No Feature No Description of Feature 20a 1 In out variable declaration textual 2 In out variable declaration graphical 3 Graphical conne
39. The following functions are available Definition of nested DDTs max 8 levels Definition of arrays with up to 6 dimensions Assignment of an initial value Assignment of an address Entering a comment Analysis of derived data types Assignment of derived data types to a library View all properties of a derived data type in a separate properties dialog box An alias name can be given to all elements of a DDT structure or an array 35006144 07 2012 41 Presentation Function Blocks The Function blocks tab is used for the instance declaration of elements and derived function blocks EFBs DFBs Tab Function blocks Data Editor Variables DDT types Function blocks B ka 4 Filter CT Name Miers More Name Number Type Value _ Comment El i SFCControl SFCCKTRL Ek lt Inputs gt CHARTREF l SFCCFHAR Link to SFC NT 2 Bool FALSE Reset SFC CLEAR 3 Bool FALSE Reset SFC DISTIME 4 Boo FALSE Supervision time DISTRANS 5 Boo FALSE Transitions DISACT 6 Boo FALSE Action processing STEPUN 7 Boo FALSE Step over STEPDEP 8 Boo FALSE StepOver RESTERR 9 Boo FALSE Supervision time DISRMOTE 10 Boo FALSE Remote contral ALLTRANS 11 Bool FALSE All transitions RESSTEPT 12 Bool FALSE Elapsed time The following functions are availa
40. Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW54 Real time System words containing date and YES YES YES STOPSEC clock time of the last power failure or PLC SW55 function on stop in Binary Coded Decimal STOPHM last stop e Sw54 Seconds 00SS SW56 SW55 Hours and Minutes STOPMD HHMM SW57 e Sw56 Month and Day MMDD STOPYEAR e Sw57 Year YYYY SW58 e sw58 the most significant byte STOPDAY contains the day of the week 1 for Monday through to 7 for Sunday and the least significant byte contains the code for the last stop e 1 change from RUN to STOP by the terminal or the dedicated input e 2 stop by watchdog PLC task or SFC overrun e 4 power outage or memory card lock operation e 5 stop on hardware fault e 6 stop on software fault Details on the type of software fault are stored in 3SwW125 SW59 Adjustment Contains two 8 bit series to adjust the 0 YES YES YES ADJDATETIME of current current date date The action is always performed on the rising edge of the bit This word is enabled by bit 2S59 1 In the following illustration bits in the left column increment the value and bits in the right column decrement the value Ne a _ Type of value Bits 0 8 Day of the week 1 9 Seconds 2 10 Minutes 3 11 Hours 4 12 Days 5 13 Months 6 14 Years 7 15 Centuries
41. 35006144 07 2012 123 Memory Structure 4 2 Memory Structure of Quantum PLCs Subject of this Section This section describes memory structure and detailed description of the memory zones of the Quantum PLCs What Is in This Section This section contains the following topics Topic Page Memory Structure of Quantum PLCs 125 Detailed Description of the Memory Zones 128 124 35006144 07 2012 Memory Structure Memory Structure of Quantum PLCs General The PLC memory supports e located application data State Ram e unlocated application data e the program task descriptors and executable code initial values and configuration of inputs outputs Structure without Memory Extension Card The data and program are supported by the internal RAM of the processor module The following diagram describes the memory structure A Located data Unlocated data Internal RAM Program Operating system 1 p Operating system 1 y Application backup 1 1 Only for 140 CPU 31 43 e 53 e processors 35006144 07 2012 125 Memory Structure Structure with Memory Extension Card Quantum 140 CPU 6e e processors can be fitted with a memory extension card The data is supported by the internal RAM of the processor module The program is supported by the extension memory card The following diagram describes the memory structure I
42. SFC Sequence Language Parallel Strings Parallel Strings With parallel branches switching a single transition leads to a parallel activation of more than one maximum 32 steps branches This applies with Single Token as well as with Multi Token Processing Parallel Strings S_5_10 a a _5_11 _5 12 _5_13 Le n fe el a b c d S_5_14 _5 15 S_5_16 sa el e S_5_17 If Then If S_5 10 is active and transition condition a which belongs to the common transition is also true then a sequence runs from s 5 10toS 5 11 S 5 12 ands 5 13 IfstepsS_5 11 S 5 12andS_5 13 are activated then the strings run independently of one another Ifs 5 14 S 5 15 andS_5 16 are active at the same time and transition condition e which belongs to the common transition is true then a sequence is run from s_5 14 S_5 15 and s 5 16tos 5 17 454 35006144 07 2012 SFC Sequence Language Using an Alternative Branch in a Parallel String If a single alternative branch is used in a parallel string it leads to blocking the string with Single Token Using an Alternative Branch in a Parallel String Le el a S_71 S_7_2 T n KESEN E b c d S_7_3 S_7_4 S_7_5 a e S_7_6 If Then If trans
43. Structured Text ST Not all formal parameters must be assigned with a value You can see which formal parameter types must be assigned with a value in the following table Parameter type EDT STRING ARRAY ANY_ARRAY ODDT STRUCT FB ANY Input VAR_IN_OUT Output Actual parameter required Actual parameter not required not applicable If no value is allocated to a formal parameter then the initial value will be used for executing the function block If no initial value has been defined then the default val Programming Notes ue 0 is used Attention should be paid to the following programming notes e All generic functions are overloaded This means the functions can be called with or without entering the data type E g il ADD i2 3 is identical to il ADD_INT i2 3 Functions can be nested see also Nesting Functions page 564 Functions are only executed if the input EN 1 or the EN input is not used see also EN and ENO page 564 e There are two ways of calling a function e Formal call calling a function with formal parameter names e Informal call calling a function without formal parameter names 35006144 07 2012 561 Structured Text ST Formal Call With formal calls calls with formal parameter names the call consists of the actual parameter of the outp
44. e VAR_IN_OUT variables cannot be used outside of the procedure call Calling a procedure with VAR_IN_oUT variable in IL PROC3 IN1 V1 IN2 V2 I01 V3 OUT1 gt V4 OUT2 gt V5 35006144 07 2012 523 Instruction List IL Calling the same procedure in FBD PROC3 VIIN OUT1 V4 V2 IN2 OUT2 V5 V3 101 101 V3 VAR_IN_OUT variables cannot be used outside the procedure call The following procedure calls are therefore invalid Invalid call example 1 LD V1 Loading a v1 variable in the accumulator CAL InOutProc Calling a procedure with the VAR_IN_OUT parameter The accumulator now contains a reference toa VAR_IN_OUT parameter AND V2 AND operation on contents of accumulator with variable v2 Error The operation cannot be carried out since the VAR_IN_OUT parameter contents of accumulator cannot be accessed outside the procedure call Invalid call example 2 LD V1 Loading a V1 variable in the accumulator AND InOutProc inout AND operation on the contents of the accumulator and a reference to a VAR_IN_OUT parameter Fehler The operation cannot be carried out since the VAR_IN_OUT parameter cannot be accessed outside the procedure call Invalid call example 3 LD V1 Loading a V1 variable in the accumulator InOutFB V2 Calling the procedure with assignment of the actual parameter V2 to the VAR_IN_OUT pa
45. 0 the value of the link is set to 0 If this project setting is set to 1 the link maintains the old value it had during the last correctly executed cycle Please refer to Maintain output links on disabled EF see Unity Pro Operating Modes EN ENO handling with function procedure blocks that have one variable and one link as output parameters FUNC PROC 1 FUNC PROC 2 EN ENO EN ENO INI1 OUT OUTI INI OUT IN2 IN2 If EN of FUNC_PROC_1 is set to 0 the value of the link on output OUT of FUNC_PROC_1 depends on the project setting Maintain output links on disabled EF available since Unity Pro 4 1 If this project setting is set to 0 the value of the link is set to 0 352 35006144 07 2012 Function Block Language FBD If this project setting is set to 1 the link maintains the old value it had during the last correctly executed cycle Please refer to Maintain output links on disabled EF see Unity Pro Operating Modes The OUT 1 variable on the same pin either retains its previous status or can be changed externally without influencing the link The variable and the link are saved independently of each other The output behavior of the FFBs does not depend on whether the FFBs are invoked without EN ENO or with EN 1 NOTE For disabled function blocks EN 0 with an internal time function e g function
46. 245 246 247 248 249 250 251 252 253 254 255 35006144 07 2012 213 System Objects Description of System Words SW144 to SW146 Detailed Description Description of system words SW144 to SW146 Word Symbol Function Description Initial state SW144 BAOPMOD Fipio bus arbiter function operating mode This system word is used to start and stop the bus arbiter function and the producer consumer function It can modify the starting automatic and manual modes of the bus in the event of a stop SW144 0 e 1 producer consumer function in RUN e 0 producer consumer function in STOP no variables are exchanged on the bus e SW144 1 1 bus arbiter is in RUN 0 e 0 bus arbiter is in STOP no variables or message scanning is carried out on the bus e SW144 2 1 automatic start in the event of an automatic bus stop e 0 manual start in the event of an automatic bus stop SW144 3 to 15 reserved SW144 3 1 SW144 4 to 15 0 0 SW145 BAPARAM Modification of Fipio Bus Arbiter Parameters The bits are set to 1 by the user and reset to 0 by the system when initialization has been carried out SW145 0 1 modification of the priority of the bus arbiter the most significant byte for this system word contains the value of the priority of the bus arbiter which is to be applied to the bus e SW145 1 and SW145 2 are reserved
47. Derived data family DDT This family includes table ARRAY and structure user or IODDT object types Generic data families ANY_ARRAY_xxx The function block family FB This family includes EFB and DFB object types 590 35006144 07 2012 Description of DFBs Authorized Objects for the Different Parameters For performances reasons the addressing mode of the DFB parameters must be transferred by address for the following object families e Inputs e Inputs Outputs e Outputs The addressing mode of a Function Block element is linked to the element type The addressing modes are passed by Value VAL Relocation table entry RTE Logical address RTE Offset L ADR Logical address and number of elements L ADR LG IO channel structure IOCHS For each of the DFB parameters the following object families may be used with its associated addressing modes Object EDT STRING Anonymous _ ppt 1 IODDT GDT FB ANY families or DDT array ANY_ARRAY_x Inputs VAL L ADR LG L ADR LG L ADR_ No L ADR LG No L ADR LG Inputs out L ApR 2 L ADR LG L ADR LG L ADR_ IOCHS see L ADR LG No L ADR LG puts page 611 Outputs VAL VAL L ADR LG VAL No L ADR LG No L ADR LG Public VAL VAL VAL VAL No No No No variables Private VAL VAL VAL VAL No No RTE No variables Key 1 Derived data family except input output derived data types IODDT 2 Except f
48. END WHILE Toop as long as CHR 106 IF CHR 106 CHR 116 7 THEN EXIT a ELSE CHR 114 CHR 104 CHR 116 CHR 106 END IF INC CHR 200 END FOR 35006144 07 2012 599 Description of DFBs 600 35006144 07 2012 User Function Blocks DFB Instance 18 Subject of this Chapter This chapter provides an overview of the creation of a DFB instance and its execution What Is in This Chapter This chapter contains the following topics Topic Page Creation of a DFB Instance 602 Execution of a DFB Instance 603 Programming Example for a Derived Function Block DFB 604 35006144 07 2012 601 DFB instance Creation of a DFB Instance DFB Instance A DFB instance is a copy of the DFB model DFB type e t uses the DFB type code the code is not duplicated e Itcreates a data zone specific to this instance which is a copy of the parameters and variables of the DFB type This zone is situated in the application s data area You must identify each DFB instance you create with a name of a maximum 32 characters the authorized characters used depend on the choice made in the Identifiers area of the Language extensions tab in the Project Settings see Unity Pro Operating Modes The first character must be a letter Keywords and symbols are prohibited Creation of an Instance From a DFB type you can create as many instances as necessary the only limitat
49. F See tables of Modbus Plus and SY MAX EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual e SY MAX specific Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual e TCP IP EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual CWRITE_REG E_EFB_MSTR_ERROR _ IF 30191 16 8A11 MSTR communication error CWRITE_REG F 8195 16 2003 Value displayed in status word Comes together with E _EFB_MSTR_ERROR CWRITE_REG F 8206 16 200E Value displayed in status word Comes together with E EFB_NOT_STATE_RAM_4X 35006144 07 2012 633 EFB Error Codes and Values EFB name Error code ENO state in case of error Error value in Dec Error value in Hex Error description CWRITE_REG F See tables of e Modbus Plus and SY MAX EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual e SY MAX specific Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual e TCP IP EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual MBP_MSTR E_EFB_OUT_OF_ RANGE 30192 16 8A10 Internal error EFB has detected a violation e g write exceeds MW 4x boundaries MBP_MSTR E_EFB_NOT_STATE RAM_4X 30531 16 88BD Variable not mapped to
50. IP subnetwork mask This double word SD143 receives the subnetwork mask of the Ethernet link 0 SW145 and SW146 IP_GATEWAY Default Ethernet gateway address This double word SD145 receives the address of the default Ethernet gateway SW147 to SW149 MAC _ADDR1 to 3 MAC Addresses The words SW147 SW148 SW149 code the addresses MAC 1 MAC 2 and MAC 3 respectively SW150 Coprocessor version This word codes the coprocessor version for 140 CPU 671 60 140 CPU 672 61 and 140 CPU 672 60 PLCs The version is displayed in hexadecimal format SW151 BOARD_STS Status of Ethernet link This word codes the status of the Ethernet link e Bit 0 0 if the Ethernet link is stopped Bit 1 0 Bit 2 O half duplex mode 1 full duplex Bit 3 0 Bits 4 to 11 7 for Quantum 6 for Hot Standby Quantum Bit 12 0 10 Mbits link 1 100 Mbits link Bit 13 0 10 100Base TX link twisted pair Bit 14 0 Bit 15 0 Ethernet link inactive 1 Ethernet link active SW152 to SW153 ERIO DROP ERROR Detected ERIO Drop error status The bits of words SW152 to SW153 are associated with the detected Ethernet RIO Drop status The bit is set to 0 if at least one I O module in the drop has detected error It is set to 1 if all modules are operating correctly SW152 0 Drop No 1 SW152 1 Drop No 2 SW153 14 Drop No 31 SW160 to SW167 REFRESH IO Device operating status d
51. IW lt mod gt lt c gt lt d gt IW4 2 3 1 R DINT type double word ID lt mod gt lt c gt ID4 2 3 R D lt mod gt lt c gt lt d gt ID4 2 3 2 R Read type REAL floating point IF lt mod gt lt c gt IF4 2 3 R IF lt mod gt lt c gt lt d gt IF 4 2 3 2 R Q outputs EBOOL type bit Q lt mod gt lt c gt Q4 20 3 R W Q lt mod gt lt c gt lt d gt Q4 20 30 1 R W INT type word QW lt mod gt lt c gt WQW4 2 3 R W QW lt mod gt lt c gt lt d gt QW4 2 3 1 R W DINT type double word QD lt mod gt lt c gt QD4 2 3 R W QD lt mod gt lt c gt lt d gt QD4 2 3 2 R W Read type REAL floating point QF lt mod gt lt c gt QF4 2 3 R W QF lt mod gt lt c gt lt d gt QF4 2 3 2 R W M variables Premium INT type word MW lt mod gt lt c gt MW4 2 3 R W MW lt mod gt lt c gt lt d gt MW4 2 3 1 R W DINT type double word MD lt mod gt lt c gt MD4 2 3 R W MD lt mod gt lt c gt lt d gt MD4 2 3 2 R W Read type REAL floating point MF lt mod gt lt c gt MF4 2 3 R W MF lt mod gt lt c gt lt d gt MF4 2 3 2 R W 322 35006144 07 2012 Data Instances KF lt mod gt lt c gt lt d gt KF4 2 3 12 Syntax Example Program access rights K Constants Modicon M340 and Premium INT type word KW lt mod gt lt c gt PKW4 2 3 R KW lt mod gt lt c gt lt d gt KW4 2 3 1 R DINT type double word KD lt mod gt lt c gt K
52. LEAD_LAG FP_ERROR F See table Common Floating Point Errors page 660 PCON2 E_ERR_DEN F 30152 16 8A38 Nota valid floating point number PCON2 W_WARN_ZDR_XRR_ IT 30105 16 7599 DR XRR lt 100 or XRR gt 100 PCON2 W_WARN_ZDR_T1T2 T 30104 16 7598 T2 gt T1 PCON2 FP_ERROR F See table Common Floating Point Errors page 660 PCON2 E_ERR_ZDR_HYS F 30106 16 8A66 2 IUZI lt IHYSI PCON3 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number PCON3 W_WARN_ZDR_XRR_ IT 30105 16 7599 DR XRR lt 100 or XRR gt 100 PCON3 W_WARN_ZDR_T1T2 T 30104 16 7598 T2 gt T1 PCON3 FP_ERROR F See table Common Floating Point Errors page 660 PCON3 E_ERR_ZDR_HYS F 30106 16 8A66 2 IUZI lt IHYSI PD_OR_PI E_ERR_DEN F 30152 16 8A38 Not a valid floating point number PD_OR_PI WAF_PDPI_OG_UG F 30103 16 8A69 YMAX lt YMIN PD_OR_PI FP_ERROR F See table Common Floating Point Errors page 660 PDM PDM_TMAX_TMIN F 30115 16 8A5D t_max lt t_min PDM PDM_OG_UG F 30114 16 8A69 pos_up_xl gt pos_lo_xl or Ineg_up_x gt Ineg_lo_xl PDM FP_ERROR F See table Common Floating Point Errors page 660 PI E_ERR_DEN 30152 16 8A38 Not a valid floating point number PI E_ERR_PI_MAX_MIN F 30103 16 8A69 YMAX lt YMIN PI FP_ERROR See table Common Floating Point Errors page 660 PID E_ERR_DEN 30152 16 8A38 Not a valid floating point number PID E_ERR_PID_MAX_MIN F 30104 16 8A68 YMAX lt YMIN PID FP_ERR
53. Macro Steps and Macro Sections Macro Step Macro steps are used for calling macro sections and thus for hierarchical structuring of sequential controls Representation of a Macro Step MS_1_1 T Macro steps have the following properties e Macro steps can be positioned in Sequence Control sections and in macro sections e The number of macro steps is unlimited e The nesting depth i e macro steps within macro steps is to 8 levels e Each macro step is implicitly allocated a variable of data type SFCSTEP_ STATE see SFCSTEP_STATE Variable page 423 e Macro steps can be allocated a variable of data type SFCSTEP_ TIMES see SFCSTEP_TIMES Variable page 423 e Macro steps can NOT be allocated with actions e Each macro step can be replaced with the sequence string in the allocated macro section Macro steps are a supplement to IEC 61131 3 and must be enabled explicitly Input Step Every macro section begins with an input step Representation of an input step MS_1_1_IN Input steps have the following properties e Input steps are automatically placed in macro sections by the SFC editor e Only 1 individual input step is placed for each macro section e An input step cannot be deleted copied or inserted manually e Each input step is implicitly allocated a variable of data type SFCSTEP_ STATE see SFCSTEP_STATE Variable page 423 e Input steps can be allocated a variable
54. and TSX P57 5e PLCs NOTE SW36 to SW339 have a specific function in Quantum Safety PLCs refer to Unity_Pro_XLS Software Operating Modes Specifics guide for more details 190 35006144 07 2012 System Objects Description of System Words SW48 to SW59 Detailed Description Description of system words 3SwW48 to 3SW59 Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW48 Number of This word indicates the IO events and 0 YES YES YES IOEVTNB events telegram processed since the last cold except start This word can be written by the for safety program or the terminal PLCs This word is not available on Quantum safety PLCs NOTE TELEGRAM is available only for PREMIUM not on Quantum or M340 SW49 Real time System words containing date and YES YES YES DAYOFWEEK clock current time in BCD SW50 function e Sw49 day of the week SEC e 1 Monday SW51 2 Tuesday HOURMIN 3 Wednesday SW52 e 4 Thursday MONTHDAY e 5 Friday SW53 e 6 Saturday YEAR e 7 Sunday Sw50 Seconds 16 SS00 SW51 Hours and Minutes 16 HHMM SW52 Month and Day 16 MMDD e SW53 Year 16 YYYY These words are managed by the system when the bit S50 is set to 0 These words can be written by the user program or by the terminal when the bit S50 is set to 1 35006144 07 2012 191 System Objects
55. different parts Cpt_bolts MD10 Cpt_parts Reset Done Presel Count Q2 1 Cpt_nuts MD12 Cpt_parts Reset Done Presel Count a we Q2 2 Cpt_screws MD14 Cpt_parts Reset Done Presel Count Q2 3 606 35006144 07 2012 Use of the DFBs from the Different Programming Languages 1 9 Subject of this Chapter This chapter provides an overview of DFB instance calls made using the different programming languages What Is in This Chapter This chapter contains the following topics Topic Page Rules for Using DFBs in a Program 608 Use of IODDTs in a DFB 611 Use of a DFB in a Ladder Language Program 614 Use of a DFB in a Structured Text Language Program 616 Use of a DFB in an Instruction List Program 619 Use of a DFB in a Program in Function Block Diagram Language 623 35006144 07 2012 607 Use of DFBs Rules for Using DFBs in a Program General DFB instances can be used in all languages Instruction List IL Structured Text ST Ladder LD and Function Block Diagram FBD and in all the tasks of the application program sections subroutine etc except for SFC program transition General Rules of Use When using a DFB you must comply with the following rules for whatever language is being used e Itis not necessary to conne
56. e Attempting to divide by 0 e Operands do not contain the correct data type for the operation e The result of a numerical operation exceeds the value range of its data type 35006144 07 2012 479 Instruction List IL IEC Conformity For a description of IEC conformity for the IL programming language see IEC Conformity see page 661 480 35006144 07 2012 Instruction List IL Operands Introduction Data Types Operators are used for operands An operand can be an address a literal a variable a multi element variable an element of a multi element variable an EFB DFB output or an EFB DFB call The operand and the current accumulator content must be of the same type Should operands of various types be processed a type conversion must be performed beforehand In the example the integer variable i1 is converted into a real variable before being added to the real variable r4 Dy 2a INT TO REAL ADD r4 ST r3 As an exception to this rule variables with data type TIME can be multiplied or divided by variables with data type INT DINT UINT or UDINT Permitted operations e LD timeVarl DIV dintVarl ST timeVar2 e LD timeVarl MUL intVarl ST timeVar2 e LD timeVarl MUL 10 ST timeVar2 This function is listed by IEC 61131 3 as undesired service 35006144 07 2012 481 Instruction List IL Direct Use of Addresses Addresses can be used directly without a previo
57. e the program task descriptors and executable code constant words initial values and configuration of inputs outputs The data and program are supported by the processor module s internal RAM The following diagram describes the memory structure Internal A Saved data Flash Memory MW backup For Data see graphic above also State RAM is available if you select Mixed topological and State RAM in the Configuration tab of a Modicon M340 processor see Unity Pro Operating Modes To use this option you need Unity Pro 6 1 or later and Modicon M340 firmware 2 4 or later NOTE If you want to import a legacy LL984 Compact application which uses Modbus request to communicate with an HMI you have to use State RAM addressing to preserve the Modbus exchange between PLC and HMI 35006144 07 2012 117 Memory Structure Program Backup The State RAM contains the following located data Address Object address Data use 0XXXXX Qr m c d Mi output module bits and internal bits 1XXXXX lr m c d li input module bits SXXXXX IWr m c d IWi input words of input output modules 4XXXXX QWr m c d MWi_ output words of input output modules and internal words NOTE Not all data represented in topological addressing is available in State RAM Please refer to Topological State RAM Addressing of Modicon M340 Discrete Modules see Modicon M340 Using Unity Pro Discrete Input
58. fb1_c_presel Int Set point AMW102 adjust_tempo_0 Int logonv Real OK Cancel These operations can be done either in the data editor or in the properties editor in the same way as in offline mode 44 35006144 07 2012 Presentation CAUTION UNEXPECTED APPLICATION BEHAVIOR When changing the type of a variable the new value of the variable to be modified depends on its kind e Inthe case of an unlocated variable the variable is set to the initial value if one exists Otherwise it is set to the default value e Inthe case of a located variable the variable restarts with the initial value if one exists Otherwise the current binary value is unchanged Before applying the variable type change check the impact of the new value of the variable on the application execution Failure to follow these instructions can result in injury or equipment damage NOTE It is not possible to modify the type of a variable declared in Derived Data Type DDT in online mode see Unity Pro Operating Modes The application has to be switched into offline mode see Unity Pro Operating Modes in order to build such a modification Restrictions About Online Modifications In the following cases the online type modification of a variable or of a Function Block FB is not allowed e lf the variable is used as network global data th
59. the bit S21 indicates the first cycle of this task including after a cold start with automatic start in run and a warm start S21 is set to 1 at the start of the cycle and reset to zero at the end of the cycle Note The bit S21 does not have the same meaning in PL7 as in Unity Pro YES YES YES 166 35006144 07 2012 System Objects Description of System Bits S30 to S59 Detailed Description Description of system bits S30 to S59 Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S30 Activation Normally set to 1 The master task is 1 YES YES YES MASTACT deactivation deactivated when the user sets the bit to 0 except for of the master This bit is taken into consideration by the safety PLCs task system at the end of each MAST task cycle This bit is not available on Quantum safety PLCs S31 Activation Normally set to 1 when the user creates the 1 YES YES YES FASTACT deactivation task The task is deactivated when the user except for of the fast sets the bit to 0 safety PLCs task This bit is not available on Quantum safety PLCs S32 Activation Normally set to 1 when the user creates the 0 NO YES YES AUXOACT deactivation task The auxiliary task is deactivated when except for of the the user sets the bit to 0 safety PLCs auxiliary This bit is not available on Quantum safety task 0 PLCs
60. 546 35006144 07 2012 Structured Text ST Select Instruction CASE OF END_ CASE Description The CASE instruction consists of an INT data type expression the selector anda list of instruction groups Each group is provided with a tag which consists of one or several whole numbers INT DINT UINT UDINT or ranges of whole number values The first group is executed by instructions whose tag contains the calculated value of the selector Otherwise none of the instructions will be executed The OF instruction indicates the start of the tag An ELSE instruction may be carried out within the CASE instruction whose instructions are executed if no tag contains the selector value The END_CASE instruction marks the end of the instruction s Example CASE OF END_CASE ExampleCaAsE OF END CASE Selector CASE SELECT OF 1 5 C SIN A COS B 2 ZAN Tags aa o o BC OA 6 10 C A ELSE B C A C A B END_CASE See Also ELSE see page 545 35006144 07 2012 547 Structured Text ST Repeat Instruction FOR TO BY DO END_FOR Description The FOR instruction is used when the number of occurrences can be determined in advance Otherwise WHILE see page 551 OfREPEAT see page 552 are used The FOR instruction repeats an instruction sequence until the END_ FOR instruction The number of occurrences is
61. Device DDT structures like DDT structures can contain e EDT e DDT e Array of EDT and DDT The DDT types are structures whose size the number of elements of which they are composed depends on the channel or the input output module that they represent In the current implementation an I O Module supports only one Device DDT type The difference with a conventional structure is that e the DDT structure is predefined by the manufacturer e the DDT structure supports EBOOL e the DDT structure supports type with extracted bits 35006144 07 2012 293 Data Types 8 7 Function Block Data Types DFB EFB Subject of this Section This section describes function block data types These are e user function blocks DFB e elementary function blocks EFB What Is in This Section This section contains the following topics Topic Page Overview of Function Block Data Type Families 295 Characteristics of Function Block Data Types EFB DFB 297 Characteristics of Elements Belonging to Function Blocks 299 294 35006144 07 2012 Data Types Overview of Function Block Data Type Families Introduction Function block data type families are e the Elementary Function Block EFB see page 245 type family e the User function block DFB see page 245 type family Function blocks pa R N EFB DFB Illustration Function blocks are entities containing e input and output variables acti
62. Execution of Quantum Sections with Remote Inputs Outputs 95 35006144 07 2012 89 Program Structure Description of the Master Task Cycle General Illustration The program for a mono task application is associated with a single user task the master task see page 79 You can choose the type of master task execution e cyclic e periodic The following illustration shows the operating cycle Acquisition of inputs Program processing Updating of outputs E Description of the Different Phases The table below describes the operating phases Phase Description Acquisition of Writing to memory of the status of the data on the inputs of the discrete and inputs application specific modules associated with the task These values can be modified by forcing values Program Execution of application program written by the user processing Updating of Writing of output bits or words to the discrete or application specific outputs modules associated with the task depending on the state defined by the application As for the inputs the values written to the outputs can be modified by forcing values NOTE During the input acquisition and output update phases the system also implicitly monitors the PLC management of system bits and words updating of current values of the real time clock updating of status LEDs and LCD screens not for Modicon M340
63. External memory card y A y Unlocated data Program Files NOTE On processors with 2 memory card slots the lower slot is reserved for the file storage function 122 Memory Structure Detailed Description of the Memory Zones User Data This zone contains the located and unlocated application data e located data e M S Boolean and MW SW numerical data e data associated with modules l Q IW QW KW etc e unlocated data e Boolean and numerical data instances e EFB and DFB instances User Program and Constants This zone contains the executable codes and constants of the application e executable codes e program code e code associated with EFs EFBs and the management of I O modules e code associated with DFBs e constants e KW constant words e constants associated with inputs outputs e initial data values This zone also contains the necessary information for downloading the application graphic codes symbols etc Other Information Other information relating to the configuration and structure of the application are also stored in the memory in a data or program zone depending on the type of information e Configuration other data relating to the configuration hardware configuration software configuration e System data used by the operating system task stack etc e Diagnostics information relating to process or system diagnostics diagnostics buffer
64. Inputs Calling the same function in FBD LIMIT 0 MN H out varl IN 5 var MX With informal calls it is not necessary to assign a value to all formal parameters see also Parameters page 560 This is a supplement to IEC 61131 3 and must be enabled explicitly An empty parameter field is used to skip a parameter Call with empty parameter field out LIMIT varl 5 var Calling the same function in FBD LIMIT MN H out vari IN 5 var MX An empty parameter field does not have to be used if formal parameters are omitted at the end out LIMIT 0 varl Calling the same function in FBD LIMIT 0 MN out varl IN 35006144 07 2012 563 Structured Text ST Nesting Functions EN and ENO A function call can include the call of further functions The nesting depth is not limited Nested call of array function out LIMIT MN 4 IN MUL IN1 varl IN2 var2 MX 5 Calling the same function in FBD LIMIT MUL 4 MN out vari JIN1 OUT IN var2 j IN2 5 MxX Functions that return a value of the ANY_ARRAY data type can not be used within a function call Unauthorized nesting with ANY ARRAY ANY_ARRAY out LIMIT MN 4 IN EXAMP IN1 varl1 IN2 var2 MX 5 ANY_ARRAY is permitted as the return value of the function called or as a parameter of the nested functions Authoriz
65. MY_COUNT CTU varl 4CU QF reset R PV CV F 570 35006144 07 2012 Structured Text ST Calling a Function Block without Inputs Even if the function block has no inputs or the inputs are not to be parameterized the function block should be called before its outputs can be used Otherwise the initial values of the outputs will be transferred i e 0 E g Calling the function block in ST MY_ CLOCK MY_ COUNT CU MY_CLOCK CLK1 R reset PV 100 Q gt out CV gt current Calling the same function block in FBD MY_CLOCK MY_COUNT SYSCLOCK CTU CLK1 CU Qt out CLK2 rest 7R CLK3 100 4 PV cv current CLEK4 CLE5 TIMER Multiple Function Block Instance Call Function block DFB instances can be called multiple times other than instances of communication EFBs these can only be called once Calling the same function block DFB instance more than once makes sense for example in the following cases e f the function block DFB has no internal value or it is not required for further processing In this case memory is saved by calling the same function block DFB instance more than once since the code for the function block DFB is only loaded once The function block DFB is then handled like a Function e f the function block DFB has an internal value and this is supposed to influence various program segments for example
66. Note 4 page 674 I NSERT function Note 4 page 674 D ELETE function Note 4 page 674 R EPLACE function Note 4 page 674 FIND function Note 4 page 674 35006144 07 2012 669 IEC Compliance Table No Feature No Description of Feature 30 la ADD function Note 6 page 676 1b ADD_TIME function 2b ADD_TOD_TIME function 3b ADD_DT_TIME function 4a SUB function Note 6 page 676 4b SUB_TIME function 5b SUB_DATE_DATE function 6b SUB_TOD_TIME function 7b SUB_TOD_TOD function 8b SUB_DT_TIME function 9b SUB_DT_DT function 10a MUL function Note 6 page 676 10b MULT IME function 11a DIV function function Note 6 page 676 11b DIVTIME function 33 la RETAIN qualifier for internal variables Note 11 page 676 2a RETAIN qualifier for output variables Note 11 page 676 2b RETAIN qualifier for input variables Note 11 page 676 3a RETAIN qualifier for internal function blocks Note 11 page 676 4a VAR_IN_OUT declaration textual 4b VAR_IN_OUT declaration and usage graphical 4c VAR_IN_OUT declaration with assignment to different variables graphical 34 1 Bistable Function Block set dominant 2 Bistable Function Block reset dominant 35 1 Rising edge detector 2 Falling edge detector 670 35006144 07 2012 IEC Compliance
67. Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt SKF lt i gt SQF IF by using their topological address for example 3MD0 6 0 11 3MFO 6 0 31 For Modicon M340 PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt are not available According to the IEC standard mw indicates a memory word type language object For Premium Atrium PLCs double type instances of located data SMD lt i gt sKD lt i gt or floating SMF lt i gt SKF lt i gt should be located by an integer type SMW lt i gt SKW lt i gt Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt SKF lt i gt SQF SIF by using their topological address for example 3MD0 6 0 11 3MFO 6 0 31 For Modicon M340 PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt are not available According to the IEC standard Q indicates a discrete output type language object 35006144 07 2012 693 Glossary QD According to the IEC standard Mw indicates an output double word type language object Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt SKF lt i gt SQF IF by using their topological address for example 3MD0 6 0 11 MFO 6 0 31 QF According to the IE
68. SW108 to SW116 0 205 Description of System Words SW123 to SW127 020 206 6 3 Atrium Premium specific System Words 0 000 cee eee 208 Description of System Words SWE0 to SWE5 0 006 209 Description of System Words SW128 to SW143 0 00 213 Description of System Words SW144 to SW146 214 Description of System Words SW147 to SW152 0 216 Description of System Word SW153 0 02 217 Description of System Word SW154 1 ee 219 Description of Premium Atrium System Words SW155 to SW167 220 6 4 Quantum specific System Words 00 0c cece eee 221 Description of Quantum System Words SWE60 to SW66 222 Description of Quantum System Words SW98 to SW109 227 Description of Quantum System Words SW110 to SW177 228 Description of Quantum System Words SW180 to SW702 231 6 5 Modicon M340 Specific System Words 0 000 e eee eee 238 Description of System Words SW138 to SW141 SW142 to SW145 SW146 and SW147 SW150 to SW154 SW160 to PSWT osc cients hah cet te nd Pah aee aSts a e tated tithe eo hes 238 Part Ill Data Description 000 cee eee eee eee 241 Chapter 7 General Overview of Data 00e ee eeeees 243 General sarren Aaa ERE eoue a Reel Sele AAA DA 244 General Overview of the Data Type Families 0 245 Overview of Data Instances 0
69. SW145 3 to SW145 7 reserved on 0 e SW145 8 to SW145 15 this byte contains the value which is applied to the bus according to the value of bit 0 These parameters can be modified when the bus arbiter is in RUN but for them to be taken into account by the application the BA must be stopped then restarted SW146 BASTATUS Fipio bus arbiter function display The least significant byte indicates the status of the producer consumer function The most significant byte indicates the status of the bus arbiter function Byte value e 16 00 the function does not exist no Fipio application e 16 70 the function has been initialized but is not operational in STOP e 16 FO the function is currently being executed normally in RUN 214 35006144 07 2012 System Objects 4 CAUTION UNINTENDED SYSTEM BEHAVIOR Modifying the SW144 and SW145 system words can cause the PLC to stop Failure to follow these instructions can result in injury or equipment damage 35006144 07 2012 215 System Objects Description of System Words SW147 to SW152 Detailed Description Description of system words SW147 to SW152 Word Function Description Initial Symbol state SW147 MAST network A value which is not zero indicates in ms the value of the MAST task 0 TCRMAST cycle time network cycle time TCRMAST SW148 FAST network A value which is
70. This page has a grid that divides the section into rows and columns A width of 11 64 columns and 17 2000 lines can be defined for LD sections The LD programming language is cell oriented i e only one object can be placed in each cell Processing Sequence IEC Conformity The processing sequence of the individual objects in an LD section is determined by the data flow within the section Networks connected to the left power rail are processed from top to bottom link to the left power rail Networks that are independent of each other within the section are processed according to their position from top to bottom see also Execution Sequence and Signal Flow page 403 For a description of IEC conformity for the LD programming language see IEC Conformity see page 661 372 35006144 07 2012 Ladder Diagram LD Contacts Introduction A contact is an LD element that transfers a status on the horizontal link to its right side This status is the result of a Boolean AND operation on the status of the horizontal link on the left side with the status of the relevant Boolean actual parameter A contact does not change the value of the relevant actual parameter Contacts take up one cell The following are permitted as actual parameters Boolean variables Boolean constants Boolean addresses topological addresses or symbolic addresses ST expression see page 529 delivering a Boolean result e g VarA OR VarB
71. Writing the output parameters NOTE The internal variables of DFBs are not reinitialized when using Build project online command after an input modification To reinitialize all internal variables use Rebuild all project command Debugging of DFBs The Unity Pro software offers several DFB debugging tools e animation table all parameters and public and private variables are displayed and animated in real time Objects may be modified and forced e breakpoint step by step and program diagnostics e runtime screens for unitary debugging 35006144 07 2012 603 DFB instance Programming Example for a Derived Function Block DFB General This example of programming a counter using a DFB is provided for instruction purposes Characteristics of the DFB Type The DFB type used to create the counter is as follows Cpt_parts Reset Done EBOOL BOOL Presel DINT Count EBOOL V_cour DINT The elements of the Cpt_ parts DFB type are as follows Elements Description Name of the DFB type Cpt_parts Input parameters e Reset counter reset EBOOL type e Presel Preset value of the counter DINT type e Count upcounter input EBOOL type Output parameters Done preset value reached output BOOL type Public internal variable V_cour current value of the counter DINT type 604 35006144 07 2012 DFB instance Operation of the Counter Th
72. follows e Using Links Instead of Actual Parameters e Network Positions The procedure for defining changing the execution sequence of networks is as follows e Positioning of Objects The following representation shows two networks for which the execution sequences are only defined by their position within the section without taking into account that block 0 4 0 5 and 0 7 0 8 require another execution sequence 1 ADD ADD EN ENO ADD EN ENO ADD i EN ENO BL 6 7 ADD ADD 7 EN ENO EN ENO ma 8 ADD s EN ENO B 35006144 07 2012 407 Ladder Diagram LD Link Instead of Actual Parameter By using a link instead of a variable the two networks are run in the proper sequence see also Original Situation page 407 1 w ADD EN ADD g ENO ADD 2 5 EN ENO ADD e EN ENO ADD s ADD EN ENO EN ENO gt a 8 ADD 6 EN ENo 408 35006144 07 2012 Ladder Diagram LD Network Positions The correct execution sequence can be achieved by changing the position of the networks in the section see also Original Situation page 407 6 vE ADD ADD EN ENO EN ENO ADD EN ENO ADD ADD EN ENO
73. other than the master task until the end of the first master task cycle the positioning of charts to initial steps the cancellation of any forcing the initialization of message and event queues the sending of configuration parameters to all discrete input output modules and application specific modules For this first restart cycle the system does the following e relaunches the master task with the S0 cold restart and S13 first cycle in RUN bits set to 1 and the SW10 word detection of a cold restart during the first task cycle is set to 0 e resets the S0 and S13 bits to 0 and sets each bit of the word SW10 to 1 at the end of this first cycle of the master task e activates the fast task and event processing at the end of the first cycle of the master task Processing a Cold Start by Program It is advisable to test the bit SW10 0 to detect a cold start and start processing specific to this cold start NOTE It is possible to test the bit SO if the parameter Automatic start in RUN has been selected If this is not the case the PLC starts in STOP the bit SO then switches to 1 on the first cycle after restart but is not visible to the program because it is not executed 35006144 07 2012 149 Operating Modes Output Changes for Premium and Atrium As soon as a power outage is detected the outputs are set in the fallback position e either they are assigned the fallback value or e the c
74. page 676 35006144 07 2012 671 IEC Compliance Table No Feature No Description of Feature 44 1 Action qualifier in action block supported N Action name in action block supported 45 None no qualifier Qualifier N Qualifier R Qualifier s Qualifier L Qualifier D Qualifier P Qualifier DS OINI OO Oo BR WO DM k Qualifier P1 N Qualifier PO 45a N Action control without final scan 46 ak Single sequence N w Divergence of sequence selection left to right priority of transition evaluations Convergence of sequence selection Simultaneous sequences divergence and convergence 5a Sequence skip left to right priority of transition evaluations 6a Sequence loop left to right priority of transition evaluations 49 CONFIGURATION END_ CONFIGURATION construction Note 12 page 676 5a Periodic TASK construction 5b Non periodic TASK construction 6a WITH construction for PROGRAM to TASK association Note 9 page 676 6c PROGRAM declaration with no TASK association Note 10 page 676 50 5a Non preemptive scheduling Note 13 page 676 5b Preemptive scheduling Note 14 page 676 672 35006144 07 2012 IEC Compliance Note 1 Note 2 List of type conversion functions
75. the value of a counter should be increased in different parts of the program In this case calling the same function block DFB means that temporary results do not have to be saved for further processing in another part of the program 35006144 07 2012 571 Structured Text ST EN and ENO With all function blocks DFBs an EN input and an ENO output can be configured If the value of EN is equal to 0 when the function block DFB is called the algorithms defined by the function block DFB are not executed and ENO is set to 0 If the value of EN is equal to 1 when the function block DFB is invoked the algorithms which are defined by the function block DFB will be executed After the algorithms have been executed successfully the value of ENO is set to 1 If an error occurred while executing the algorithms ENO is set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if EN equals to 1 If ENO is set to 0 results from EN 0 or an error during execution the outputs of the function block DFB retain the status from the last cycle in which they were correctly executed The output behavior of the function blocks DFBs does not depend on whether the function blocks DFBs are called without EN ENO or with EN 1 If EN ENO are used the function block call must be formal The assignment of variables to
76. variable editor Located data instances have a predefined memory location in the PLC and this location is known by the user e Topological address for input output modules e Global address M340 Premium or State RAM M340 Quantum Located data instances are defined using data types belonging to one of the following families e Elementary Data Types EDT e Derived Data Types DDT e Input Output Derived Data Types IODDT The list below shows the datas instances that should be located on a MW KW addresses type e INT e UINT e WORD e BYTE e DATE e DT e e e e e STRING TIME TOD DDT structure type Table EBOOL or EBOOL tables datas instances have to be located on a M Q or SI addresses type IODDT datas instances type have to be located by cH module channel type NOTE Double type instances of located data DINT DUNIT DWORD or floating REAL should be located by mw KW addresses type Only I O objects instances type localization is possible with sMD lt i gt SKD lt i gt QD ID MF lt gt KF lt gt SOF SIF type by using their topological address for example MD0 6 0 11 MFO0 6 0 31 NOTE For Modicon M340 the index i value must be even see page 288 for double type instances of located data sMw and kw 35006144 07 2012 313 Data Instances Examples Var_1 EBOOL AT M100 nstance of EDT family of Boolean type with 1 byte memory a
77. 00 40 AVO 020 00 01 00 unication 40 CRP 811 00 01 00 40 CRP 93X 00 01 00 40 EIA 921 00 01 00 40 NOE 211 00 01 00 40 NOE 251 00 01 00 Cut Copy B Insert Delete Module Open Module Move Module Power Supply and I O Budget Copy Insert ew Device T ee gt One of the following shortcut menus is called depending on the position of the mouse pointer e Mouse pointer on the background allows among others e Change CPU e Selection of different Zoom factors e Mouse pointer on the module allows among others e Access to editor functions delete copy move e Open the module configuration for defining the module specific parameters e Show the I O properties and the total current e Mouse pointer on an empty slot allows among others e Insert a module from the catalog e Insert a previously copied module including its defined properties 350061 44 07 2012 33 Presentation Module Configuration The module configuration window called via the modules shortcut menu or a double click on the module is used to configure the module This also includes channel selection selection of functions for the channel selected assignment of State RAM addresses only Quantum etc Module configuration window for a Premium I O module Bl 0 2 TSX EY 414 4 AN
78. 1 TRUE A BOOL type word extract bit for example sMW10 4 35006144 07 2012 697 Glossary Break point BYTE Constants CPU Cyclic execution Used in the debug mode of the application It is unique one at a time and when reached signals to the processor to stop the program run Used in connected mode it can be positioned in one of the following program elements e LD network e Structured Text Sequence or Instruction List e Structured Text Line Line mode When 8 bits are put together this is callad a BYTE A BYTE is either entered in binary or in base 8 The BYTE type is coded in an 8 bit format which in hexadecimal ranges from 16 00 to L6 FF C An INT DINT or REAL type variable located in the constant field sk or variables used in direct addressing SKW SKD or SKF The contents of these cannot be modified by the program during execution Is the abbreviation of Control Processing Unit This is the microprocessor It is made up of the control unit combined with the arithmetic unit The aim of the control unit is to extract the instruction to be executed and the data needed to execute this instruction from the central memory to establish electrical connections in the arithmetic unit and logic and to run the processing of this data in this unit We can sometimes find ROM or RAM memories included in the same chip or even I O interfaces or buffers The mas
79. 1 to 0 and at the same time the status of the left connection is 1 Otherwise the status of the right link is 0 In the example a negative edge of the variable A is supposed to be recognize and B should therefore be set for a cycle A B N ly W 396 35006144 07 2012 Ladder Diagram LD Forcing Bits Anytime the value bit of A equals 0 and the history bit equals 1 B is set to 1 fora cycle cycle 2 and 8 o g E ao A 8 0 a are ve l vate A History Bit o 2 m B Value bit zo Ze _ x When forcing bits the value of the variable determined by the logic will be overwritten by the force value In the example a negative edge of the variable A is supposed to be recognized and B should therefore be set for a cycle A B N y Ld Anytime the value bit or force bit of A equals 0 and the history bit equals 1 B is set to 1 for a cycle cycle 1 and 8 0828940 87 8 A Value bit gt A Force Bit m A History Bit pe B Value bit j i p 35006144 07 2012 397 Ladder Diagram LD Using BOOL and EBOOL Variables Edge recognition behavior using BOOL or EBOOL variables types can be different e When using a BOOL variable the system manages the history by allowing edge detection during the contact execution e When using an EBOOL variable the histor
80. 2 least significant half bytes Representation in BCD format of the date 2001 09 20 Year 2001 Month 09 Day 20 0010 0000 0000 0001 0000 1001 0010 0000 The Date type is entered as follows D lt Year gt lt Month gt lt Day gt This table shows the lower upper limits in each field Field Limits Comment Year 1990 2099 Month 01 12 The left 0 is always displayed but can be omitted at the time of entry Day 01 31 For the months 01 03 05 07 08 10 12 01 30 For the months 04 06 09 11 01 29 For the month 02 leap years 01 28 For the month 02 non leap years Example Entry Comments D 2001 1 1 The left O of the month and the day can be omitted d 1990 02 02 The prefix can be written in lower case 266 35006144 07 2012 Data Types The Time of Day TOD Type At a Glance Syntax Rules The Time of Day type coded in 32 bit format contains the following information e the hour coded in an 8 bit field 2 most significant half bytes e the minutes coded in an 8 bit field 2 half bytes e the seconds coded in an 8 bit field 2 half bytes NOTE The 8 least significant bits are unused Representation in BCD format of the time of day 13 25 47 Hour 13 Minutes 25 Seconds 47 Least significant byte 0001 0011 0010 0101 0100 0111 Unused The Time of Day type
81. 23 TIME_OF_DAY DT 2000 01 01 12 25 23 DATE_AND_TIME 16 FFFO WORD UINT 16 9AF typed value UINT DWORD 16 FFFF typed value DWORD 35006144 07 2012 329 Data References References to Data Instances by Name Introduction What is a data instance reference see page 249 References to Instances of the EDT Family The user chooses a name symbol which can be used to access the data instance Valve_State BOOL Hopper_Content UINT Oven_Temperature INT AT MW100 Encoder Value WORD References to Instances of the DDT Family Tables The user chooses a name symbol which can be used to access the data instance Car Ve Instance name of the Vehicles type table Car 11 5 Ac s to car 11 of the color cor the or_range table onding to element 5 of 330 35006144 07 2012 Data References Structures The user chooses a name symbol which can be used to access the data instance Giving the 2 structures ADDRESS str STRING 20 Pc _ e UDINT Town STRING 20 IDENT Surname STRING 15 irst name STRING 15 UINT Birth DATE Location ADDRESS Person_1 IDENT Instance name of structure of IDENT type Person_1 Age Acc s to the age of Person_1l Person_1 Location Town Ac to the location where Per on_1 resides 35006144 07 2012 331 Data References References to Instances of the DFB EFB Families The user chooses a
82. 3110 4 Variablel If a transition section is used as a transition condition then the section name is used as the transition name Transition names maximum 32 characters must be unique over the entire project i e no other transition variable or section with the exception of the assigned transition section etc may exist with the same name There are no case distinctions The transition name must correspond with the standardized name conventions 436 35006144 07 2012 SFC Sequence Language Enabling a Transition A transition is enabled if the steps immediately preceding it are active Transitions whose immediately preceding steps are not active are not normally analyzed NOTE If no transition condition is defined the transition will never be active Triggering a Transition A transition is triggered when the transition is enabled and the associated transition conditions are satisfied Triggering a transition leads to the disabling resetting of all immediately preceding steps that are linked to the transition followed by the activation of all immediately following steps Trigger Time for a Transition The transition trigger time switching time can theoretically be as short as possible but can never be zero The transition trigger time lasts at least the duration of a program cycle 35006144 07 2012 437 SFC Sequence Language Transition Section Introduction For every transition a transitio
83. 443 SFC Sequence Language Properties of an Alternative Sequence The properties of an alternative sequence mainly depend on whether the sequence control is operating in single token or multi token mode See e Properties of an Alternative Sequence in Single Token see page 450 e Properties of an Alternative Sequence in Multi Token see page 462 444 35006144 07 2012 SFC Sequence Language Parallel Branch and Parallel Joint Introduction With parallel branches switching a single transition leads to a parallel activation of more than one maximum 32 step branches Execution is from left to right After this common activation the individual branches are processed independently from one another All parallel branches are grouped using a parallel joint according to IEC 61131 1 The transition following a parallel joint is evaluated when all the immediately preceding steps of the parallel joint have been set Combining a parallel branch with an alternative joint is only possible in Multi Token see page 465 operation Example of a Parallel Sequence Example of a Parallel Sequence S_5_10 35006144 07 2012 445 SFC Sequence Language Properties of a Parallel Sequence see e Properties of a Parallel Sequence in Single Token see page 450 e Properties of a Parallel Sequence in Multi Token see page 462 446 35006
84. 483 Instruction List IL Modifier Introduction Modifiers influence the execution of the operators see Operators page 486 Table of Modifiers Table of Modifiers Modifier Use of Description Operators of data type N BOOL BYTE The modifier N is used to invert the value of the operands bit WORD DWORD by bit Example In the example c is 1 if Ais 1 and B is 0 LD A ANDN B ST C BOOL The modifier c is used to carry out the associated instruction should the value of the accumulator be 1 TRUE Example In the example the jump after START is only performed when A is 1 TRUE and B is 1 TRUE LDA AND B JMPC START CN BOOL If the modifiers C and N are combined the associated instruction is only performed if the value of the accumulator be a Boolean 0 FALSE Example In the example the jump after START is only performed when A is 0 FALSE and B is 0 FALSE LDA AND B JMPCN START 484 35006144 07 2012 Instruction List IL Modifier Use of Description Operators of data type all The left bracket modifier is used to move back the evaluation of the operand until the right bracket operator appears The number of right parenthesis operations must be equal to the number of left bracket modifiers Brackets can be nested Example In the example E is 1 if c and or Dis 1 and A and Bare 1 LD A AND B AND C OR D ST E The example can also be progr
85. 5 maximum 10 4 14 e 140 CPU 6e N 20 minimum 5 maximum 20 4 24 NOTE Requests may come from various modules or embedded communication ports The communication exchange capacity of each port is limited therefore the maximum request value set in sw90 might not be reached N YES YES YES 35006144 07 2012 199 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum Continued SW90 MAXREQNB Maximum number of requests processed per master task cycle The Word is initialized by the system with N default value If the value 0 is entered it is the value N that is taken into account If a value between 1 and minimum is entered it is the minimum value that is taken into account If a value greater than maximum is entered it is maximum value that is taken into account The number of requests to be processed per cycle should take into account requests from all communication ports having access to the server This means that requests from other clients than communication EFs like IO Scanner connected HMI and so on should also be taken into account N YES YES YES SW91 92 Function blocks message rates Sw91 Number of function blocks messages sent per second e Sw92 Number of function block messages received per second Can be read by the user program or
86. 6 AND BL gt 364 35006144 07 2012 Function Block Language FBD Explicit Definition The correct execution sequence can be achieved by explicitly changing the execution sequence of an FFB To indicate that which FFB s had their execution order changed the execution number is shown in a black field see also Original Situation page 362 3 4 1 AND AND AD bin 5 6 AND BL 6 7 2 3 AND AND EN ENO maA 8 5 AND PB NOTE Only one reference of an instance is allowed e g the instance 7 may only be referenced once 35006144 07 2012 365 Function Block Language FBD FFB Positions The position of FFBs only influences the execution sequence if more than one FFB is linked to the same output of the calling FFB see also Original Situation page 362 In the first network block positions 4 and 5 are switched In this case common origins for both block inputs the execution sequence of both blocks is switched as well processed from top to bottom In the second network block positions 7 and 8 are switched In this case different origins for the block inputs the execution sequence of the blocks is not switched processed in the order the block outputs are called AND AND EN 5 BL gt AND A gt AND ENO AND AND
87. 60 User Documentation 61 Debug Services 62 Diagnostic Viewer 69 Operator Screen 70 35006144 07 2012 17 Presentation Capabilities of Unity Pro Hardware Platforms Unity Pro supports the following hardware platforms e Modicon M340 e Premium e Atrium e Quantum Programming Languages Block Libraries Unity Pro provides the following programming languages for creating the user program e Function Block Diagram FBD e Ladder Diagram LD language e Instruction List IL e Structured Text ST e Sequential Control SFC e Ladder Logic 984 LL984 All of these programming languages can be used together in the same project All these languages conform to IEC 61131 3 The blocks that are included in the delivery of Unity Pro extensive block libraries extend from blocks for simple Boolean operations through blocks for strings and array operations to blocks for controlling complex control loops For a better overview the different blocks are arranged in libraries which are then broken down into families The blocks can be used in the programming languages FBD LD IL and ST Elements of a Program A program can be constructed from e a Master task MAST a Fast task FAST one to four AUX Tasks not available for Modicon M340 sections which are assigned one of the defined tasks sections for processing time controlled events Timerx sections for processing hardware controlled events EVTx subroutine
88. A Ary kh E Ac nee akc tia A hed ceca kee la E ating tin od 441 35006144 07 2012 7 13 7 Branches and Merges 00 e cee teeta 442 Alternative Branches and Alternative Joints 05 443 Parallel Branch and Parallel Joint 0 2 0 0 ee eee eee 445 13 8 TextObjects croat nye Setar Ak borne parked athe a a 447 Text ODjOCt redia cece ea tt a od wie ees 447 13 9 Single Token 0 aa a aea e AA ar a Oa ea 448 Execution Sequence Single Token 0 cece eee eee eee 449 Alternative String 0 0 0 eee te eee 450 Sequence Jumps and Sequence Loops 0 eee ee eee 451 Parallel Strings 4 07 25 te 2 Sse 4 a mode a E eee wets 454 Asymmetric Parallel String Selection 00 0c eee eee eee 456 13 10 Multi Token enre n oh adage eatin tet dade Pe 459 Multi Token Execution Sequence 00 0 cece eee eee 460 Alternative String 0 0 0 e eee eee 462 Parallel Strings 0s scec0 ee ele ad Sete DOE eed ae be eae 465 Jump into a Parallel String 0 0 0 cece eee 469 Jump out of a Parallel String 0 0 cece ee 470 Chapter 14 Instruction List IL annn eee eee 475 14 1 General Information about the IL Instruction List 476 General Information about the IL Instruction List 477 Operands is scat a Gon a Resta a eee aetna Shee Cate nas Cead Saag Sea 481 Modifier ie cee dn ert eee ae ee eee dad Me
89. A QWs er SPA A MAST call stack Calls newest to the oldest Section Instance Langu Line test test my_dfb ST 1 4 test1 ST 2 1 Display Close 35006144 07 2012 67 Presentation Bookmarks The following functions are provided in single step mode Step by step execution of the program Stepln 1 StepOut StepOver Show Current Step 2 Call memory 3 When the step into function is executed several times the call memory enables the display of the entire path starting with the first breakpoint NOTE Running the PLC program in step by step mode as well as entering StepIn in a read write protected section may lead to the inability to read the program and exit from the section The user must switch the PLC in Stop mode to get back to the initial state Bookmarks allow you to select code sections and easily find them again 68 35006144 07 2012 Presentation Diagnostic Viewer Description Unity Pro provides system and project diagnostics Errors which occur are displayed in a diagnostics window The section which caused the error can be opened directly from the diagnostics window in order to correct the error Diagnostic Viewer Acknowledged Buffer battery error System fe Deleted Buffer battery error System S68 0 Deleted Buffer battery error System S68 0 Deleted Index overflow Syst
90. Belonging to Sequential Function Charts SFC 304 8 10 Compatibility Between Data Types 306 35006144 07 2012 251 Data Types 8 1 Elementary Data Types EDT in Binary Format Subject of this Section This section describes Binary format data types These are e Boolean types e Integer types e Time types What Is in This Section This section contains the following topics Topic Page Overview of Data Types in Binary Format 253 Boolean Types 255 Integer Types 260 The Time Type 262 252 35006144 07 2012 Data Types Overview of Data Types in Binary Format Introduction The data types in Binary format belong to the EDT Elementary data type family which includes single rather than derived data types tables structures function blocks Reminder Concerning Binary Format A data item in binary format is made up of one or more bits where each of these is represented by one of the base 2 figures 0 or 1 The scale of the data item depends on the number of bit s of which it is made Example l 1 bit Format 7 Bit position 0 0 1 0 Of 1 1 1 0 8 bit Format Most significant Least significant nibble nibble A data item can be e signed Here the highest ranking bit is the sign bit e 0 indicates a positive value e 1 indicates a negative value The range of values is 2 Bits 1 2 Bits 1 _ 1 e unsigned Here all the bits represe
91. Bits 0 to 15 of each of these words are associated with the modules located in positions 16 to 1 of these stations The bit is set to 0 if the module is faulty and set to 1 if the module is operating correctly Example SW412 5 0 The module located in station 7 slot 11 of the second DIO network is faulty NOTE For modules 140 CRA 2 eee the value of this bit is not significant and is always set to 0 These words are not available on safety PLCs and Quantum Ethernet I O DIO network with Modbus from 0 to 15 Plus link This word is not available on Quantum safety PLCs SW341 to SW404 Operating status The words SW341 to SW404 are associated with the MB IOHEALTHi of the distributed distributed stations DIO 64 words associated with the 64 DIO i 1 64 station modules stations of the first network of the first DIO SW341 operating status of the station 1 modules network SW342 operating status of the station 2 modules SW404 operating status of the station 64 modules Bits 0 to 15 of each of these words are associated with the modules located in positions 16 to 1 of these stations The bit is set to 0 if the module is faulty and set to 1 if the module is operating correctly Example SW362 5 0 The module located in station 22 slot 11 of the first DIO network is faulty NOTE For modules 140 CRA 2 eee the value of this bit is not significant and is always set to 0 These words are not available on safety P
92. BlocksS 0 000 cece eee 388 ENKS eere a taeae erase seabed nee REA DS lad ee heap ee A 390 Text ObDj Ct vicki ware whee eee eee ee ee 393 Edge Recognition eee eee ee eee ee 394 Execution Sequence and Signal Flow 0 0 eee eee eee 403 Loop Planning sise tee eis ak Se a OE aa a AS EA aes 405 Change Execution Sequence 00 cee tte 407 Chapter 13 SFC Sequence Language 2 eeeeeeeees 413 13 1 General Information about SFC Sequence Language 414 General Information about SFC Sequence Language 415 LINK RUICS ose ee Ba hee e Re hole tegen ated alee eens 419 13 2 Steps and Macro Steps 0 cece eee 420 Step mony tires hu nested me greene Sa ee back eee ee ee ee i 421 Macro Steps and Macro Sections 20 cece eee eee 424 13 3 Actions and Action Sections 0 0 ete 428 ACHION oncoran ide hve Soi ee icy arenes Gan tet at Sue Belek eee awl we N 429 ACTION SECTION ceea tre che Stet Le Ao ara eat ad de a ee tae tes 431 Qualifier 22 0 cece ek etna coe coe vey bea 432 13 4 Transitions and Transition Sections 00 0 eee eee 435 Transition ee awh ed Eee a PA a ee Se eh 436 Transition Section 0 0 ete 438 13 5 JUMP anni aape Aobdcha eaa aa a a bode dae Dee gn eee 440 DUMP ed tes meei ai aes saene Ta aa bag ape A elai a alee ge heed tetas aan peace eis 440 13 67 ENKA cise Wee dont eh ee Pin pee EE Wed tated ae AN 441 Liaise
93. Data Instances Direct addressing data instances have a predefined location in the PLC memory or in an application specific module and this location is known to the user Direct addressing data instances are defined using types belonging to the Elementary Data Type EDT family Examples of direct addressing data instances Internal Constant System Input Output Network N lt i gt S lt i gt Q Vl MW lt i gt KW lt i gt SW lt i gt QW IW NW MD lt i gt 1 KD lt i gt 1 QD ID MF lt i gt 1 KF lt i gt 1 OF IF Legend 1 Not available for Modicon M340 NOTE Located data instances can be used by a direct addressing in the program Example e Var_1 DINT AT smw10 sS MW10 and MW11 are both used 3MD10 direct addressing can be used or Var_1 in the program 35006144 07 2012 315 Data Instances Data Instance Attributes At a Glance The attributes of a data instance are its defining information This information is e its name see page 250 except for the direct addressing data instances see page 319 e its topological address except for unlocated data type instances its data type which can belong to one of the following families e Elementary Data Type EDT Derived Data Type DDT Device derived Data type Device DDT Function Block data type EFB DFB Sequential Function Chart data type SFC an optional descriptive comment 1
94. EFBs of the Measurement family EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex AVGMV E_ERR_DEN F 30152 16 8A38 Not a valid floating point number AVGMV W_WARN_AVGMV IT 30108 AVGMV N must be lt 50 16 759C AVGMV FP_ERROR F See table Common Floating Point Errors page 660 AVGMV_K E_ERR_DEN F 30152 16 8A38 Not a valid floating point number AVGMV_K W_WARN_AVGMV_K T 30109 AVGMV_K N must be lt 10000 16 759D AVGMV_K FP_ERROR F See table Common Floating Point Errors page 660 DEAD_ZONE E_ERR_DEN F 30152 16 8A38 Not a valid floating point number DEAD_ZONE E_ERR_DZONE F 30119 16 8A59 DZONE DZ must be gt 0 DEAD_ZONE FP_ERROR F See table Common Floating Point Errors page 660 LOOKUP_TABLE1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number LOOKUP_TABLE1 E_ERR_POLY_ F 30107 16 8A65 number of inputs not even ANZAHL LOOKUP_TABLE1 E_ERR_POLY_ F 30108 16 8A64 base point x i lt x i 1 FOLGE LOOKUP_TABLE1 FP_ERROR F See table Common Floating Point Errors page 660 648 35006144 07 2012 EFB Error Codes and Values Output Processing Table of error codes and errors values created for EFBs of the Output Processing family EFB Error code ENO state Error Error Error description name in case of valuein value in error Dec Hex MS W_WARN_OUT_OF__ T 30110 16 75
95. FBD editor is used for graphical function block programming according to IEC 61131 3 Representation Representation of an FBD section EN Input ENO Output Inversion ST Expression NI window Link 1 2 3 table AND OR AND N cond Alen ENO EN ENO EN ENO Frrorl N IN1 l 4 A lt B m Result1 TRUE IX1 5 4 C D z 1 l IX1 5 5 ga Y Ea ff Fa Execution number i A 5 Crossin Literal Topological Link g Addresses 4 XOR 5 EN ENO Error2 AND H Result2 Tooltip D gt condi EN ENO ad IN2 M Varx IN3 PLL E1061 Undefined Symbol Varx Objects The objects of the FBD Function Block Diagram programming language help to divide a section into a number of e Elementary Functions EFs Elementary Function Blocks EFBs Derived Function Blocks DFBs Procedures Subroutine calls Jumps Links Actual Parameters Text objects to comment on the logic 35006144 07 2012 49 Presentation Properties FBD sections have a grid behind them A grid unit consists of 10 coordinates A grid unit is the smallest possible space between 2 objects in an FBD section The FBD programming language is not cell oriented but the objects are still aligned with the grid coordinates An FBD section can be configured in number of cells horizontal grid coordinates and vertical grid coordinates The program can be entered using
96. HTTP and FTP task cycle requests e Sws9 Number of requests received by the processed by server functions processor s immediately per master Web server and MAST task cycle FTP server per For Modicon M340 second e sw88 Number of HTTP requests received by the processor s Web server per second e Sws89 Number of FTP requests received by the FTP server per second 198 35006144 07 2012 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW90 MAXREQNB Maximum number of requests processed per master task cycle This word is used to set a maximum number of requests all protocols included UNI TE Modbus etc which can be processed by the server of the PLC per master task cycle Requests sent by the PLC as client are not concerned This number of requests must be between a minimum and a maximum defined as N 4 depending on the model For M340 range BMX P34 10 20 e N 8 minimum 2 maximum 8 4 12 For Premium range TSX 57 0 N 4 minimum 2 maximum 4 4 9 e TSX 57 1 N 4 minimum 2 maximum 4 4 8 e TSX 57 2 N 8 minimum 2 maximum 8 4 12 e TSX57 3 N 12 minimum 2 maximum 12 4 16 e TSX57 4 N 16 minimum 2 maximum 16 4 20 e TSX57 5e N 16 minimum 2 maximum 16 4 20 For Quantum range 140 CPU 31 43 e 53ee N 10 minimum
97. Latch and block THREAD CUTTING mito Qo Menu The operator screen editor offers the following features e Extensive visualization functions e Geometric elements Line rectangle ellipse curve polygon bitmap text e Control elements Buttons control box shifter screen navigation hyperlinks input field rotating field e Animation elements Bar chart trend diagram dialog date disappear blinking colors variable animation Create a library for managing graphical objects Copying objects Creating a list of all variables used in the operator screen Creating messages to be used in the operator screen Direct access from the operator screen to the animation table or the cross reference table for one or more variables Tooltips give additional information about the variables Managing operator screens in families Import export of individual operator screens or entire families 35006144 07 2012 71 Presentation 72 35006144 07 2012 Application Structure In This Part This part describes the application program and memory structures associated with each type of PLC What Is in This Part This part contains the following chapters Chapter Chapter Name Page 2 Description of the Available Functions for Each Type of PLC 75 3 Application Program Structure 77 4 Application Memory Structure 115 5 Operating Modes 131 6 System Objects 157 3500
98. MW 4x area MBP_MSTR 8195 16 2003 Value displayed in status word Comes together with E_EFB_MSTR_ERROR in status of control block MBP_MSTR 8206 16 200E Value displayed in status word Comes together with E_EFB_NOT_STATE_RAM_4X in status of control block MBP_MSTR See tables of e Modbus Plus and SY MAX EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual e SY MAX specific Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual e TCP IP EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual READ_REG W_WARN_OUT_OF_ RANGE 30110 16 759E Parameter out of range READ_REG E_EFB_NOT_STATE RAM_4X 30531 16 88BD Variable not mapped to MW 4x area 634 35006144 07 2012 EFB Error Codes and Values EFB name Error code ENO state in case of error Error value in Dec Error value in Hex Error description READ_REG E_EFB_MSTR_ERROR F 30191 16 8A11 MSTR communication error READ_REG F 8195 16 2003 Value displayed in status word Comes together with W_WARN_OUT_OF_RANGE READ_REG MBPUNLOC 8206 16 200E Value displayed in status word Comes together with E_EFB_NOT_STATE_RAM_4X READ_REG See tables of Modbus Plus and SY MAX EtherNet Error Codes see Modico
99. MW103 2 byte MW103 24 byte Reserved for the alignment The table below gives two examples of data structures with arrays First Memory Address Description of the structure Modicon M340 Premium EHC105_Out Mw100 1 byte Mw100 15 byte Quit BYTE MW100 2 byte MW100 2 byte Control ARRAY 1 5 OF BYTE 2mw104 15t byte MW103 15t byte Final ARRAY 1 5 OF DINT CPCfg_ex sMW100 1t byte sMW100 15t byte Profile_type INT sMW101 15t byte MW101 15t byte Interp_type INT sMW102 15t byte sMW102 1St byte Nb_of_coords INT MW103 15t byte MW103 15t byte Nb_of_points INT sMW104 1t byte sMW104 15t byte reserved ARRAY 0 4 OF BYTE MW106 2 byte 2Mw106 2 byte Reserved for the alignment of variable Master_offset on even bytes 2mw108 1 byte sMW107 15t byte Master_offset DINT MW110 15t byte sMW109 15t byte Follower_offset INT MW111 entire word Reserved for the alignment 290 35006144 07 2012 Data Types Overview of Input Output Derived Data Types lIODDT At a Glance The IODDTs Input Output Derived Data Types are predefined by the manufacturer and contain language objects of the EDT family belonging to the channel of an application specific module Illustration IODDT str
100. No 3 FB Instances No No No Yes No Yes No EF Yes 2 No No No No No Variable Yes No Yes Yes No 1 No 1 An instance belonging to the application domain cannot have the same name as an EF 2 An instance belonging to the type domain internal variable can have the same name as an EF The EF in question cannot be used in this type 35006144 07 2012 337 Data References 3 The creation or import of EFB DFBs with the same name as an existing instance are prohibited 4 An DDT IODDT element might have the same name of an FB EF however it is not advised as the FB EF should not be used in the application NOTE A number of additional considerations to the rules given in the table are listed below specifying that e Within a type an instance internal variable cannot have the same name as the type name of the object to which it belongs e There is no conflict between the name of an instance belonging to a section of the application and the name of the instance belonging to a section of a DFB e There is no conflict between the name of a section belonging to a task and the name of the section belonging to a DFB 338 35006144 07 2012 Programming Language IV Contents of this Part This part describes the syntax of the programming languages that are available What Is in This Part This part contains the following chapters Chapter Chapter Name P
101. OF BOOL ARRAY i j OF EBOOL destination destination ARRAY i j OF BOOL Yes No source ARRAYVii j OF No Yes EBOOL source 35006144 07 2012 Data Types Compatibility Compatibility between static variables BOOL MW xi direct EBOOL Mi direct addressing addressing BOOL Var BOOL Yes No declared variable EBOOL Var EBOOL No Yes declared variable EBOOL data types follow the rules below e A EBOOL type variable cannot be passed as a BOOL type input output parameter e EBOOL arrays cannot be passed as ANY type parameters of an FFB e BOOL and EBOOL arrays are not compatible for instructing assignment same rule as for FFB parameters e On Quantum e EBOOL type located variables cannot be passed as EBOOL type input output parameters e EBOOL arrays cannot be passed as parameters of a DFB 35006144 07 2012 259 Data Types Integer Types At a Glance Integer Type INT Integer types are used to represent a value in different bases These are e base 10 decimal by default Here the value is signed or unsigned depending on the integer type e base 2 binary Here the value is unsigned and the prefix is 2 e base 8 octal Here the value is unsigned and the prefix is 8 e base 16 hexadecimal Here the value is unsigned and the prefix is 16 NOTE In decimal representation if the chosen type is signed the value can be prece
102. Output Modules User Manual and Topological State RAM Addressing of Modicon M340 Analog Modules see Modicon M340 with Unity Pro Analog input output modules User manual If the memory card is present working properly and not write protected the program is saved on the memory card e Automatically after e adownload e online modification e arising edge of the system bit S66 in the project program e Manually e with the command PLC Project backup Backup Save e in an animation table by setting the system bit S66 A WARNING LOSS OF DATA APPLICATION NOT SAVED The interruption of an application saving procedure by an untimely or rough extraction of the memory card may lead to the loss of saved application The bit S65 see page 170 allows managing a correct extraction See help page 65 bit in system bit chapter Failure to follow these instructions can result in death serious injury or equipment damage The memory card uses Flash technology therefore no battery is necessary 118 35006144 07 2012 Memory Structure Program Restore If the memory card is present and working properly the program is copied from the PLC memory card to the internal memory e Automatically after e a power cycle e Manually with the Unity Pro command PLC Project backup Backup Restore NOTE When you insert the memory card in run or stop mode you have to do a power cycle to restore the project on the
103. PLC is in Halt all tasks are stopped Check the behavior of the associated I Os to ensure that the consequences of the PLC Halt on the application are acceptable Failure to follow these instructions can result in death serious injury or equipment damage 156 35006144 07 2012 System Objects Subject of this Chapter This chapter describes the system bits and words of Unity Pro language Note The symbols associated with each bit object or system word mentioned in the descriptive tables of these objects are not implemented as standard in the software but can be entered using the data editor They are proposed in order to ensure the homogeneity of their names in the different applications What Is in This Chapter This chapter contains the following sections Section Topic Page 6 1 System Bits 158 6 2 System Words 179 6 3 Atrium Premium specific System Words 208 6 4 Quantum specific System Words 221 6 5 Modicon M340 Specific System Words 238 35006144 07 2012 157 System Objects 6 1 System Bits Subject of this Section This section describes the system bits A WARNING UNEXPECTED APPLICATION BEHAVIOR Do not use system objects Si SWi as variable when they are not documented Failure to follow these instructions can result in death serious injury or equipment damage What Is in This Section This section contains the following topi
104. Parameter Input MY_COUNT value S Formel Parameter Input PV ee My_COUNT varl MY_COUNT MY_COUNT out MY_COUNT CV current Q Instancename VJ Formal Parameter Output Actual Parameter Output Calling the function block in the IL programming language CU MY_CLOCK CLK1 R reset CAL MY_CLOCK CAL MY COUNT PV 100 LD ST LD s1 MY COUNT Q out MY _COUNT CV current Calling the same function block in FBD MY_CLOCK SYSCLOCK CLEK1 CLK2 CLK3 CLK4 CLK5 TIMER MY_COUNT reset 100 4 CU CTU CV out current 514 35006144 07 2012 Instruction List IL Multiple Function Block Instance Call Function block DFB instances can be called multiple times other than instances of communication EFBs these can only be called once Calling the same function block DFB instance more than once makes sense for example in the following cases e f the function block DFB has no internal value or it is not required for further processing In this case memory is saved by calling the same function block DFB instance more than once since the code for the function block DFB is only loaded one time The function block DFB is then handled like a Function e f the function block DFB has an internal value and this is supposed to influence various program segments for example the value of a cou
105. RETURN FBD 355 IL 495 LD 387 ST 555 S S IL 488 LD 374 SFC 432 sections 84 85 SFC language 413 429 structure 415 SFCCHART_STATE 417 SFCSTEP_STATE 423 SFCSTEP_TIMES 423 State RAM Modicon M340 117 state RAM of Modicon M340 RUN mode 143 STOP mode 143 STRING 274 structure 281 structured text ST instructions 539 language 527 560 566 574 operators 534 structure 529 SUB IL 490 subroutines 84 88 system bits 158 35006144 07 2012 721 Index system words 179 Modicon M340 238 Premium 208 213 Quantum 221 228 T tasks 77 81 cyclic 92 periodic 93 TIME 262 TOD 267 U UDINT 260 UINT 260 W warm start 137 watchdogs mono task 94 multi task 102 WHILE DO END_WHILE ST 551 WORD 279 X XOR IL 489 ST 538 722 35006144 07 2012
106. S33 Activation Normally set to 1 when the user creates the 0 NO YES YES AUX1ACT deactivation task The auxiliary task is deactivated when except for of the the user sets the bit to 0 safety PLCs auxiliary This bit is not available on Quantum safety task 1 PLCs S34 Activation Normally set to 1 when the user creates the 0 NO YES YES AUX2ACT deactivation task The auxiliary task is deactivated when except for of the the user sets the bit to 0 safety PLCs auxiliary This bit is not available on Quantum safety task 2 PLCs S35 Activation d Normally set to 1 when the user creates the 0 NO YES YES AUX3ACT _ eactivation of task The auxiliary task is deactivated when except for the auxiliary the user sets the bit to 0 safety PLCs task 3 This bit is not available on Quantum safety PLCs S38 Enabling Normally set to 1 Events are inhibited when 1 YES YES YES ACTIVEVT inhibition of the user sets the bit to 0 except for events This bit is not available on Quantum safety safety PLCs PLCs 35006144 07 2012 167 System Objects Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S39 Saturation in This bit is set to 1 by the system to indicate 0 YES YES YES EVTOVR event that one or more events cannot be except for processing processed following saturation of the safety PLCs queues The user must reset this bit to 0 T
107. ST expressions as actual parameters for contacts are a supplement to IEC 61131 3 and must be enabled explicitly Contact Types The following contacts are available Designation Representation Description Normally open XXX In the case of normally open contacts the status of the left link is transferred to the right link if the status of the relevant Boolean actual parameter indicated with xxx is ON Otherwise the status of the right link is OFF Normally closed XXX In the case of normally closed contacts the status of the left link is transferred to the right link if the status of the relevant Boolean actual parameter indicated with xxx is OFF Otherwise the status of the right link is OFF Contact for detecting positive transitions XXX With contacts for detection of positive transitions the right link for a program cycle is ON if a transfer of the relevant actual parameter j labeled by xxx goes from OFF to ON and the status of the left link is ON at the same time Otherwise the status of the right link is 0 Also see Edge Recognition page 394 Contact for detecting XXX With contacts for detection of negative transitions the right link for negative transitions a program cycle is ON if a transfer of the relevant actual parameter N labeled by xxx goes from ON to OFF and the status of the left link is ON at the same time Otherwise the status of the right link is 0 Also see Edge Re
108. The procedure for defining changing the execution sequence of networks is as follows e Using links instead of actual parameters e Network positions e Explicit execution sequence definition The procedure for defining changing the execution sequence of networks is as follows e FFB positions The following diagram shows two networks for which the execution sequences are simply defined by their positions within the section without taking into account the fact that blocks 4 5 and 7 8 require a different execution sequence 4 1 3 2 1 AND AND AD 5 3 AND BE gt 6 7 4 5 AND AND EN ENO moa AND 362 35006144 07 2012 Function Block Language FBD Link Instead of Actual Parameters By using a link instead of a variable the two networks are executed in the proper sequence see also Original Situation page 362 2 1 AND AND AD 5 6 AND 6 7 3 4 AND AND EN ENO gt a 8 6 AND 35006144 07 2012 363 Function Block Language FBD Network Positions The correct execution sequence can be achieved by changing the position of the networks in the section see also Original Situation page 362 1 2 AND AND EN ENO A 8 3 AND mB 4 3 AND 5 4 AND AD os 5
109. Types such as e Arrays which contain elements of the same type Bool tables EDT tables EBool tables Device DDT Arrays tables of tables DDT tables tables of structures DDT tables e structures which contain elements of the different types e Bool structures Word structures etc EDT structures e EBool tables Device DDT structure e structures of tables structures of structures structures of tables structures DDT structures e Bool structures table structures etc EDT and DDT structures e structures concerning input output data IODDT structures Device DDT Device Derived Data Types such as e tables which contain elements of the same type e Bool tables EDT tables e tables of tables DDT tables e tables of structures DDT tables e structures which contain elements of the different types e Bool structures Word structures etc EDT structures e structures of tables structures of structures structures of tables structures DDT structures e Bool structures table structures etc EDT and DDT structures e structures concerning input output data e Structures containing variables that restore the status properties of an action or transition of a Sequential Function Chart EFB Elementary Function Blocks written in C language These comprise e input variables e internal variables output variables a processing algorithm DFB Derived Function Blocks written in automa
110. Use of DFBs Elements of the DFB Call Program The following table lists the different elements of the DFB call program Element Meaning CAL DFB call instruction Cpt_1 Name of the DFB instance Reset Presel Count Input parameters Assignment symbol of an input Clear MD10 100 Assignment object or value of the inputs Done Output parameter gt Assignment symbol of an output Q1 2 1 Assignment object of an output Argument separation symbol DFB Call when the Arguments Are Values When the arguments are values the DFB call Cpt_1 is performed with the following syntax CAL Cpt_1 Clear LD Cpt_1 Done ST Q1 2 1 Elements of the DFB Call Program SMD10 100 The following table lists the different elements of the DFB call program Element Meaning CAL DFB call instruction Cpt_1 Name of the DFB instance Clear MD10 100 Assignment object or value of the inputs Argument separation symbol 35006144 07 2012 621 Use of DFBs DFB Call with no Argument When there is no argument the DFB call Cpt_1 is performed with the following syntax LD Clear ST Cpt_1 Reset LD SMD10 ST Cpt_1 Presel LD 100 ST Cpt_1 Count CAL Cpt 1 LD Cpt_1 Done ST 301 2 1 Elements of the DFB Call Program The following table lists the different elements of the DFB call program
111. With informal calls call without Formal parameter names the function block is called using an instruction made from the function block instance names followed by a bracketed list of the actual parameters for the inputs and outputs The order in which the actual parameters are listed in a function block call is significant EN and ENO cannot be used for this type of call Calling a function block without formal parameter names Instance Name Actual Parameter Input MY_COUNT varl reset 100 value out current Actual Parameter Output Calling the same function block in FBD MY_COUNT vari CU Qe out reset R 100 value PV cv current With informal calls it is not necessary to assign a value to all formal parameters see also Parameter page 566 This does not apply for VAR_IN_OUT variables for input parameters with dynamic lengths and outputs of type ANY It must always be assigned a variable This is a supplement to IEC 61131 3 and must be enabled explicitly An empty parameter field is used to skip a parameter Call with empty parameter field MY COUNT varl 100 value out current Calling the same function block in FBD MY_COUNT CTU vari CU Q out R 100 value PV cv current An empty parameter field does not have to be used if formal parameters are omitted at the end MY COUNT varl reset Calling the same function block in FBD
112. action list field actions with the qualifier see page 432 P1 are always processed first and actions with the qualifier PO are processed last The control of actions is expressed through the use of qualifiers see page 432 A maximum of 20 actions can be assigned to each step The action variable that is assigned to an action can also be used in actions from other steps The action variable can also be used for reading or writing in any other section of the project multiple assignment Actions that are assigned an qualifier with duration can only be activated one time Only Boolean variables addresses or Boolean elements of multi element variables are allowed as action variables Actions have unique names The name of the action is either the name of the action variable or the name of the action section The following are authorized as action variables Address of data type BOOL An action can be assigned to a hardware output using an address In this case the action can be used as enable signal for a transition as input signal in another section and as output signal for the hardware Simple variable or element of a multi element variable of data type BOOL The action can be used as an input signal with assistance from a variable in another section e Unlocated Variable With unlocated variables the action can be used as enable signal for a transition and as input signal in another section e Located Variable With located variables
113. are a supplement to IEC 61131 3 and must be enabled explicitly Inputs and outputs are required to transfer values to or from procedures These are called formal parameters The current process states are transferred to the formal parameters These are called actual parameters The following can be used as actual parameters for procedure inputs e Variable e Address e Literal e ST Expression The following can be used as actual parameters for procedure outputs e Variable e Address The data type of the actual parameters must match the data type of the formal parameters The only exceptions are generic formal parameters whose data type is determined by the actual parameter When dealing with generic ANY BIT formal parameters actual parameters of the INT or DINT not UINT and UDINT data types can be used This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed AND AnyBitParam IntVarl AnyBitParam2 IntVar2 Not allowed AND WORD WordParaml IntVarl WordParam2 IntVar2 AND ARRAY WORD ArrayInt In this case an explicit type conversion must be carried out using INT ARR TO WORD ARR n this case AND_INT must be used 574 35006144 07 2012 Structured Text ST Not all formal parameters must be assigned with a value You can see which formal parameter types must be assigned with a value in the following table Parameter
114. are as follows e The diagnostic is integrated in the project and can thus be conceived during development and therefore better meets the user s requirements e The error dating and recording system is done at the source in the PLC which means the information exactly represents the state of the process e You can connect a number of Viewers Unity Pro Magelis Factory Cast which will transcribe the exact state of the process to the user Each Viewer is independent and any action performed on one for example an acknowledgement is automatically viewed on the others 35006144 07 2012 625 Diagnostics DFB 626 35006144 07 2012 Appendices At a Glance The appendix contains additional information What Is in This Appendix The appendix contains the following chapters Chapter Chapter Name Page A EFB Error Codes and Values 629 B IEC Compliance 661 35006144 07 2012 627 628 35006144 07 2012 EFB Error Codes and Values A Introduction The following tables show the error codes and error values created for the EFBs sort by library and family What Is in This Chapter This chapter contains the following topics Topic Page Tables of Error Codes for the Base Library 630 Tables of Error Codes for the Diagnostics Library 632 Tables of Error Codes for the Communication Library 633 Tables of Error Codes for the IO Management Lib
115. as well e Horizontal Boolean Links Horizontal Boolean links enable sequential contacts and coil switching e Vertical Boolean Links Vertical Boolean links enable parallel contacts and coil switching e FFB Links FFB connections are a combination of horizontal and vertical segments that connect FFB inputs outputs with other objects Connections Horizontal Boolean Link a f 1 LS Vertical Boolean Link XXX XXX s VA s LS ENO EN ENO FFBLink XXX EN ENO XXX EN ENO gt 390 35006144 07 2012 Ladder Diagram LD General Programming Notes Attention should be paid to the following general programming notes The data types of the inputs outputs to be linked must be the same Links between parameters with variable lengths e g ANY ARRAY INT are not allowed Several links can be connected with one output right hand side of one contact one coil or one FFB output However only one link can be connected with an input left hand side of one contact one coil or one FFB output Unconnected contacts coils and FFB inputs are specified as 0 by default Links may not be used to create loops since the sequence of execution in this case cannot be clearly determined in the section Loops must be created using actual parameters see Non Permitted Loops page 405 Notes on Programming Boolean Links Notes on Programming Boole
116. behaviour You will find MASKEVT Global EVT masking and UNMASKEVT Global EVT unmasking in the System functions of the libset By default the multi task system is preemptive 676 35006144 07 2012 IEC Compliance IL language elements IL language elements IEC compliance table for IL language elements Table No Feature No Feature description 51b 1 Parenthesized expression beginning with explicit operator 51b 2 Parenthesized expression short form 52 1 LD operator with modifier N 2 ST operator with modifier N 3 S R operator 4 AND operator with modifiers N 6 OR operator with modifiers N 7 XOR operator with modifiers N 7a NOT operator 8 ADD operator with modifier 9 SUB operator with modifier 10 MUL operator with modifier 11 DIV operator with modifier 11a MOD operator with modifier 12 GT operator with modifier 13 GE operator with modifier 14 EQ operator with modifier 15 NE operator with modifier 16 LE operator with modifier 17 LT operator with modifier 18 JMP operator with modifiers c N 19 CAL operator with modifiers C N 20 RET operator with modifiers C N Note page 678 21 evaluate deferred operation 35006144 07 2012 677 IEC Compliance Note
117. by the terminal These counters does not include other outgoing requests coming from an IO Scanner for example YES YES NO 200 35006144 07 2012 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW93 Memory card Can be read and written by the 0 YES NO NO file system user program or the terminal This format word is used by the customer to command amp format or clean up the memory status card The format operation deletes the web pages To recover them perform one of the two following actions e Use FTP e Before performing the format save the web pages using FTP e After performing the format reload the web pages via FTP e Reinstall the firmware operating system of the processor The clean up operation deletes the content of the data storage directory Formatting or clean up is possible only in Stop mode e SwW93 0 1 arising edge starts the format operation e SW93 1 gives the file system status after a format or a clean Up operation request e SW93 1 0 invalid file system or command under progress SW93 1 1 valid file system e Sw93 2 1 arising edge starts the clean up operation 35006144 07 2012 201 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW94 SW95 Application
118. can have another value during the individual operations For example with a counter the value on the output is incremented Function blocks can have several output values outputs Derived Function Block Derived function blocks DFBs have the same properties as elementary function blocks The user can create them in the programming languages FBD LD IL and or ST Parameter Inputs and outputs are required to transfer values to or from function blocks These are called formal parameters The current process states are transferred to the formal parameters They are called actual parameters The following can be used as actual parameters for function block inputs e Variable e Address e Literal The following can be used as actual parameters for function block outputs e Variable e Address The data type of the actual parameters must match the data type of the formal parameters The only exceptions are generic formal parameters whose data type is determined by the actual parameter Exception When dealing with generic ANY BIT formal parameters actual INT or DINT not UINT and UDINT parameters can be used This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed AND AnyBitParam IntVarl AnyBitParam2 IntVar2 506 35006144 07 2012 Instruction List IL Not allowed AND WORD WordParaml IntVarl WordParam2 IntVar2 In this case AND_ INT must be used AND A
119. choose the type of master task execution e cyclic default selection e or periodic 1 to 255ms The master task can be controlled by program by bits and system words System objects Description SWO Task period S30 Master task activation S11 Watchdog error S19 Period overrun SW27 Number of ms spent in the system during the last Mast cycle SW28 Maximum overhead time in ms for Modicon M340 SW29 Minimum overhead time in ms for Modicon M340 SW30 Execution time in ms of the last cycle SW31 Execution time in ms of the longest cycle SW32 Execution time in ms of the shortest cycle 35006144 07 2012 79 Program Structure Presentation of the Fast Task General The fast task is intended for short duration and periodic processing tasks Structure The fast task FAST is made up of sections and subroutines Each section of the fast task is programmed in one of the following languages LD FBD IL or ST SFC language cannot be used in the sections of a fast task Subroutines are programmed in LD FBD IL or ST language and are called in the task sections Execution The execution of the fast task is periodic It is higher priority than the master task The period of the fast task FAST is fixed by configuration from 1 to 255ms The executed program must however remain short to avoid the overflow of lower priority tasks Control The fast
120. conditional jump a jump object is placed at the end of a series of contacts Label LABEL Labels jump targets are indicated as text with a colon at the end This text is limited to 32 characters and must be unique within the entire section The text must conform to general naming conventions Jump labels can only be placed in the first cell directly on the power rail Note Jump labels may not cut through networks i e an assumed line from the jump label to the right edge of the section may not be crossed by any object This also applies to Boolean links and FFB links Return lt RETURN gt RETURN objects can not be used in the main program e Ina DFB a RETURN object forces the return to the program which called the DFB e The rest of the DFB section containing the RETURN object is not executed e The next sections of the DFB are not executed The program which called the DFB will be executed after return from the DFB If the DFB is called by another DFB the calling DFB will be executed after return e ina SR a RETURN object forces the return to the program which called the SR e The rest of the SR containing the RETURN object is not executed The program which called the SR will be executed after return from the SR 35006144 07 2012 387 Ladder Diagram LD Operate Blocks and Compare Blocks Introduction Objects In addition to the objects defined in IEC 61131 3 there ar
121. configuration does not match hardware configuration ARI030 E_EFB_ILLEGAL_CONFIG F 30198 16 8A0A_ EFB error Illegal configuration DATA data ATI030 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration AVI030 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration AVO020 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration 642 35006144 07 2012 EFB Error Codes and Values EFB name Error code ENOstate Error Error Error description in case of value in value in error Dec Hex DROP E_EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration ERT_854_10 ES_WRONG_SLOT F 20480 16 5000 ERT_854_10 E_ WRONG_SLOT F 30215 16 89F9 Defined as E_EFB_USER_ERROR_16 ERT_854_10 ES_HEALTHBIT F 24576 16 6000 ERT_854_10 E_HEALTHBIT F 30216 16 89F8 Defined as E_EFB_USER_ERROR_17 ERT_854_10 ES_TIMEOUT F 32768 16 8000 ERT_854_10 E_TIMEOUT 30210 16 89FE Defined as E _EFB_USER_ERROR_11 ERT_854 10 E_ERT_BASIC values F 30199 16 8A09 Defined as E_EFB_USER_ERROR_1 1 ERT_854_ 10 E_ WRONG_ANSW F 30211 16 89FD Defined as E_EFB_USER_ERROR_12 ERT_854_10 ES_CBUF_OFLOW F 28672 16 7000 ERT_854_10 E_CBUF_OFLOW F 30217 16 89F
122. cycle PLCs Graph Sms 5ms This bit is not available on Quantum safety PLCs S5 Timebase Idem 84 YES YES YES TB100MS 100 ms except for safety PLCs S6 Time Idem S4 YES YES YES TB1SEC base 1s except for safety PLCs S7 Time base Idem 84 YES YES YES TB1MIN 1 min except for safety PLCs 35006144 07 2012 161 System Objects Description of System Bits S9 to S13 Detailed Description Description of system bits S9 to S13 Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S9 Outputs Normally at 0 this bit is set to 1 by the program 0 YES 1 YES NO OUTDIS set tothe or the terminal fallback e set to 1 sets the bit to 0 or maintains the position on current value depending on the chosen all buses configuration X bus Fipio AS i etc e set to 0 outputs are updated normally Note The system bit acts directly on the physical outputs and not on the image bits of the outputs Note On Modicon M340 ethernet I O scanner and Global Data are affected by the S9 bit 1 Note On Modicon M340 inputs outputs distributed via CANopen bus are not affected by the S9 bit On Modicon M340 after an operating mode outputs are in security mode state equal to 0 while the bit is set S10 Global I O Normally at 1 this bit is set to O when an error 1 YES YES YES IOERR detected on an in rack module or
123. device on a network is error detected e g non compliant configuration exchange fault hardware fault etc The S10 bit is reset to 1 by the system when all the detected errors have disappeared 162 35006144 07 2012 System Objects Detected network communication errors with remote devices are not reported on bits S10 S16 and S119 CAUTION UNEXPECTED APPLICATION BEHAVIOR SPECIFIC VARIABLE BEHAVIOR Manage detected network communication errors with remote devices with a method specific to each type of communication modules NOM NOE NWM CRA CRP or motion modules MMS e communication function blocks status if they are used e communication modules status if they exist Failure to follow these instructions can result in injury or equipment damage Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S11 Watchdog Normally at 0 this is set to 1 by the 0 YES YES YES WDG overflow system as soon as the task execution time becomes greater than the maximum execution time i e the watchdog declared in the task properties S12 PLC in RUN This bit is set to 1 by the system when the 0 YES YES YES PLCRUNNING PLC is in RUN It is set to 0 by the system as soon as the PLC is no longer in RUN STOP INIT etc S13 First cycle Switching the PLC from STOP mode to YES YES YES 1RSTSCANRUN after RUN mod
124. displayed but can be omitted at the time of entry Minute 00 59 The left 0 is always displayed but can be omitted at the time of entry Second 00 59 The left 0 is always displayed but can be omitted at the time of entry Example TOD 23 59 45 An active step of an SFC is known as a token U UDINT is the abbreviation of Unsigned Double Integer format coded on 32 bits unsigned The lower and upper limits are as follows 0 to 2 to the power of 32 1 Example 0 4294967295 2 11111111111111111111111111111111 8 37777777777 LO FFFFFFFF UINT is the abbreviation of Unsigned integer format coded on 16 bits The lower and upper limits are as follows 0 to 2 to the power of 16 1 Example 0 65535 2 1111111111111111 8 177777 LO FFFF An unlocated variable is a variable for which it is impossible to know its position in the PLC memory A variable which have no address assigned is said to be unlocated 716 35006144 07 2012 Glossary Variable Memory entity of the type BOOL WORD DWORD etc whose contents can be modified by the program during execution Visualization window This window also called a watch window displays the variables that cannot be animated in the language editors Only those variables that are visible at a given time in the editor are displayed W Watch point Used in the debug mode of the application It enables the display of animated variables to be synchron
125. e g write exceeds MW 4x boundaries _RAW E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration _RAWSIM E EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration I_SCALE E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE I_SCALE E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE I_SCALE E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration I_SCALE_WARN E_EFB_NO_WARNING_ F 30189 16 8A13 Module delivers no warning STATUS_AVAILABLE status I_SCALE_WARN E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE I_SCALE_WARN E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE I_SCALE_WARN E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration O_NORM E _EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE O_NORM E EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE O_NORM E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration O_NORM_WARN E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE O_NORM_WARN E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE O_NORM_WARN E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration 35006144 07 2012 639 EFB Error Codes and Values
126. ees 484 Operators aanren eis Sea eee Ranh Ae ais oe ee rat ah he 486 Subroutine Call 6 2 tee teens 496 Labels and JUMPS 0 00 cee eee eee eee 497 COMMON ss nha reyes ect Lee ad ack Ae eo SE E eee 499 14 2 Calling Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures 0 00 ee eee eee eee 500 Calling Elementary Functions 00 0000 cece eee 501 Calling Elementary Function Blocks and Derived Function Blocks 506 Calling Procedures 0 0 0 0 ccc eee teeta 518 Chapter 15 Structured Text ST 20 2 e eee eee eee 527 15 1 General Information about the Structured Text ST 528 General Information about Structured Text ST 0000 529 Operands setg e Oe ce Ge ohare Gate oa an e a eevee ba 532 OPSratOnssce sees ns E aan a epee aaa aa ea eevee deine aaa aed ae 534 15 2 InStructionS c eee eee ree Ae he whe So ba ee ee 539 INStUCTIONS e rcii sii a aur Pastas ace ah wd als al apa fae eA 540 ASSIQNMEOEN aurra a Fie ate bh OEE et Bode Sed 541 Select Instruction IF THEN END_IF 0 0000 cee eee eee 544 Select Instruction ELSE 2 2 2 eee eee 545 Select Instruction ELSIF THEN 0 0000 cece eee eee 546 Select Instruction CASE OF END_CASE 000000 547 Repeat Instruction FOR TO BY DO END_FOR 548 Repeat Instruction WHILE DO END_WHILE 551 35006144 07 20
127. for the DFBs Function Domain PLCs for which DFBs can be used Premium Atrium and Quantum DFB creation software Unity Pro Software with which DFBs can be used Unity Pro or Unity Pro Medium Programming language for creating the DFB code IL ST LD or FBD 1 Programming language with which DFBs can be used IL ST LD or FBD 1 1 IL Instruction List ST Structured Text LD LaDder FBD Functional Block Diagram language 35006144 07 2012 585 Overview of DFBs Implementing a DFB Function Block Implementation Procedure There are 3 steps in the DFB function block implementation procedure Step Action 1 Create your DFB model called DFB type 2 Create a copy of this function block called an instance every time the DFB is used in the application 3 Use the DFB instances in your application program Creation of the DFB Type This operation consists in designing a model of the DFB you want to use in your application To do this use the DFB editor to define and code all the elements that make up the DFB e Description of the function block name type DFB activation of diagnostics comment e Structure of the function block parameters variables code sections NOTE If you use a DFB that is already in the User Defined Library and modify it the new modified type will be used for any additional instances in the open proje
128. gt represents the instance number NOTE The memory organization is identical to that of internal variables The S lt i gt and SX lt i gt data are not used for detection of edges and do not manage forcing N Network Variables These variables contain information which has to be exchanged between several application programs across the communication network Access syntax Syntax Format Program access rights Common word NW lt n gt lt s gt lt d gt 16 bits INT R W or R Word extracted bit NW lt n gt lt s gt lt d gt lt j gt 1 bit BOOL R W or R lt n gt represents the network number lt s gt represents the station number lt d gt represents the data number lt j gt represents the position of the bit in the word 35006144 07 2012 321 Data Instances Case with Input Output Variables These variables are contained in the application specific modules Access syntax Syntax Example Program access rights Input Output structure IODDT CH lt mod gt lt c gt CH4 3 2 R l inputs BOOL type module error bit l lt mod gt MOD ERR 14 2 MOD ERR R BOOL type channel error bit l lt mod gt lt c gt ERR 14 2 3 ERR R BOOL or EBOOL type bit l lt mod gt lt c gt 14 2 3 R l lt mod gt lt c gt lt d gt 14 2 3 1 R INT type word IW lt mod gt lt c gt IW4 2 3 R
129. have the same status both 0 or 1 D is 0 OUT IN1 XOR IN2 If more than two operands are linked the result with an uneven number of 1 states is 1 and is 0 with an even number of 1 states Example In the example OUT is 1 if 1 or 3 operands are 1 OUT is 0 if 0 2 or 4 operands are 1 OUT IN1 XOR IN2 XOR IN3 XOR IN4 OR Logical OR 11 lowest Expression Literal Variable Address of Data Type BOOL BYTE WORD or DWORD With or there is a logical OR link between the operands With the BYTE and WORD DWORD data types the link is made bit by bit Example In the example OUT is 1 if IN1 IN2 or IN3 is 1 OUT IN1 OR IN2 OR IN3 538 35006144 07 2012 Structured Text ST 15 2 Instructions Overview This section describes the instructions for the programming language of structured text ST What Is in This Section This section contains the following topics Topic Page Instructions 540 Assignment 541 Select Instruction IF THEN END_IF 544 Select Instruction ELSE 545 Select Instruction ELSIF THEN 546 Select Instruction CASE OF END_CASE 547 Repeat Instruction FOR TO BY DO END_FOR 548 Repeat Instruction WHILE DO END_WHILE 551 Repeat Instruction REPEAT UNTIL END_REPEAT 552 Repeat Instruction EXIT 553 Subroutine Call 554 RETURN 555 Empty Instruction 556 Labels and Jumps 557 Comment 55
130. inputs Number of inputs outputs less than or equal to 32 2 Number of outputs Number of inputs outputs less than or equal to 32 NOTE The IODDT related to CANopen devices for Modicon M340 cannot be used as a DFB I O parameter During the analyse build step of a project the following message This IODDT cannot be used as a DFB parameter advises the limitations to the user 592 35006144 07 2012 Description of DFBs Parameters that Can Be Accessed by the Application Program The only parameters that can be accessed by the application program outside the call are output parameters To make this possible the following syntax must be used in the program DFB_Name Parameter_name DFB_Name represents the name of the instance of the DFB used maximum of 32 characters Parameter_Name represents the name of the output parameter maximum 32 characters Example Control Accel indicates the output Acce1 of the DFB instance called Control EN and ENO Parameters EN is an input parameter and ENO is an output parameter They are both of BOOL type and may or may not be used optional in the definition of a DFB type Where the user wishes to use these parameters the editor sets them automatically EN is the first input parameter and ENO the first output parameter Example of implementation of EN ENO parameters Control _ EN ENO L Deviation Accel Inputs Outputs Speed Error _ Enable Inputs J Actions o
131. is raised Ifthe bit is at 1 and device not present then no error is raised NOTE The default value is 0 NOTE This inhibition can be performed on the fly but in order for it to be taken into account the CANopen Master must be reset by setting bit 5 of the output word QWO0 0 2 0 to 1 NOTE The system words SW142 to SW145 are available since SV 2 1 of the CPU OS SW146 and SW147 Modicon M340 Those 2 system words contain the unique SD card serial number 32bits If there is not an SD card or an unrecognized SD card the 2 system words are set to 0 This information can be used to protect an application see Modicon M340 Using Unity Pro Processors Racks and Power Supply Modules Setup Manual against duplication NOTE The system words SW146 and SW147 are available since SV 2 1 of the CPU OS SW150 to SW154 CANopen Modicon M340 Informations concerning the last SDO abort transfer SW150 Low word of the SDO abort code SW151 High word of the SDO abort code SW152 Node number of the SDO transfer SW153 Index number of the SDO transfer e SW154 Sub index number of the SDO transfer 35006144 07 2012 239 System Objects Word Function Description Initial Symbol State SW160 to SW167 Premium and Words SW160 to SW167 are associated respectively to PREMRACKO to Modicon M340 racks 0 to 7 PREMRACK7 Rack 0 to 7 error Bits 0 to 15 of
132. is entered as follows TOD lt Hour gt lt Minutes gt lt Seconds gt This table shows the lower upper limits in each field Field Limits Comment Hour 00 23 The left 0 is always displayed but can be omitted at the time of entry Minute 00 59 The left 0 is always displayed but can be omitted at the time of entry Second 00 59 The left 0 is always displayed but can be omitted at the time of entry Example Entry Comment TOD 1 59 0 The left 0 of the hours and seconds can be omitted tod 23 10 59 The prefix can be written in lower case Tod 0 0 0 The prefix can be mixed lower upper case 35006144 07 2012 267 Data Types The Date and Time DT Type At a Glance The Date and Time type coded in 64 bit format contains the following information e The year coded in a 16 bit field 4 most significant half bytes e the month coded in an 8 bit field 2 half bytes e the day coded in an 8 bit field 2 half bytes e the hour coded in an 8 bit field 2 half bytes e the minutes coded in an 8 bit field 2 half bytes e the seconds coded in an 8 bit field 2 half bytes NOTE The 8 least significant bits are unused Example Representation in BCD format of the date and Time 2000 09 20 13 25 47 Year 2000 Month 09 Day 20 Hour 13 Minute 25 Seconds 47 Least significant byte 0010 0000 0000 0000 0000 1001 0010 0000 0001 0011 00
133. is negative Example Using field variables var an 2S gy var2 otto 4 var3 var4 1 itj 5 4 35006144 07 2012 533 Structured Text ST Operators Introduction An operator is a symbol for e an arithmetic operation to be executed or e a logical operation to be executed or e a function edit call Operators are generic i e they adapt automatically to the data type of the operands Table of Operators Operators are executed in sequence according to priority see also Execution Sequence page 530 ST programming language operators Operator Meaning Order of possible operands Description rank Use of 1 highest Expression Brackets are used to alter the execution Brackets sequence of the operators Example If the operands A B C and D have the values 1 2 3 and 4 A B C D has the result 9 and A B C D has the result 0 FUNCNAME Function 2 Expression Literal Function processing is used to execute Actual processing Variable Address all data functions see Calling Elementary parameter call types Functions page 560 list S Negation 3 Expression Literal During negation a sign reversal for the Variable Address of Data value of the operand takes place TypeINT DINT or REAL Example In the example OUT is 4 if IN1 is 4 OUT IN1 NOT Complement 3 Expression Literal In NOT a bit by bit inversion of the operands Variable Address
134. it returns values from SMW1000 SW138 contains 0001 When the Modbus server receives a Read Discrete Inputs request code 02 with starting address equal to 0000 it returns values from SM1 A WARNING UNINTENDED EQUIPMENT OPERATION You must set the values of the 4 system words 3SW138 SW139 3SW140 and 3SW141 using the Initial value mechanism Do not use programming code to set the values Otherwise when using the PLC init command or setting S0 to 1 or downloading an application the 4 system words are set to 0000 and the behavior of Modbus server is wrong Failure to follow these instructions can result in death serious injury or equipment damage 238 35006144 07 2012 System Objects Description of system words 2SW142 to 3SW145 3SW146 and SW147 SW150 to SW154 SSW160 to 3SW167 Word Symbol Function Description Initial State SW142 to SW145 Modicon M340 Inhibit the I O error raised by the system when a configured device on the CANopen bus is not present This inhibition can be managed with 4 system words SW 142 143 144 145 These System words implement a bit list indicating CANopen node error to inhibit bit 0 of 3Sw142 concerns device at node address 1 bit 1 of 3Sw142 concerns device at node address 2 bit15 of sw145 concerns device at node address 64 Bit values e Ifthe bit is at O and device not present then an error
135. loading the actual parameters followed by saving them in the formal parameters followed by an input operator The sequence of loading and saving the parameters is not significant Only load and save instructions for the function block currently being configured are allowed between the first load instruction for the actual parameters and the input operator of the function block All other instructions are not allowed in this position EN and ENO cannot be used for this type of call It is not necessary to assign a value to all formal parameters see also Parameter see page 506 The possible input operators for the various function blocks can be found in the table Additional input operators are not available Input Operator FB type S1 R SR S R1 RS CLK R_TRIG CLK F_TRIG CU R PV CTU_INT CTU_DINT CTU_UINT CTU_UDINT CD LD PV CTD_INT CTD_DINT CTD_UINT CTD_UDINT CU CD R LD PV CTUD_INT CTUD_DINT CTUD_UINT CTUD_UDINT IN PT TP IN PT TON IN PT TOF 35006144 07 2012 513 Instruction List IL Use of the input operators Input Operator Calling a Function Block without Inputs Even if the function block has no inputs or the inputs are not to be parameterized the function block should be called before its outputs can be used Otherwise the initial values of the outputs will be transferred i e 0 E g reset wr pg Actual
136. made using the gt operator see also Formal Call page 569 Assignments cannot be made outside of the function block call The instruction My Var My SAH OUT is invalid if the output OUT of the SAH function block is of type ANY The instruction Cal My SAH OUT gt My Var is valid Special conditions apply when using VAR_IN_OUT variables see page 572 The use of function blocks consists of two parts in ST e the Declaration see page 568 e calling the function block There are two ways of calling a function block e Formal call see page 569 calling a function with formal parameter names This way variables can be assigned to outputs using the gt operator e Informal call see page 570 call without formal parameter names Function block DFB instances can be called multiple times other than instances of communication EFBs these can only be called once see Multiple Function Block Instance Call page 571 Declaration Before calling a function block it must be declared in the variables editor 568 35006144 07 2012 Structured Text ST Formal Call With formal calls call with formal parameter names the function block is called using an instruction sequence made from the function blocks instance names that follows a bracketed list of actual parameter assignments to the formal parameters Assign input formal parameters via _ Assignment and the assignment of the input formal parameter us
137. mismatch If OS version mismatch is not allowed in the command register bit 4 0 the system will not work as redundant as soon as the fault is signaled SW61 15 If SW 61 15 is set 1 the setting indicates that Ethernet Copro device is set up correctly and working YES NO 35006144 07 2012 211 System Objects Word Symbol Function Description Initial state Premium Atrium B parr VERSE2 Premium Transfer word These four words are reverse registers reserved for the Reverse Transfer process These four reverse registers can be written to the application program first section of the Standby controller and are transferred at each scan to the Primary controller 0 YES NO 212 35006144 07 2012 System Objects Description of System Words SW128 to SW143 Detailed Description Description of system words SW128 to SW143 occurrence of a fault on this connection point For a non configured connection point the corresponding bit is always 1 Word Function Description Initial Symbol state SW128 143 Faulty Fipio Each bitin this group of words indicates the state of a device connected 0 ERRORCNXi connection to the Fipio bus where i 0 to 15 point Normally set to 1 the presence of a 0 in one of these bits indicates the Table showing correspondence between word bits and connection point
138. modification signature These two words contain a 32 bit value that changes at every application modification except when updating upload information e replacing the initial value with the current value e saving the parameter command They can be read by the user program or by the terminal YES NO NO SW96 CMDDIAGSAV EREST Command and Diagnostic of Save and Restore This word is used to copy or delete the current value of Mw to or from internal flash memory see page 117 and to give the action s status It can be read by the user program or by the terminal e SwW96 0 Request to copy current value of 2Mw to internal Flash memory Set to 1 by the user to request a save and set to 0 by the system when a save is in progress NOTE You must stop the processor before copying via SW96 0 e SW96 1 is setto 1 by the system when a save is finished and set to 0 by the system when a save is in progress Sw96 2 1 indicates an error on a save or restore operation see 3SW96 8 to15 for error code definitions e SW96 3 1 indicates thata restore operation is in progress sw96 4 may be set to 1 by the user to delete MW area in internal Flash memory SW96 7 1 indicates that internal memory has valid sMw backup YES NO NO 202 35006144 07 2012 System Objects Word Symbol Function Description Initial st
139. must be different AUTOTUNE W_WARN_AUTOTUNE_ T 30111 AUTOTUNE has failed FAILED 16 759F AUTOTUNE FP_ERROR F See table Common Floating Point Errors page 660 AUTOTUNE E_ERR_AUTOTUNE_ F 30120 16 8A58 The tuned EFB is not allowed or has ID_UNKNOWN not yet been called AUTOTUNE Status word values T F For details about the AUTOTUNE status word refer to the AUTOTUNE description see Unity Pro Control Block Library PI_B W_WARN_OUT_OF_ T 30110 Parameter out of range RANGE 16 759E PI_B E_ERR_NULL_INPUT F 30121 16 8A57 Null input scale max and min limit SCALE must be different PI_B FP_ERROR F See table Common Floating Point Errors page 660 PI_B Status word values T F For details about the PI_B status word refer to the PI_B description see Unity Pro Control Block Library PIDFF W_WARN_OUT_OF_ T 30110 Parameter out of range RANGE 16 759E PIDFF E_ERR_NULL_INPUT F 30121 16 8A57 Null input scale max and min limit SCALE must be different PIDFF FP_ERROR F See table Common Floating Point Errors page 660 PIDFF Status word values T F For details about the PIDFF status word refer to the PIDFF description see Unity Pro Control Block Library SAMPLETM E_EFB_SAMPLE_TIME_ F 30184 Internal error OVERFLOW 16 8A18 STEP2 W_WARN_OUT_OF_ T 30110 Parameter out of range RANGE 16 759E 646 35006144 07 2012 EFB Error Codes and Values EFB name E
140. name symbol which can be used to access the data instance Giving the DFB type Parts_Counter 10 4 1 5 Part OK MW100_ _ Preset Num_parts_attained M2 Num_Parts_Prog ounter of Parts_Counter type Screw_Counter Parts Instance name of b Screw_Counter Num Parts_Prog s to public variable Num_Parts_Prog Screw_Counter Num parts_attained s to the output interface Num_parts_attained 332 35006144 07 2012 Data References References to Data Instances by Address Introduction What is a data instance reference see page 249 At a Glance It is only possible to reference a data instance by address for certain data instances that belong to the EDT family These instances are e internal variables M lt i gt MW lt i gt MD lt i gt MF lt i gt e constants KW lt i gt KD lt i gt KF lt i gt e inputs outputs l lt address gt Q lt address gt NOTE Instances MD lt i gt MF lt i gt KD lt i gt and KF lt i gt are not available for Modicon M340 Reference by Direct Addressing Addressing is considered direct when the address of the instance is fixed or in other words when it is written into the program Examples M1 Access to first bit of the memory SMW12 Access to twelfth word of the memory MD4 Access to fourth double word of the memory KF100 Access to hundredth floating pointing word of the memory Q0 4 0 5 Access to f
141. normalized value 7 986 will be coded by the application as E 129 M 8359248 0 1000001 11111111000110101010000 Using the formula 0 129 127 _ 8359248 __ 1 x2 x 1 a 7 986000061035145625 a3 J The number 7 986 should have a significant of 23 ee L286 1 x2 8359247 872 42 As the significant is expressed as an integer it can only be coded as 8359248 rounded to the nearest limit No number can be coded between the significant 8359247 and 8359248 or between the real number 7 9859995841 97998046875 and 7 98600006103515625 The weight of the less significant bit gap is in absolute precision 029 127 a 2 0 000000476837 158203125 423 35006144 07 2012 271 Data Types The gap becomes very important for big values as shown below Value bs M 24 Ranges 2 lt Values 2 8359243 100 000 000 Between 27 and 227 526 a eS 3 9127 9127 i2 2 79 2 02x10 NOTE The gap corresponds to the weight of the less significant bit In order to get an expected resolution it is necessary to define the maximum range for the calculation according the following formula na lno x2 j Ln 2 p being the accuracy and e the exponent e E 127 For instance if the accuracy needs to be 0 001 the fixed point part will be F 1 x2 x 1 4 21 16384 423 with 13 In 2 Beyond of this limit F the accuracy will be los
142. of Data takes place Type BOOL BYTE WORD or Example In the example OUT is DWORD 0011001100 if IN1 is 1100110011 OUT NOT INI FA Exponentiation 4 Expression Literal In exponentiation the value of the first Variable Address of Data operand basis is raised to the power of the TypeREAL Basis and second operand exponent INT DINT UINT UDINT Example In the example OUT is 625 0 if or REAL Exponent IN1 is 5 0 and IN2 is 4 0 OUT IN1 IN2 534 35006144 07 2012 Structured Text ST Operator Meaning Order of possible operands Description rank Multiplication 5 Expression Literal In multiplication the value of the first Variable Address of Data operand is multiplied by the value of the TypeINT DINT UINT second operand exponent UDINT or REAL Example In the example OUT is 20 0 if IN1 is 5 0 and IN2 is 4 0 OUT IN1 IN2 Note The MULTIME function in the obsolete library is available for multiplications involving the data type Time Division 5 Expression Literal In division the value of the first operand is Variable Address of Data divided by the value of the second operand TypeINT DINT UINT Example In the example OUT is 4 0 if IN1 UDINT or REAL is 20 0 and IN2 is 5 0 OUT IN1 IN2 Note The DIVTIME function in the obsolete library is available for divisions involving the data type Time MOD Modulo 5 Expression Liter
143. of Macro step T_ lt section name gt _ lt macro step No gt _ lt transition No gt Names of Instances Belonging to the Function Block Family Instance names are implicitly declared while the user inserts the instances into the sections of the application program They are default names supplied by the manufacturer which the user may modify Syntax of manufacturer supplied default names FB_ lt name ot tunction block type gt _ lt instance No gt NOTE Instance names do not include the name of the section in which the instance is used since it can be used in different sections of the application Access to an Element of a DDT Family Instance The access syntax is as follows For structure type data lt Instance name gt lt Element name gt For table type data lt Instance name gt Element index Rule The maximum size of the access syntax is 1024 characters and the possible limits of a derived data type are as follows e 10 nesting levels tables structures e 6 dimensions per table e 4 digits figures to define the index of a table element 35006144 07 2012 317 Data Instances Access to an Element of a Device DDT Family Instance The access syntax is as follows For structure type data lt Instance name gt lt Element name gt For table type data lt Instance name gt Element index Rule The maximum size of the access syntax is 1024 characters and the possible limits of a deri
144. of data type SFCSTEP_ TIMES see SFCSTEP_TIMES Variable page 423 e Input steps can be allocated actions 424 35006144 07 2012 SFC Sequence Language Output Step Every macro section ends with an output step Representation of an output step MS_1_1_0U Output steps have the following properties e Output steps are automatically placed in macro sections by the SFC editor Only 1 individual output step is placed for each macro section An output step cannot be deleted copied or inserted manually Output steps can NOT be allocated with actions Output steps can only be assigned a delay time Assigning supervision times is not possible see Step Times page 422 Macro Section A macro section consists of a single sequence string having principally the same elements as a sequence control section e g steps initial step s macro steps transitions branches joints etc Additionally each macro section contains an input step at the beginning and an output step at the end Each macro step can be replaced with the sequence string in the allocated macro section Therefore macro sections can contain 0 1 or more initial steps see also Step Types page 421 e Single Token e 0 Initial steps are used in macro sections if there is already an initial step in the higher or lower section e 1 Initial step is used in macro sections if there are no initial steps in the higher or lower
145. of the first operand is compared equal to Variable Address of Data with the value of the second operand using comparison Type BOOL BYTE INT gt If the value of the first operand is DINT UINT UDINT REAL greater than or equal to the value of the TIME WORD DWORD second the result is a Boolean 1 If the STRING DT DATE or TOD value of the first operand is less than the value of the second the result is a Boolean 0 Example In the example OUT is 1 if IN1 is greater than or equal to 10 and otherwise is 0 OUT IN1 gt 10 536 35006144 07 2012 Structured Text ST Operator Meaning Order of possible operands Description rank Equality 8 Expression Literal The value of the first operand is compared Variable Address of Data with the value of the second operand using Type BOOL BYTE INT If the value of the first operand is equal to DINT UINT UDINT REAL the value of the second the result is a TIME WORD DWORD Boolean 1 If the value of the first operand STRING DT DATE or TOD is not equal to the value of the second the result is a Boolean 0 Example In the example OUT is 1 if IN1 is equal to 10 and is otherwise 0 OUT IN1 10 lt gt Inequality 8 Expression Literal The value of the first operand is compared Variable Address of Data with the value of the second using lt gt If the Type BOOL BYTE INT value of the first operand is not equal to the D
146. once The function block DFB is then handled like a Function e f the function block DFB has an internal value and this is supposed to influence various program segments for example the value of a counter should be increased in different parts of the program In this case calling the same function block DFB means that temporary results do not have to be saved for further processing in another part of the program One EN input and one ENO output can be used in all FFBs If the value of EN is equal to 0 when the FFB is invoked the algorithms defined by the FFB are not executed and ENO is set to 0 If the value of EN is equal to 1 when the FFB is invoked the algorithms defined by the FFB will be executed After the algorithms have been executed successfully the value of ENO is set to 1 If an error occurs when executing these algorithms ENO is set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if EN equals to 1 Please refer to Maintain output links on disabled EF see Unity Pro Operating Modes e Function blocks If ENO is set to 0 caused by EN 0 or an error during execution e EN ENO handling with function blocks that only have one link as an output parameter FUNCBLOCK 1 EN ENO IN1 OUT IN2 EN INI IN2 FUNCBLOCK 2 ENO OUT
147. or RUN mode as of context defined in the configuration 4 CAUTION LOSS OF DATA ON APPLICATION TRANSFER Loading or transferring an application to the PLC typically involves initialization of unlocated variables To save the located variables e Avoid the initialization of the sMwi by unchecking Initialize MWi on cold start in the configuration screen of the CPU It is necessary to assign a topological address to the data if the process requires keeping the current values of the data when transferring the application Failure to follow these instructions can result in injury or equipment damage 35006144 07 2012 135 Operating Modes Illustration 4 CAUTION LOSS OF DATA ON APPLICATION TRANSFER Do not press the RESET button on the power supply Otherwise MWi is reset and initial values are loaded Failure to follow these instructions can result in injury or equipment damage CAUTION RISK OF LOSS OF APPLICATION If there is no memory Card in the PLC during a cold restart the application is lost Failure to follow these instructions can result in injury or equipment damage The diagram below describes how a cold restart operates Acquisition of inputs gt Processor stopped Application context TOP program execution saved If SW10 0 0 Power retum possible processing of cold restart Configuration self t
148. or from 1 gt 0 negative edge For this the value of the bit in the previous cycle is compared to the value of the bit in the current cycle In this case not only the current value but also the old value are needed Instead of a bit 2 bits are therefore needed for edge recognition current value and old value Because the data type BOOL only offers one single bit current value there is another data type for edge recognition EBOOL expanded BOOL In addition to edge recognition the data type EBOOL provides an option for forcing It must also be saved whether forcing the bit is enabled or not The data type EBOOL saves the following data e the current value of the bit in Value bit e the old value of the bit in History bit the content of the value bit is copied to the History bit at the beginning of each cycle e Information whether forcing of the bit is enabled in Force Bit 0 Forcing disabled 1 Forcing enabled Restrictions for EBOOL 4 CAUTION UNINTENDED EQUIPMENT OPERATION To perform a good edge detection the sM must be updated at each task cycle When performing a unique writing the edge will be infinite Failure to follow these instructions can result in injury or equipment damage Using an EBOOL variable for contacts to recognize positive P or negative N edges or with an EF called RE or FE you have to adhere to the restrictions described below 394 35006144 07 201
149. parallel branches or alternative joints to a step In these cases the direction of the link is indicated with an arrow symbol S11 e With links there is a difference between a String Jump see page 451 anda String Loop see page 452 35006144 07 2012 441 SFC Sequence Language 13 7 Branches and Merges Overview This section describes the branch and merge objects of the SFC sequence language What Is in This Section This section contains the following topics Topic Page Alternative Branches and Alternative Joints 443 Parallel Branch and Parallel Joint 445 442 35006144 07 2012 SFC Sequence Language Alternative Branches and Alternative Joints Introduction The alternative branch offers the possibility to program branches conditionally in the control flow of the SFC structure With alternative branches as many transitions follow a step under the horizontal line as there are different processes All alternative branches are run together into a single branch again with alternative joints or Jumps see page 440 where they are processed further Example of an Alternative Sequence Example of an Alternative Sequence S_5_10 a a a b c S_5_11 S_5 12 5 13 a aa a d e f S_5_14 S_5_16 S_5_15 m m g h gt S_5_16 35006144 07 2012
150. procedure below for each project Step Action 1 Launch Unity Pro Start Programs Schneider Electric SoCollaborative Unity Pro Open the STA file from File Open menu The file type selected must be Unity Pro Archived Application File STA Click on Open Save the project as an STU file 35006144 07 2012 29 Presentation XEF File This file type is used for exporting projects in an XML source format and can be created at any stage of a project The following table presents the XEF file advantages and drawbacks Advantages Drawbacks e The XML source format ensures project Medium size compatibility with any version of Unity Pro e Opening of the project takes time while the project is imported before operation e Generation of the project is mandatory to re assemble the project binary code Operating with the PLC requires to rebuild all the project and perform a download in the processor e Connecting to the PLC in Equal Online mode with an XEF file is not possible For additional information see Connection Disconnection see Unity Pro Operating Modes ZEF File This file type is used for exporting projects with global DTMs configuration and can be created at any stage of a project For details on project export import refer to chapter Import Export see Unity Pro Operating Modes The following table presents th
151. program DFB sections you can use the following languages e Instruction List IL e Structured Text ST e Ladder language LD e Functional Block Diagram FBD Defining a Section A section is defined by a symbolic name that identifies the section maximum of 32 characters a validation condition that defines the execution of the section a comment maximum of 256 characters a protection attribute no protection write protected section read write protected section Programming Rules When executed a DFB section can only use the parameters you have defined for the function block input output and input output parameters and internal variables Consequently a DFB function block cannot use either the global variables of the application or the input output objects except the system words and bits Si SWi and SDi A DFB section has maximum access rights read and write for its parameters 598 35006144 07 2012 Description of DFBs Example of Code The following program provides an example of Structured Text code CHR 200 CHR 100 CHR 114 CHR 104 CHR 116 CHR 106 RESET DEMARRE We increment 80 times CHR 100 FOR CHR 102 1 TO 80 DO a INC CHR 100 WHILE CHR 104 CHR 114 lt 100 DO IF CHR 1045400 THEN EXIT B END IF INC CH 04 REPEAT IF CHR 106 gt 300 THEN EXIT END IF INC CHR 106 UNTIL CHR 100 CHR 116 gt 100 END REPEAT
152. reads the inputs outputs assigned to it The association of a channel group of channels or an input output module with a task is defined in the configuration screen of the corresponding module The task that is associated by default is the MAST task Reading of Inputs and Writing of Outputs on Premium All the input output channels of in rack modules can be associated with a task MAST FAST or AUX 0 3 Local and remote inputs outputs X bus For each task cycle the inputs are read at the start of the task and the outputs are written at the end of the task Remote inputs outputs on Fipio bus In controlled mode the refreshing of inputs outputs is correlated with the task period The system guarantees that inputs outputs are updated in a single period Only the inputs outputs associated with this task are refreshed In this mode the period of the PLC task MAST FAST or AUX must be greater than or equal to the network cycle time In free mode no restriction is imposed on the task period The PLC task period MAST FAST or AUX can be less than the network cycle If this is the case the task can be executed without updating the inputs outputs Selecting this mode gives you the possibility of having the lowest possible task times for applications where speed is critical Reading of Inputs and Writing of Outputs on Quantum Local inputs outputs Each input output module or group of modules can be associated with a single t
153. return from the SR 35006144 07 2012 355 Function Block Language FBD Link Description Links are vertical and horizontal connections between FFBs OR X FFB Input AND vari gt FFB Output Representation The link coordinates are identified by a filled circle OR AND OR Crossed links are indicated by a broken link AND OR AND OR 356 35006144 07 2012 Function Block Language FBD Programming Notes Attention should be paid to the following programming notes Links can be used for any data type The data types of the inputs outputs to be linked must be the same Several links can be connected with one FFB output Only one may be linked with an FFB input however Inputs and outputs may be linked to one another Linking more than one output together is not possible That means that no OR connection is possible using links in FBD An OR function is to be used in this case Overlapping links with other objects is permitted Links may not be used to create loops since the sequence of execution in this case cannot be clearly determined in the section Loops must be created using actual parameters see Loop Planning page 367 To avoid links crossing each other links can also be represented in the form of connectors The source and target for the connection are labeled with a name that is un
154. sections SR 18 35006144 07 2012 Presentation Software Packages The following software packages are available e Unity ProS Unity Pro M Unity Pro L Unity Pro XL Unity Pro XLS Performance Scope The following table shows the main characteristics of the individual software packages Unity Pro S Unity Pro M Unity Pro L Unity Pro XL Unity Pro XLS Programming languages Function Block Diagram FBD Ladder Diagram LD language Instruction 2 List IL Structured 2 Text ST Sequential 2 Language SFC Libraries 1 Standard 2 library Control library 2 Communica 2 tion library Diagnostics 2 library VO 2 Management library System library 2 Motion control 2 drive library TCP Open optional optional optional optional 2 library 35006144 07 2012 19 Presentation Unity Pro S Unity Pro M Unity Pro L Unity Pro XL Unity Pro XLS Obsolete library MFB library Safety library Memory card file management library General information Create and use data structures DDTs Create and use Derived Function Blocks DFBs Project browser with structural and or functional view Managing access rights Operato
155. sections sub programs macro steps animation tables runtime screen etc whose purpose is to perform an automation device function A functional module may itself be separated into lower level functional modules which perform one or more sub functions of the main function of the automation device G GRAY Gray or reflected binary code is used to code a numerical value being developed into a chain of binary configurations that can be differentiated by the change in status of one and only one bit This code can be used for example to avoid the following random event in pure binary the change of the value 0111 to 1000 can produce random numbers between 0 and 1000 as the bits do not change value altogether simultaneously Equivalence between decimal BCD and Gray Decimal 0 1 2 3 4 5 6 7 8 9 BCD 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 Gray 0000 0001 0011 0010 0110 0111 0101 0100 1100 1101 Hyperlink The hyperlink function enables links to be created between your project and external documents You can create hyperlinks in all the elements of the project directory in the variables in the processing screen objects etc The external documents can be web pages files xls pdf wav mp3 jpg gif etc 706 35006144 07 2012 Glossary 1 0 Object IEC 61131 3 INF An I O object is an implicit or explicit language object for an expert function module or a I O device on a fieldbus They a
156. storing user applications and projects Each type of file can be used according to specific requirements File types can be identified by their extension e STU Unity Pro File e STA Unity Pro Archived Application File e XEF Unity Pro Application Exchange File e ZEF Unity Pro Full Application Exchange File STU File This file type is used for daily working tasks This format is used by default when opening or saving a user project The following table presents the STU file advantages and drawbacks Advantages Drawbacks e The project can be saved at any stage e Not convenient when transferring project consistent or inconsistent through the due to the very large size of the file default command Project saving and opening is fast as the e Not compatible when updating Unity Pro entire internal database is present in the from one version to another file e Automatic creation of BAK files 1 Each time a STU file is saved a backup copy is also created with the same name as the STU file and the extension BAK files By changing the file extension from BAK to STU it is possible to revert to the state the project was the last time it was saved BAK files are stored in the same folder as the project STU file 35006144 07 2012 27 Presentation STA File This file type is used for archiving projects and can be created only after the project has been generated This file type al
157. than or equal to 10 otherwise the value of Dis 0 LDA GE 10 ST D EQ Comparison Literal variable The EQ operator compares the contents of the direct address of accumulator with the contents of the operand If data type BOOL the contents of the accumulator is equal to the BYTE WORD DWORD contents of the operands the result is a Boolean STRING INT DINT 1 If the contents of the accumulator are not equal UINT UDINT REAL to the contents of the operands the result is a TIME DATE DT or Boolean 0 TOD Example In the example the value of Dis 1 if Ais equal to 10 otherwise the value of D is 0 LDA EQ 10 ST D 492 35006144 07 2012 Instruction List IL Operator Modifier Meaning Operands Description NE Comparison Literal variable The NE operator compares the contents of the lt gt direct address of accumulator with the contents of the operand If data type BOOL the contents of the accumulator are not equal to BYTE WORD DWORD the contents of the operands the result is a STRING INT DINT Boolean 1 If the contents of the accumulator are UINT UDINT REAL equal to the contents of the operands the result is TIME DATE DT or a Boolean 0 TOD Example In the example the value of D is 1 if Ais not equal to 10 otherwise the value of D is 0 LD A NE 10 ST D LE Comparison Literal variable The LE operator compares the contents of the lt dir
158. the Modicon M340 remote I O modules All the informations bits and registers related to a channel are accessible directly as a field of device DDT structure NOTE Optional Explicit structures are DDT Explicit DDT created on demand from data editor and used through Function block to be refreshed NOTE Optional Explicit DDT types are proposed in the data editor to support Status or Command data used by explicit exchanges on a Channel of an IO Modules in a M340 remote I O drop Explicit DDT instances are created manually by the user in the data editor and used as Input or Output Parameter with the Function block managing the explicit exchange READ STS OX see Unity Pro I O Management Block Library WRITE CMD QX see Unity Pro I O Management Block Library 40 35006144 07 2012 Presentation Derived Data Types DDT The DDT types tab is used for defining derived data types DDTs A derived data type is the definition of a structure or array from any data type already defined elementary or derived Tab DDT types f Data Editor BE Variables DDT types Function blocks DFB types Filter LY Name i Name v_ Type v Comment X Standard lt Struct gt E G_ Motor lt Struct gt siop Bool feedback Bool start Bool alarm Standard Speed Int Amp Int SFCSTEP_STATE lt Struct gt El SFCSTEP_TIMES lt Struct gt
159. the action can be used as an enabling signal for a transition as an input signal in another section and as an output signal for the hardware 35006144 07 2012 429 SFC Sequence Language Action Names If an address or a variable is used as an action then that name e g Q10 4 Variable1 is used as the action name If an action section is used as an action then the section name is used as the action name Action names maximum 32 characters must be unique over the entire project i e no other transition variable or section etc may exist with the same name There are no case distinctions The action name must correspond with the standardized name conventions 430 35006144 07 2012 SFC Sequence Language Action Section Introduction An action section can be created for every action This is a section which contains the logic of the action and it is automatically linked with the action Name of the Action Section The name of the action section is always identical to the assigned action see Action Names page 430 Programming Languages FBD LD IL and ST are possible as programming languages for action sections Properties of Action Sections Action sections have the following properties Action sections can have any amount of outputs Subroutine calls are only possible in action sections when Multitoken operation is enabled Note The called subroutines are not affected by the controller of the se
160. the presence and characteristics of a peripheral device We also use the term peripheral device driver The best known drivers are printer drivers To make a PLC communicate with a PC communication drivers need to be installed Uni Telway XIP Fipway etc DT DT is the abbreviation of Date and Time The DT type coded in BCD in 64 bit format contains the following information The year coded in a 16 bit field the month coded in an 8 bit field the day coded in an 8 bit field the hour coded in a 8 bit field the minutes coded in an 8 bit field the seconds coded in an 8 bit field NOTE The 8 least significant bits are unused The DT type is entered as follows DT lt Year gt lt Month gt lt Day gt lt Hour gt lt Minutes gt lt Seconds gt This table shows the lower upper limits in each field Field Limits Comment Year 1990 2099 Year Month 01 12 The left 0 is always displayed but can be omitted at the time of entry Day 01 31 For the months 01 03 05 07 08 10 12 01 30 For the months 04 06 09 1 1 01 29 For the month 02 leap years 01 28 For the month 02 non leap years Hour 00 23 The left 0 is always displayed but can be omitted at the time of entry Minute 00 59 The left 0 is always displayed but can be omitted at the time of entry Second 00 59 The left 0 is always displayed but can be omitted at the time of entry 35006144 07 2012 701 Gl
161. the steps immediately preceding it are active Transitions whose immediately preceding steps are not active are not analyzed e A transition is triggered when the transition is enabled and the associated transition conditions are satisfied e Triggering a transition leads to the disabling resetting of all immediately preceding steps that are linked to the transition followed by the activation of all immediately following steps e f more than one transition condition in a row of sequential steps has been satisfied then one step is processed per cycle e Steps and macro steps can be activated or deactivated by other non SFC sections or by user operations e If an active step is activated and deactivated at the same time then the step remains active e The use of macro steps is possible Whereas the macro step section can also contain initial steps e More than one branch can be active with alternative branches The branches to be run are determined by the result of the transition conditions of the transitions that follow the alternative branch Branch transitions are processed in parallel The branches with satisfied transitions are activated All alternative branches do not have to be combined at the end by an alternative joint or jumps e lf jumps are to be made into a parallel branch or out of a parallel branch then this option can be enabled All parallel branches do not have to be combined at the end by a parallel joint in this case e
162. the value of EN is 1 when the procedure is called the algorithms defined by the function are executed After the algorithms have been executed successfully the value of ENO is set to 1 If an error occurs when executing these algorithms ENO is set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if EN equals to 1 If ENO is set to 0 caused when EN 0 or an error occurred during executing the outputs of the procedure are set to 0 If EN ENO are used the procedure call must be formal The assignment of variables to ENO must be made using the gt operator PROC EN 1 IN1 varl IN2 var2 ENO gt error OUT1 gt resultl OUT2 gt result2 Calling the same procedure in FBD PROC THEN ENO error vari IN1 OUT1 result1 var2 IN2 OUT2 result2 VAR_IN_OUT Variable Procedures are often used to read a variable at an input input variables to process it and to output the updated values of the same variable output variables This special type of input output variable is also called a VAR_IN_OUT variable The following special features are to be noted when using procedures with VAR_IN_OUT variables e All VAR_IN_OUT inputs must be assigned a variable e VAR_IN_OUT inputs may not have literals or constants assigned to them e VAR_IN_OUT outputs may not have values assigned to them
163. then a sequence runstoS 8 12ands 8 13 If transition condition c is true then a sequence runstoS 8 14 S 8 15 ands 8 16 IfstepsS_8 13 ands _8 14 are active and transition condition d is true then a sequence runs to S_8 17 If steps S_8 12 ands _8 17 are active and transition condition e is true then a sequence runs toS_8 18 458 35006144 07 2012 SFC Sequence Language 13 10 Multi Token Overview This section describes the Multi Token operating mode for sequence controls What Is in This Section This section contains the following topics Topic Page Multi Token Execution Sequence 460 Alternative String 462 Parallel Strings 465 Jump into a Parallel String 469 Jump out of a Parallel String 470 35006144 07 2012 459 SFC Sequence Language Multi Token Execution Sequence Description The following rules apply for Multi Token e The original situation is defined in a number of initial steps O to 100 which can be defined e Anumber of steps which can be freely defined can be active at the same time in a sequence string e The active signal status processes take place along the directional links triggered by switching one or more transitions The direction of the string process follows the directional links and runs from the under side of the predecessor step to the top side of the successive step e Atransition is enabled if
164. time of the application program to events e coming from input output modules e from event timers These processing tasks are performed with priority over all other tasks They are therefore suited to processing tasks requiring a very short response time in relation to the event The number of event processing tasks see page 76 that can be programmed depends on the type of processor An event processing task is monosectional and made up of a single unconditioned section It is programmed in either LD FBD IL or ST language Two types of event are offered e O event for events coming from input output modules e TIMER event for events coming from event timers The execution of an event processing task is asynchronous The occurrence of an event reroutes the application program to the processing task associated with the input output channel or event timer which caused the event The following system bits and words can be used to control event processing tasks during the execution of the program System objects Description S38 Activation of event processing S39 Saturation of the event call management stack SSwW48 Number of IO events and telegram processing tasks executed NOTE TELEGRANM is available only for PREMIUM not on Quantum neither M340 SSW75 Number of timer type events in the queue 35006144 07 2012 83 Program Structure 3 2 Description of Sections and Subroutine
165. to version 2 02 It is used to memory monitor the main battery status when card battery the memory card is in the lower PCMCIA slot For Premium processors S75 is supported by the following processors TSX P57 4e TSX P57 5ee and TSX P57 6ee NOTE For all others Premium processors S75 shows a low battery level only when the battery is already at a critical level For Quantum processors S75 is supported by the following processors 140 CPU 672 61 140 CPU 672 60 140 CPU 671 60 60S 140 CPU 651 60 60S 140 CPU 652 60 and 140 CPU 651 50 S75 is e set to 1 when the main battery voltage is low The application is kept but the battery must be replaced following the predictive maintenance see Premium and Atrium using Unity Pro Processors racks and power supply modules Implementation manual procedure e set to 0 when the main battery voltage is sufficient application always kept Data stored ona memory card in slot B is not processed in safety projects 172 35006144 07 2012 System Objects Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S76 Configured This bit is set to 1 by the system when 0 YES YES YES DIAGBUFFCONF diagnostics the diagnostics option has been buffer configured a diagnostics buffer for storage of errors found by diagnostics DFBs is then reserved This bit
166. trigger an error when they appear in operands of a function or an arithmetic expression See SW17 see page 184 and S18 see page 164 This table gives the calculation formula of the value of the floating point number Floating point number Value Normalized z 1 x 2 x1 f Denormalized DEN s ED x 97126 xf NOTE A real number between 1 1754944e 38 and 1 1754944e 38 is a denormalized DEN When an operand is a DEN the result is not guaranteed The bits SW17 see page 184 and S18 see page 164 are raised except for the Modicon M340 The Modicon M340 PLCs are able to use the denormalized operands but due to the format with a loss of precision Underflow is signaled depending on the operation only when the result is O total underflow or when the result is a denormalized gradual underflow with loss of precision 270 35006144 07 2012 Data Types The Real Type Presentation Type Scale bits Default value REAL 32 0 0 Range of values grayed out parts Ea E 3 4028235e 38 1 1754944e 38 0 0 1 1754944e 38 3 4028235e 38 When a calculation result is e between 1 1754944e 38 and 1 1754944e 38 it is a DEN less than 3 4028234e 38 the symbol INF for infinite is displayed greater than 3 4028234e 38 the symbol INF for infinite is displayed undefined square root of a negative number the symbol NAN is displayed Examples of inaccuracy on
167. turns on When a memory card is inserted e the accessing LED turns on e the CARDERR LED shows the memory card status e S65 remains unchanged S65 must reset to 0 to allow rising edge detection NOTE If a rising edge is generated on the bit and the memory card is not extracted resetting the bit to 0 does not make the memory card accessible To make the memory card accessible again ether e extract and re insert the memory card re initialize the PLC using the power supply reset button 0 YES NO NO 170 35006144 07 2012 System Objects Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SE66 Application This bit is set to 1 by the user to start a 0 YES NO NO LEDBATT backup backup operation transfer application APPLIBCK from RAM to card The system will detect the rising edge to start the backup The state of this bit is polled by the system every second A backup takes place only if the application in RAM is different from the one in the card This bit is set to 0 by the system when the backup is finished Warning Before doing a new backup by setting bit S66 to 1 you must test that bit ss66 has been set to 0 by the system meaning that the previous backup has finished Never use 3866 if it is set to 1 This may lead to a loss of data Bit S66 is particularly useful after replacement of initial value S94 and save paramet
168. type EDT STRING ARRAY ANY_ARRAY ODDT STRUCT FB ANY Input VAR_IN_OUT Output s 2 Actual parameter required Actual parameter not required not applicable If no value is allocated to a formal parameter then the initial value will be used for executing the function block If no initial value has been defined then the default value 0 is used Programming Notes Formal Call Attention should be paid to the following programming notes e Procedures are only executed if the input EN 1 or the EN input is not used see also EN and ENO page 577 e Special conditions apply when using VAR_IN_OUT variables see page 578 e There are two ways of calling a procedure e Formal call see page 575 calling a function with formal parameter names This way variables can be assigned to outputs using the gt operator e Informal call see page 576 call without formal parameter names With formal calls call with formal parameter names the procedures are called using an instruction sequence made from the procedure name followed by a bracketed list of actual parameter assignments to the formal parameters The assignment of the input formal parameter is made using the assignment and the output formal parameter is made using the gt assignment The sequence in which the input formal parameters and output formal parameters are enumerated is not si
169. value an object or an expression In any case the type of external element value evaluation of the expression etc must be identical to that of the input parameter A DFB block must have at least one connected Boolean input and an output if necessary For this you may use the EN input parameters and the ENO output parameter see the description of these parameters below It is compulsory to connect or assign the ANY_ARRAY type inputs the generic data type outputs ANY_ and the input outputs of a DFB block Graphic Representation of a DFB Block The following illustration shows a simple DFB programming example Control_port_1 1 ABS MDO0 3 4 10000 4 5 MW100 6 Control 2 Deviation 7 Accel 8 Speed 7 Error 8 Enable 7 Actions 9 tL MWS8 Q1 2 1 MW100 614 35006144 07 2012 Use of DFBs Elements of the DFB Block The following table lists the different elements of the DFB block labeled in the above illustration Label Element Name of the DFB instance Name of the DFB type Input assigned by an expression Input assigned by a value Connected input Input assigned by an object address or symbol Input parameters Output parameters olo INI oI oO AI WwW DY Input output parameters Use of EN ENO Parameters See EN and ENO Parameters page 593 3500614
170. 0 SW3 Period of auxiliary task 1 SW4 Period of auxiliary task 2 SW5 Period of auxiliary task 3 S32 Activation of auxiliary task 0 S33 Activation of auxiliary task 1 S34 Activation of auxiliary task 2 S35 Activation of auxiliary task 3 S11 Watchdog error S19 Period overrun SW36 Execution time in ms of the last cycle of auxiliary task 0 35006144 07 2012 81 Program Structure System objects Description SW39 Execution time in ms of the last cycle of auxiliary task 1 SW42 Execution time in ms of the last cycle of auxiliary task 2 SW45 Execution time in ms of the last cycle of auxiliary task 3 SW37 Execution time in ms of the longest cycle of auxiliary task 0 SW40 Execution time in ms of the longest cycle of auxiliary task 1 SW43 Execution time in ms of the longest cycle of auxiliary task 2 SW46 Execution time in ms of the longest cycle of auxiliary task 3 SW38 Execution time in ms of the shortest cycle of auxiliary task 0 SW41 Execution time in ms of the shortest cycle of auxiliary task 1 SW44 Execution time in ms of the shortest cycle of auxiliary task 2 SW47 Execution time in ms of the shortest cycle of auxiliary task 3 82 35006144 07 2012 Program Structure Overview of Event Processing General Structure Execution Control Event processing is used to reduce the response
171. 0 0 c eects 247 Overview of the Data References 00 00 e eee eee eee 249 Syntax Rules for Type Instance Names 00000 e eee eee 250 35006144 07 2012 5 Chapter 8 8 1 8 2 8 3 8 4 8 5 8 6 8 7 8 8 8 9 8 10 Chapter 9 Chapter 10 Data TYDGS onee ne baie Sats ee Ieee a ie eae 251 Elementary Data Types EDT in Binary Format 252 Overview of Data Types in Binary Format 0 000005 253 Boolean TYPES prira o wt nike needa eee ee bk gees Cade daw eee 255 INtEGEr TYPOS jive sie deca en le aha tet e eee ed eae ee as 260 The TMG Type si smoiis ee pitta te a saw See ype ee eed a 262 Elementary Data Types EDT in BCD Format 0 263 Overview of Data Types in BCD Format 0 ee eee 264 The Date Type in eae da gegen eo ana baa eee bee 266 The Time of Day TOD Type 0 0 c eee eee eee 267 The Date and Time DT Type 000 cece eee eee 268 Elementary Data Types EDT in Real Format 269 Presentation of the Real Data Type 0 00 e eae 269 Elementary Data Types EDT in Character String Format 274 Overview of Data Types in Character String Format 274 Elementary Data Types EDT in Bit String Format 277 Overview of Data Types in Bit String Format 4 278 Bit String TYPES eee ree ck he era ee ee bi ee es 279 Derived Data Types DDT IO
172. 006144 07 2012 699 Glossary DFB DFB instance DINT Documentation DFB is the abbreviation of Derived Function Block DFB types are function blocks that can be programmed by the user ST IL LD or FBD By using DFB types in an application it is possible to simplify the design and input of the program increase the legibility of the program facilitate the debugging of the program reduce the volume of the generated code A DFB type instance occurs when an instance is called from a language editor The instance possesses a name input output interfaces the public and private variables are duplicated one duplication per instance the code is not duplicated A DFB type can have several instances DINT is the abbreviation of Double Integer format coded on 32 bits The lower and upper limits are as follows 2 to the power of 31 to 2 to the power of 31 1 Example 2147483648 2147483647 16 FFFFFFFFE Contains all the information of the project The documentation is printed once compiled and used for maintenance purposes The information contained in the documentation cover the hardware and software configuration the program the DFB types the variables and animation tables the cross references When building the documentation file you can include all or some of these items 700 35006144 07 2012 Glossary Driver A program indicating to your computer s operating system
173. 012 System Objects Word Symbol Function Description Initial state Premium Atrium SW61 HSB STS Premium Hot Standby status register Meaning of the different bits of the word SW61 7 to SW61 9 e SW61 7 this bit indicates if there is a Main Processor OS version mismatch between Primary and Standby 0 no OS version firmware mismatch 1 OS version mismatch If OS version mismatch is not allowed in the command register bit 4 0 the system will not work as redundant as soon as the fault is signaled SW61 8 this bit indicates if there is a COPRO OS version mismatch between Primary and Standby 0 no COPRO OS version mismatch 1 COPRO OS version mismatch If OS version mismatch is not allowed in the command register bit 4 0 the system will not work as redundant as soon as the fault is signaled SW61 9 this bit indicates if at least one ETY module does not have the minimum version 0 all the ETY modules have the minimum version 1 at least one ETY module doesn t have the minimum version In this case no Primary PLC could start 0 YES NO SW61 HSB STS Premium Hot Standby status register Meaning of the different bits of the word SW61 10 and SWE61 15 SW61 10 this bit indicates if there is a Monitored ETY OS version mismatch between Primary and Standby 0 no Monitored ETY OS version mismatch 1 Monitored ETY OS version
174. 024 characters maximum Authorized characters correspond to the ASCII codes 32 to 255 Name of a Data Instance This is a symbol 32 characters maximum automatically instantiated with a defaut name This name can be modified by the user Certain names cannot be used for example key words used in text languages names of program sections names of data types that are predefined or chosen by the user structures tables names of DFB EFB data types that are predefined or chosen by the user names of Elementary Functions EF that are predefined or chosen by the user Names of Instances Belonging to the SFC Family The names of instances are declared implicitly while the user drafts his sequential function chart They are default names supplied by the manufacturer which the user can modify Manufacturer supplied default names SFC object Name Step S_ lt section name gt _ lt step No gt Step of Macro step S_ lt section name gt _ lt macro step No gt _ lt step No gt Macro step MS_ lt section name gt _ lt step No gt Nested macro step MS_ lt section name gt _ lt macro step No gt _ lt step No gt Input step of Macro step S_IN lt section name gt _ lt macro step No gt 316 35006144 07 2012 Data Instances SFC object Name Output step of Macro step S_OUT lt section name gt _ lt macro step No gt Transition T_ lt section name gt _ lt transition No gt Transition
175. 06144 07 2012 Program Structure Periodic Execution Description Operation Operating Mode Cycle Check In this operating mode input acquisition the processing of the application program and the updating of outputs are all carried out periodically over a defined period of 1 to 255 ms At the start of the PLC cycle a time out whose current value is initialized to the defined period starts the countdown The PLC cycle must be completed before this time out expires and launches a new cycle The following diagram shows the execution phases of the PLC cycle Processing the Processing the program program l Q l Q Cycle n E Cycle n 1 mai a gt l Reading of inputs Q Writing of outputs The processor carries out internal processing input acquisition processing of the application program and the updating of outputs in that order e lf the period is not yet over the processor completes its operating cycle until the end of the period by performing internal processing e Ifthe operating time is longer than that assigned to the period the PLC signals a period overrun by setting the system bit S19 of the task to 1 Processing then continues and is executed fully however it must not exceed the watchdog time limit The following cycle is started after the outputs have been implicitly written for the current cycle Two checks are carried out e period overrun see page 94
176. 1 Presentation Objects Properties Input Aids The objects of the LD programming language help to divide a section into a number of Contacts Coils Elementary Functions EFs Elementary Function Blocks EFBs Derived Function Blocks DFBs Procedures Control elements Operation and compare blocks which represent an extension to IEC 61131 3 Subroutine calls Jumps Links Actual Parameters Text objects to comment on the logic LD sections have a background grid that divides the section into lines and columns The LD programming language is cell oriented i e only one object can be placed in each cell LD sections can be 11 64 columns and 17 2000 lines in size The program can be entered using the mouse or the keyboard The LD editor offers the following input aids e Objects can be selected from the toolbar the menu or directly using shortcut keys e Syntax and semantics are checked as the program is being written e Incorrect objects are displayed in blue e Unknown words e g undeclared variables or unsuitable data types are marked with a red wavy line e Brief description of errors in the Quickinfo Tooltip e Information for variables and for elements of an LD section that can be connected to a variable pins contacts coils operation and compare blocks can be displayed in a Quickinfo Tooltip e type name address and comment of a variable expression e type name and comment of FFB pins contacts e
177. 1 1 inhibits the acquisition of inputs relating to the FAST task SW8 2 to 5 1 inhibits the acquisition of inputs relating to the AUX 0 3 tasks 1 Note On Modicon M340 inputs outputs distributed via CANopen bus are not affected by the word swe 2 Note On Quantum inputs outputs distributed via DIO bus are not affected by the word 2sws 3 Note On PREMIUM inputs outputs distributed via ETY and ETY PORT are not affected by the word sw8 High End CPU Ethernet Port is affected by the word 3Sws This word is not available on Quantum safety PLCs 0 YES 1 YES 3 YES 2 except for safety PLCs 35006144 07 2012 181 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SWI9 Monitoring Normally set to O this bit can be set to 1 0 YES 8 YES YES 4 TSKINHIBOUT of task or 0 by the program or the terminal except output Inhibits the output updating phase of for safety update each task PLCs Sw9 0 1 assigned to the MAST task outputs relating to this task are no longer managed e SW9 1 1 assigned to the FAST task outputs relating to this task are no longer managed SwW9 2 to 5 1 assigned to the AUX 0 3 tasks outputs relating to these tasks are no longer managed 3 Note On Modicon M340 inputs outputs distributed via CANopen bus are not affected by the word sw9 On Modic
178. 100101 01000111 Unused Syntax Rules The Date and Time type is entered as follows DT lt Year gt lt Month gt lt Day gt lt Hour gt lt Minutes gt lt Seconds gt This table shows the lower upper limits in each field Field Limits Comment Year 1990 2099 Month 01 12 The left 0 is always displayed but can be omitted during entry Day 01 31 For the months 01 03 05 07 08 1 0 12 01 30 For the months 04 06 09 1 1 01 29 For the month 02 leap years 01 28 For the month 02 non leap years Hour 00 23 The left 0 is always displayed but can be omitted during entry Minute 00 59 The left 0 is always displayed but can be omitted during entry Second 00 59 The left 0 is always displayed but can be omitted during entry Example Entry Comment DT 2000 1 10 0 40 0 The left 0 of the month hour second can be omitted dt 1999 12 31 23 59 59 The prefix can be written in lower case Dt 1990 10 2 12 02 30 The prefix can be mixed lower upper case 268 35006144 07 2012 Data Types 8 3 Elementary Data Types EDT in Real Format Presentation of the Real Data Type Introduction The data types in Binary format belong to the EDT Elementary data type family which includes single rather than derived data types tables structures function blocks Reminder Concerning Real Format The Real format floating point in ANSI IEEE 754 standard is coded in 32 bit format which corresponds to the single decimal point flo
179. 110 16 759E Parameter out of range RANGE DTIME FP_ERROR F See table Common Floating Point Errors page 660 DTIME Status word values T F For details about the DTIME status word refer to the DTIME desription see Unity Pro Control Block Library INTEGRATOR E_ERR_DEN 30152 16 8A38 Nota valid floating point number INTEGRATOR E_ERR_IB_MAX_MIN 30102 16 8A6A YMAX lt YMIN INTEGRATOR FP_ERROR See table Common Floating Point Errors page 660 LAG_FILTER E_ERR_DEN 30152 16 8A38 Not a valid floating point number LAG_FILTER FP_ERROR See table Common Floating Point Errors page 660 LDLG E_ERR_DEN 30152 16 8A38 Not a valid floating point number LDLG FP_ERROR See table Common Floating Point Errors page 660 LEAD E_ERR_DEN 30152 16 8A38 Not a valid floating point number LEAD FP_ERROR See table Common Floating Point Errors page 660 MFLOW W_WARN_OUT_OF_ T 30110 16 759E Parameter out of range RANGE MFLOW FP_ERROR F See table Common Floating Point Errors page 660 644 35006144 07 2012 EFB Error Codes and Values EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex MFLOW Status word values T F For details about the MFLOW status word refer to the MFLOW desription see Unity Pro Control Block Library QDTIME E_ERR_DEN 30152 16 8A38 N
180. 12 15 3 Part V Chapter 16 Chapter 17 Chapter 18 Chapter 19 Chapter 20 Appendices Appendix A Repeat Instruction REPEAT UNTIL END_REPEAT Repeat Instruction EXIT 2 0 00 eee Subroutine Call sae rei ir a eee ene RETURN y ron nia a ee atte a E had eee es Empty Instruction ssi ri ea e a a a aaa a eY Labels and JUMPS s r 1 0 ienai aaam a aE tenes Comments seine digas a ie wee eee et ets Poe et Calling Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures 2000020 cece eee eee Calling Elementary Functions 00 c eee eee Call Elementary Function Block and Derived Function Block Procedures ati s ddan doa AE die kt ee eae Se User Function Blocks DFB 5 Overview of User Function Blocks DFB Introduction to User Function Blocks 20000000 ee eaee Implementing a DFB Function Block 0 2 0 0 eee eee eee Description of User Function Blocks DFB Definition of DFB Function Block Internal Data DEB Parameters resan tS nee i ead 8b det Gade eed Ean ee DFB Variables e 004 2 ota Pia el te oe ae ae area A DEB Code Sectionies 3 42 w iesen hr ke ORE web dat bate ed User Function Blocks DFB Instance Creation of a DFB Instance 000 cee eee eee eee Execution of a DFB Instance 00 0c eee eee eee Programming E
181. 144 07 2012 SFC Sequence Language 13 8 Text Objects Text Object Introduction Text can be positioned in the form of text objects using SFC sequence language The size of these text objects depends on the length of the text This text object is at least the size of a cell and can be vertically and horizontally enlarged to other cells according to the size of the text Text objects can overlap with other SFC objects 35006144 07 2012 447 SFC Sequence Language 13 9 Single Token Overview This section describes the Single Token operating mode for sequence controls What Is in This Section This section contains the following topics Topic Page Execution Sequence Single Token 449 Alternative String 450 Sequence Jumps and Sequence Loops 451 Parallel Strings 454 Asymmetric Parallel String Selection 456 448 35006144 07 2012 SFC Sequence Language Execution Sequence Single Token Description The following rules apply for single token The original situation is defined by the initial step The sequence string contains 1 initial step only Only one step is ever active in the sequence string The only exceptions are parallel branches in which one step is active per branch The active signal status processes take place along the directional links triggered by switching one or more transitions The direction of the string process follows the directional links and run
182. 2 Ladder Diagram LD EBOOL with M not written inside program An EBOOL variable with a 3M address which is not written inside your program but directly for example by an animation table an operator screen or an HMI will not work in the expected way The edge is TRUE infinitely because the M is only written one time NOTE To avoid this issue the M has to be written at the end of the task to update the old value information The old value is only updated when the M bit is written so if you write the bit only one time the edge detection will be infinite Old Value Current Value Edge Detect Description 0 0 0 state 0 before writing the bit 0 1 1 Write 1 in the bit e g by animation table 0 1 1 If you do not write again the edge remains infinitely 1 1 0 Write 1 again in the bit the old value is updated and the edge detection is set to 0 EBOOL with M written inside program For an EBOOL variable with a 3M address which is written inside your program you have to adhere to the restrictions described below e Do not use the bit with a SET or RESET coil In this case the old value is not updated So you can perform an infinite edge e Do not write the bit conditionally A simple logic as IF NOT M1 THEN M1 TRUE END_IF leads to an infinite edge because it is written only one time EBOOL with l For an EBOOL variable with a I address you have to adhere to the restri
183. 2012 Use of DFBs Formal DFB Call The formal DFB call Cpt_1 is performed with the following syntax Cpt_1 Reset Clear Presel P_ Select Count 100 Done gt Q1 2 1 Where the input parameters assigned by a value expression object or immediate value are entered in the list of arguments the syntax is Cpt_1 Reset Clear Presel P_ Select Count 100 Q1 2 1 Cpt_1 Done Elements of the Sequence Informal DFB Call The following table lists the different elements of the program sequence when a formal DFB call is made Element Meaning Cpt_1 Name of the DFB instance Reset Presel Count Input parameters Assignment symbol of an input Clear Assignment object of an input symbol 100 Assignment value of an input Done Output parameter gt Assignment symbol of an output Q1 2 1 Assignment object of an output address End of sequence symbol Argument separation symbol The informal DFB call Cpt_1 is performed with the following syntax Cpt_1 Clear MD10 100 Q1 2 1 Cpt_1 Done 35006144 07 2012 617 Use of DFBs Elements of the Sequence The following table lists the different elements of the program sequence when a formal DFB call is made Element Meaning Cpt_1 Name of the DFB instance Clear MD10 100 Assignment object or value of the inputs Non assigned inputs are represented by an empty field
184. 231 35006144 07 2012 221 System Objects Description of Quantum System Words SW60 to SW66 Detailed Description System words description SW60 to SW66 Word Function Description Initial Symbol state SW6O Quantum Hot Different bits meaning of the word SWE60 0 HSB CMD Standby SW60 0 1 invalidates the commands entered in the display keypad command SWE60 1 register e 0 sets PLC A to OFFLINE mode e 1 sets PLC A to ONLINE mode SWE0 2 e 0 sets PLC B to OFFLINE mode 1 sets PLC B to ONLINE mode NOTE The Primary CPU controller goes to RUN Offline only if the secondary CPU is RUN Standby At Startup of the Secondary PLC the secondary CPU goes to Online mode RUN Standby only if both bits SWE60 1 and SW60 2 are set to 1 regardless of A B assignment If bits SW60 1 and SW60 2 are set to 0 simultaneously a switchover occurs e Primary controller goes RUN Offline and e Standby controller now operates as RUN Primary To complete the switchover bits SW60 1 and SW60 2 must be set back to 1 This makes the Offline CPU going back to Online mode Run Standby The OFFLINE ONLINE mode controlled by the SW60 1 and SW60 2 bits is not linked to the LCD Keypad ONLINE OFFLINE mode see Modicon Quantum Hot Standby System User Manual sSw60 3 0 lf an application mismatch is detected Standby CPU is forced to OFFLINE mode e 1 Standby CPU operates normally even if a mi
185. 35006144 12 Unity Pro Program Languages and Structure Reference Manual 07 2012 Schneider www schneider electric com Electric The information provided in this documentation contains general descriptions and or technical characteristics of the performance of the products contained herein This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability of these products for specific user applications It is the duty of any such user or integrator to perform the appropriate and complete risk analysis evaluation and testing of the products with respect to the relevant specific application or use thereof Neither Schneider Electric nor any of its affiliates or subsidiaries shall be responsible or liable for misuse of the information that is contained herein If you have any suggestions for improvements or amendments or have found errors in this publication please notify us No part of this document may be reproduced in any form or by any means electronic or mechanical including photocopying without express written permission of Schneider Electric All pertinent state regional and local safety regulations must be observed when installing and using this product For reasons of safety and to help ensure compliance with documented system data only the manufacturer should perform repairs to components When devices are used for applications with technical safety requirements the
186. 3_6 If Then If the transition condition a is true then a sequence runstoS 3 lands 3 2 IfstepsS_3 lands 3 2 are activated then the strings run independently of one another If transition condition b is false and c is true then a sequence runs to S 3 5 A second token is created by the sequence running on the alternative branch out of the parallel string Both tokens are running parallel to one another i e S 3 1 ands 3 5 are active at the same time 472 35006144 07 2012 SFC Sequence Language Token 1 S_3_1 Token 2 S_3_5 If Then If Then Since S_3 4 cannot become active S_3_1 remains If transition condition dis then a sequence runs to token 1 active true 513 6 If transition condition a is true then a sequence runs to s_3_1 and s_3_2 This ends token 2 and the string is again processed as Single Token If the transition condition a is true then a sequence runs toS 3 lands 3 2 If transition condition b is then a sequence runs to true and c is false S34 Since S_3 4 cannot become active S_3 1 remains token 1 active until a sequence appears on S_3_ 2 token 2 and the transition is b IfS_4 4 is no longer active token 1 then it is reactivated by token 2 and both tokens continue running parallel Multi Token Merging the two tokens can also be done ins 4 3 35006144 07 2012 473 SFC Sequence Language 474 35006144 07 2012
187. 4 07 2012 615 Use of DFBs Use of a DFB in a Structured Text Language Program Principle In Structured Text a user function block is called by a DFB call name of the DFB instance followed by a list of arguments Arguments are displayed in the list between brackets and separated by commas The DFB call can be of one of two types e aformal call when arguments are assignments parameter value In this case the order in which the arguments are entered in the list is not important The EN input parameter and the ENO output parameter can be used to control the execution of the function block e an informal call when arguments are values expression object or an immediate value In this case the order in which the arguments are entered in the list must follow the order of the DFB input parameters including for non assigned inputs the argument is an empty field It is not possible to use EN and ENO parameters DFB Name argument 1 argument 2 argument n NOTE The ANY_ARRAY type inputs generic data type outputs ANY_ and input outputs of a DFB must be assigned Use of EN ENO Parameters Example of a DFB See EN and ENO Parameters page 593 The following simple example explains the different DFB calls in Structured Text language This is the instance Cpt_1 of the Cpt_parts type DFB Cpt_1 Cpt_parts Clear Reset Done Q1 2 1 P_Select Presel 100 Count 616 35006144 07
188. 403 for the function is shown to the right of the function type The function counter is shown above the frame The function counter is the sequential number of the function within the current section Function counters cannot be modified Elementary Function 1 DIV EN ENO INI OUT IN2 With some elementary functions the number of inputs can be increased 376 35006144 07 2012 Ladder Diagram LD Elementary Function Block Elementary function blocks have internal states If the input values are the same the value on the output can be different each time the function is called e g fora counter the value on the output is incremented An elementary function block is represented graphically as a frame with inputs and outputs The inputs are always represented on the left and the outputs always on the right of the frame The name of the function block i e the function block type is displayed in the center of the frame The instance name is displayed above the frame Function blocks can have more than one output The name of the function block i e the function block type is displayed in the center of the frame The execution number see page 403 for the function block is shown to the right of the function block type The instance name is displayed above the frame The instance name serves as a unique identification for the function block in a project The instance name is created au
189. 6144 07 2012 73 Application Structure 74 35006144 07 2012 Description of the Available Functions for Each Type of PLC 2 Functions Available for the Different Types of PLC Programming Languages All the following languages are available for platforms Modicon M340 Premium Atrium and Quantum e LD FBD ST IL SFC NOTE Only LD and FBD languages are available on Quantum Safety PLCs 35006144 07 2012 75 PLC Functions Tasks and Processes The following table describes the available tasks and processes Platforms Modicon M340 Premium TSX Atrium Quantum 140 CPU TSX Processors P34 1000 P34 20 P57 0244 P57 20 P57 5ee PCI 57 3teese 6519 651 60S P57 1e P57 3ee P57 6634 204 354 43eeee 65260 671 60S P57 4ee 53eeee 670 60 H57 24M 671 60 H57 44M 672 60 672 61 Master task X X X X X X X Xx X cyclic or periodic Fast task X X X X X X X X periodic Auxiliary tasks 4 4 periodic Maximum size 64Kb 16Mb of a section I O type event 32 64 32 64 128 64 64 128 processing Timer type 16 32 32 16 32 event processing Total of I O 32 64 32 64 128 64 64 128 type and Timer type event processing X or Value available tasks or processes the value is the maximum number unavailable tasks or processes 76 35006144 07 2012 Application Program Structure Subject of this Chapt
190. 7 Defined as E_EFB_USER_ERROR_18 ERT_854_10 ES_WRONG_PAKET F 8192 16 2000 ERT_854_10 E_WRONG_PAKET 30212 16 89FC Defined as E_EFB_USER_ERROR_13 ERT_854_10 ES_WRONG_FELD 12288 16 3000 ERT_854_10 E_WRONG_FELD F 30213 16 89FB Defined as E_EFB_USER_ERROR_14 QUANTUM E_EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration QUANTUM E_EFB_UNKNOWN_DROP F 30190 16 8A12 Unknown drop No Quantum traffic cop XBE E_EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration XBE E_EFB_UNKNOWN_DROP F 30190 16 8A12 Unknown drop No Quantum traffic cop XDROP E_EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration NOTE For details about 1 ERT 854 10 please refer to the ERT_854_10 description see Quantum with Unity Pro 140 ERT 854 10 Time Stamp Module User s manual in the IO Management Library 35006144 07 2012 643 EFB Error Codes and Values Tables of Error Codes for the CONT_CTL Library Introduction The following tables show the error codes and error values created for the EFBs of the CONT_CTL Library Conditioning Table of error codes and errors values created for EFBs of the Conditioning family EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex DTIME W_WARN_OUT_OF_ T 30
191. 7 16 8A15_ Negative overflow RANGE O_SCALE_WARN E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration 640 35006144 07 2012 EFB Error Codes and Values Immediate I O Table of error codes and errors values created for EFBs of the Immediate I O family EFB name Error code ENO state Error value Error value Error description in case of in Dec in Hex error IMIO_IN F 0000 0000 Operation OK IMIO_IN F 8193 2001 invalid operation type e g the I O module addressed is not an input module IMIO_IN F 8194 2002 Invalid rack or slot number I O map in the configurator contains no module entry for this slot IMIO_IN F 8195 2003 invalid slot number IMIO_IN F 4095 F001 Module not OK IMIO_OUT F 0000 0000 Operation OK IMIO_OUT F 8193 2001 invalid operation type e g the I O module addressed is not an input module IMIO_OUT F 8194 2002 Invalid rack or slot number I O map in the configurator contains no module entry for this slot IMIO_OUT 8195 2003 invalid slot number IMIO_OUT 4095 F001 Module not OK 35006144 07 2012 641 EFB Error Codes and Values Quantum I O Configuration Table of error codes and errors values created for EFBs of the Quantum I 0 Configuration family EFB name Error cod
192. 7 16 8A1F A negative value cannot be FOR_TIME_OPERATION converted to data type TIME MULTIME FP_ERROR F See table Common Floating Point Errors page 660 630 35006144 07 2012 EFB Error Codes and Values Statistical Table of error codes and errors values created for EFBs of the Statistical family EFB Error code ENO state Error Error Error description name in case of value in value in error Dec Hex AVE E_INPUT_VALUE_OUT_ F 30183 16 8A19 Input value is out of range OF_RANGE AVE E DIVIDE_BY_ZERO F 30176 16 8A20 Divide by zero AVE FP_ERROR See table Common Floating Point Errors page 660 AVE E_ARITHMETIC_ F 30170 16 8A26 Arithmetic error ERROR AVE E _FP_STATUS_FAILED F 30150 16 8A3A Illegal floating point operation AVE E_ARITHMETIC_ 30172 16 8A24 Arithmetic error Muliplication overflow ERROR_MUL_OV AVE E_ARITHMETIC_ F 30173 16 8A23 Arithmetic error Addition overflow ERROR_ADD_OV AVE E_ARITHMETIC_ F 30171 16 8A25 Arithmetic error Parameter exceeds ERROR_BIG_PAR range AVE E_ARITHMETIC_ F 30174 16 8A22 Arithmetic error Unsigned overflow ERROR_UNSIGN_OV MAX FP_ERROR F See table Common Floating Point Errors page 660 MIN FP_ERROR F See table Common Floating Point Errors page 660 MUX E_SELECTOR_OUT_ F 30175 16 8A21 Selector is out of range OF_RANGE 35006144 07 2012 631 EFB Error
193. 7 2012 Operating Modes Processing of Power Outage and Restoral of Modicon M340 PLCs General If the duration of the outage is less than the power supply filtering time it has no effect on the program which continues to run normally If this is not the case the program is interrupted and power restoration processing is activated Filtering time PLC Alternating Current Direct Current BMX CPS 2000 10ms BMX CPS 3500 BMX CPS 3540T BMX CPS 2010 ims BMX CPS 3020 Illustration The following illustration shows the different power cycle phases RUN or STOP Application Ww Power failure Save Context Valid context Invalid context Wam restart Cold start 35006144 07 2012 133 Operating Modes Operation The table describes the power outage processing phases Phase Description 1 On power outage the system saves the application context the values of application variables and the state of the system on internal Flash memory 2 The system sets all the outputs into fallback state state defined in configuration 3 On power restoral some actions and checks are done to verify if warm restart is available e restoring from internal Flash memory application context e verification with memory card presence application availability e verification that the application context is identical to the memory card
194. 8 35006144 07 2012 539 Structured Text ST Instructions Description Instructions are the Commands of the ST programming language Instructions must be terminated with semicolons Several instructions Separated by semicolons can be present in one line A single semicolon represents an Empty instruction see page 556 540 35006144 07 2012 Structured Text ST Assignment Introduction When an assignment is performed the current value of a single or multi element variable is replaced by the result of the evaluation of the expression An assignment consists of a variable specification on the left side followed by the assignment operator followed by the expression to be evaluated Both variables left and right sides of the assignment operator must have the same data type Arrays are a special case After being explicitly enabled assignment of two arrays with different lengths can be made Assigning the Value of a Variable to Another Variable Assignments are used to assign the value of a variable to another variable The instruction A B is used for example to replace the value of the variable A with the current value of variable B If A and B are elementary data types the individual value of B is passed to A If A and B are derived data types the values of all B elements are passed to A Assigning the Value of a Literal to a Variable Assignments are used to assign a lite
195. 91 35006144 07 2012 719 Index DS SFC 432 DT 268 DWORD 279 E EBOOL 255 EDT 251 EFB 294 elementary data types EDT 257 elementary function block EFB 294 295 ELSE 545 ELSIF THEN 546 EN ENO FBD 351 IL 505 515 523 LD 383 ST 564 572 577 EQ IL 492 error codes 629 event processing 97 EXIT 553 F FBD language 341 344 structure 342 floating point 269 FOR TO BY DO END_FOR ST 548 forced bits 255 G GE IL 492 GT IL 492 H HALT 156 IEC Compliance 667 IF THEN END_IF ST 544 IN_OUT FBD 353 IL 516 523 LD 386 ST 572 578 input output addressing 319 instruction list IL language 475 501 506 518 operators 486 structure 477 INT 260 J JMP FBD 355 IL 494 497 LD 387 SFC 440 ST 557 L L SFC 432 labels FBD 355 IL 497 LD 387 ST 557 LD language 369 376 structure 370 LD operators IL 369 LE IL 493 LT 493 720 35006144 07 2012 Index M memory structures 115 Modicon M340 117 MOD IL 491 ST 535 Modicon M340 memory structures 117 State RAM 117 MUL IL 490 N NE IL 493 NOT IL 490 O operate 388 OR IL 489 ST 538 P P SFC 432 PO SFC 432 P1 SFC 432 private variables DFB 596 FBD 350 382 508 568 public variables DFB 596 FBD 349 IL 508 LD 382 ST 567 R R IL 488 LD 374 SFC 432 REAL 269 REPEAT UNTIL END_REPEAT 552
196. 944e 38 0 0 1 1754944e 38 3 4028235e 38 When a calculation result is e between 1 175494e 38 and 1 175494e 38 it is considered as a DEN less than 3 4028234e 38 the symbol INF for infinite is displayed greater than 3 4028234e 38 the symbol INF for infinite is displayed undefined square root of a negative number the symbol NAN or NAN is displayed NOTE The IEC 559 standard defines two classes of NAN quiet NAN QNAN and signaling NaN SNaN QNAN is a NAN with the most significant fraction bit set and a SNAN is a NAN with the most significant fraction bit clear Bit number 22 QNANs are allowed to propagate through most arithmetic operations without signaling an exception SNAN generally signal an invalid operation exception whenever they appear as operands in arithmetic operations See SW17 and S18 NOTE when an operand is a DEN De normalized number the result is not significant An literal real value is a number expressed in one or more decimals Example 12 0 0 0 0 456 3 14159 26 Real literals with exponent An Literal decimal value can be expressed using standard scientific notation The representation is as follows mantissa exponential Example 1 34E 12 or 1 34e 12 1 0E 6 or1 0et 6 1 234E6 or1 234e6 712 35006144 07 2012 Glossary RS 232C RS 485 RUN RUN Auto Rung Section Serial communication standard which defines the voltage of the following service e as
197. 9E Parameter out of range RANGE MS FP_ERROR F See table Common Floating Point Errors page 660 MS Status word values T F For details about the MS status word refer to the MS description see Unity Pro Control Block Library PWM1 WAF_PBM_TMINMAX 30113 16 8A5F t_min lt t_max PWM1 FP_ERROR See table Common Floating Point Errors page 660 SERVO FP_LERROR F See table Common Floating Point Errors page 660 SERVO Status word values T F For details about the SERVO status word refer to the SERVO description see Unity Pro Control Block Library SPLRG W_WARN_OUT_OF__ T 30110 16 759E Parameter out of range RANGE SPLRG E_ERR_NULL_INPUT_ F 30121 16 8A57 Null input scale max and min limit must be SCALE different SPLRG FP_LERROR F See table Common Floating Point Errors page 660 SPLRG Status word values T F For details about the SPLRG status word refer to the SPLRG description see Unity Pro Control Block Library 35006144 07 2012 649 EFB Error Codes and Values Setpoint Management Table of error codes and errors values created for EFBs of the Setpoint Management family EFB Error code ENO state Error Error Error description name in case of valuein value in error Dec Hex RAMP W_WARN_OUT_OF_ T 30110 16 759E Parameter out of range RANGE RAMP FP_ERROR F See table Common Floating Point Errors pag
198. A IN OUT result EN and ENO With all functions an EN input and an ENO output can be configured If the value of EN is equal to 0 when the function is called the algorithms defined by the function are not executed and ENO is set to 0 If the value of EN is equal to 1 when the function is called the algorithms defined by the function are executed After the algorithms have been executed successfully the value of ENO is set to 1 If an error occurred while executing the algorithms ENO is set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if EN equals to 1 If ENO is set to 0 caused when EN 0 or an error occurred during execution the output of the function is set to 0 The output behavior of the function does not depend on whether the function was called up without EN ENO or with EN 1 If EN ENO are used the function call must be formal LIMIT EN 1 MN 0 IN varl MX 5 ENO gt var2 ST out Calling the same function in FBD LIMIT 1 jEN ENO var2 0 MN OUT out vari IN 5 MX 35006144 07 2012 505 Instruction List IL Calling Elementary Function Blocks and Derived Function Blocks Elementary Function Block Elementary function blocks have internal states If the inputs have the same values the value on the output
199. A MULTIRANGE E TSX AEY 414 El Configuration E Channel F Sal Fik ymbo ange cale ilter E Channel 1 0 sov pe o Channel 2 i Thermo K wiitoec 0 v DEMEEN A AOV e O g PHOOIECIDIN I h110 C 10 v Task MAST Me C Terminal Block Recognition Cold Connection Internal Telefast Extemal PT100 34 35006144 07 2012 Presentation Module Properties The module properties window called via the modules shortcut menu shows the modules properties such as the power consumption number of I O points only Premium and more The module properties window for the power supply shows the total current of the rack TSX PSY 2600M 1 Power Supply EA 120 5000 mA 100 80 60 1904 mA 40 20 5V E Used E Overloaded Available 625 mA GmA 24V 500 mA 30 mA 24VR VR For relay V For VDC inputs OK _ camca 35006144 07 2012 35 Presentation Network Configuration The network configuration is called via the communications folder Network configuration Project Browser Ta Structural view E Communication Eeo Es Ether New Network og C Program Add User Directory y Animation T Add Hyperlink Operator Scr y Documentatii 200m in Zoom out lt j ili
200. ATE variables in the Data Editor The Comment for aSFCSTEP_ STATE variable is the comment entered as a property of the step itself Please refer to Defining the properties of steps see Unity Pro Operating Modes in the Unity Pro Operating Modes Manual The data structure cannot be used in variable declarations Therefore accessing the entire data structure e g as FFB parameter is not possible Structure of the Data Structure Element Name Data type Description StepName t TIME Current dwell time in the step If the step is deactivated the value of this element is retained until the step is activated again StepName x BOOL 1 Step active 0 Step inactive StepName tminErr BOOL This element is a supplement to IEC 61131 3 1 Underflow of minimum supervision time 0 No underflow of minimum supervision time The element is automatically reset in the following cases e Ifthe step is activated again e lf the sequence control is reset e lf the command button Reset Time Error is activated StepName tmaxErr BOOL This element is a supplement to IEC 61131 3 1 Overflow of maximum supervision time 0 No overflow of maximum supervision time The element is automatically reset in the following cases e Ifthe step is exited e lf the sequence control is reset e f the command button Reset Time Error is activated 35006144 07 2012 423 SFC Sequence Language
201. C standard smw indicates an output real type language object Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt SKF lt i gt SOF IF by using their topological address for example SMD0 6 0 11 SMFO 6 0 31 QW According to the IEC standard QW indicates an analog output type language object A Animating the links This is also called power flow and refers to a type of animation used with Ladder language and the function blocks The links are displayed in red green or black according to the variables connected 694 35006144 07 2012 Glossary ANY There is a hierarchy between the different types of data In the DFB it is sometimes possible to declare which variables can contain several types of values Here we use ANY xxx types The following diagram shows the hierarchically ordered structure ANY ANY_ELEMENTARY ANY_MAGNITUDE_OR_BIT ANY_MAGNITUDE ANY_NUM ANY_REAL REAL ANY_INT DINT INT UDINT UINT TIME ANY_BIT DWORD WORD BYTE BOOL ANY_STRING STRING ANY_DATE DATE_AND_TIME DATE TIME_OF_DAY EBOOL ANY_DERIVED ANY_ARRAY ANY_ARRAY_ANY_EDT JANY_ARRAY_ANY_MAGNITUDE NY_ARRAY_ANY_NUM ANY_ARRAY_ANY_REAL ANY_ARRAY_REAL ANY_ARRAY_ANY_INT ANY_ARRAY_DINT ANY_ARRAY_INT ANY_ARRAY_UDINT ANNY_ARRAY_UINT NY_ARRAY_TIME JANY_ARRAY_ANY_BIT NY_ARRAY_DWORD NY_ARRAY_WORD NY_ARRAY_BYTE NY_ARRAY_BOOL JANY_ARRAY_ANY_STRING ANY_ARRAY_STRING JANY_ARRA
202. CAL InOutFB Calling a function block with the VAR_IN_OUT parameter IN1 V1 inout V2 and assigning the actual parameter within the function block call Valid call example 2 LD V1 Loading a V1 variable in the accumulator ST InOutFB IN1 Assigning the accumulator contents to the IN1 parameter of the IN1 function block CAL InOutFB inout V2 Calling the function block with assignment of the actual parameter V2 to the VAR_IN_OUT parameter 35006144 07 2012 595 Description of DFBs DFB Variables Description of the Variables This table shows the role of each type of variable Variable Maximum Role number Public unlimited These internal variables of the DFB may be used by the DFB by the application program and by the user in adjust mode Private unlimited These internal variables of the DFB can only be used by this function block and are therefore not accessible by the application program but these type of variables can be accessed by the animation table These variables are generally necessary to the programming of the block but are of no interest to the user for example the result of an intermediate calculation etc NOTE Nested DFBs are declared as private variables of the parent DFB So their variables are also not accessible through programming but trough the animation table Variables that Can Be Accessed by the Application Program The o
203. CFG_CP_V MMF_BAD_4X T 9010 16 2332 CFG_CP_V MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error CFG_CS BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 CFG_CS MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error CFG_FS BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 CFG_FS MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error CFG_IA BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 CFG_IA MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error CFG_RA BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 CFG_RA MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error CFG_SA BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 CFG_SA MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error DRV_DNLD_ BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 DRV_DNLD MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error DRV_UPLD BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 DRV_UPLD MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error IDN_CHK BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 IDN_CHK MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error IDN_XFER BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 IDN_XFER MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error MMF_BITS BAD_REVISION F 30200 16 8A08 defined as E_EFB
204. Codes and Values Tables of Error Codes for the Diagnostics Library Introduction The following tables show the error codes and error values created for the EFBs of the Diagnostics Library Diagnostics Table of error codes and errors values created for EFBs of the Diagnostics family EFB name Error code ENO state in case of error Error value in Dec Error value in Hex Error description ONLEVT E_EFB_ONLEVT T F 30196 16 8A0C Error of EFB ONLEVT ENO states e True Error registration OK e False Error registration failed 632 35006144 07 2012 EFB Error Codes and Values Tables of Error Codes for the Communication Library Introduction The following tables show the error codes and error values created for the EFBs of the Communication Library Extended Table of error codes and errors values created for EFBs of the Extended family EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex CREAD_REG E_EFB_MSTR_ERROR_ IF 30191 16 8A11 MSTR communication error CREAD_REG E_EFB_NOT_STATE F 30531 16 88BD Variable not mapped to MW 4x RAM_4X area CREAD_REG F 8195 16 2003 Value displayed in status word Comes together with E_EFB_MSTR_ERROR CREAD_REG F 8206 16 200E Value displayed in status word Comes together with E _EFB_NOT_STATE_RAM_4X CREAD_REG
205. D4 2 3 R KD lt mod gt lt c gt lt d gt KD4 2 3 12 R Read type REAL floating point KF lt mod gt lt c gt KF4 2 3 R R lt mod lt b gt lt e gt lt r gt lt m gt lt b gt bus number omitted if station is local lt e gt device connection point number omitted if station is local the connection point is also called Drop for Quantum users lt r gt rack number lt m gt module slot lt c gt channel number 0 to 999 or MOD reserved word lt d gt data number 0 to 999 or ERR reserved word optional if 0 value For Modicon M340 lt d gt is always even 35006144 07 2012 323 Data Instances Examples local station and station on bus for Modicon M340 PLCs Configuration Modicon M340 l0 1 5 rack 0 module 1 channel 5 Configuration Modicon M340 Lele 1 SI Si Tose e ees ss PFS TTS Sho Line end CANopen Bus No 3 J 1 10 mie EN gi d s STB interface module ATV31 XPSMC 16 LEXIUM 05 YlW 3 1 0 0 0 17 IW 3 10 0 0 0 1 bus 3 adresse device 1 bus 3 adresse device 10 channel 0 data 17 channel 0 data 1 324 35006144 07 2012 Data Instances Examples local station and station on bus for Quantum and Premium PLCs
206. DDT Device DDT 281 Array Sna oi hides a beh A ei pod pions Seb cal E a E a a aea een ee ee 282 SUUCTUNCS S naaa a aa E a aueia boca oen e aaa serie and a ae 285 Overview of the Derived Data Type family DDT 286 DDT Mapping Rules 0 e eee eee 288 Overview of Input Output Derived Data Types IODDT 291 Overview of Device Derived Data Types Device DDT 293 Function Block Data Types DFB EFB 02000 eee eee 294 Overview of Function Block Data Type Families 295 Characteristics of Function Block Data Types EFB DFB 297 Characteristics of Elements Belonging to Function Blocks 299 Generic Data Types GDT 0 0 0 cece ects 302 Overview of Generic Data Types 0 000 e eee eee eee 302 Data Types Belonging to Sequential Function Charts SFC 304 Overview of the Data Types of the Sequential Function Chart Family 304 Compatibility Between Data Types 0 0 0 c eee eee ee 306 Compatibility Between Data Types 0 0 0 cece eee ee 306 Data Instances i s oesa dials wdinon Sea os Kaas seal ae 311 Data Type Instances 0 cece tts 312 Data Instance Attributes 0 2 eee es 316 Direct Addressing Data Instances 0 00 0 e eee eee eee 319 Data References 2 02 2 cece eee eee eens 327 References to Data Instances by Value 00 00 eae 328 Refe
207. EBOOL Type This type takes up one memory byte which contains e the bit for the value V e the history bit H for managing rising or falling edges Each time the object s status changes the value is copied to this bit e the bit containing the forcing status F Equal to 0 if the object is not forced and equal to 1 if the object is forced The default value for the bits associated with the EBOOL type is FALSE 0 It is accessible via an address specifying the offset of the corresponding byte Address settings Memory Offset Historical Trend Diagram The trend diagram below shows the main statuses of the value and history bits associated with the EBOOL type The rising edges of the value bit 1 4 are copied to the history bit in the next PLC cycle 2 5 The falling edges of the value bit 2 7 are copied to the history bit of the next PLC cycle 3 8 0 8 48 8 2 8 A Value a a S S a S T History bit i i i i i i z 256 35006144 07 2012 Data Types Trend Diagram and Forcing The trend diagram below shows the main statuses of the value history and forcing bits associated with the EBOOL type The rising edges of the value bit 1 4 are copied to the history bit in the next PLC cycle 2 5 The falling edges of the value bit 2 7 are copied to the history bit in the next PLC cycle 3 8 Between 4 and 5 the forcing bit
208. EC Compliance IEC standards tables The supported features and other implementation specific information is given in the following compliance statement and the subsequent tables as required by the Standard 35006144 07 2012 663 IEC Compliance B 2 IEC Compliance Tables Overview This system complies with the requirements of IEC 61131 3 for the language and feature listed in the following tables What Is in This Section This section contains the following topics Topic Page Common elements 665 IL language elements 677 ST language elements 679 Common graphical elements 680 LD language elements 681 Implementation dependent parameters 682 Error Conditions 685 664 35006144 07 2012 IEC Compliance Common elements Common elements IEC compliance table for common elements Table No Feature No Description of Feature 1 2 Lower case characters 3a Number sign 4a Dollar sign 5a Vertical bar I 2 1 Upper case and numbers Upper and lower case numbers embedded underlines Upper and lower case numbers leading or embedded underlines wo Comments 3a Pragmas nN Integer literals Real literals Real literals with exponents Base 2 literals Base 8 literals Base 16 literals Boolean zero and one Boolean FALSE and TRUE O ON oJ oO AJ OIN Typed literals
209. ENO must be made using the gt operator MY COUNT EN 1 CU varl R reset PV 100 value ENO gt error Q gt out CV gt current Calling the same function block in FBD MY_COUNT CTU 1 EN ENO error yari CU Q out reset R 100 value PV CV current VAR_IN_OUT Variable Function blocks are often used to read a variable at an input input variables to process it and to restate the altered values of the same variable output variables This special type of input output variable is also called a VAR_IN_OUT variable The following special features are to be noted when using function blocks DFBs with VAR_IN_OUT variables e All VAR_IN_OUT inputs must be assigned a variable e VAR_IN_OUT inputs may not have literals or constants assigned to them e VAR_IN_OUT outputs may not have values assigned to them e VAR_IN_OUT variables cannot be used outside of the function block call Calling a function block with VAR_IN_OUT variable in ST MY FBLOCK IN1 V1 IN2 V2 101 V3 OUT1 gt V4 OUT2 gt V5 572 35006144 07 2012 Structured Text ST Calling the same function block in FBD MY_FBLOCK FBLOCK Vi IN1 OUT1 V4 v2 IN2 OUT2 V5 V3 101 101 V3 VAR_IN_OUT variables cannot be used outside the function block call The following function block calls are therefore invalid Invalid call example 1 InOutFB inout V1 Assigning th
210. F_DAy precision 1 s Maximum number of enumerated values Not applicable Maximum number of array subscripts 6 Maximum array size 64 kbytes Maximum number of structure elements no limit Maximum structure size 64 kbytes Maximum range of subscript values DINT range Maximum number of levels of nested 10 structures Default maximum length of STRING and WSTRING variables 16 characters Maximum allowed length of STRING and WSTRING variables 64 kbytes 682 35006144 07 2012 IEC Compliance Parameters Limitations Behavior Maximum number of hierarchical levels Logical or physical mapping Premium physical mapping 5 levels Quantum logical mapping 1 level Maximum number of inputs of extensible functions The number of all input parameters including in out parameters is limited to 32 The number of all output parameters including in out parameters is also limited to 32 Thus the limit for extensible input parameters is 32 number of input parameters number of in out parameters The limit for extensible output parameters is 32 number of output parameters number of in out parameters Effects of type conversions on accuracy See online help Error conditions during type conversions Error conditions are described in the online help Globally S18 is set for overflow errors ENO is also set The result is depending on the specific fu
211. How to Program Event Processing 113 35006144 07 2012 97 Program Structure Multitasking Software Structure Tasks and Processing The task structure of this type of application is as follows Task Processing Designation Description Master MAST Always present may be cyclic or periodic Fast FAST Optional always periodic Auxiliary AUX 0 to 3 Optional and always periodic Event EVTi and Called by the system when an event occurs on an TIMERi input output module or triggered by the event timer see page 107 These types of processing are optional and can be used by applications that need to act on inputs outputs within a short response time Illustration The following diagram shows the tasks in a multitasking structure and their level of priority Auxiliary Master Fast Event task task task processing 7 AUXi MAST FAST EVTi and TIMERi a EEE p Priority ese Description The master MAST task is still the application base The other tasks differ depending on the type of PLC see page 76 Levels of priority are fixed for each task in order to prioritize certain types of processing Event processing can be activated asynchronously with respect to periodic tasks by an order generated by external events It is processed as a priority and requires any processing in progress to be stopped
212. IMES Literals Maximum CJ Minimum Delay x Step Properties ctions Comment M Time Actio Qualifier Literal Variable Variable Section ma 7 Motori VIL Motori Accept actiol New Action Delete Up init Search for selected variable oK Cancel Apply Hep _ The step properties are defined using a dialog box that offers the following features Definition of initial steps e Definition of diagnostics times e Step comments e Allocation of actions and their qualifiers 56 35006144 07 2012 Presentation Instruction List IL Introduction The IL editor is used for instruction list programming according to IEC 61131 3 Representation Representation of an IL section Label Operators Operands Comments Inspection window r Zo AA 7 START LD vara Key 1 ANDN VarB and not key 2 ST varc Ventilator On LD Var Undeclared Variable Tooltip E1061 Undefined Symbol VarX a Objects An instruction list is composed of a series of instructions Each instruction begins on a new line and consists of e An operator A modifier if required One or more operands if required A label as a jump target if required A comment about the logic if required Input Aids The IL editor offers the following inp
213. ING No Yes No T_CSY_IND No Yes No T_CSY_FOLLOW No Yes No T_CSY_COORD No Yes No T_CSY_CAM No Yes No Communication application T_COM_STS_GEN Yes Yes No T_COM_UTW_M No Yes No T_COM_UTW_S No Yes No T_COM_MB No Yes No T_COM_CHAR No Yes No T_COM_FPW No Yes No T_COM_MBP No Yes No T_COM_JNET No Yes No T_COM_ASI No Yes No T_COM_ETY_1X0 No Yes No T_COM_ETY_210 No Yes No T_COM_IBS_128 No Yes No T_COM_IBS_242 No Yes No T_COM_PBY No Yes No 612 35006144 07 2012 Use of DFBs IODDT families Modicon M340 Premium Quantum T_COM_CPP100 No Yes No T_COM_ETYX103 No Yes No T_COM_ETHCOPRO No Yes No T_COM_MB_BMX Yes No No T_COM_CHAR_BMX Yes No No T_COM_CO_BMX Yes No No T_COM_ETH_BMX Yes No No Adjustment application T_PROC_PLOOP No Yes No T_PROC_3SING_LOOP No Yes No T_PROC_CASC_LOOP No Yes No T_PROC_SPP No Yes No T_PROC_CONST_LOOP No Yes No Weiging application T_WEIGHING_ISPY101 No Yes No Common to all applications T_GEN_MOD No No No 35006144 07 2012 613 Use of DFBs Use of a DFB in a Ladder Language Program Principle In Ladder language there are two possible ways of calling a DFB function block e via a textual call in an operation block in which the syntax and constraints on the parameters are identical to those of Structured Text language e via a graphic call The inputs of the function blocks may be connected or assigned a
214. INT Tab 3 ARRAY 1 11 OF INT Tab 4 ARRAY 101 110 OF INT Tab _1 Tab 2 Assignment authorized Tab _1 Tab 3 Assignment refused non IEC compliant Tab_1 Tab_4 Assignment refused non IEC compliant 284 35006144 07 2012 Data Types Structures What is a Structure It is a data item containing a set of data of a different type such as e a group of BOOL WORD UNINT etc EDT structure e agroup of tables DDT structure e agroup of REAL DWORD tables etc EDT and DDT structures NOTE You can create nested structures nested DDTs over 8 levels Recurring structures DDT are not allowed Characteristics A structure is composed of data which are each characterized by e atype e aname which enables it to be identified e a comment optional describing its role Definition of a structure type IDENT Surname STRING 12 irst name STRING 16 UINT The IDENT type STRING type data structure contains a UINT type data item and two Definition of two data instances of an IDENT type structure Pe Pe n_1 IDENT n_2 IDENT The instances Person_1 and Person_2 are of IDENT Structure type Access to the Data of a Structure Access to the data of the Person_1 IDENT type instance Person_1 Name To access Person_1 Age To access age of Person_1l 35006144 07 2012 285 Data Types Overview of the Derived Data Type family DDT Introduction Characteristics Th
215. INT UINT UDINT REAL value of the second the result is a Boolean TIME WORD DWORD 1 If the value of the first operand is equal to STRING DT DATE or TOD the value of the second the result is a Boolean 0 Example In the example OUT is 1 if IN1 is not equal to 10 and is otherwise 0 OUT IN1 lt gt 10 amp Logical AND 9 Expression Literal With lt there is a logical AND link between Variable Address of Data the operands In the case of BYTE WORD Type BOOL BYTE WORD or and DWORD data types the link is made bit DWORD by bit Example In the examples OUT is 1 if IN1 IN2 and IN3 are 1 OUT IN1 amp IN2 amp IN3 AND Logical AND 9 Expression Literal With AND there is a logical AND link Variable Address of Data between the operands In the case of BYTE Type BOOL BYTE WORD or WORD and DWORD data types the link is DWORD made bit by bit Example In the examples OUT is 1 if IN1 IN2 and IN3 are 1 OUT IN1 AND IN2 AND IN3 35006144 07 2012 537 Structured Text ST Operator Meaning Order of rank possible operands Description XOR Logical Exclusive OR 10 Expression Literal Variable Address of Data Type BOOL BYTE WORD or DWORD With xor there is a logical Exclusive OR link between the operations In the case of BYTE WORD and DWORD data types the link is made bit by bit Example In the example OUT is 1 if IN1 and IN2 are not equal If A and B
216. INT must be used Not all formal parameters have to be assigned an actual parameter However this does not apply in the case of negated pins These must always be assigned an actual parameter This is also the case with some formal parameter types These types are shown in the following table Table of formal parameter types Parameter type EDT STRING ARRAY ANY_ARRAY IODDT STRUCT FB ANY EFB Input EFB VAR_IN_OUT p EFB Output ee DFB Input 2 DFB VAR_IN_OUT E DFB Output EF Input z S EF VAR_IN_OUT z z EF Output z 5 7 F Procedure Input 348 35006144 07 2012 Function Block Language FBD Parameter type EDT STRING ARRAY ANY_ARRAY IODDT STRUCT FB ANY Procedure VAR_IN_OUT Procedure Output Z 5 2 F Actual parameter required Actual parameter not required not applicable FFBs that use actual parameters on the inputs that have not yet received any value assignment work with the initial values of these actual parameters If no value is allocated to a formal parameter then the initial value will be used for executing the function block If no initial value has been defined then the default value 0 is used If a
217. Input byte which determines the event processing number to be triggered The following table describes the output parameters Parameter Type Comment Status Timer WORD Status word Current_Value TIME Current value of timer Timing Diagram for Normal Operation Timing diagram RESET i ENABLE ee I HOLD T T Preset x TB l 4 f 15 1 A 1 EN ar l I I l I l as Eee Let yy oY Event Event Event Event 35006144 07 2012 109 Program Structure Normal operation The following table describes the triggering of TIMER type event processing operations see timing diagram above Phase Description 1 When a rising edge is received on the RESET input the timer is reset to 0 2 The current value VALUE of the timer increases from 0 towards the preset value at a rate of one unit for each pulse of the time base 3 An event is generated when the current value has reached the preset value the timer is reset to 0 and then reactivated The associated event processing is also triggered if the event is not masked It can be deferred if an event processing task with a higher or identical priority is already in progress 4 When the ENABLE input is at 0 the events are no longer sent out TIMER type event processing is no longer triggered 5 When the HOLD input is at 1 the timer is frozen and the current value stops incrementin
218. Instruction List IL Formal Call With this type of call call with formal parameter names the function is called using an instruction sequence consisting of the function name followed by the bracketed list of value assignments actual parameters to the formal parameters The order in which the formal parameters are listed is not significant The list of actual parameters may be wrapped immediately following a comma After executing the function the result is loaded into the accumulator and can be stored using ST EN and ENO can be used for this type of call Calling a function with formal parameter names Function Name Formal Parameters LIMIT MN 0 Sa ST out Actual Parameters Inputs Actual Parameter Output or LIMIT MN 0 IN varl MX var2 ST out Calling the same function in FBD LIMIT 0 MN OUT out vari IN var2 MX With formal calls values do not have to be assigned to all formal parameters see also Parameter see page 501 LIMIT MN 0 IN varl ST out Calling the same function in FBD LIMIT 0 MN OUT out vari IN 35006144 07 2012 503 Instruction List IL Informal Call With this type of call call without formal parameter names the function is called using an instruction sequence made up by loading the first actual parameter into the accumulator followed
219. JIN1 outit result var2 IN2 out2 result2 With informal calls it is not necessary to assign a value to all formal parameters see also Parameter page 574 This is a supplement to IEC 61131 3 and must be enabled explicitly An empty parameter field is used to skip a parameter Call with empty parameter field PROC varl resultl result2 Calling the same procedure in FBD PROC vari INi outi resultl IN2 ouT2 result2 An empty parameter field does not have to be used if formal parameters are omitted at the end PROC varl var2 resultl Calling the same procedure in FBD PROC vari JIN1 outit resultl var2 IN2 OUT2 With all procedures an EN input and an ENO output can be configured If the value of EN is equal to 0 when the procedure is called the algorithms defined by the procedure are not executed and ENO is set to 0 If the value of EN is 1 when the procedure is called the algorithms defined by the function are executed After successful execution of these algorithms the value of ENO is set to 1 If an error occurs during execution of these algorithms ENO will be set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if EN equals to 1 If ENO is set to 0 caused when EN 0 or an error occurred during executing the outp
220. LC A to OFFLINE mode command e 1 sets PLC A to RUN mode register 35006144 07 2012 209 System Objects Word Symbol Function Description Initial state Premium Atrium SW61 HSB STS Premium Hot Standby status register Meaning of the different bits of the word SW61 0 to SWE61 6 SWE6E1 0 and SW61 1 Status of local PLC SW61 1 0 and SW61 0 1 OFFLINE mode SW61 1 1 and SW61 0 0 Primary mode e SW61 1 1 and SW61 0 1 Standby mode SWE1 2 and SW6E1 3 Status of remote PLC SW61 3 0 and SW61 2 1 OFFLINE mode SW61 3 1 and SW61 2 0 Primary mode SW61 3 1 and SW61 2 1 Standby mode SW61 3 0 and SW61 2 0 the remote PLC is not accessible Power off no communication SWE61 4 is set 1 whenever a logic mismatch is detected between the Primary and Standby controllers SWE61 5 is set to 0 or 1 depending on the Ethernet copro MAC address e 0the PLC with the lowest MAC dress becomes PLC A e 1 the PLC with the highest MAC address becomes PLC B SWE1 6 this bit indicates if the CPU sync link between the two PLC is valid SW61 6 0 the CPU sync link is valid The content of bit 5 is significant SW61 6 1 the CPU sync link is not valid In this case the contents of the bit 5 is not significant because the comparison of the two MAC addresses cannot be performed 0 YES NO 210 35006144 07 2
221. LCs and Quantum Ethernet I O DIO network SW405 Slot number of Slot number of module 140 NAME 2 for connection to the NOM1DIOSLOT the first interface second DIO network module of the The slot number is coded from 0 to 15 DIO network This word is not available on Quantum safety PLCs SW406 to SW469 Operating status The words SW406 to SW469 are associated with the NOM1DIOHEALTHi of the distributed distributed stations DIO 64 words associated with the 64 DIO i 1 64 station modules stations of the second network 232 35006144 07 2012 System Objects Word Function Description Initial Symbol state SW470 Slot number of Slot number of module 140 NAME 2 for connection to the third NOM2DIOSLOT the second DIO network interface module The slot number is coded from 0 to 15 of the DIO This word is not available on Quantum safety PLCs network SW471 to SW534 Operating status The words SW471 to SW534 are associated with the NOM2DIOHEALTHi of the distributed distributed stations DIO 64 words associated with the 64 DIO i 1 64 station modules stations of the third network of the third DIO SW471 operating status of the station 1 modules network SW472 operating status of the station 2 modules SW534 operating status of the station 64 modules Bits 0 to 15 of each of these words are associated with the modules located in positions 16 to 1 of these st
222. Limited by the available area for entering Alternative Parallel branches maximum is 32 rows Maximum number of action blocks per step 20 Access to the functional equivalent of the Q or A outputs not applicable Transition clearing time Target dependent always lt 100 micro seconds Maximum width of diverge converge constructs 32 Contents of RESOURCE libraries Not applicable Effect of using READ WRITE access to function block outputs Not applicable Maximum number of tasks Depends on controller type Maximum on most powerful controller 9 tasks Task interval resolution 10 ms Maximum length of expressions Practically no limit Maximum length of statements Practically no limit Maximum number of CASE selections Practically no limit Value of control variable upon termination of FOR loop Undefined Restrictions on network topology No restrictions Evaluation order of feedback loops The block connected to the feedback variable is executed first 684 35006144 07 2012 IEC Compliance Error Conditions Error Conditions IEC standards table for error conditions Error conditions Treatment see Note page 686 Nested comments 2 error is reported during programming Value of a variable exceeds the specified subrange 4 error is reported during execution Missing configuration of an incomplete a
223. List IL Informal Call with CAL Instruction With this type of call procedures are called using an instruction sequence consisting of the CAL instruction followed by the procedure name followed by a list of the input and output actual parameters The order in which the actual parameters are listed is significant The list of actual parameters cannot be wrapped EN and ENO cannot be used for this type of call Calling a procedure with formal parameter names using CAL instruction Actual Parameters Inputs CAL PROC varl var2 resultl result2 Actual Parameters Outputs Procedure Name or CAL PROC varl var2 resultl result2 Calling the same procedure in FBD PROC varl JIN1 OUT1 result1 var2 IN2 OUT2 result2 NOTE Unlike informal calls without a CAL instruction when making informal calls with a CAL instruction the value to be processed first actual parameter is not explicitly loaded in the battery Instead it is part of the list of actual parameters For this reason when making informal calls with a CAL instruction the list of actual parameters must be put in brackets 522 35006144 07 2012 Instruction List IL EN and ENO With all procedures an EN input and an ENO output can be configured If the value of EN is equal to 0 when the procedure is called the algorithms defined by the procedure are not executed and ENO is set to 0 If
224. ME E_ERR_DEN F 30152 16 8A38 Not a valid floating point number DERIV E ERR_DEN 30152 16 8A38 Not a valid floating point number DERIV FP_ERROR F See table Common Floating Point Errors page 660 FGEN E_ERR_DEN F 30152 16 8A38 Not a valid floating point number FGEN WAF_SIG_TV_MAX F 30116 16 8A5C t_acc gt t_rise 2 FGEN WAF_SIG_TH_MAX F 30117 16 8A5B t_rise too big FGEN WAF_SIG_TA_MAX T 30106 16 759A t_off gt halfperiod FGEN WAF_SIG_T1_MIN T 30107 16 759B t_max lt t_min FGEN WAF_SIG_FKT F 30118 16 8A5A func_no lt 0 or func_no gt 8 FGEN FP_ERROR F See table Common Floating Point Errors page 660 INTEG E ERR_DEN 30152 16 8A38 Not a valid floating point number INTEG E _ERR_IB_MAX_MIN 30102 16 8A6A YMAX lt YMIN INTEG FP_ERROR See table Common Floating Point Errors page 660 LAG E_ERR_DEN 30152 16 8A38 Not a valid floating point number LAG FP_ERROR See table Common Floating Point Errors page 660 LAG2 E_ERR_DEN 30152 16 8A38 Not a valid floating point number LAG2 FP_ERROR See table Common Floating Point Errors page 660 35006144 07 2012 655 EFB Error Codes and Values EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex LEAD_LAG E_ERR_DEN F 30152 16 8A38 Not a valid floating point number
225. ND IF Expression A 35006144 07 2012 529 Structured Text ST Section Size Syntax The length of an instruction line is limited to 300 characters The length of an ST section is not limited within the programming environment The length of an ST section is only limited by the size of the PLC memory Identifiers and Keywords are not case sensitive Exception Not allowed spaces and tabs keywords literals values identifiers variables and limiter combinations e g for comments Execution Sequence The evaluation of an expression consists of applying the operators to the operands in the sequence as defined by the rank of the operators see Table of Operators see page 534 The operator with the highest rank in an expression is performed first followed by the operator with the next highest rank etc until the evaluation is complete Operators with the same rank are performed from left to right as they are written in the expression This sequence can be altered with the use of parentheses lf for example A B C and D have the values 1 2 3 and 4 and are calculated as follows A B C D the result is 9 In the case of the following calculation A B C D the result is 0 If an operator contains two operands the left operand is executed first e g in the expression SIN A COS B the expression SIN A is calculated first then COS B and only then is the product calculated
226. OR See table Common Floating Point Errors page 660 PID_P E_ERR_DEN 30152 16 8A38 Not a valid floating point number PID_P E_ERR_PID_MAX_MIN F 30104 16 8A68 YMAX lt YMIN 656 35006144 07 2012 EFB Error Codes and Values EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex PID_P FP_ERROR F See table Common Floating Point Errors page 660 PIP E_ERR_DEN F 30152 16 8A38 Not a valid floating point number PIP E _ERR_PI_MAX_MIN 30103 16 8A69 YMAX lt YMIN PIP FP_ERROR See table Common Floating Point Errors page 660 PPI E_ERR_DEN 30152 16 8A38 Not a valid floating point number PPI E_ERR_PI_MAX_MIN 30103 16 8A69 YMAX lt YMIN PPI FP_ERROR See table Common Floating Point Errors page 660 PWM WAF_PBM_TMINMAX 30113 16 8A5F t_min lt t_max PWM FP_ERROR See table Common Floating Point Errors page 660 QPWM WAF_PBM_TMINMAX 30113 16 8A5F t_min lt t_max QPWM FP_ERROR F See table Common Floating Point Errors page 660 SCON3 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number SCON3 W_WARN_DSR_TN T 30101 16 7595 ITN 0 SCON3 W_WARN_DSR_TSN T 30102 16 7596 TSN 0 SCON3 W_WARN_DSR_KP T 30103 16 7597 KP lt 0 SCON3 E ERR_DSR_HYS F 30105 16 8A67 2 IUZI lt IHYSI SCON3 FP_ERROR F See table Common Floating Point Errors pag
227. ORD TO BOOL WORD TO BYT WORD_TO_ DINT WORD TO O_ INT WORD TO REAL WORD TO TIME WORD TO UDINT WORD TO_ UINT D WORD 1 TO BIT WORD TO DWOR e DWORD TO BOOL DWORD TO BYTE DWORD TO DINT DWORD TO INT DWORD TO REAL DWORD TO TIM DWORD TO BIT DWORD TO UDINT DWORD TO UINT The effects of each conversion are described in the help text supplied with the Base Library List of types for truncate function R R EA TRUNC_ DINI EA TRUNC_UIN1 REAL TRUNC_INT REAL TRUNC_UDINT x The effects of each conversion are described in the help text supplied with the Base Library 35006144 07 2012 673 IEC Compliance Note 3 List of types for BCD conversion function e BCD TO INT DBCD TO INT DBCD TO DINT List of types for BCD conversion function e INT TO BCD INT TO DBCD DINT TO DBCD The effects of each conversion are described in the help text supplied with the Base Library Note 4 List of types for String functions LEN INT LEFT INT RIGHT INT MID INT INSERT INT DELETE INT REPLACE INT FIND INT Note 5 A variable can be mapped to a directly represented variable if they stricly have the same type This means that a variable of type INT can only be mapped on a directly represented variable of type INT But there is one excep
228. PLC Saved Data Located unlocated data diagnostic buffer are automatically saved in the internal Flash memory at power off They are restored at warm start Save_Param The SAVE PARAM function does both current and initial parameter adjustment in internal RAM as in other PLCs In this case the internal RAM and the memory card content are different S96 0 and the CARDERR LED is on On cold start after application restore the current parameter are replaced by the last adjusted initial values only if a save to memory card function Backup Save or S66 rising edge was done Save Current Value On a S94 rising edge the current values replace the initial values in internal memory The internal RAM and the memory card content are different S96 0 and the CARDERR LED is on On cold start the current values are replaced by the most recent initial values only if a save to memory card function Backup Save or S66 rising edge was done 35006144 07 2012 119 Memory Structure Delete Files There are two ways to delete all the files on the memory card e Formatting the memory card delete all files of the file system partition e Deleting the content of directory DataStorage delete only files added by user Both actions are performed using SW93 see page 193 The system word SwW93 can only be used after download of a default application in the PLC A CAUTION INOPERABLE MEMORY CARD Do not format
229. PLFIP exchanges on Fipio carried out by instructions READ_STS REA_PARAM etc Also takes into account the explicit exchanges carried out by requests READ_IO_OBJECT WRITE_IO_OBJECT etc Note The number of explicit exchanges is always less than 24 SW160 to Operating status of The words SW160 to SW167 are respectively associated with 0 SW167 the PLC modules racks 0 to 7 PREMRACKO to Bits 0 to 15 of each of these words are associated with the modules PREMRACK7 located in positions 0 to 15 of these racks The bit is set to 0 if the module is faulty and set to 1 if the module is operating correctly Example SW163 5 0 The module located in slot 5 of rack 3 is faulty 220 35006144 07 2012 System Objects 6 4 Quantum specific System Words Subject of this Section This section describes the system words SW60 to SW640 for Quantum PLCs A WARNING UNEXPECTED APPLICATION BEHAVIOR Do not use system objects Si SWi as variable when they are not documented Failure to follow these instructions can result in death serious injury or equipment damage What Is in This Section This section contains the following topics Topic Page Description of Quantum System Words SWE0 to SW66 222 Description of Quantum System Words SW98 to SW109 227 Description of Quantum System Words SW110 to SW177 228 Description of Quantum System Words SW180 to SW702
230. Processing This figure shows the possible contents of event processing bit test and action If crossing threshold event 0 THEN set physical output Q2 0 to 1 Q2 0 AW 1 0 3 5 If crossing threshold event 1 THEN set physical output Q2 0 to 0 Q2 0 R 114 35006144 07 2012 Application Memory Structure Subject of this Chapter This chapter describes the application memory structure of Premium Atrium and Quantum PLCs What Is in This Chapter This chapter contains the following sections Section Topic Page 4 1 Memory Structure of the Premium Atrium and Modicon M340 116 PLCs 4 2 Memory Structure of Quantum PLCs 124 35006144 07 2012 115 Memory Structure 4 1 Memory Structure of the Premium Atrium and Modicon M340 PLCs Subject of this Section This section describes memory structure and detailed description of the memory zones of the Premium Atrium and Modicon M340 PLCs What Is in This Section This section contains the following topics Topic Page Memory Structure of Modicon M340 PLCs 117 Memory Structure of Premium and Atrium PLCs 121 Detailed Description of the Memory Zones 123 116 35006144 07 2012 Memory Structure Memory Structure of Modicon M340 PLCs Overview Structure State RAM The PLC memory supports e located application data e unlocated application data
231. QQ Program I Derived Data Types Q Table Derived FB Types RA Screen 4 Variables amp FB instances E Filling Feedbox I Communication E J Program Qj Programs ee ladder1 Tasks Q Table MAST E Screen AJ Sections JERS Mixing H E process E Program H EE Filling Feeding Box yE STI H E Mixing ge Table E Mixing _1 ST A Screen E Mixing_2 ST2 Process ri i J Program E lt 3 SR Sections ia 1 i j Table Structural View The project browser offers the following features in the structural view Creation and deletion of elements The section symbol shows the section programming language and if it is protected in case of an empty section the symbol is grey View the element properties Creation of user directories Launching the different editors Start the import export function 35006144 07 2012 25 Presentation Functional View The project browser offers the following features in functional view Creation of functional modules Insertion of sections animation tables etc using Drag and Drop from the structural view Creation of sections View the element properties Launching the different editors The section symbol shows the section programming language and other attributes 26 35006144 07 2012 Presentation User Application and Project File Formats Introduction Unity Pro manages three types of files for
232. RAM YES NO NO 4 CAUTION APPLICATION UPLOAD NOT SUCCESSFUL The bit S94 must not be set to 1 during an upload If the bit S94 is set to 1 then the upload may be impossible Failure to follow these instructions can result in injury or equipment damage 35006144 07 2012 175 System Objects 4 CAUTION LOSS OF DATA The bit S94 must not be used with the TSX MFP e or the TSX MCP e flash PCMCIA memory The function of this system bit is not available with this type of memory Failure to follow these instructions can result in injury or equipment damage 176 35006144 07 2012 System Objects Description of System Bits S100 to S123 Detailed Description Description of system bits S100 to S123 Bit Function Description Initial Modicon Premium Quantum SYMBOL state M340 Atrium S100 Protocol on This bit is set to 0 or 1 by the system NO YES NO PROTTERINL terminal according to the state of the INL DPT shunt port on the console e ifthe shunt is missing S100 0 then the master Uni Telway protocol is used e if the shunt is present S100 1 then the protocol used is the one indicated by the application configuration S117 Detected Normally set to 1 this bit is set to 0 by the No No YES ERIOERR RIO error system when a detected error occurs in a on Ethernet device on the Ethernet RIO I O network This bit is reset
233. RRAY WORD ArrayInt In this case an explicit type conversion must be carried out using INT ARR TO WORD ARR Not all formal parameters need be assigned a value You can see which formal parameter types must be assigned a value in the following table Parameter type EDT STRING ARRAY ANY_ARRAY IODDT STRUCT FB ANY EFB Input m x EFB VAR_IN_OUT EFB Output 2 DFB Input DFB VAR_IN_OUT DFB Output E Actual parameter required Actual parameter not required not applicable If no value is allocated to a formal parameter then the initial value will be used for executing the function block If no initial value has been defined then the default value 0 is used If a formal parameter is not assigned a value and the function block DFB is instanced more than once then the following instances are run with the old value 35006144 07 2012 507 Instruction List IL Public Variables Private Variables In addition to inputs and outputs some function blocks also provide public variables These variables transfer statistical values values that are not influenced by the process to the function block They are used for setting parameters for the function block Public variables are a supplement to IEC 61131 3 The assignment of values to public vari
234. S YES MASTCURRTIME execution time of the last master task cycle time in ms SW31 Maximum This word indicates the longest YES YES YES MASTMAXTIME master task master task execution time since execution the last cold start in ms time SW32 Minimum This word indicates the shortest YES YES YES MASTMINTIME mastertask master task execution time since execution the last cold start in ms time SW33 Fast task This word indicates the execution YES YES YES FASTCURRTIME execution time of the last fast task cycle in except for time ms safety This word is not available on PLCs Quantum safety PLCs SW34 Maximum This word indicates the longest fast YES YES YES FASTMAXTIME fast task task execution time since the last except for execution cold start in ms safety time This word is not available on PLCs Quantum safety PLCs SW35 Minimum This word indicates the shortest YES YES YES FASTMINTIME fast task fast task execution time since the except for execution last cold start in ms safety time This word is not available on PLCs Quantum safety PLCs NOTE Execution time is the time elapsed between the start input acquisition and the end output update of a scanning period This time includes the processing of event tasks the fast task and the processing of console requests In a Quantum HSBY configuration 3SW30 SW31 and Sw32 include the time of Copro Data exchange between Primary and Stand By CPU
235. ST D XOR N N Logical Literal variable The XOR operator makes a logical exclusive OR link between the accumulator content and the operand If more than two operands are linked the result with an uneven number of 1 states is 1 and is 0 with an even number of 1 states In the case of BYTE WORD and DWORD data types the link is made bit by bit Example In the example D is 1 if A or B is 1 If A and B have the same status both 0 or 1 D is 0 LD A XOR B ST D If more than two operands are linked the result with an uneven number of 1 states is 1 and is 0 with an even number of 1 states Example In the example F is 1 if 1 or 3 operands are 1 F is 0 if 0 2 or 4 operands are 1 LD A XOR B XOR C XOR D XOR E ST F 35006144 07 2012 489 Instruction List IL complement types BOOL BYTE WORD or DWORD Operator Modifier Meaning Operands Description NOT Logical Accumulator The accumulator content is inverted bit by bit with negation contents of data NOT Example In the example B is 1 if Ais 0 and B is O if a is 1 LD A NOT ST B Arithmetic Operators IL programming language Arithmetic operators Operator Modifier Meaning Operands Description ADD Addition Literal variable With ADD the value of the operand is added to the direct address of value of the accumulator contents data types INT Example The example correspon
236. Section The following table describes the characteristics of a section Characteristic Description Name 32 characters maximum accents are possible but spaces are not allowed Language LD FBD IL ST or SFC Task or Master fast auxiliary event processing Condition A BOOL or EBOOL type bit variable can be used to condition the optional execution of the section Comment 256 characters maximum Protection Write protection read write protection 86 35006144 07 2012 Program Structure Description of SFC sections General Example The sections in Sequential Function Chart language are made up of e a main chart programmed in SFC e macro steps MS programmed in SFC e actions and transitions programmed in LD FBD ST or IL The SFC sections are programmable only in the master task see detailed description of SFC sections The following diagram gives an example of the structure of an SFC section and uses the chart to show the macro step calls that are used MAST Bh H Sections Folder 5 Airlock Oven_1 Sequential processing ty Chart Ee J5 MS_1_1 Li Js MS_2_1 ms12 a C Unused Macro EL MS 41 7 Actions rA ae 4 Transitions Dryer 35006144 07 2012 87 Pro
237. String Jump out of a Parallel String e a b gt S_2_1 S_2_2 S_2_3 D n c d as a e f S 25 If Then If the transition condition a is true and b is false then a sequence runstoS 2 lands 2 2 IfstepsS_2 lands 2 2 are activated then the strings run independently of one another If the transition condition c is true then a jump is made tos 2 3 A second token is created by the jump out of the parallel string Both tokens are running parallel to one another i e S 2 lands 2 3 are active at the same time 470 35006144 07 2012 SFC Sequence Language Token 1 S_2_1 Token 2 S_2_3 If Then If Then If the transition condition e is then a sequence runs _ If transition condition d is then a sequence runs to true tos 2 5 true S24 If transition condition f is then a sequence runs to true S 2 S will be further processed as Single Token Token IfS_2 5 is still active token 1 because of the activation of transition condition e then token 2 is ended and the string If s_2_5 is no longer active token 1 then it is reactivated by token 2 and both tokens continue running parallel Multi Jump Between Two Branches of a Parallel String Jump Between Two Branches of a Parallel String m a I S_4 1 S_42 b c S_4_3 S_4_1
238. Subroutine calls be used in an action section e Multiple tokens can be created with Multiple initial steps e Alternative or parallel branches that are not terminated e Jumps in combination with alternative and parallel strings e Activation of steps using the SFC control block SETSTEP from a non SFC section or with SFC control instructions 460 35006144 07 2012 SFC Sequence Language e Tokens can be ended with e Simultaneous meeting of two or more tokens in a step e Deactivation of steps using the SFC control block RESETSTEP from a non SFC section or with SFC control instructions 35006144 07 2012 461 SFC Sequence Language Alternative String Alternative Strings x off n select The user can define the behavior for the evaluation of transition conditions in alternative branches with Multi Token The following are possible e Processing is from left to right with a stop after the first active transition 1 off n select This corresponds with the behavior of alternative strings with Single Token see page 450 e Parallel processing of all transitions of the alternative branch x off n select With Multi Token more than one parallel switch can be made from the transitions 1 off n select The branches to be run are determined by the result of the transition conditions of the transitions that follow the alternative branch The transitions of the branches are all processed All
239. T 2 Connected value object or Optional 3 expression BOOL Connected value object or Optional expression DDT Connected value or object Compulsory ANY_ Connected or object Compulsory ANY_ARRAY Connected or object Compulsory Inputs outputs EDT Connected or object Compulsory DDT Connected or object Compulsory IODDT Connected or object Compulsory ANY Connected or object Compulsory ANY_ARRAY Connected or object Compulsory Outputs EDT Connected or object Optional DDT Connected or object Optional ANY Connected or object Compulsory ANY_ARRAY Connected or object Optional 1 Connected in Ladder LD or Function Block Diagram FBD language Value or object in Instruction List IL or Structured Text ST language 2 Except BOOL type parameters 3 Except for STRING type parameters that is compulsory 35006144 07 2012 609 Use of DFBs Rules when using DFBs with arrays A WARNING UNEXPECTED EQUIPMENT OPERATION Check the size of arrays when copying from source into target arrays using DFBs Failure to follow these instructions can result in death serious injury or equipment damage When using dynamic arrays it is mandatory to check the sizes of arrays that are identical In specific case using dynamic arrays as an output or input output an overflow could lead to improper execution of the program and stop of the PLC This behavior occurs if the following conditions are fulfilled
240. TE for BMX CRA 312 0 e Rack 0 is the main rack e Rack 1 is the extension rack SW701 rack 0 in BMX CRA 312 0 drop 31 rack 1 in 140 CRA 312 00 drop 31 SW702 rack 1 in BMX CRA 312 0 drop 31 rack 2 in 140 CRA 312 00 drop 31 Bits 0 to 15 of each of these words are associated with the modules located in positions e 16 to 1 of the 140 CRA 312 00 Drop module e 15 to 0 of the BMX CRA 312 0 Drop module The bit is set to 0 if the module has a detected error It is set to 1 if the module is operating correctly Word Function Description Initial Symbol state SWE41 to SW702 Ethernet RIO The words SW641 to SW702 are the Quantum Ethernet I O 0 35006144 07 2012 237 System Objects 6 5 Modicon M340 Specific System Words Description of System Words SW138 to SW141 SW142 to SW145 SW146 and SW147 SW150 to SW154 SW160 to SW167 Detailed Description Description of system words 3SW138 to 3SW141 Word Function Description Initial Symbol State SW138 and Modicon M340 Base addresses for 1 discrete input and Iw input SW140 register SW139 and Modicon M340 Base addresses for M coil address and Mw holding SW141 register The base address is the number of M or SMW which corresponds to Modbus address 0000 Examples e SW140 contains 1000 When the Modbus server receives a Read Input Registers request code 04 with starting address equal to 0000
241. Text ST Assignments between Arrays and WORD DWORD Variables Assignments between arrays and WORD DWORD variables are only possible if a type conversion has previously been carried out e g Q3 0 16 INT TO AR BOOL 3MW20 The following conversion functions are available General Library family Array MOVE BOOL AREBOOL MOVE WORD ARWORD MOVE DWORD_ARDWORD MOVE INT ARINT MOVE DINT ARDINT MOVE REAL ARREAL zo 35006144 07 2012 543 Structured Text ST Select Instruction IF THEN END_IF Description The IF instruction determines that an instruction or a group of instructions will only be executed if its related Boolean expression has the value 1 true If the condition is O false the instruction or the instruction group will not be executed The THEN instruction identifies the end of the condition and the beginning of the instruction s The END_IF instruction marks the end of the instruction s NOTE Any number of IF THEN END_IF instructions may be nested to generate complex selection instructions Example IF THEN END IF The condition can be expressed using a Boolean variable If FLAG is 1 the instructions will be executed if FLAG is 0 they will not be executed IF FLAG THEN C SIN A COS B B C Aj END_IF The condition can be expressed using an operation that returns a Boolean result If A is greater than B the instruct
242. The size is equal to the actual The EF writes a maximum of The FB writes a n characters size of the input parameter n characters maximum of limited to n characters n characters Strings and the ANY Pin When you use a STRING type variable as an ANY type parameter it is highly recommended to check that the size of the variable is less than the maximum declared size Example Use of STRING on the SEL function Selector Stringl STRING 8 String2 STRING 4 String3 STRING 4 Stringl AAAAAAAA String3 CC Scenario 1 String2 BBBB the size of the string is equal to the maximum declared size Stringl SEL FALSE String2 String3 the result will be BBBBAAAA Scenario 2 String2 BBB the size of the string is less than the maximum declared size Stringl SEL FALSE String2 String3 the result will be BBB 276 35006144 07 2012 Data Types 8 5 Elementary Data Types EDT in Bit String Format Subject of this Section This section describes data types in bit string format These are e Byte type e Word type e Dword type What Is in This Section This section contains the following topics Topic Page Overview of Data Types in Bit String Format 278 Bit String Types 279 35006144 07 2012 277 Data Types Overview of Data Types in Bit String Format Intro
243. The task which can be interrupted must in particular e Enable processing of events at system level set bit S38 to 1 default value e Unmask events with the instruction UNMASKEVT active by default Unmask the events concerned at channel level for events triggered by input output modules by setting the input output module s implicit language objects for unmasking of events to 1 By default the events are masked e Check that the stack of events at system level is not saturated bit S39 must be at 0 3 Event program creation phase The program must e Determine the origin of the event s on the basis of the event status word associated with the input output module if the module is able to generate several events e Carry out the reflex processing associated with the event This process must be as short as possible Write the reflex outputs concerned Note the event status word is automatically reset to zero 35006144 07 2012 113 Program Structure Illustration of Event Unmasking This figure shows event unmasking in the MAST task Unmasking events UNMASKEVT EN ENO If cold start THEN authorize events S1 S38 S If cold start THEN unmask threshold 0 crossing event QW1 1 0 5 S1 YQW 1 0 1 5 4 If cold start THEN unmask threshold 1 crossing event QW1 1 0 6 9 hol AWI 0 1 6 Illustration of the Contents of Event
244. U Q out R 100 PV cv current An empty parameter field does not have to be used if formal parameters are omitted at the end MY COUNT varl reset Calling the same function block in FBD MY_COUNT CTU varl 4CU Q reset R PY CV F CAL and Load Save the Input Parameters Function blocks may be called with an instruction list consisting of loading the actual parameters followed by saving into the formal parameter followed by the CAL instruction The sequence of loading and saving the parameters is not significant Only load and save instructions for the function block currently being configured are allowed between the first load instruction for the actual parameters and the call of the function block All other instructions are not allowed in this position It is not necessary to assign a value to all formal parameters see also Parameter see page 506 512 35006144 07 2012 Instruction List IL CAL with Load Save the input parameters Actual Parameter Input varl MY_COUNT lt CU reset MY_COUNT R Formal Parameter Input value MY_COUNT PV CAL MY COUNT Calling the function block we MERWE HOCH MY_COUNT 9 Formal Parameter Output D T out D MY_COUNT CV T current Actual Parameter Output Use of the Input Operators Function blocks can be called using an instruction list that consists of
245. UT IOl I01 Comb_IN_OUT The following special features are to be noted when using FFBs with VAR_IN_OUT variables e All VAR_IN_OUT inputs must be assigned a variable e Via graphical links only VAR_IN_ OUT outputs with VAR_IN_OUT inputs can be connected e Only one graphical link can be connected to a VAR_IN_OUT input output e Acombination of variable address and graphical connections is not possible for VAR_IN_OUT outputs e No literals or constants can be connected to VAR_IN_OUT inputs outputs e No negations can be used on VAR_IN_OUT inputs outputs e Different variables variable components can be connected to the VAR_IN_ OUT input and the VAR_IN_OUT output In this case the value of the variables variable component on the input is copied to the at the output variables variable component 386 35006144 07 2012 Ladder Diagram LD Control Elements Introduction Control elements are used for executing jumps within an LD section and for returning from a subroutine SRx or derived function block DFB to the main program Control elements take up one cell Control Elements The following control elements are available Designation Representation Description Jump NEXT gt When the status of the left link is 1 a jump is made to a label in the current section To generate an unconditional jump the jump object must be placed directly on the left power rail To generate a
246. WORD WordParaml IntVarl WordParam2 IntVar2 AND ARRAY WORD ArrayInt In this case an explicit type conversion must be carried out using INT_ARR_TO WORD ARR n this case AND_INT must be used 566 35006144 07 2012 Structured Text ST Not all formal parameters must be assigned with a value Which formal parameter types must be assigned a value can be seen in the following table Parameter type EDT STRING ARRAY ANY_ARRAY IODDT STRUCT FB ANY EFB Input EFB VAR_IN_OUT EFB Output DFB Input DFB VAR_IN_OUT DFB Output 4 4 4 l tle ey ia is tg Bis a a tla 4 Actual parameter required Actual parameter not required not applicable Public Variables If no value is allocated to a formal parameter then the initial value will be used for executing the function block If no initial value has been defined then the default value 0 is used If a formal parameter is not assigned with a value and the function block DFB is instanced more than once then the following instances are run with the old value In addition to inputs and outputs some function blocks also provide public variables These variables transfer statistical values values that are not influenced by the process to the function block They are used for setting parameters for the func
247. Y_ANY_DATE NY_ARRAY_DATE_AND_TIME NY_ARRAY_DATE Y_ARRAY_TIME_OF_DAY ANY_ARRAY_EBOOL ANY_ARRAY_ANY_DDT ANY_STRUCTURE ANY_DDT ANY_IODDT ANY_FFB ANY_EFB ANY_DFB 35006144 07 2012 695 Glossary ARRAY ASCII Auxiliary tasks Base 10 literals Base 16 literals An ARRAY is a table of elements of the same type The syntax is as follows ARRAY lt terminals gt OF lt Type gt Example ARRAY 1 2 OF BOOL is a one dimensional table made up of two BOOL type elements ARRAY 1 10 1 20 OF INT is a two dimensional table made up of 10x20 INT type elements ASCII is the abbreviation of American Standard Code for Information Interchange This is an American code but which has become an international standard that uses 7 bits to define every alphanumerical character used in English punctuation symbols certain graphic characters and other miscellaneous commands Optional periodic tasks used to process procedures that do not require fast processing measurement adjustment diagnostic aid etc A literal value in base 10 is used to represent a decimal integer value This value can be preceded by the signs and If the character _ is employed in this literal value it is not significant Example 12 0 123 456 986 An literal value in base 16 is used to represent an integer in hexadecimal The base is determined by the number 16 and the sign The signs and are not allowed For g
248. _ F 30104 16 7598 T2 gt T1 THREEPOINT_CON1 FP_ERROR F See table Common Floating Point Errors page 660 THREEPOINT_CON1 E_ERR_ZDR_HYS F 30106 16 8A66 2 IUZI lt IHYSI TWOPOINT_CON1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number TWOPOINT_CON1 W_WARN_ZDR_XRR_ F 30105 16 7599 DR XRR lt 100 or XRR gt 100 TWOPOINT_CON1 W_WARN_ZDR_T1T2 F 30104 16 7598 T2 gt T1 TWOPOINT_CON1 FP_ERROR F See table Common Floating Point Errors page 660 TWOPOINT_CON1 E_ERR_ZDR_HYS F 30106 16 8A66 2 IUZI lt IHYSI 654 35006144 07 2012 EFB Error Codes and Values CLC_PRO Table of error codes and errors values created for EFBs of the CLC_PRO family EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex ALIM E ERR_DEN F 30152 16 8A38 Not a valid floating point number ALIM WAF_AB2_VMAX F 30111 16 8A61 vmax lt 0 ALIM WAF_AB2_BMAX F 30112 16 8A60 bmax lt 0 ALIM FP_ERROR F See table Common Floating Point Errors page 660 COMP_PID E_ERR_DEN F 30152 16 8A38 Not a valid floating point number COMP_PID WAF_KPID_KUZ F 30110 16 8A62 gain_red lt 0 or gain_red gt 1 COMP_PID WAF_KPID_OGUG F 30104 16 8A68 YMAX lt YMIN COMP_PID WAF_KPID_UZ F 30109 16 8A63 db lt 0 COMP_PID FP_ERROR F See table Common Floating Point Errors page 660 DEADTI
249. _USER_ERROR_1 35006144 07 2012 651 EFB Error Codes and Values EFB name __ Error code ENO state Error Error Error description in case of value in value in error Dec Hex MMF_ESUB BAD_REVISION F 30200 16 8A08 defined as E_ EFB_USER_ERROR_1 MMF_ESUB MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error MMF_IDNX_ BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 MMF_IDNX MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error MMF_JOG_ BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 MMF_JOG MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error MMF_JOG MMF_SUB_TIMEO T 7005 16 1B5D Subroutine does not complete in time UT MMF_MOVE BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 MMF_MOVE MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error MMF_RST BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 MMF_SUB _ BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 MMF_SUB MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error MMF_USUB BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 MMF_USUB MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error NOTE For details about MMF error codes and error values please refer to the Faults and Error Reporting see Unity Pr
250. a Yes No No No Yes Yes 1 2 No Public data Yes No No No Yes No No Private data Yes No No No Yes No Yes Initial Values for an Element Belonging to a DFB 1 not authorized for BOOL and EBOOL type data 2 must be completed during the execution of the EFB and not usable outside the EFB This table specifies whether the initial values can be entered from the DFB type definition or the DFB instance Element of the DFB From the DFB type From the DFB instance Input data no ANY type Yes Yes Input data of ANY type No No Input output data No No Output data no ANY type Yes Yes Output data of ANY type No No Public data Yes Yes Private data Yes No 300 35006144 07 2012 Data Types Initial Values for an Element Belonging to an EFB This table specifies whether the initial values can be entered from the EFB type definition or the EFB instance Element of the EFB From the EFB type From the DFB instance Input data no ANY type Yes Yes See generic data types see page 302 Input data of ANY type No No Input output data No No Output data no ANY type Yes Yes Output data of ANY type No No Public data Yes Yes Private data Yes No A WARNING starting index 0 equipment damage UNEXPECTED APPLICATION BEHAVIOR INVALID ARRAY INDEX When using EFBs and DFBs on variables of ar
251. ables is made via their initial values or via the load and save instructions Example Instance Name Public Variable D_ACT1 is an instance of the function block D_AcT and has the public LD 1 yy as variables AREA_NR and OP_CTRL ST D_ACT1 0OP_CTRL Public variables are read via the instance name of the function block and the names of the public variables Example Instance Name Public Variable a LD D_ACT1 OP_CTRL ST Varl In addition to inputs outputs and public variables some function blocks also provide private variables Like public variables private variables are used to transfer statistical values values that are not influenced by the process to the function block Private variables can not be accessed by user program These type of variables can only be accessed by the animation table NOTE Nested DFBs are declared as private variables of the parent DFB So their variables are also not accessible through programming but trough the animation table Private variables are a supplement to IEC 61131 3 508 35006144 07 2012 Instruction List IL Programming Notes Attention should be paid to the following programming notes e Functions are only executed if the input EN 1 or the EN input is not used see also EN and ENO see page 515 e The assignment of variables to ANY or ARRAY output types must be made using the gt operator see also Formal Form of CAL with a List of the Input Parameter
252. acters The authorized characters correspond to the ASCII codes 32 to 255 e an initial value e an access right from the application program sections of the application or section belonging to the DFBs see Definition of the function block type interface and internal variables see page 297 e an access right from communication requests e a public variables backup flag Authorized Data Types for an Element Belonging to a DFB The authorized data types are Element of the DFB EDT DDT types ANY Function types block types IODDT Unnamed ANY_ARRAY _ other tables Input data Yes No Yes Yes Yes Yes 2 No Input output data Yes 1 Yes Yes Yes Yes Yes 2 No Output data Yes No Yes No Yes Yes 2 3 No Public data Yes No Yes No Yes No No Private data Yes No Yes No Yes No Yes 1 not authorized for the EBOOL type static data used on Quantum PLCs 2 not authorized for BOOL and EBOOL type data 3 must be completed during the execution of the DFB and not usable outside the DFB 35006144 07 2012 299 Data Types Authorized Data Types for an Element Belonging to an EFB The authorized data types are Element of the EFB EDT DDT types ANY Function block types types IODDT Unnamed ANY_ARRAY other tables Input data Yes No No Yes Yes Yes 1 No Input output data Yes Yes No Yes Yes Yes 1 No Output dat
253. acters correspond to the ASCII codes 32 to 255 e the application interface data e the inputs not accessible in read write mode from the application but read by the function block code e the inputs outputs not accessible in read write mode from the application but read and written by the function block code e the outputs accessible in read only from the application and read and written by the function block code e the internal data e public internal data accessible in read write mode from the application and read and written by the function block code e private internal data not accessible from the application but read and written by the function block code e the code e for DFBs this is written by the user in PLC language Structured Text Instruction List Ladder language function block language and is structured in a single section if the IEC option is active or may be structured in several sections if this option is inactive e for EFBs this is written in C language e information such as e type version number e date of the last modification of the code or of the internal variables or of the interface variables e an optional descriptive file 832767 characters describing the block function and its different modifications 35006144 07 2012 297 Data Types Characteristics This table gives the characteristics of the elements that make up a type Element EFB DFB Name 32 charac
254. address Bit O Bit 1 Bit 2 Bit 3 Bit 4 Bit 5 Bit 6 Bit 7 Bit 8 Bit9 Bit Bit Bit Bit Bit Bit 10 11 12 13 14 15 SW128 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SW129 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 SW130 32 33 34 35 36 37 38 39 40 4 42 43 44 45 46 47 SW131 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 gt SW 132 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 SW133 80 81 82 83 84 85 i86 87 88 89 90 91 92 93 94 95 SW134 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 SW135 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 SW136 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 SW137 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 SW138 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 SW139 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 SW140 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 SW141 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 gt SW 142 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 SW143 240 241 242 243 244
255. age 11 Function Block Language FBD 341 12 Ladder Diagram LD 369 13 SFC Sequence Language 413 14 Instruction List IL 475 15 Structured Text ST 527 35006144 07 2012 339 Programming Language 340 35006144 07 2012 Function Block Language FBD 11 Overview This chapter describes the function block language FBD which conforms to IEC 61131 What Is in This Chapter This chapter contains the following topics Topic Page General Information about the FBD Function Block Language 342 Elementary Functions Elementary Function Blocks Derived Function Blocks 344 and Procedures FFBs Subroutine Calls 354 Control Elements 355 Link 356 Text Object 358 Execution Sequence of the FFBs 359 Change Execution Sequence 362 Loop Planning 367 35006144 07 2012 341 Function Block Language FBD General Information about the FBD Function Block Language Introduction The FBD editor is used for graphical function block programming according to IEC 61131 3 Representation of an FBD Section Representation EN Input ENO Output Inversion ST Expression Link Variable AND OR AND cond gt EN ENO EN ENO EN ENO INI gt So A lt B D TRUE gt IX1 5 4 gt c Db Ve Le IX1 5 5 gt Nie Literals Topological Link Crossing Addresses XOR EN ENO IN4 gt Objects E
256. age is detected the outputs are set in the fallback position e either they are assigned the fallback value e or the current value is maintained depending on the choice made in the configuration After power restoral the outputs remain at zero until they are updated by the task 138 35006144 07 2012 Operating Modes Processing on Warm Restart for Modicon M340 PLCs Cause of a Warm Restart Illustration A warm restart may be caused by a power restoral without loss of context CAUTION RISK OF LOSS OF APPLICATION If there is no Memory Card in the PLC during a warm restart the application is lost Failure to follow these instructions can result in injury or equipment damage The diagram below describes how a warm restart operates Acquisition of inputs Vv TOP program execution If S1 1 processing of warm restart Outage detected No Yes Processor stopped Application context saved Power restoral Configuration self test Setting of bit S1 to 1 We Setting of bit S1 to 0 Updating of outputs 35006144 07 2012 139 Operating Modes Operation The table below describes the program execution restart phases on warm restart Phase Description 1 Program execution doesn t resume from the element where the power outage occurred The rem
257. aining program is discarded during the warm start Each task will restart from the beginning 2 At the end of the restart cycle the system carries out the following e restore the application s variable value set bit S1 to 1 e the initialization of message and event queues e the sending of configuration parameters to all discrete input output and application specific modules e the deactivation of the fast task and event processing until the end of the master task cycle 3 The system performs a restart cycle during which it e relaunches the master task from beginning of cycle resets bit S1 to 0 at the end of this first master task cycle e reactivates the fast task event processing at the end of this first cycle of the master task Processing a Warm Restart by Program In the event of a warm restart if you want the application to be processed ina particular way you must write the corresponding program to test that S1 is set to 1 at the start of the master task program SFC Warm start specific features The Warm start on M340 PLCs is not considered as a real warm start by the CPU SFC interpreter does not depend on tasks SFC publishes a memory area ws_data to the OS that contains SFC section specific data to be saved at a power fail At the beginning of chart processing the currently active steps are saved to ws_data and processing is marked to be in critical section At the end of cha
258. al BCD format is used to represent decimal numbers between 0 and 9 using a group of four bits half byte In this format the four bits used to code the decimal numbers have a range of unused combinations Correspondence table Decimal Binary 0000 er 0001 0010 0011 0100 0101 0110 0111 1000 oloo lN I oIa AI OIN 1001 1010 unused 1011 unused 1100 unused 1101 unused 1110 unused 1111 unused Example of coding using a 16 bit format Decimal value 2 4 5 0 2450 Binary value 0010 0100 0101 0000 264 35006144 07 2012 Data Types Example of coding using a 32 bit format Data Types in BCD Format Decimal value 7 8 9 9 3 0 1 6 78993016 Binary value 0111 1000 1001 1001 0011 0000 0001 0110 Three data types Type Designation Scale bits Default value DATE Date 32 D 1990 01 01 TIME_OF_DAY Time of day 32 TOD 00 00 00 DATE_AND_TIME_ Date and Time 64 DT 1990 01 01 00 00 00 35006144 07 2012 265 Data Types The Date Type At a Glance Syntax Rules The Date type in 32 bit format contains the following information e the year coded in a 16 bit field 4 most significant half bytes e the month coded in an 8 bit field 2 half bytes e the day coded in an 8 bit field
259. al For MOD the value of the first operand is Variable Address of Data divided by that of the second operand and Type INT DINT UINTor the remainder of the division Modulo is UDINT displayed as the result Example In this example out is 1 if IN1 is 7 and IN2 is 2 out is 1 if IN1 is 7 and IN2 is 2 OUT is 1 if IN1 is 7 and IN2 is 2 OUT is 1 if IN1 is 7 and IN2 is 2 OUT IN1 MOD IN2 Addition 6 Expression Literal In addition the value of the first operand Variable Address of Data is added to the value of the second Type INT DINT UINT operand UDINT REAL or TIME Example In this example OUT is 9 if IN1 is 7 and IN2 is 2 OUT IN1 IN2 Subtraction 6 Expression Literal In subtraction the value of the second Variable Address of Data operand is subtracted from the value of the Type INT DINT UINT first operand UDINT REAL or TIME Example In the example OUT is 6 if IN1 is 10 and IN2 is 4 OUT IN1 IN2 35006144 07 2012 535 Structured Text ST Operator Meaning Order of possible operands Description rank lt Less than 7 Expression Literal The value of the first operand is compared comparison Variable Address of Data with the value of the second using lt If the Type BOOL BYTE INT value of the first operand is less than the DINT UINT UDINT REAL value of the second the result is a Boolean TIME WORD DWORD 1 If th
260. all tabs of the data editor Copy Cut Paste Expand collapse structured data Sorting according to Type Symbol Address etc Filter Inserting deleting and changing the position of columns Drag and Drop between the data editor and the program editors Undo the last change Export Import The Variables tab is used for declaring variables Variables tab amp Data Editor Variables DDT Types Function Blocks DFB Types Filter T Name EDT KIDDT KJIODDT Device DDT Name Type Address Value Comment M The following functions are available Defining a symbol for variables Assigning data types Own selection dialog box for derived data types Assignment of an address Automatic symbolization of I O variables Assignment of an initial value Entering a comment View all properties of a variable in a separate properties dialog box 38 35006144 07 2012 Presentation Hardware Dependent Data Types IODDT IODDTs are used to assign the complete I O structure of a module to an individual variable Assignment of IODDTs Filter E hme EC AE AT A T A Diea DOT The following functions are available e Complete I O structures can be assigned with individual variables using IO DDTs e After entering the variables addresses all elements of the structure are automatically assigned with the correct input output bit or word e Because it is possible to assign addresses later on stan
261. alue bit are set to 1 While processing the first line of the logic in the third cycle the history bit of the coil B will also be set to 1 Problem During edge recognition comparison of the value bit and the history bit in the second line of the logic no edge is recognized because due to the updating the value bit and history bit on line 1 of B are always identical Solution In this example the variable B is first assigned to the link to recognize positive edges and then the coil B Cc E P CJ B CA LS 0206 6 0 B E OH sau maoo B Value bit me u I l B Force Bit B B History Bit p C Value bit p At the beginning of the second cycle the value bit of B equals 0 When forcing B within this cycle the force bit and value bit are set to 1 While processing the first line of the logic in the third cycle the history bit of the link B will remain set to 0 Edge recognition recognizes the difference between value bits and history bit and sets the coil C to 1 for one cycle 35006144 07 2012 401 Ladder Diagram LD Using Set Coil or Reset Coil Can Cause the Loss of Edge Recognition Using set coil or reset coil can cause the loss of edge recognition with EBOOL variables The variable above the set reset coil variable c in the example is always affected by the value of the left link If the left link is 1 the value bit variable c in t
262. ames entered are strings made up of alphanumeric characters and the Underscore character The rules are as follows e the first character of the name is an alphabetic character or an Underscore e two Underscore characters cannot be used consecutively If the Allow extended Checkbox is not Selected The names entered are strings made up of alphanumeric characters and the Underscore character Additional characters are authorized such as e characters corresponding to ASCII codes 192 to 223 except for code 215 e characters corresponding to ASCII codes 224 to 255 except for code 247 The rules are as follows e the first character of the name is an alphanumeric character or an Underscore e Underscore characters can be used consecutively 250 35006144 07 2012 Data Types Subject of this Chapter This chapter describes all the data types that can be used in an application What Is in This Chapter This chapter contains the following sections Section Topic Page 8 1 Elementary Data Types EDT in Binary Format 252 8 2 Elementary Data Types EDT in BCD Format 263 8 3 Elementary Data Types EDT in Real Format 269 8 4 Elementary Data Types EDT in Character String Format 274 8 5 Elementary Data Types EDT in Bit String Format 277 8 6 Derived Data Types DDT IODDT Device DDT 281 8 7 Function Block Data Types DFB EFB 294 8 8 Generic Data Types GDT 302 8 9 Data Types
263. ammed in the following manner LD A AND B AND LD C OR D STE 35006144 07 2012 485 Instruction List IL Operators Introduction An operator is a symbol for e an arithmetic operation to be executed e a logical operation to be executed or e calling an elementary function block DFBs or subroutines Operators are generic i e they adapt automatically to the data type of the operands Load and Save Operators IL programming language load and save operators Operator Modifier Meaning Operands Description LD N Loads the Literal variable The value of an operand is loaded into the only for operands direct address of any accumulator using LD The size of the operands of value into the data type accumulator adapts automatically to the data type data type accumulator of the operand This also applies to the derived BOOL BYTE data types WORD or Example In this example the value of A is loaded DWORD into the accumulator the value of B then added and the result saved in E LD A ADD B STE 486 35006144 07 2012 Instruction List IL Operator Modifier Meaning Operands Description ST N only for operands of data type BOOL BYTE WORD or DWORD Saves the accumulator value in the operand Variable direct address of any data type The current value of the accumulator is stored in the operand using ST T
264. an Links Overlapping Boolean links with other objects is not permitted The signal flow power flow is from left to right for Boolean links Therefore backwards links are not allowed If two Boolean links are crossed the links are connected automatically Since crossing Boolean links is not possible links are not indicated in any special way Notes on Programming FFB Links Notes on Programming FFB Links At least one side of an FFB link must be connected with an FFB input or output To differentiate them from Boolean links FFB links are shown with a doubly thick line The signal flow power flow in FFB links is from the FFB output to the FFB input no matter which direction they are made in Therefore backwards links are allowed Only FFB inputs and FFB outputs may be linked to one another Linking more than one FFB outputs together is not possible That means that no OR connection is possible in LD using FFB links Overlapping FFB links with other objects is permitted Crossing FFB links is also permitted Crossed links are indicated by a broken link AND OR AND OR 35006144 07 2012 391 Ladder Diagram LD e Connection points between more FFB links are shown with a filled circle OR OR e To avoid links crossing each other FFB links can also be represented in the form of connectors The source and target for the FFB connection a
265. an algorithm that controls a motor incorporating local safety requirements By exporting then importing these blocks they can be used by a group of programmers working on a single application or in different applications Benefits of Using a DFB Using a DFB function block in an application enables you to e simplify the design and entry of the program e increase the legibility of the program e facilitate the debugging of the application all of the variables handled by the function block are identified on its interface e reduce the volume of code generated the code that corresponds to the DFB is only loaded once however many calls are made to the DFB in the program only the data corresponding to the instances are generated Comparison with a Subroutine Compared to a subroutine using a DFB makes it possible to e set processing parameters more easily e use internal variables that are specific to the DFB and therefore independent from the application e test its operation independently from the application Furthermore LD and FBD languages provide a graphic view of the DFBs facilitating the design and debugging of your program DFB Created with Previous Software Versions DFBs created using PL7 and Concept must first be converted using the converters that come with the product before being used in the application 584 35006144 07 2012 Overview of DFBs Domain of Use The following table shows the domain of use
266. anguage object For Premium Atrium PLCs double type instances of located data SMD lt i gt sKD lt i gt or floating SMF lt i gt SKF lt i gt should be located by an integer type MW lt i gt SKW lt i gt Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt SQD 1D SMF lt i gt SKF lt i gt SOF IF by using their topological address for example 3MD0 6 0 11 3MFO 6 0 31 For Modicon M340 PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt are not available According to the IEC standard smw indicates a constant real type language object For Premium Atrium PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt should be located by an integer type sMW lt i gt KW lt i gt Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD 1D SMF lt i gt SKF lt i gt SOF IF by using their topological address for example 3MD0 6 0 11 3MFO 6 0 31 For Modicon M340 PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt are not available According to the IEC standard Kw indicates a constant word type language object For Premium Atrium PLCs double type instances of located data SMD lt i gt sKD lt i gt or floating SMF lt i gt SKF lt i gt should be located by an integer ty
267. ask MAST FAST or AUX 0 3 Remote inputs outputs Remote input output stations can only be associated with the master MAST task The assignment is made for sections see page 95 with 1 remote input station and 1 remote output station per section Distributed inputs outputs Distributed input output stations can only be associated with the master MAST task The inputs are read at the start of the master task and the outputs are written at the end of the master task 35006144 07 2012 105 Program Structure Example on Premium With its 8 successive channel modularity channels 0 to 7 channels 8 to 15 etc the inputs outputs of the Premium discrete modules can be assigned in groups of 8 channels independently of the MAST AUXi or FAST task Example it is possible to assign the channels of a 28 input output module as follows inputs O to 7 assigned to the MAST task inputs 8 to 15 assigned to the FAST task outputs 0 to 7 assigned to the MAST task outputs 8 to 15 assigned to the AUXO task 106 35006144 07 2012 Program Structure Management of Event Processing General Event processing take priority over tasks The following illustration describes the 3 defined levels of priority Timer 1 O module O module event lt event 4 event r rq TIMERi EVTi EVTo bey easy es l be pean en Priority 2 Prior
268. assign all the required input parameters before executing the CAL command It is not possible to use EN and ENO parameters CAL DFB Name argument 1 argument 2 argument n or LD Value 1 ST Parameter 1 LD Value n ST Parameter n CAL DFB Name NOTE The ANY_ARRAY type inputs generic data type outputs ANY_ and input outputs of a DFB must be assigned Use of EN ENO Parameters See EN and ENO Parameters page 593 35006144 07 2012 619 Use of DFBs Example of a DFB The following example explains the different calls of a DFB in Instruction List This is the instance Cpt_1 of the Cpt_ parts type DFB Cpt_1 Cpt_parts Clear Reset Done Q1 2 1 P_Select Presel 100 Count DFB Call when the Arguments Are Assignments When the arguments are assignments the DFB call Cpt_1 is performed with the following syntax CAL Cpt_1 Reset Clear Presel MD10 Count 100 Done gt Q1 2 1 Where the input parameters assigned by a value expression object or immediate value are entered in the list of arguments the syntax is CAL Cpt_1 Reset Clear Presel MD10 Count 100 LD Cpt_1 Done ST Q1 2 1 In order to make your application program more legible you can enter a carriage return after the commas that separate the arguments The sequence then takes the following syntax CAL Cpt_1 Reset Clear Presel MD10 Count 100 Done gt Q1 2 1 620 35006144 07 2012
269. aster task Mono Task Multi task Multiple token LD is the abbreviation of Ladder Diagram LD is a programming language representing the instructions to be carried out in the form of graphic diagrams very close to a schematic electrical diagram contacts coils etc A located variable is a variable for which it is possible to know its position in the PLC memory For example the variable Water pressure is associated with3MW102 Water pressure is said to be localized M A macro step is the symbolic representation of a unique set of steps and transitions beginning with an input step and ending with an output step A macro step can call another macro step Main program task It is obligatory and is used to carry out sequential processing of the PLC An application comprising a single task and so necessarily the Master task Application comprising several tasks Mast Fast Auxiliary event processing The order of priority for the execution of tasks is defined by the operating system of the PLC Operating mode of an SFC In multitoken mode the SFC may possess several active steps at the same time 35006144 07 2012 709 Glossary N Naming convention identifier NAN Network Operator screen An identifier is a sequence of letters numbers and underlines beginning with a letter or underline e g name of a function block type an instance a variable or a section Letters from national charac
270. ata e Boolean and numerical data e EFB and DFB This zone contains located data State Ram Address Object address Data use 0XXXXX Qr m c d Mi output module bits and internal bits 1XXXXX lr m c d li input module bits 3XXXXX IWr m c d IWi input register words of input output modules 4XXXXX QWr m c d MWi_ output words of input output modules and internal words This zone contains the executable codes of the application e program code e code associated with EFs EFBs and the management of I O modules e code associated with DFBs e initial variable values This zone also contains the necessary information for downloading the application graphic codes symbols etc On 140 CPU 31 41 51 processors this contains the operating system for processing the application This operating system is transferred from an internal EPROM memory to internal RAM on power up A Flash EPROM memory zone of 1435K8 available on processors 140 CPU 310e 41 e 51 can be used to backup the program and the initial values of variables The application stored in this zone is automatically transferred to internal RAM when the PLC processor is powered up if the PLC MEM switch is set to off on the processor front panel 128 35006144 07 2012 Memory Structure Other Information Other information relating to the configuration and structure of the application are also stored in the mem
271. ate Modicon M340 Premium Atrium Quantum SW96 CMDDIAGSAV EREST Command and Diagnostic of Save and Restore SW96 8 to 15 are error codes when SwW96 2 is set to 1 SW96 9 1 indicates that the saved Mw number is less than the configured number e ssw96 8 1and SwW96 9 1 means thatthe saved MW number is greater than the configured number sSw96 8 SSW96 9 1 and SW96 10 1 indicates a detected write error in internal flash memory 1 YES NO NO SW97 CARDSTS Card status Can be read by the user program or by the terminal Indicates the status of the card SW97 0000 no error 0001 application backup or file write sent to a write protected card 0002 card not recognized or application backup damaged 0003 backup of the application requested but no card available 0004 card access error for example after a card has been removed not properly 0005 no file system present in the card or file system not compatible Use swW93 0 to format the card YES NO NO 35006144 07 2012 203 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW99 INPUTADR SWAP Communication redundancy management 1 NOTE This word is used for Premium and Quantum module but has a different function Word used to manage the redundancy of network m
272. ating numbers The 32 bits representing the floating point value are organized in three distinct fields These are e S the sign bit which can have the value e 0 for a positive floating point number e 1 for a negative floating point number e e the exponential coded in an 8 bit field integer in binary format e f the fixed point part coded in a 23 bit field integer in binary format Representation 30 23 22 0 s Exponential e Fixed point part f The value of the fixed point part Mantissa is between 0 1 and is calculated using the following formula F 2 M Number Types that Can Be Represented These are the numbers which are e normalized e denormalized e of infinite values e with values 0 and 0 35006144 07 2012 269 Data Types This table gives the values in the different fields according to number type e f S Number type 0 255 0 1 Oor1 normalized 0 0 1 near 1 4 amp 45 denormalized DEN 255 0 0 infinity INF 255 0 1 infinity INF 255 jO 1 and bit22 0 Oor1 SNAN 255 0 1 and bit 22 1 Oori QNAN 0 0 0 0 0 0 1 0 NOTE Standard IEC 559 defines two classes of NAN not a number QNAN and SNAN e ONAN is a NAN whose bit 22 is set to 1 SNAN is a NAN whose bit 22 is set to 0 They behave as follows e ONAN do not trigger errors when they appear in operands of a function or an expression e SNAN
273. ation the remaining words are set to 0 Initializing elementary function blocks on the basis of initial data Initializing data declared in the DFBs either to 0 or to the initial value declared in the DFB type Initializing system bits and words Positioning charts to initial steps Cancelling any forcing Initializing message and event queues Sending configuration parameters to all discrete input output modules and application specific modules For this first restart cycle the system does the following Relaunches the master task with the SO cold restart and S13 first cycle in RUN bits set to 1 and the SW10 word detection of a cold restart during the first task cycle is set to 0 Resets the S0 and S13 bits to 0 and sets each bit of the word SW10 to 1 at the end of this first cycle of the master task Activates the fast task and event processing at the end of the first cycle of the master task Processing a cold start by program It is advisable to test the bit SW10 0 to detect a cold start and start processing specific to this cold start NOTE It is possible to test the bit SO if the parameter Automatic start in RUN has been selected If this is not the case the PLC starts in STOP the bit SO then switches to 1 on the first cycle after restart but is not visible to the program because it is not executed 35006144 07 2012 137 Operating Modes Output Changes As soon as a power out
274. ations The bit is set to 0 if the module is faulty and set to 1 if the module is operating correctly Example SW520 5 0 The module located in station 86 slot 11 of the third DIO network is faulty NOTE For modules 140 CRA 2 eee the value of this bit is not significant and is always set to 0 These words are not available on safety PLCs and Quantum Ethernet I O DIO network 35006144 07 2012 233 System Objects Word Function Description Initial Symbol state SW535 RIO error on This word stores the start up error code This word is always set RIOERRSTAT start up to 0 when the system is running in the event of error the PLC does not start up but generates a stop status code 01 I O assignment length 02 Remote 1 0 link number 03 Number of stations in the I O assignment 04 I O assignment checksum 10 Length of the station descriptor 11 I O station number 12 Station autonomy time 13 ASCII port number 14 Number of station modules 15 Station already configured 16 Port already configured 17 More than 1024 output points 18 More than 1024 input points 20 Module slot address 21 Module rack address 22 Number of output bytes 23 Number of input bytes 25 First reference number 26 Second reference number 28 Internal bits outside the 16 bit range 30 Unpaired odd output module 31 Unpaired odd input module 32 Unpaired odd module reference 33 Reference 1x after register 3x 34 R
275. atus e decrements each time an discrete bit is unforced register SW109 Forced Word SW109 0 FORCED ANALOG analog increment each time an analog channel is forced COUNT channel e decrement each time an analog channel is unforced counting NOTE status register NOTE Limited to analog channels of Modicon M340 Analog Modules in M340 remote I O drops 35006144 07 2012 227 System Objects Description of Quantum System Words SW110 to SW177 Detailed Description Description of system words SW110 to SW177 these words are active on Quantum 140 CPU 6e ee PLCs Word Function Description Initial Symbol state SW110 number of This system word gives information on the size of the 0 unrestricted memory unrestricted memory area for M area for M SW111 number of This system word gives information on the size of the 0 unrestricted memory unrestricted memory area for MW area for MW SW128 Number of The Most Significant Byte of this word indicates the number 0 NB_P502 CNX connections open of TCP connections open on the Ethernet link TCP IP port 502 SW129 Number of This word indicates the number of TCP connections 0 NB_DENIED CNX connections refused refused on the Ethernet link TCP IP port 502 SW130 Number of This word indicates the number of TCP messages refused 0 NB_P502_ REF messages refused on the Ethernet link TCP IP port 502 SW132 and SW133 Number of This dou
276. ay Time The delay time step dwell time sets the minimum time for which the step must be active NOTE The defined times apply for the step only not for the allocated actions Individual times can be defined for these Setting the Step Times The following formula is to be used for defining determining these times Delay time lt minimum supervision time lt maximum supervision time There are 2 ways to assign the defined values to a step e Asa duration literal e Use of the data structure SFCSTEP_ TIMES 422 35006144 07 2012 SFC Sequence Language SFCSTEP_TIMES Variable Every step can be implicitly allocated a variable of data type SFCSTEP TIMES The elements for this data structure can be read from and written to read write The data structure is handled the same as any other data structure i e they can be used in variable declarations and therefore accessing the entire data structure e g as FFB parameter is possible Structure of the Data Structure Element Name Data type Description VarName delay TIME Delay Time VarName min TIME Minimum Supervision Time VarName max TIME Maximum Supervision Time SFCSTEP_STATE Variable Every step is implicitly allocated a variable of data type SFCSTEP_ STATE This step variable has the name of the allocated step The elements for this data structure can only be read read only You can see the SFCSTEP_ ST
277. ay have the same target step e In accordance with IEC 61131 3 jumps into a parallel sequence see page 445 or out of a parallel sequence are not possible If it should also be used again then it must be enabled explicitly e With jumps there is a difference between a Sequence Jump see page 451 and a Sequence Loop see page 452 e The jump target is indicated by the jump target symbol gt gt li S_4_7 Jump Name Jumps do not actually have their own names Instead the name of the target step jump target is shown inside of the jump symbol 440 35006144 07 2012 SFC Sequence Language 13 6 Link Link Introduction Links connect steps and transitions transitions and steps etc Properties of Links Links have the following properties e Links between objects of the same type step with step transition with transition etc are not possible e Links are possible between e unlinked object outputs and e unlinked or linked step inputs i e multiple step inputs can be linked Overlapping links and other SFC objects step transition jump etc is not possible Overlapping links and links is possible Crossing links with links is possible and is indicated by a broken link Links consist of vertical and horizontal segments Standard signal flow in a sequence string is from top to bottom To create a loop however links can be made from below to a step above This applies to links from transitions
278. bjects 6 2 System Words Subject of this Section This section describes the Modicon M340 Atrium Premium and Quantum system words 4 WARNING UNEXPECTED APPLICATION BEHAVIOR Do not use system objects Si SWi as variable when they are not documented Failure to follow these instructions can result in death serious injury or equipment damage What Is in This Section This section contains the following topics Topic Page Description of System Words SWO to SW11 180 Description of System Words SW12 to SW29 184 Description of System Words SW30 to SW47 189 Description of System Words SW48 to SW59 191 Description of System Words SW70 to SW100 193 Description of System Words SW108 to SW116 205 Description of System Words SW123 to SW127 206 35006144 07 2012 179 System Objects Description of System Words SW0 to SW11 Detailed Description Description of system words SW0 to SSW11 Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SWO Master task This word is used to modify the period of 0 YES YES YES MASTPERIOD scanning the master task via the user program or except period via the terminal for safety The period is expressed in ms PLCs 1 255 ms SWO 0 in cyclic operation On a cold restart it takes the value defined by the configuration This word is not available on Quantum safe
279. ble Display of the function blocks used in the project Definition of a symbol for the function blocks used in the project Automatic enabling of the defined symbols in the project Enter a comment about the function block View all parameters inputs outputs of the function block Assignment of an initial value to the function block inputs outputs 42 35006144 07 2012 Presentation DFB Types The DFB types tab is used for the defining derived function block DFBs parameters The creation of DFB logic is carried out directly in one or more sections of the FBD LD IL or ST programming languages Tab DFB types yw Data Editor Variables DDT types Function blocks DFB types Filter LT Name a a Name Nu Type Value Comment _ lt Inputs gt Open Bool close Bool valid Bool cot opened Bool cotclosed Bool H e lt Outputs gt 1 0 lt Inputs outputs gt Ll lt Public gt imer disc Int timer opening Int X 4 The following functions are available Definition of the DFB name Definition of all parameter of the DFB such as e Inputs e Outputs e VAR_IN_OUT combined inputs outputs e Private variables e Public variables Assignment of data types to DFB parameters Own selection dialog box for derived data types Assignment of an initial value Nesting DFBs Use of several se
280. ble word SD132 indicates the number of 0 NB_SENT_MSG messages sent messages sent on the Ethernet link TCP IP port 502 SW134 and SW135 Number of This double word SD134 indicates the number of 0 NB_RCV_MSG messages received messages received on the Ethernet link TCP IP port 502 SW136 Number of devices This word indicates the number of devices scanned on the 0 NB_IOS_CNX scanned Ethernet link TCP IP port 502 SW137 Number of IO This word indicates the number of messages received per 0 NB_IOS MSG Scanning messages second from the IO Scanning service on the Ethernet link received TCP IP port 502 SW138 Global Data Global Data coherence error 0 GLBD_ERROR coherence error SW139 Global Data and IO The Least Significant Byte of this word measures the 0 BW_GLBD IOS Scanning service percentage of load relating to IO Scanning load The Most Significant Byte of this word measures the percentage of load relating to Global Data SW140 Load for messaging The Least Significant Byte of this word measures the 0 BW_OTHER_MSG service and other percentage of load relating to messaging services The Most Significant Byte of this word measures the percentage of load relating to other services SW141 and SW142 IP Address This double word SD141 receives the IP address of the 0 IP_ADDR Ethernet link 228 35006144 07 2012 System Objects Word Symbol Function Description Initial state SW143 and SW144 IP_NETMASK
281. block DELAY time seems to keep running since it is calculated with the help of a system clock and is therefore independent of the program cycle and the release of the block VAR_IN_OUT Variable FFBs are often used to read a variable at an input input variables to process it and to output the altered values of the same variable output variables This special type of input output variable is also called a VAR_IN_OUT variable The link between input and output variables is represented by a line in the FFB VAR_IN_OUT variable EXAMP1_2 EXAMPI1 Input 4IN1 OUTI Outputl Input2 IN2 OUT2 Output2 Comb_IN_OUT 101 ____ IO1 Comb_IN_OUT The following special features are to be noted when using FFBs with VAR_IN OUT variables e All VAR_IN_OUT inputs must be assigned a variable e Via graphical links only VAR_IN_ OUT outputs with VAR_IN_OUT inputs can be connected e Only one graphical link can be connected to a VAR_IN_OUT input output e Acombination of variable address and graphical connections is not possible for VAR_IN_OUT outputs e No literals or constants can be connected to VAR_IN_OUT inputs outputs e No negations can be used on VAR_IN_OUT inputs outputs e Different variables variable components can be connected to the VAR_IN OUT input and the VAR_IN_OUT output In this case the value of the variables variable component on the input is copied to the at the output variables variabl
282. branches with satisfied transitions are activated If none of the transitions are switched the step that is currently set remains set x off n select S_5_10 Seared a b 5 11 S_5_12 a a c d S_5_13 If Then If S_5 10 is active and transition condition a is true and then a sequence isrunfroms 5 10tos 5 11 b is false If S_5 10 is active and transition condition a is false and then a sequence is runfroms 5 10toS 5 12 b is true If S_5 10 is active and transition conditions a and b are then a sequence is run from s_ 5 10tosS 5 11 and true S512 462 35006144 07 2012 SFC Sequence Language A second token is created by the parallel activation of the two alternative branches These two tokens are now running parallel to one another i e S 5 11 ands _5 12 are active at the same time Token 1 S_5_ 11 Token 2 S_5_ 12 If Then If Then If the transition condition c is then a sequence is run If transition condition d is then a sequence is run from true from s_5_11 to true S 5 1210 5 5 13 5 13 If S_5 13 is still active token 1 because of the activation of transition condition c then token 2 is ended and the string will be further processed as Single Token If S_5 13 is no longer active token 1 then it is reactivated by token 2 and both tokens continue running parallel Multi Token If alt
283. by the function name and an optional list of actual parameters The order in which the actual parameters are listed is significant The list of actual parameters cannot be wrapped After executing the function the result is loaded into the accumulator and can be stored using ST EN and ENO cannot be used for this type of call Calling a function with formal parameter names Actual Parameters K Function Name LD A LIMIT B C ST result Actual Parameters Result of the function Calling the same function in FBD LIMIT A MN OUT result B IN cC MX NOTE Note that when making an informal call the list of actual parameters cannot be put in brackets IEC 61133 3 requires that the brackets be left out in this case to illustrate that the first actual parameter is not a part of the list Invalid informal call for a function LD A LIMIT B C If the value to be processed first actual parameter is already in the accumulator the load instruction can be omitted LIMIT B C ST result If the result is to be used immediately the store instruction can be omitted LD A IMIT REAL B C MUL E If the function to be executed only has one input the name of the function is not followed by a list of actual parameters 504 35006144 07 2012 Instruction List IL Calling a function with one actual parameter Actual Parameters a Function Name LD Wisse SIN ST result Result of the function Calling the same function in FBD SIN
284. c term for Elementary Function EF see page 344 e Elementary Function Block EFB see page 345 e DFB Derived Function Block see page 346 e Procedure see page 346 Elementary Function Elementary functions EF have no internal states If the input values are the same the value on the output is the same every time the function is called For example the addition of two values always gives the same result An elementary function is represented graphically as a frame with inputs and one output The inputs are always represented on the left and the output is always on the right of the frame The name of the function i e the function type is displayed in the center of the frame The execution number see page 359 for the function is shown to the right of the function type The function counter is shown above the frame The function counter is the sequential number of the function within the current section Function counters cannot be modified Elementary Function DIV 1 DIV IN1 QUT IN2 With some elementary functions the number of inputs can be increased 344 35006144 07 2012 Function Block Language FBD Elementary Function Block Elementary function blocks EFBs have internal states If the input values are the same the value on the output can be different each time the function is called e g for a counter the value on the output is incremented An elementary function bloc
285. case AND_ INT must be used AND ARRAY WORD ArrayInt In this case an explicit type conversion must be carried out using INT ARR TO WORD ARR 518 35006144 07 2012 Instruction List IL Not all formal parameters must be assigned a value for formal calls Which formal parameter types must be assigned a value can be seen in the following table Parameter type EDT STRING ARRAY ANY_ARRAY IODDT STRUCT FB ANY Input VAR_IN_OUT Output s 2 Actual parameter required Actual parameter not required not applicable If no value is allocated to a formal parameter then the initial value will be used for executing the function block If no initial value has been defined the default value 0 is used Programming Notes Formal Call Attention should be paid to the following programming notes e Procedures are only executed if the input EN 1 or the EN input is not used see also EN and ENO see page 523 e Special conditions apply when using VAR_IN_OUT variables see page 523 e There are two ways of calling a procedure e Formal call calling a function with formal parameter names In this case variables can be assigned to outputs using the gt operator calling a function block in shortened form e Informal call calling a function without formal parameter names With this type of call call wi
286. cation has been loaded onto the PLC For Quantum PLCs automatic start in RUN also depends on the position of the switch on the front panel of the processor For more details refer to the Quantum documentation see Quantum with Unity Pro Hardware Reference Manual A WARNING UNEXPECTED SYSTEM BEHAVIOR UNEXPECTED PROCESS START The following actions will trigger automatic start in RUN e Inserting the PCMCIA card when the PLC is powered up Premium Quantum e Replacing the processor while powered up Premium Quantum e Unintentional or careless use of the reset button e lf the battery is found to be defective in the event of a power outage Premium Quantum To avoid an unwanted restart when in RUN mode e We stongly recommend to use the RUN STOP input on Premium PLCs or the switch on the front of the panel of the processor for Quantum PLCs e We strongly recommend not to use memorized inputs as RUN STOP input of the PLC Failure to follow these instructions can result in death serious injury or equipment damage 35006144 07 2012 155 Operating Modes 5 3 PLC HALT Mode PLC HALT Mode At a Glance The following actions switches the PLC to HALT mode e using the HALT instruction e watchdog overflow e Program execution error division by zero overflow etc if the bit S78 see page 170 is set to 1 Precaution A WARNING UNEXPECTED APPLICATION BEHAVIOR When the
287. cation is loaded from Backup memory to RAM of the PLC The PLC remains in RUN Configured Mem Prt or Stop Do not Care Warm Start no application loaded PLC powers up in previous state models 1 Start and Stop are valid for the 434 and 534 models only and Off is valid for the 311 only Mem Prt is valid on all 2 The Automatic RUN in the application refers to the application that is loaded Specificities of Memory Cards Three types of memory card are offered e application these cards contain the application program The cards on offer use either RAM or Flash EPROM technology e application file storage in addition to the program these cards also contain a zone which can be used to backup restore data using the program The cards on offer use either RAM or Flash EPROM technology e file storage these cards can be used to backup restore data using the program These cards use SRAM technology The following diagram describes the memory structure with an application and file storage card Internal RAM A Located data Unlocated data External A memory Program card g Files y NOTE On processors with 2 memory card slots the lower slot is reserved for the file storage function 35006144 07 2012 127 Memory Structure Detailed Description of the Memory Zones Unlocated Data Located Data User Program Operating System Application Backup This zone contains unlocated d
288. ch other e Functions Procedures As defined in IEC61 131 3 the outputs from deactivated functions EN input set to 0 are undefined The same applies to procedures Here nevertheless an explanation of the output statuses in this case e EN ENO handling with function procedure blocks that only have one link as an output parameter FUNC PROC 1 FUNC PROC 2 EN ENO EN ENO INI1 OUT INI OUT IN2 IN If EN of FUNC_PROC_1 is set to 0 the value of the link on output OUT of FUNC_PROC_1 depends on the project setting Maintain output links on disabled EF available since Unity Pro 4 1 If this project setting is set to 0 the value of the link is set to 0 If this project setting is set to 1 the link maintains the old value it had during the last correctly executed cycle For detailed information please refer to Maintain output links on disabled EF see Unity Pro Operating Modes 384 35006144 07 2012 Ladder Diagram LD e EN ENO handling with function procedure blocks that have one variable and one link as output parameters FUNC PROC 1 FUNC PROC 2 EN ENO EN ENO INI1 OUT OUTI INI OUT IN2 IN2 If EN of FUNC_PROC_1 is set to 0 the value of the link on output OUT of FUNC_PROC_1 depends on the project setting Maintain output links on disabled EF available since Unit
289. ck Elementary Function Block Elementary function blocks have internal states If the inputs have the same values the value on the output can have another value during the individual operations For example with a counter the value on the output is incremented Function blocks can have several output values outputs Derived Function Block Derived function blocks DFBs have the same characteristics as elementary function blocks The user can create them in the programming languages FBD LD IL and or ST Parameter Inputs and outputs are required to transfer values to or from function blocks These are called formal parameters The current process states are transferred to the formal parameters They are called actual parameters The following can be used as actual parameters for function block inputs e Variable e Address e Literal The following can be used as actual parameters for function block outputs e Variable e Address The data type of the actual parameters must match the data type of the formal parameters The only exceptions are generic formal parameters whose data type is determined by the actual parameter When dealing with generic ANY BIT formal parameters actual parameters of the INT or DINT not UINT and UDINT data types can be used This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed AND AnyBitParam IntVarl AnyBitParam2 IntVar2 Not allowed AND
290. cognition page 394 35006144 07 2012 373 Ladder Diagram LD Coils Introduction A coil is an LD element which transfers the status of the horizontal link on the left side unchanged to the horizontal link on the right side The status is stored in the respective Boolean actual parameter Normally coils follow contacts or FFBs but they can also be followed by contacts Coils take up one cell The following are permitted as actual parameters e Boolean variables e Boolean addresses topological addresses or symbolic addresses Coil Types The following coils are available Designation Representation Description Coil XXX With coils the status of the left link is transferred to the relevant Boolean actual parameter indicated by xxx and the right link negated coil XXX With negated coils the status of the left link is copied onto the right link The inverted status of the left link is copied to the relevant Boolean actual j parameter indicated by xxx If the left link is OFF then the right link will also be OFF and the relevant Boolean actual parameter will be ON Coil for XXX With coils that detect positive transitions the status of the left link is copied detecting p onto the right link The relevant actual parameter of data type EBOOL positive indicated by xxx is 1 for a program cycle if a transition of the left link from transitions 0 to 1 is made Also s
291. complete restored cycle of the PLC either in RUN or in STOP mode It is reset to 0 by the system before the following cycle To detect the first cycle in run after cold start please refer to sSW10 In Safe mode this bit is not available on Quantum safety PLCs S0 is not always set in the first scan of the PLC If a signal set for every start of the PLC is needed S21 should be used instead For Premium and Quantum Processing on Cold Start for Premium Quantum PLCs see page 149 For Modicon M340 Processing on Cold Start for Modicon M340 PLCs see page 137 1 1 cycle YES YES YES S1 WARMSTART Warm restart Normally at 0 this bit is set to 1 by e power is restored with data save e the user program e the terminal It is reset to 0 by the system at the end of the first complete cycle and before the outputs are updated This bit is not available on Quantum safety PLCs S1 is not always set in the first scan of the PLC If a signal set for every start of the PLC is needed S21 should be used instead YES YES YES except for safety PLCs 160 35006144 07 2012 System Objects Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S4 Timebase An internal timer regulates the change in YES YES YES TB10MS 10 ms status of this bit except for It is asynchronous in relation to the PLC safety
292. conditionally or unconditionally with CAL accumulator DFB or or subprogram see also Calling Elementary Function Blocks and contents are subprogram Derived Function Blocks page 506 and of the BOOL Subroutine Call page 496 data type FUNCTIO Executing a Literal variable A function is performed by specifying the name of NNAME function direct address data the function type is dependenton see also Calling Elementary Functions page 501 function PROCEDU Executing a Literal variable A procedure is performed by specifying the name RENAME procedure direct address data of the procedure see also Calling Procedures page 518 Structuring Operators IL programming language structuring operators accumulator contents are of the BOOL data type Operator Modifier Meaning Operands Description JMP Cc CN Jump to label LABEL With JMP a jump to the label can be conditional or only if the unconditional see also Labels and Jumps page 497 494 35006144 07 2012 Instruction List IL accumulator contents are of the BOOL data type program organization unit Operator Modifier Meaning Operands Description RET C CN Return to the RETURN operators can be used in DFBs derived only if the next highest function blocks and in SRs subroutines RETURN operators can not be used in the main program e Ina DFB a RETURN operator forces the return to the program whic
293. context If all checks are correct a warm restart see page 139 is done otherwise a cold start see page 135 is carried out 134 35006144 07 2012 Operating Modes Processing on Cold Start for Modicon M340 PLCs Cause of a Cold Start The following table describes the different possible causes of a cold start Causes Startup characteristics Loading of an application Cold start forced in STOP Restore application from memory card Cold start forced in STOP or RUN mode as when the application is different from the defined in the configuration one in internal RAM Restore application from memory card with Cold start forced in STOP or RUN mode as Unity Pro commands PLC Project defined in the configuration backup RESET button pressed on supply Cold start forced in STOP or RUN mode as defined in the configuration RESET button pressed on supply less than Cold start forced in STOP or RUN mode as 500ms after a power down defined in the configuration RESET button pressed on supply after a Cold start forced in STOP The start in RUN processor error except in the case of a mode as defined in the configuration is not watchdog error taken into account Initialization from Unity Pro Start in STOP or in RUN retaining the Forcing the system bit SO operating mode in progress at downtime initialization only of application Restoral after power supply outage with loss Cold start forced in STOP
294. cs Topic Page System Bit Introduction 159 Description of System Bits SO to S7 160 Description of System Bits S9 to S13 162 Description of System Bits S15 to S21 164 Description of System Bits S30 to S59 167 Description of System Bits S65 to S79 170 Description of System Bits S80 to S96 174 Description of System Bits S100 to S123 177 158 35006144 07 2012 System Objects System Bit Introduction General The Modicon M340 Premium Atrium and Quantum PLCs use Si system bits which indicate the state of the PLC or they can be used to control how it operates These bits can be tested in the user program to detect any functional development requiring a set processing procedure Some of these bits must be reset to their initial or normal state by the program However the system bits that are reset to their initial or normal state by the system must not be reset by the program or by the terminal 35006144 07 2012 159 System Objects Description of System Bits S0 to S7 Detailed Description Description of system bits SO to S7 Bit Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum S0 COLDSTART Cold start Normally on 0 this bit is set on 1 by power restoral with loss of data battery fault e the user program e the terminal e a change of cartridge This bitis setto 1 during the first
295. ct However the User Defined Library remains unchanged Description of a DFB Type The following diagram shows a graphic representation of a DFB model Name Inputs Outputs Lani tal tl T L nputs Outputs Public variables Private variables Sections 586 35006144 07 2012 Overview of DFBs The function block comprises the following elements e Name name of the DFB type max 32 characters This name must be unique in the libraries the authorized characters used depend on the choice made in the Identifiers area of the Language extensions tab in the Project Settings see Unity Pro Operating Modes Inputs input parameters excluding input output parameters Outputs output parameters excluding input output parameters Inputs Outputs input output parameters Public variables internal variables accessible by the application program Private variables nested internal variables or DFBs not accessible by the application program Sections DFB code sections in LD IL ST or FBD e Comment of a maximum of 1024 characters Formatting characters carriage return tab etc are not authorized For each type of DFB a descriptive file is also accessible via a dialog box size of the DFB number of parameters and variables version number date of last modification protection level etc Online Help for DFB Types It is possible to link an HTML help file to each DFB in the User Defin
296. ct all the input input output or output parameters except the following parameters which it is compulsory for you to assign e generic data type input parameters ANY_INT ANY_ARRAY etc e input output parameters e generic data type output parameters other than tables ANY_INT ANY_REAL etc e STRING type input parameters e unconnected input parameters keep the value of the previous call or the initialization value defined for these parameters if the block has never been called e all of the objects assigned to the input input output and output parameters must be of the same type as those defined when the DFB type was created for example if the type INT is defined for the input parameter speed then you cannot assign it the type DINT or REAL The only exceptions are BOOL and EBOOL types for input and output parameters not for input output parameters which can be mixed Example The input parameter Validation may be defined as BOOL and associated with a Mi internal bit of type EBOOL However in the internal code of the DFB type the input parameter actually has BOOL type properties it cannot manage edges 608 35006144 07 2012 Use of DFBs Assignment of Parameters The following table summarizes the different possibilities for assigning parameters in the different programming languages Parameter Type Assignment of the parameter 1 Assignment Inputs ED
297. ct eee Debug Servicess aires ira iaa an ara eee Diagnostic Viewer 2 0 2 2 eee ees Operator Screens onart or ae eae od HE ea eS ad Application Structure 000ce eee eee Description of the Available Functions for Each Type of Functions Available for the Different Types of PLC Application Program Structure 0005 Description of Tasks and ProcesseS 00002 eee ee eeeeee Presentation of the Master Task 0 0 0 2 c eee eee eee eee Presentation of the Fast Task 2 0 0 cee eee eee Presentation of Auxiliary Tasks 0 0 0 cece eee Overview of Event Processing 0 0c eee eee eee eee eae 35006144 07 2012 3 2 3 3 3 4 Chapter 4 41 4 2 Chapter 5 5 1 5 2 5 3 Description of Sections and Subroutines 20005 Description of Sections 0 00 ee eee Description of SFC sections 0 00000 eee eee Description of Subroutines 0 0 0 0 Mono Task Execution 0 00000 cee ees Description of the Master Task Cycle 000 c eee eee eee Mono Task Cyclic Execution 0 0 0 0 cece eee eee Periodic Execution a a a a eee Control of Cycle Time 0 c eect eee Execution of Quantum Sections with Remote Inputs Outputs Multitasking Execution 0 2 0 eee tee Multitasking Software Structure 0 0 0 ee eee Sequencing of Tasks in a Multitasking Structure
298. ction described below e When using multitasking the test of s I edge must be performed in the task where it is updated The use of the edge detection of a I scheduled in a task of higher priority must be avoided Example If you have a fast task which updates a 31 do not use a edge detection in the mast task Depending on the scheduling you can detect the edge or not 35006144 07 2012 395 Ladder Diagram LD Recognizing Positive Edges A contact to recognize positive edges is used to recognize positive edges With this contact the right connection for a program cycle is 1 when the transition of the associated actual parameter A is from 0 to 1 and at the same time the status of the left connection is 1 Otherwise the status of the right link is 0 In the example a positive edge of the variable A is supposed to be recognize and B should therefore be set for a cycle A B p fx aaa ea Anytime the value bit of A equals 1 and the history bit equals 0 B is set to 1 fora cycle cycle 1 4 and 9 0 8 4 8 OM 8B 1 A Value bit _ A History Bit B Value bit DoE gt Recognizing Negative Edges A contact to recognize negative edges is used to recognize negative edges With this contact the right connection for a program cycle is 1 when the transition of the associated actual parameter A is from
299. ction REPEAT UNTIL END_REPEAT Description The REPEAT instruction has the effect that a sequence of instructions is executed repeatedly at least once until its related Boolean condition is 1 true The UNTIL instruction marks the end condition The occurrence may be terminated early using the EXIT The END REPEAT instruction marks the end of the instruction s In the following cases REPEAT may not be used as it can create an endless loop which causes the program to crash REPEAT may not be used for synchronization between processes e g as a Waiting Loop with an externally defined end condition REPEAT may not be used in an algorithm as the completion of the loop end condition or execution of an EXIT instruction can not be guaranteed Example REPEAT UNTIL END_REPEAT x 1 REPEAT KX X 2 UNTIL x gt 101 END_REPEAT See Also EXIT see page 553 552 35006144 07 2012 Structured Text ST Repeat Instruction EXIT Description Example EXIT See Also The EXIT instruction is used to terminate repeat instructions FOR WHILE REPEAT before the end condition has been met If the EXIT instruction is within a nested repetition the innermost loop in which EXIT is situated is left Next the first instruction following the loop end END_ FOR END WHILE Or END REPEAT is executed
300. ction of in out variable to different variables graphical 21 Overloaded functions N Typed functions 22 TO_ Note 1 page 673 TRUNC Note 2 page 673 _BCD_TO_ Note 3 page 674 AJOJN TO BCD Note 3 page 674 23 ABS function SQRT function LN function LOG function EXP function SIN function Cos function TAN function ASIN function fo ACOS function 3 0 0 N O oO AJ wo np a ATAN function 24 Po ADD function w MUL function i A SUB function oa DIV function O MOD function N EXPT function MOVE function 25 SHL function SHR function ROR function AJOJN ROL function 668 35006144 07 2012 IEC Compliance Table No Feature No Description of Feature 26 A ND function O R function X OR function oN O N oT function 27 S EL function MAX function M IN function L IMIT function M UX function 28 G T function G E function EQ function Li E function Li T function N E function 29 Li EN function Note 4 page 674 Li EFT function Note 4 page 674 R IGHT function Note 4 page 674 M ID function
301. ctions in a DFB Enter a comment for DFBs and DFB parameters Analyze the defined DFBs Version management Assignment of defined DFBs to a library 35006144 07 2012 43 Presentation Data Usage Data types and instances created using the data editor can be inserted context dependent in the programming editors The following functions are available e Access to all programming language editors e Only compatible data is displayed e View of the functions function blocks procedures and derived data types arranged according to their library affiliation e Instance declaration during programming is possible Data selection dialog box GEOFBDEDITOR Instance selection Pt IN1 IN2 1 AND OUT Variables Function blocks CF Name lt In structure Name Type Comment Address Emptying SFCSTEP_STATE Online Modifications It is possible to modify the type of a variable or a Function Block FB instance declared in application or in a Derived Function Block DFB directly in online mode see Unity Pro Operating Modes That means it is not required to stop the application to perform such a type modification motor mixer Motor motor emptying Motor b1_a_presel Int Set paint AMW100 fo1_b_presel Int Set point SoMIW101
302. d and ENO it is set to 0 If EN 1 the internal program of the block is executed and ENO is set to 1 by the system If an error occurs ENO is set to 0 ENO means Error NOtification this is the output associated to the optional input EN If ENO is set to O caused by EN 0 or in case of an execution error e the outputs of function blocks remain in the status they were in for the last correct executed scanning cycle and e the output s of functions and procedures are set to 0 NOTE If EN is not connected it is automatically set to 1 Event processing 1 is a program section launched by an event The instructions programmed in this section are executed when a software application event Timer or a hardware event application specific module is received by the processor Event processes take priority over other tasks and are executed the moment the event is detected The event process EVTO is of highest priority All others have the same level of priority NOTE For M340 IO events with the same priority level are stored in a FIFO and are treated in the order in which they are received All the timers have the same priority When several timers end at the same time the lowest timer number is processed first The system word SW48 counts IO events and telegram processed NOTE TELEGRAM is available only for PREMIUM not on Quantum or M340 F Task launched periodically setting of the period in th
303. dard modules can be simply created whose names are defined at a later date e Analias name can be given to all elements of an IODDT structure Hardware Dependent Device Derived Data Types Device DDT Device derived data type DDT is a predefined DDT that describes the I O language elements of an I O Module This data type is represented in a structure which depends on the capabilities of the I O module This structure provides bits and register views when both extracted bits and register exist in IODDT In this case extracted bit is not seen as a child element of the register variable but directly as field of Device DDT structure When adding a Modicon M340 module in a M340 remote I O drop the Unity Pro software will create automatically the associated Device DDT instance This instance is deduced from IODDT other not mapped object like KW are not accessible 35006144 07 2012 39 Presentation Each I O Module is associated with one implicit device DDT instance e Implicit Device DDT instances are created by default on device insertion and refreshed automatically by the PLC They contain the modules status modules and channels health bits values of the modules inputs values of the modules outputs etc The Implicit Device DDT can be e linked to a device Managed e not linked to a device Un managed NOTE IODDT and topologic address see Modicon M340 with Unity Pro CANopen User Manual are no longer supported with
304. ddress specification notation Not applicable Attempt by a program organization unit to modify a variable which has been declared CONSTANT 2 error is reported during programming Improper use of directly represented or external variables in functions Not applicable A VAR_IN_OUT variable is not properly mapped 2 error is reported during programming Type conversion errors 4 error is reported during execution Numerical result exceeds range for data type 4 error is reported during execution Division by zero 4 error is reported during execution Mixed input data types to a selection function 2 error is reported during programming Result exceeds range for data type 4 error is reported during execution No value specified for an in out variable 2 error is reported during programming Zero or more than one initial steps in SFC network 3 error is reported during analyzing loading linking User program attempts to modify step state or time 2 error is reported during programming Side effects in evaluation of transition condition 3 error is reported during analyzing loading linking Action control contention error 3 error is reported during analyzing loading linking Simultaneously true non prioritized transitions in a selection divergence Not applicable Unsafe or unreachable SFC 3 error is reported during analyzing loading li
305. ded by the sign or sign the sign is optional Signed type with a 16 bit format This table shows the range in each base Base from to Decimal 32768 32767 Binary 2 1000000000000000 2 0111111111111111 Octal 8 100000 8 077777 Hexadecimal 16 8000 16 7FFF Double Integer Type DINT Signed type with a 32 bit format This table shows the range in each base Base from to Decimal 2147483648 2147483647 Binary 2 1 0000000000000000000000000000000 2 01111111111111111111111111111111 Octal 8 20000000000 8 17777777777 Hexadecimal 16 80000000 16 7FFFFFFF 260 35006144 07 2012 Data Types Unsigned Integer Type UINT Unsigned type with a 16 bit format This table shows the range in each base Base from to Decimal 0 65535 Binary 2 0 2 1111111111111111 Octal 8 0 84177777 Hexadecimal 16 0 16 FFFF Unsigned Double Integer Type UDINT Unsigned type with a 32 bit format This table shows the range in each base Base from to Decimal 0 4294967295 Binary 2 0 2 11111111111111111111111111111111 Octal 8 0 8 37777777777 Hexadecimal 16 0 16 FFFFFFFF 35006144 07 2012 261 Data Types The Time Type At a Glance Entering a Value The Time type T or TIME is represented by an unsigned double integer UDINT see page 260 type It expresses a duration in milliseconds whic
306. detection of changes between RUN STOP etc and the processing of requests from the terminal modifications and animation 90 35006144 07 2012 Program Structure Operating Mode PLC in RUN the processor carries out internal processing input acquisition processing of the application program and the updating of outputs in that order PLC in STOP the processor carries out e internal processing e input acquisition 1 e and depending on the chosen configuration e fallback mode the outputs are set to fallback position e maintain mode the last value of the outputs is maintained 1 for Quantum PLCs input acquisition is inhibited when the PLC is in STOP 35006144 07 2012 91 Program Structure Mono Task Cyclic Execution General The master task operates as outlined below A description is provided of cyclic execution of the master task in mono task operation Operation The following drawing shows the execution phases of the PLC cycle Processing the Processing program the program l Q l Q Cycle n Cycle n 1 ma ap gt l Reading of inputs Q Writing of outputs Description This type of operation consists of sequencing the task cycles one after another After having updated the outputs the system performs its own specific processing then starts another task cycle without pausing Cycle Check The cycle is checked by the watchdog see page 94 92 350
307. determined by start value end value and control variable The control variable initial value and end value must be of the same data type DINT or INT The control variable initial value and end value can be changed by a repeated instruction This is a supplement to IEC 61131 3 The FOR instruction increments the control variable value of one start value to an end value The increment value has the default value 1 If a different value is to be used it is possible to specify an explicit increment value variable or constant The control variable value is checked before each new loop If it is outside the start value and end value range the loop will be left Before running the loop for the first time a check is made to determine whether incrementation of the control variables starting from the initial value is moving toward the end value If this is not the case e g initial value lt end value and negative increment the loop will not be processed The control variable value is not defined outside of the loop The DO instruction identifies the end of the repeat definition and the beginning of the instruction s The occurrence may be terminated early using the EXIT The END_ FOR instruction marks the end of the instruction s Example FOR with Increment 1 FOR with increment 1 Control variable Start value End value FOR i 1 TO 50 DO C C COS B END_FOR 548 35006144 07 2012 Structured Text ST
308. ds to the DINT UINT UDINT formulaD A B C REAL or TIME LDA ADD B ADD C ST D SUB Subtraction Literal variable With SUB the value of the operand is subtracted direct address of from the accumulator content data types INT Example The example corresponds to the DINT UINT UDINT formula D A B C REAL or TIME LD A SUB B SUB C ST D MUL Multiplication Literal variable The MUL operator multiplies the content of the direct address of accumulator by the value of the operand data type INT Example The example corresponds to the DINT UINT UDINT formulaD A B C or REAL LD A MUL B MUL C ST D Note The MULTIME function in the obsolete library is available for multiplications involving the data type Time 490 35006144 07 2012 Instruction List IL Operator Modifier Meaning Operands Description DIV Division Literal variable The DIV operator divides the contents of the direct address of accumulator by the value of the operand data type INT Example The example corresponds to the DINT UINT UDINT formulaD A B cC or REAL LD A DIV B DIV C ST D Note The DIVTIME function in the obsolete library is available for divisions involving the data type Time MOD Modulo Literal variable The MOD operator divides the value of the first Division direct address of operand by the value of the second and returns INT DINT UINT or the remainder Modulo as the result UDINT data types Exam
309. duction Data types in bit string format belong to the EDT Elementary data type family which includes single rather than derived data types tables structure function blocks Reminder Concerning Bit String Format The particularity of this format is that all of its component bits do not represent a numerical value but a combination of separate bits The data belonging to types of this format can be represented in three bases These are e hexadecimal 16 e octal 8 e binary 2 Data Types in Bit String Format Three data types Type Scale bits Default value BYTE 8 0 WORD 16 0 DWORD 32 0 278 35006144 07 2012 Data Types Bit String Types The Byte Type The Word Type The Byte type is coded in 8 bit format This table shows the lower upper limits of the bases which can be used Base Lower limit Upper limit Hexadecimal 16 0 16 FF Octal 8 0 8 377 Binary 2 0 2 11111111 Representation examples Data content Representation in one of the bases 00001000 16 8 00110011 8 63 00110011 2 110011 The Word type is coded in 16 bit format This table shows the lower upper limits of the bases which can be used Base Lower limit Upper limit Hexadecimal 16 0 16 FFFF Octal 8 0 84177777 Binary 2 0 24 1111111111111111 Representation examples Data content Representation in one of
310. e component 35006144 07 2012 353 Function Block Language FBD Subroutine Calls Calling a Subroutine In FBD subroutines are called using the following blocks Condition MysR SR_CALL EN SR_NAME ENO If the status called The output of EN is 1 the respective subroutine variable name inSR_Name is ENO is not used to display the error status for this type of block The output ENO is always 1 for this type of block and is used to call multiple subroutines simultaneously The following construction makes it possible to call multiple subroutines simultaneously Condition MysSRI1 SR_CALL EN SR_NAME ENO MySR2 SR_CALL EN SR_NAME ENO The subroutine to be called must be located in the same task as the FBD section called Subroutines can also be called from within subroutines Subroutine calls are a supplement to IEC 61131 3 and must be enabled explicitly In SFC action sections subroutine calls are only allowed when Multitoken Operation is enabled 354 35006144 07 2012 Function Block Language FBD Control Elements Introduction Control elements are used for executing jumps within an FBD section and for returning from a subroutine SRx or derived function block DFB to the main program Control Elements The following control elements are available Designation Repr
311. e including after a cold start switching to with automatic start in run is indicated by RUN setting system bit S13 to 1 This bit is reset to 0 at the end of the first cycle of the MAST task in RUN mode 35006144 07 2012 163 System Objects Description of System Bits S15 to S21 Detailed Description Description of system bits S15 to S21 Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S15 Character Normally set to O this bit is setto 1 whenthe 0 YES YES YES STRINGERROR string fault destination zone for a character string exceptfor transfer is not of sufficient size including the safety number of characters and the end of string PLCs character to receive this character string The application stops in error state if the S78 bit has been to set to 1 This bit must be reset to 0 by the application This bit is not available on Quantum safety PLCs S16 Task Normally set to 1 this bit is set to O by the 1 YES YES YES IOERRTSK input output system when a fault on an in rack module or fault device on Fipio is detected e g non compliant configuration exchange fault hardware fault etc This bit must be reset to 1 by the user UNEXPECTED APPLICATION BEHAVIOR SPECIFIC VARIABLE BEHAVIOR On Quantum network communication errors with remote devices detected by communication modules NOM NOE NWM CRA CRP and motion
312. e 660 RAMP Status word values T F For details about the RAMP status word refer to the RAMP description see Unity Pro Control Block Library RATIO FP_ERROR F See table Common Floating Point Errors page 660 RATIO Status word values T F For details about the RATIO status word refer to the RATIO description see Unity Pro Control Block Library SP_SEL W_WARN_OUT_OF_ T 30110 16 759E Parameter out of range RANGE SP_SEL FP_LERROR F See table Common Floating Point Errors page 660 SP_SEL Status word values T F 7 For details about the SP_SEL status word refer to the SP_SEL description see Unity Pro Control Block Library 650 35006144 07 2012 EFB Error Codes and Values Tables of Error Codes for the Motion Library Introduction The following tables show the error codes and error values created for the EFBs of the Motion Library MMF Start Table of error codes and errors values created for EFBs of the MMF Start family EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex CFG_CP_F BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1 CFG_CP_F MMF_BAD_4X T 9010 16 2332 CFG_CP_F MMF_ABORT_SUB T 7004 16 1B5C SubNum SubNumEcho handshake error CFG_CP_V BAD_REVISION F 30200 16 8A08 defined as E_EFB_USER_ERROR_1
313. e 660 VLIM E_ERR_DEN 30152 16 8A38 Not a valid floating point number VLIM E_ERR_AB1_MAX_MIN F 30101 16 8A6B YMAX lt YMIN VLIM FP_ERROR See table Common Floating Point Errors page 660 35006144 07 2012 657 EFB Error Codes and Values Extension Compatibility Table of error codes and errors values created for EFBs of the Extension Compatibility family EFB name Error code ENO Error Error Error description state in valuein value in case of Dec Hex error AKF_TA E_AKFEFB_TIMEBASE_IS_ F 30482 16 88EE Time base is zero ZERO AKF_TE E_AKFEFB_TIMEBASE_IS_ F 30482 16 88EE Time base is zero ZERO AKF_TI E_AKFEFB_TIMEBASE_IS_ F 30482 16 88EE Time base is zero ZERO AKF_TS E_AKFEFB_TIMEBASE_IS_ F 30482 16 88EE Time base is zero ZERO AKF_TV E_AKFEFB_TIMEBASE_IS_ F 30482 16 88EE Time base is zero ZERO FIFO E_INPUT_VALUE_OUT_OF_ F 30183 16 8A19 Input value is out of range RANGE GET_3X E_INPUT_VALUE_OUT_OF_ F 30183 16 8A19 Input value is out of range RANGE GET_4X E_INPUT_VALUE_OUT_OF_ F 30183 16 8A19 Input value is out of range RANGE GET_BIT E_INPUT_VALUE_OUT_OF_ F 30183 16 8A19 Input value is out of range RANGE IEC_BMDI E_EFB_USER_ERROR_1 F 30200 16 8A08 Input value is invalid register type SourceTable IEC_BMDI E_EFB_USER_ERROR_2 F 30201 16 8A07 The input offset OffsetInSourc
314. e DDT Derived Data Type family includes derived data types such as e tables e structures Illustration Structures EDT EDT and EDT DDT and DDT DDT tables tables structures arrays A data item belonging to the DDT family is made up of e the type name see page 250 32 characters maximum defined by the user not obligatory for tables but recommended see page 283 e the type structure or table e an optional comment of a maximum of 1024 characters Authorized characters correspond to the ASCII codes 32 to 255 e the description in the case of a structure of these elements e the element name see page 250 32 characters maximum e the element type e an optional comment 1024 characters maximum describing its role The authorized characters correspond to the ASCII codes 32 to 255 e information such as e type version number e date of the last modification of the code or of the internal variables or of the interface variables e an optional descriptive file 32767 characters describing the block function and its different modifications NOTE The total size of a table or of a structure does not exceed 64 Kbytes 286 35006144 07 2012 Data Types Examples Definition of types COORD X INT Vso NT 7COORD type structure w EGMENT Origin COORD Destination COORD SEGMENT type structure containing 2 COORD type structures OUTLINE ARRAY 0 99 OF SEGMENT 7OUTLINE type table conta
315. e ENOstate Error Error Error description in case of value in value in error Dec Hex ACI030 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration ACI040 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration ACI040 E EFB_CURRENT_MODE_ F 30197 16 8A0B EFB error Current mode is not NOT_ALLOWED allowed ACO020 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration ACO130 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration ACO130 E_EFB_CURRENT_MODE_ F 30197 16 8A0B EFB error Current mode is not NOT_ALLOWED allowed All330 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration All330 E EFB_ILLEGAL_CONFIG F 30198 16 8A0A_ EFB error Illegal configuration DATA data All33010 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration All33010 E EFB_CURRENT_MODE_ F 30197 16 8A0B EFB error Current mode is not NOT_ALLOWED allowed AlO330 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration AlO330 E _EFB_CURRENT_MODE_ F 30197 16 8A0B EFB error Current mode is not NOT_ALLOWED allowed AMMO090 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration ARI030 E _EFB_NOT_CONFIGURED F 30188 16 8A14 EFB
316. e PC configuration used to carry out a part of the application having a superior level of priority to the Mast task master 704 35006144 07 2012 Glossary FBD FFB Flash Eprom FNES Function Function block Function view FBD is the abbreviation of Function Block Diagram FBD is a graphic programming language that operates as a logic diagram In addition to the simple logic blocks AND OR etc each function or function block of the program is represented using this graphic form For each block the inputs are located to the left and the outputs to the right The outputs of the blocks can be linked to the inputs of other blocks to form complex expressions Collective term for EF Elementary Function EFB Elementary Function Block and DFB Derived Function block PCMCIA memory card containing the program and constants of the application FNES is the abbreviation of Fichiers Neutres d Entr es Sorties Neutral I O Documentation FNES format describes using a tree structure the PLCs in terms of rack cards and channels It is based on the CNOMO standard comit de normalisation des outillages de machines outils see EF see EFB View making it possible to see the program part of the application through the functional modules created by the user See Functional module definition 35006144 07 2012 705 Glossary Functional Module A functional module is a group of program elements
317. e SFC control blocks to the SFC section to be controlled Token Rule The behavior of an SFC network is greatly affected by the number of tokens selected i e the number of active steps Explicit behavior is possible by using one token single token Parallel branches each with an active token step per branch as a single token This corresponds to a step chain as defined in IEC 61131 3 A step chain with a number of maximum active steps Multi Token defined by the user increases the degree of freedom This reduces eliminates the restrictions for enforcing unambiguousness and non blocking and must be guaranteed by the user Step chains with Multi Token do not conform to IEC 61131 3 35006144 07 2012 417 SFC Sequence Language Section Size IEC Conformity An SFC section consists of a single page window Because of performance reasons it is strongly recommended to create less than 100 SFC sections in a project makro section are not counted The window has a logical grid of 200 lines and 32 columns Steps transitions and jumps each require a cell Branches and links do not require their own cells they are inserted in the respective step or transition cell A maximum of 1024 steps can be placed per SFC section including all their macro sections A maximum of 100 steps can be active Multi Token per SFC section including all their macro sections A maximum of 64 steps can be set manually at the same time pe
318. e ZEF file advantages and drawbacks Advantages Drawbacks e The ZEF format ensures project e Medium size compatibility with any version of e Opening of the project takes time while the Unity Pro project is imported before operation e Generation of the project is mandatory to re assemble the project binary code Operating with the PLC requires to rebuild all the project and perform a download in the processor e Connecting to the PLC in Equal Online mode with a ZEF file is not possible For additional information see Connection Disconnection see Unity Pro Operating Modes 30 35006144 07 2012 Presentation Create Unity Pro Application Exchange File ZEF or XEF The following table describes the procedure for generating ZEF or XEF files Step Action 1 Launch the current Unity Pro software Start Programs Schneider Electric SoCollaborative Unity Pro 2 Open the project STU file 1 File Open 2 Select the project STU file 3 Click on Open File Export Project Choose a location for the file to be saved Do not save files in the default Schneider Electric directory C Program Files Schneider Electric Unity Pro Files saved in this directory may be deleted during Unity Pro installation Click on Export and select the export file format ZEF or XEF Remember the location where the ZEF or XEF file is stored on
319. e a name symbol and a topological address defined by the manufacturer in which case we say the data is located since its memory allocation is known e atopological address defined by the manufacturer in which case we say the data is direct addressing and its memory allocation is known Unlocated Data Instances Unlocated data instances are managed by the PLC operating system and their physical location in the memory is unknown to the user Unlocated data instances are defined using data types belonging to one of the following families e Elementary Data Types EDT Derived Data Types DDT Device Derived Data Type Device DDT Function Block data types EFB DFB Sequential Function Chart data types SFC Examples Var_1 BOOL Instance of EDT family of Boolean type with 1 byte memory allocation Var_2 UDINT Instance of EDT family of double unsigned integer type with 4 byte memory allocation Var_3 ARRAY 1 10 OF INT Instance of DDT family of table type with 20 byte memory allocation COORD X INT Y INT Var_4 COORD Instance of DDT family of COORD type structure with 4 byte memory allocation NOTE Sequential Function Chart SFC data type instances are created when they are inserted in the application program with a default name that the user can modify 312 35006144 07 2012 Data Instances Located Data Instances Localizing a variable defined by a symbol consists in creating an address in the
320. e by watchdog see page 94 35006144 07 2012 93 Program Structure Control of Cycle Time General The period of master task execution in cyclic or periodic operation is controlled by the PLC watchdog and must not exceed the value defined in Tmax configuration 1500 ms by default 1 5 s maximum Software Watchdog Periodic or Cyclic Operation If watchdog overflow should occur the application is declared in error which causes the PLC to stop immediately HALT state The bit S11 indicates a watchdog overflow It is set to 1 by the system when the cycle time becomes greater than the watchdog The word SW11 contains the watchdog value in ms This value is not modifiable by the program NOTE e The reactivation of the task requires the terminal to be connected in order to analyze the cause of the error correct it reinitialize the PLC and switch it to RUN e Itis not possible to exit HALT by switching to STOP To do this you must reinitialize the application to ensure consistency of data Control in Periodic Operation In periodic operation an additional control enables a period overrun to be detected A period overrun does not cause the PLC to stop if it remains less than the watchdog value The bit S19 indicates a period overflow It is set to 1 by the system when the cycle time becomes greater than the task period The word SWO contains the value of the period in ms It is initialized on cold restart b
321. e macro section assigned to the macro step etc may exist with the same name There are no case distinctions The step name must correspond with the standardized name conventions If the name of the macro step is changed then the name of the respective macro section and the steps within it are changed automatically For example If MS_1_1 is renamed to MyStep then the step names in the macro section are renamed to MyStep IN MyStep 1 MyStep_n MyStep_ OUT 35006144 07 2012 427 SFC Sequence Language 13 3 Actions and Action Sections Overview This section describes the actions and action sections of the SFC sequence language What Is in This Section This section contains the following topics Topic Page Action 429 Action Section 431 Qualifier 432 428 35006144 07 2012 SFC Sequence Language Action Introduction Action Variable Actions have the following properties An action can be a Boolean variable action variable see page 429 or a section action section see page 431 of programming language FBD LD IL or ST A step can be assigned none or several actions A step which is assigned no action has a waiting function i e it waits until the assigned transition is completed If more than one action is assigned to a step they are processed in the sequence in which they are positioned in the action list field Exception Independent of their position in the
322. e online type modification is not permitted e Whether the current FB can not be removed online or anew FB can not be added online the online type modification of this FB is not allowed Indeed some Elementary Function Blocks EFB like the Standard Function Blocks SFB do not allow to be added or removed online As a result changing the type of an EFB instance to a SFB instance is not possible and conversely In both of these cases the following dialog box is displayed On Line Modification Authorization x A You must build this modification Offline Do you confirm the modification NOTE Due to these limitations if a Derived Function Block DFB contains at least one instance of a SFB it is not be possible to add or remove instance of this DFB in online mode see Unity Pro Operating Modes 35006144 07 2012 45 Presentation Program Editor Introduction A program can be built from e Tasks that are executed cyclically or periodically Tasks are built from e Sections e Subroutines e Event processing that is carried out before all other tasks Event processing is built from e Sections for processing time controlled events e Sections for processing hardware controlled events Example of a Program Project Browser Es Structural View E Program 3 Tasks H S MAST Eh Section A Counting ues Drilling o E BEE Washing E S SR Sections E SRI SR2 J FAST F Sectio
323. e operation of the counter must be as follows Phase Description 1 The DFB counts the rising edges on the Count input 2 The number of edges it counts is then stored by the variable V_cour This variable is reset by a rising edge on the Reset input When the number of edges counted is equal to the preset value the Done output is set to 1 This variable is reset by a rising edge on the Reset input Internal Program of the DFB The internal program of the DFB type Cpt_parts is defined in Structured Text as follows Programming of the Cpt_parts DFB IF RE Reset THEN V_cour 0 END_IF IF RE Count THEN V_cour V_cour 1 END_IF IF V_cour gt Presel THEN ELSE Example of Use SET Done RESET Done END_IF Let us suppose your application needs to count 3 part types for example bolts nuts and screws The DFB type Cpt_parts can be used three times 3 instances to perform these different counts The number of parts to be procured for each type is defined in the words MD10 MD12 and MD14 respectively When the number of parts is reached the counter sends a command to an output Q1 2 1 Q1 2 2 or Q1 2 3 which then stops the procurement system for the corresponding parts 35006144 07 2012 605 DFB instance The application program is entered in Ladder language as follows The 3 DFBs instances Cpt_bolts Cpt_nuts and Cpt_screws are used to count the
324. e runs from s_ 1 12toS 1 14 If transition condition is true then a jump is made from s_1_14 backtos 1 12 The loop from s_1__12 by means of transition conditions c b is true or c is false and d is true and f backtoS_ 1 12 is repeated until transition condition If transition conditions b and c are false and d is true then a jump is made from s_1 12 directly back to Sta condition b or c is true The loop froms_ 1 11toS 1 12 andbacktos 1 11 via transition conditions a and d is repeated until transition 452 35006144 07 2012 SFC Sequence Language Infinite sequence loops are not permitted within an alternative sequence Infinite sequence loops S11 S11 Eii MER a b c a b c gt gt S12 s13 14 S_1_2 S_13 S_1_4 Coa at Les pened a Ls pe d e f d 7 i FE S14 S13 S_1_5 a_i g g S_1_6 S_1_6 If Then If transition condition b is true then a sequence runs from s_ 1 1toS 1 3 If transition condition e is true then a jump is made to S_1_4 If transition condition f is true then a jump is made to s_1_3 is now repeated infinitely The loop from s_1_ 3 via transition condition e to S_1_4 via transition condition f and a jump back to S_1_ 3 again 35006144 07 2012 453
325. e several other blocks for executing ST instructions see page 529 and ST expressions see page 529 and for simple compare operations These blocks are only available in the LD programming language The following objects are available Designation Representation Description Operate block OPERATE When the status of the left link is 1 the ST instruction in the block _ is executed RES sFCTZNAMES All ST instructions see page 529 are allowed except the control instructions RETURN JUMP IF CASE FOR o etc For operate blocks the state of the left link is passed to the right link regardless of the result of the ST instruction A block can contain up to 4096 characters If not all characters can be displayed then the beginning of the character sequence will be followed by suspension points An operate block takes up 1 line and 4 columns Example In1 In2 Out1 _ instruction l Instruction2 In the example Instruction1 is executed if In1 1 Instruction2 is executed if Inl 1 and In2 1 the result of Instruction1 has no meaning for the execution of Instruction2 Outi becomes 1 if In1 1 and In2 1 the results of Instruction1 and Instruction2 have no meaning for the status of Out 1 388 35006144 07 2012 Ladder Diagram LD Designation Representation Description Horizontal Matching Block
326. e to be incremented by 0 If 0 the instructions are executed and an endless loop is created as the end value will never be reached with an increment of 0 FOR i 1 TO 10 BY j DO Cr C COS B 3 END FOR 550 35006144 07 2012 Structured Text ST Repeat Instruction WHILE DO END_WHILE Description Example WHILE See Also The WHILI E instruction has the effect that a sequence of instructions will be executed repeatedly until its related Boolean expression is 0 false If the expression is false right from the start the group of instructions will not be executed at all The Do instruction identifies the end of the repeat definition and the beginning of the instruction s The occurrence may be terminated early using the EXIT The END WHILE instruction marks the end of the instruction s In the following cases WHILE may not be used as it can created an endless loop which cau e WHILE ses the program to crash may not be used for synchronization between processes e g as a Waiting Loop with an externally defined end condition WHILE may not be used in an algorithm as the completion of the loop end condition or execution of an EXIT instruction can not be guaranteed DO END_WHILE x 1 WHILE x lt 100 DO x X 4 END_WHILE EXIT see page 553 35006144 07 2012 551 Structured Text ST Repeat Instru
327. e value of the first operand is greater STRING DT DATE or TOD than or equal to the value of the second the result is a Boolean 0 Example In the example OUT is 1 if IN1 is less than 10 and is otherwise 0 OUT IN1 lt 10 gt Greater than 7 Expression Literal The value of the first operand is compared comparison Variable Address of Data with the value of the second using gt If the Type BOOL BYTE INT value of the first operand is greater than the DINT UINT UDINT REAL value of the second the result is a Boolean TIME WORD DWORD 1 If the value of the first operand is less STRING DT DATE or TOD than or equal to the value of the second the result is a Boolean 0 Example In the example OUT is 1 if IN1 is greater than 10 and is 0 if IN1 is less than 0 OUT IN1 gt 10 lt Less than or 7 Expression Literal The value of the first operand is compared equal to Variable Address of Data with the value of the second operand using comparison Type BOOL BYTE INT lt If the value of the first operand is less DINT UINT UDINT REAL than or equal to the value of the second the TIME WORD DWORD result is a Boolean 1 If the value of the first STRING DT DATE or TOD operand is greater than the value of the second the result is a Boolean 0 Example In the example OUT is 1 if IN1 is less than or equal to 10 and otherwise is 0 OUT IN1 lt 10 gt Greater than or 7 Expression Literal The value
328. e variables v1 to a VAR_IN_OUT parameter Error The operation cannot be executed since the VAR_IN_OUT parameter cannot be accessed outside of the function block call Invalid call example 2 V1 InOutFB inout Assigning a VAR_IN_OUT parameter to the v1 variable Error The operation cannot be executed since the VAR_IN_OUT parameter cannot be accessed outside of the function block call The following function block calls are always valid Valid call example 1 InOutFB inout V1 Calling a function block with the VAR_IN_OUT parameter and formal assignment of the actual parameter within the function block call Valid call example 2 InOutFB V1 Calling a function block with the VAR_IN_OUT parameter and informal assignment of the actual parameter within the function block call 35006144 07 2012 573 Structured Text ST Procedures Procedure Parameter Procedures are provided in the form of libraries The logic of the procedure is created in the programming language C and may not be modified in the ST editor Procedures like functions have no internal states If the input values are the same the value on the output is the same for all executions of the procedure For example the addition of two values gives the same result at every execution In contrast to functions procedures do not return a value and support VAR_IN_ OUT variables Procedures
329. eTable selects an address outside acceptable limits IEC_BMDI E_EFB_USER_ERROR_3 F 30202 16 8A06 The input offset OFF_IN is not 1 or a multiple of 16 1 IEC_BMDI E_EFB_USER_ERROR_4 F 30203 16 8A05 Output value is invalid register type DestinationTable IEC_BMDI E_EFB_USER_ERROR_5 F 30204 16 8A04 The output offset OffsetInDestinationTable selects an address outside acceptable limits 658 35006144 07 2012 EFB Error Codes and Values EFB name Error code ENO Error Error Error description statein valuein value in case of Dec Hex error IEC_BMDI E _EFB_USER_ERROR_6 F 30205 16 8A03 The output offset OffsetInDestinationTable is not 1 or a multiple of 16 1 IEC_BMDI E _EFB_USER_ERROR_7 F 30206 16 8A02 The value for NumberOfElements is 0 IEC_BMDI E _EFB_USER_ERROR_8 F 30207 16 8A01 The value for NumberOfElements addresses more than 1600 bits IEC_BMDI E _EFB_USER_ERROR_9 F 30208 16 8A00 The value for NumberOfElements addresses more than 100 words IEC_BMDI E _EFB_USER_ERROR_10 F 30209 16 89FF The value for NumberOfElements selects a source address outside the acceptable limits IEC_BMDI E _EFB_USER_ERROR_11 F 30210 16 89FE The value for NumberOfElements selects a destination address outside the acceptable limits IEC_BMDI E _EFB_USER_ERROR_12 F 30211 16 89FD The value for Numbe
330. each of these words are associated with the modules located in positions 0 to 15 of these racks The bit is at 0 if the module is in fault and at 1 if the module is operating correctly Example 2Sw163 5 0 The module located in position 5 on rack 3 is in fault In case of half racks 2 contiguous half racks make a complete normal rack referenced by only one Swi 240 35006144 07 2012 Data Description In This Part This part describes the different data types that can be used in a project and how to implement them What Is in This Part This part contains the following chapters Chapter Chapter Name Page 7 General Overview of Data 243 8 Data Types 251 9 Data Instances 311 10 Data References 327 35006144 07 2012 241 Data Description 242 35006144 07 2012 General Overview of Data Subject of this Chapter This chapter provides a general overview of e the different data types e the data instances e the data references What Is in This Chapter This chapter contains the following topics Topic Page General 244 General Overview of the Data Type Families 245 Overview of Data Instances 247 Overview of the Data References 249 Syntax Rules for Type Instance Names 250 35006144 07 2012 243 General Overview of Data General Introduction A data item designates an object which can beinstantiated such a
331. ect address of accumulator with the contents of the operand If data type BOOL the contents of the accumulator are less BYTE WORD DWORD than equal to the contents of the operands the STRING INT DINT result is a Boolean 1 If the contents of the UINT UDINT REAL accumulator are greater than the contents of the TIME DATE DT or operands the result is a Boolean 0 TOD Example In the example the value of D is 1 if Ais smaller than or equal to 10 otherwise the value of Dis 0 LD A LE 10 ST D LT Comparison lt Literal variable The LT operator compares the contents of the direct address of accumulator with the contents of the operand If data type BOOL the contents of the accumulator is less than the BYTE WORD DWORD contents of the operands the result is a Boolean STRING INT DINT 1 If the contents of the accumulator is greater UINT UDINT REAL than equal to contents of the operands the result TIME DATE DT or is a Boolean 0 TOD Example In the example the value of D is 1 if Ais smaller than 10 otherwise the value of D is 0 LD A LT 10 ST D 35006144 07 2012 493 Instruction List IL Call Operators IL programming language call operators type is dependent on procedure Operator Modifier Meaning Operands Description CAL C CN Call of a Instance name of the A function block DFB or subprogram is called up only if the function block function block DFB
332. ed The program which called the DFB will be executed after return from the DFB If the DFB is called by another DFB the calling DFB will be executed after return e InaSR a RETURN instruction forces the return to the program which called the SR e The rest of the SR containing the RETURN instruction is not executed The program which called the SR will be executed after return from the SR 35006144 07 2012 555 Structured Text ST Empty Instruction Description A single semicolon represents an empty instruction For example IF x THEN ELSE In this example an empty instruction follows the THEN instruction This means that the program exits the IF instruction as soon as the IF condition is 1 556 35006144 07 2012 Structured Text ST Labels and Jumps Introduction Labels serve as destinations for jumps Jumps and labels in ST are a supplement to the IEC 61131 3 and must be enabled explicitly Label Properties Label properties e Labels must always be the first element in a line e Labels may only come before instructions of the first order not in loops e The name must be clear throughout the directory and it is not upper lower case sensitive e Labels must conform to the general naming conventions e Labels are separated by a colon from the following instruction Properties of Jumps Properties of jumps e Jumps can be made within program and DFB sect
333. ed SW542 Global The words SW542 to SW544 are the global communication GLOBERRCNTO communication error words SW543 status SW542 displays the global communication status GLOBERRCNT1 SW542 15 1 communication operating correctly SW544 SW542 14 1 communication on cable A operating GLOBERRCNT2 correctly SW542 13 1 communication on cable B operating correctly SW542 11 to 8 lost communications counter SW542 7 to 0 retry totalizer counter SW543 is the global error totalizer counter for cable A e most significant byte counts the errors detected e least significant byte counts non responses SW544 is the global error totalizer counter for cable B e most significant byte counts the errors detected e least significant byte counts non responses SW545 to SW547 Status of the For the PLCs where station 1 is reserved for local input outputs MODUNHEALTH1 local station the status words SW545 to SW547 are used in the following IOERRCNT1 way IORETRY1 SW545 status of the local station SW545 15 1 all modules are operating correctly SW545 14 to 8 unused always set to 0 SW545 7 to 0 number of times the module has appeared defective the counter loops back at 255 SW546 this is used as a counter for 16 bit input output bus errors SW547 this is used as a counter for 16 bit input output bus repetitions 35006144 07 2012 235 System Objects Word Fu
334. ed for the frame body 35006144 07 2012 217 System Objects e bit 12 unknown frame type received within the frame body the first byte identifies the type of frame link A set number of frame types are defined in the WorldFip standard link protocol Any other code found within a frame is therefore an unknown frame type e bit 13 a truncated frame has been received a frame section is recognized by a sequence of symbols delimiting the end of the frame while the destination station awaits the arrival of a delimiter sequence for the start of the frame e bit 14 unused non significant value e bit 15 unused non significant value 218 35006144 07 2012 System Objects Description of System Word SW154 Detailed Description Description of system word SW154 Word Function Description Initial Symbol state SW154 List of Fipio channel Each bit is set to 1 by the system and reset 0 FipioERR1 manager faults to 0 by the user See the list below Description of the Bits bit O aperiodic sequence time out indicates that the messages or aperiodic variables window has overflowed its limit within an elementary cycle of the macro cycle bit 1 refusal of messaging request indicates that the message queue is saturated for the time being the bus arbiter is in no position to latch onto nor to comply with a request bit 2 urgent update command refused indicates that
335. ed Library This file must e Have a name that is identical to the linked DFB e Be located in the directory Schneider Electric FFBLibset CustomLib MyCustomFam Language where Language is named Eng Fre Ger lta Spa or Chs according to the language desired Creation of a DFB Instance Once the DFB type is created you can define an instance of this DFB via the variable editor or when the function is called in the program editor Use of DFB Instances A DFB instance is used as follows e asa standard function block in Ladder LD or Functional Block Diagram FBD language e as an elementary function in Structured Text ST or Instruction List IL language A DFB instance can be used in all application program tasks except event tasks and Sequential Function Chart SFC transitions 35006144 07 2012 587 Overview of DFBs Storage The DFB types the user creates can be stored see Unity Pro Operating Modes in the function and function block library 588 35006144 07 2012 Description of User Function Blocks DFB 1 7 Subject of this Chapter This chapter provides an overview of the different elements that make up the user function blocks What Is in This Chapter This chapter contains the following topics Topic Page Definition of DFB Function Block Internal Data 590 DFB Parameters 592 DFB Variables 596 DFB Code Section 598 35006144 07 2012 589 Descripti
336. ed by IEC 61131 3 as undesired service Direct Use of Addresses Addresses can be used directly without a previous declaration In this case the addresses data type is assigned directly The assignment is made using the Large prefix The different large prefixes are given in the following table Large prefix Symbol Example Data type no prefix 110 SCH203 MOD SCH203 MOD ERR BOOL X SMX20 BOOL B QB102 3 BYTE W SKW43 INT D QD100 DINT F 3MF100 REAL 532 35006144 07 2012 Structured Text ST Using Other Data Types Should other data types be assigned as the default data types of an address this must be done through an explicit declaration This variable declaration takes place comfortably using the variable editor The data type of an address can not be declared directly in an ST section e g declaration AT SMW1 UINT not permitted For example the following variables are declared in the variable editor UnlocV1l ARRAY 1 10 OF INT LocV1 ARRAY 1 10 OF INT AT MW100 LocV2 TIME AT MW100 The following calls then have the correct syntax SMW200 5 UnlocV1 2 LocV1 MW200 Locv2 t 3s Accessing Field Variables When accessing field variables ARRAY only literals and variables of the INT UINT DINT and UDINT data types are permitted in the index entry The index of an ARRAY element can be negative if the lower threshold of the range
337. ed list of actual parameter assignments to the formal parameters The assignment of the input formal parameter is made using the assignment and the output formal parameter is made using the gt assignment The sequence in which the input formal parameters and output formal parameters are enumerated is not significant The list of actual parameters may be continued immediately following a comma EN and ENO can be used for this type of call Function block call in the formal form of CAL with a list of input parameters Instance Name Formal Parameters Inputs Formal Parameters Outputs CAL MY_COUNT CU varl R reset PV 100 Q gt out CV gt current Actual Parameters Inputs Actual Parameters Outputs or CAL MY COUNT CU varl R reset PV 100 QO gt out CV gt current Calling the same function block in FBD MY_COUNT CTU vari CU Q out reset R 100 PV cv current It is not necessary to assign a value to all formal parameters see also Parameter see page 506 CAL MY COUNT CU varl R reset Q gt out CV gt current 510 35006144 07 2012 Instruction List IL Calling the same function block in FBD MY_COUNT cTU vari CU QF out reset 7R PV cv current The value of a function block output can be stored and then saved by loading the function block output function block instance name and separated by a full stop or enter
338. ed nesting with ANY ARRAY ANY_ARRAY ANY IRPIN ANY_ARRAY 4 out EXAMP MN 4 IN EXAMP IN1 varl IN2 var2 MX var3 With all functions an EN input and an ENO output can be configured If the value of EN is equal to 0 when the function is called the algorithms defined by the function are not executed and ENO is set to 0 If the value of EN is equal to 1 when the function is called the algorithms which are defined by the function are executed After successful execution of these algorithms the value of ENO is set to 1 If an error occurs during execution of these algorithms ENO will be set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if EN equals to 1 If ENO is set to 0 caused when EN 0 or an error occurred during executing the output of the function is set to 0 The output behavior of the function does not depend on whether the function was called up without EN ENO or with EN 1 564 35006144 07 2012 Structured Text ST If EN ENO are used the function call must be formal out LIMIT EN 1 MN 0 IN varl MX 5 ENO gt var2 Calling the same function in FBD r LIMIT 1 EN ENO var2 ie MN out vari IN 5 MX 35006144 07 2012 565 Structured Text ST Call Elementary Function Block and Derived Function Blo
339. ee Edge Recognition page 394 Coil for XXX With coils that detect negative transitions the status of the left link is copied detecting onto the right link The relevant actual Boolean parameter indicated by xxx negative is 1 for a program cycle if a transition of the left link from 1 to 0 is made transitions Also see Edge Recognition page 394 Set coil XXX With set coils the status of the left link is copied onto the right link The S relevant Boolean actual parameter indicated by xxx is set to ON if the left link has a status of ON otherwise it remains unchanged The relevant Boolean actual parameter can be reset through the reset coil Also see Edge Recognition page 394 Reset coil XXX With reset coils the status of the left link is copied onto the right link The E relevant Boolean actual parameter indicated by xxx is set to OFF if the left link has a status of ON otherwise it remains unchanged The relevant Boolean actual parameter can be set through the set coil Also see Edge Recognition page 394 374 35006144 07 2012 Ladder Diagram LD Om Designation Representation Description Stop coil XXX With halt coils if the status of the left link is 1 the program execution is stopped immediately With stop coils the status of the left link is not copied to the right link Call coil XXX With call coils the status of the left link is copied to the right link If the status of the
340. ee deka vee cee dads 661 General Information regarding IEC 61131 3 0 0000 662 General information about IEC 61131 3 Compliance 662 IEC Compliance Tables 0 0 0 e eects 664 Common elements 000 c eee eet eete ee ae 665 IL language elements 00 0 cee eee eee 677 ST language elements 0 000 cece eee eee teens 679 Common graphical elements 00000 e cece eee 680 LD language elements 0 00 e eee tees 681 Implementation dependent parameters 20 e eee eee 682 Error Conditions 2 4 sanne etek pete r ii bate oda i gaT e a a E 685 Extensions of IEC 61131 3 0 0 2 eect eee 687 Extensions of IEC 61131 3 2nd Edition 005 687 Textual language syntax 0 eee tee 689 Textual Language Syntax 0 0 cece cee 689 Secret eee ee ee ee re ee eee mere eee 691 a ta eg as tu a wo a ah a cl ay OR ava e Saha ah 719 10 35006144 07 2012 Safety Information Za Important Information NOTICE Read these instructions carefully and look at the equipment to become familiar with the device before trying to install operate or maintain it The following special messages may appear throughout this documentation or on the equipment to warn of potential hazards or to call attention to information that clarifies or simplifies a procedure The addition of this symbol to a Danger safety label indicates that an electrical ha
341. eference of dummy module already used 35 Module 3x is not a dummy module 36 Module 4x is not a dummy module SW536 Communication The words SW536 to SW538 are the communication error CAERRCNTO status on words on cable A SW537 cable A SW536 CAERRCNT1 SW538 e most significant byte counts framing errors CAERRCNT2 e least significant byte counts overruns of the DMA receiver e SW537 e most significant byte counts receiver errors e least significant byte counts incorrect station receptions SW538 SW538 15 1 short frame SW538 14 1 no end of frame SW538 3 1 CRC error e SW538 2 1 alignment error SW538 1 1 overrun error SW538 13 to 4 and 0 are unused 234 35006144 07 2012 System Objects Word Function Description Initial Symbol state SW539 Communication The words SW539 to SW541 are the communication error CBERRCNTO status on cable B words on cable B SW540 SW539 CBERRCNT1 to e most significant byte counts framing errors SW541 e least significant byte counts overruns of the DMA receiver CBERRCNT2 e SW540 e most significant byte counts receiver errors e least significant byte counts incorrect station receptions e SW541 SW541 15 1 short frame SW541 14 1 no end of frame SW541 3 1 CRC error SW541 2 1 alignment error SW541 1 1 overrun error SW541 13 to 4 and 0 are unus
342. elements Common graphical elements IEC compliance table for common graphical elements Table No Feature No Feature description 57 2 Horizontal lines Graphic or semigraphic 4 Vertical lines Graphic or semigraphic 6 Horizontal vertical connection Graphic or semigraphic 8 Line crossings without connection Graphic or semigraphic 10 Connected and non connected corners Graphic or semigraphic 12 Blocks with connecting lines Graphic or semi graphic 58 1 Unconditional Jump FBD Language 2 Unconditional Jump LD Language 3 Conditional Jump FBD Language 4 Conditional Jump LD Language 5 Conditional Return LD Language Note page 680 6 Conditional Return FBD Language Note page 680 7 Unconditional Return from function or function block Note page 680 8 Unconditional Return LD Language Note page 680 Note In DFB only 680 35006144 07 2012 IEC Compliance LD language elements LD language elements Note IEC compliance table for LD language elements Table No Feature No Feature description 59 1 Left power rail 2 Right power rail 60 1 Horizontal link Vertical link 61 Normally open contact vertical bar Note page 681 Normally closed contact vertical bar Note page 681 Positive transition sensing contact vertical bar Note page 681 Negative transition sensing contact vertica
343. em S20 MAST 0 System alarm Buffer battery error 28 01 2002 21 10 51 Faulty device rack Faulty device slot 35006144 07 2012 69 Presentation Operator Screen Introduction Operator windows visualize the automation process The operator screen editor makes it easy to create change and manage operator screens Operator screens are created and accessed via the project browser Project Browser Te Structural View Hfl HYK ei 3 Events _ Animation Tables lt Operator Screen J Station H Configuration Se 0 XBus Derived Data Types Derived FB Types gt Variables amp FB instances Elementary Variables Derived Variables 0 Derived Variables Derived FB Instances El Communication E Network Routing Table Program Tasks Family_1 Screen Screen_2 R Screen_3 Family_2 C Family_3 Documentation Title Page General Information Fo Elementary FB instances 70 35006144 07 2012 Presentation Operator Screen Editor An operator window contains much information dynamic variables overviews written text etc and makes it easy to monitor and change automation variables Operator Screen FBD1 MAST Drilling Thread cutting Drilling speed K e Enable
344. ence jump S_5 10 S_5 10 a a a ey as a a b e a b e _5_11 S_5_13 5 14 511 S514 Ai a SEs a c f c f a d d gt S_5_13 S_5_13 If Then If transition condition a is true then a sequence is run froms 5 10toS 5 11 S 5 12 and s_5_13 If transition condition b is true then a jump is made from s_5_10 directly to S_5_13 If transition condition e is true then a sequence is run from s_5_10 to s_5_14 and 5 0 13 35006144 07 2012 451 SFC Sequence Language Sequence Loop A sequence loop is a special type of alternative branch with which one or more branches lead back to a previous step A sequence loop can be made with jumps or with links Sequence loop gt S_1_11 S_1_11 Pi nt aad tf a a a gt A S_1_12 S_1_12 D n ii aay pl at Ls el b c d A b c d S_1_13 S_1_14 S_111 X S_1_13 S_1_14 a a a gt e f e f _1_15 S_1_12 _1_15 T If Then If transition condition a is true then a sequence runs from Ss_1_11 to S_1_12 If transition condition b is true then a sequence runs from s 1 12toS 1 13 If transition condition b is false and c is true then a sequenc
345. ent content operand to0 address of BOOL of the accumulator is a Boolean 1 when the data type Example In this example the value of A is loaded accumulator to the accumulator If the content of the content is 1 accumulator value of A is 1 then OUT is set to 0 LDA R OUT Usually this operator is used together with the set operator S as a pair Example This example shows a SR flip flop set dominant that is controlled through the two Boolean variables A and c LDA R OUT LD C S OUT 488 35006144 07 2012 Instruction List IL Logical Operators IL programming language logic operators exclusive OR direct address of BOOL BYTE WORD or DWORD data types Operator Modifier Meaning Operands Description AND N N Logical AND Literal variable The AND operator makes a logical AND link direct address of between the accumulator content and the BOOL BYTE WORD operand or DWORD data types In the case of BYTE WORD and DWORD data types the link is made bit by bit Example In the example Dis 1 if A B and C are 1 LD A AND B AND C ST D OR N N Logical OR Literal variable The OR operator makes a logical OR link between direct address of the accumulator content and the operand BOOL BYTE WORD In the case of BYTE WORD and DWORD data types or DWORD data types the link is made bit by bit Example In the example D is 1 if A or B are 1 and Cis 1 LD A OR B OR C
346. equals 1 while the value and history bits remain at 1 Status change action 4 686 7 B Value bit Forcing bit SEE History bit EEE PLC Variables Belonging to Boolean Types List of variables Variable Type Internal bit EBOOL System bit BOOL Word extracted bit BOOL l inputs Module error bit BOOL Channel error bit BOOL Input bit EBOOL Q outputs Output bit EBOOL 35006144 07 2012 257 Compatibility between BOOL and EBOOL The operations authorized between these two types of variables are e value copying e address copying Copies between types BOOL destination EBOOL destination BOOL source Yes Yes EBOOL source Yes Yes Compatibility between the parameters of elementary functions EF Effective parameter external to EF Formal BOOL parameter internal to EF Formal EBOOL parameter internal to EF BOOL Yes No EBOOL In gt Yes Yes In Out gt No Out gt Yes Compatibility between the parameters of block functions EFB DFB Effective parameter external to FB Formal BOOL parameter internal to FB Formal EBOOL parameter internal to FB BOOL Yes In gt Yes In Out gt No Out gt Yes EBOOL In gt Yes Yes In Out gt No Out gt Yes Compatibility between array variables ARRAY i j
347. er This chapter describes the structure and execution of the programs created using the Unity Pro software What Is in This Chapter This chapter contains the following sections Section Topic Page 3 1 Description of Tasks and Processes 78 3 2 Description of Sections and Subroutines 84 3 3 Mono Task Execution 89 3 4 Multitasking Execution 97 35006144 07 2012 77 Program Structure 3 1 Description of Tasks and Processes Subject of this Section This section describes the tasks and processes that comprise the application program What Is in This Section This section contains the following topics Topic Page Presentation of the Master Task 79 Presentation of the Fast Task 80 Presentation of Auxiliary Tasks 81 Overview of Event Processing 83 78 35006144 07 2012 Program Structure Presentation of the Master Task General Structure Execution Control The master task represents the main task of the application program It is obligatory and created by default The master task MAST is made up of sections and subroutines Each section of the master task is programmed in the following languages LD FBD IL ST or SFC The subroutines are programmed in LD FBD IL or ST and are called in the task sections NOTE SFC can be used only in the master task sections The number of sections programmed in SFC is unlimited You can
348. er the textual syntax of the IL and ST languages as specified in Annex B 2 and B 3 of IEC 61131 3 2nd Edition including all directly and indirectly referenced productions out of Annex B 1 is supported in textual language sections Those syntax productions in Annex B of IEC 61131 3 2nd Edition belonging to features which are not supported by Unity Pro according to the compliance tables see page 664 are not implemented 35006144 07 2012 689 IEC Compliance 690 35006144 07 2012 Glossary l ID IF IW 0 9 According to the IEC standard 1 indicates a discrete input type language object According to the IEC standard Mw indicates an input double word type language object Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt S3KF lt i gt SQF IF by using their topological address for example SMD0 6 0 11 3MFO 6 0 31 According to the IEC standard mw indicates an input real type language object Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt S3KF lt i gt SOF IF by using their topological address for example SMD0 6 0 11 3MFO 6 0 31 According to the IEC standard Iw indicates an analog input type language object 35006144 07 2012 691 Glossary KD KF KW M According to the IEC standard mw indicates a constant double word type l
349. ernative branches should only be switched exclusively in this mode of operation then this must be defined explicitly with the transition logic Example S_5_10 a a NOTA s_5_11 s_5_12 c d 35006144 07 2012 463 SFC Sequence Language Terminating an Alternative Branch with a Parallel Merge If a parallel merge is used to terminate an alternative branch it may block the string Terminating an Alternative Branch with a Parallel Merge a a b S_6_1 S_6_2 Pd d If Then If transition condition a is true and b is false then a sequence runs tos 6 1 can never be active at the same time Since Ss _6 1 ands 6 2 are linked by a parallel merge the branch cannot be departed because S_ 6 lands 6 2 Either s_6_1 is activated with transition condition a or S_6_2 with transition condition b Therefore S 6 1 ands 6 2 can never be active at the same time either The string is blocked This block can be removed for example by a second timed token that runs via transition b 464 35006144 07 2012 SFC Sequence Language Parallel Strings Parallel Strings With parallel branches switching a single transition leads to a parallel activation of more than one maximum 32 steps branches This applies with Single Token as well as with Multi Token Processing Parallel Strings
350. ers S67 State of the This bit is used to monitor the status of NO YES YES PCMCIABATO application the main battery when the memory card memory is in the upper PCMCIA slot This card battery applies to Atriums Premiums and Quantums CPU 140 CPU 671 60 60S 140 CPU 672 61 140 CPU 672 60 140 CPU 651 60 60S 140 CPU 652 60 and 140 CPU 651 50 e set to 1 main voltage battery is low The application is kept but the battery must be replaced following the predictive maintenance see Premium and Atrium using Unity Pro Processors racks and power supply modules Implementation manual procedure e set to 0 main battery voltage is sufficient application always kept e Bit S67 is supported by Unity version 2 02 NOTE With blue PCMCIAs PV gt 04 bit S67 is not set to 1 when main battery is absent though with green PCMCIAs PV lt 04 bit S67 is set to 1 in the same condition 35006144 07 2012 171 System Objects Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S68 State of This bit is used to check the operating NO YES YES PLCBAT processor state of the backup battery for saving battery data and the program in RAM e set to 0 battery present and operational e set to 1 battery missing or non operational S75 State of the This bit is supported by Unity Pro equal NO YES YES PCMCIABAT1 data storage or greater
351. es Arrays What Is an Array Characteristics It is a data item that contains a set of data of the same type such as e elementary data EDT for example e a group of BOOL words e a group of UINT integer words e etc e derived data DDT for example e a group of WORD tables a group of structures Device derived data Device DDT etc An array is characterized by two parameters e a parameter which defines its organization array dimension s e a parameter that defines the type of data it contains NOTE The most complex organization is the array with six dimensions The syntax comprising these two parameters is ARRAY lt dimension s of array gt OF lt data type gt a lt dimension 1 gt lt dimension 2 gt lt dimension n gt a Boe lt minimum limit gt lt maximum limit gt lt minimum limit gt strictly less than lt maximum limit gt 282 35006144 07 2012 Data Types Defining and Instancing an Array Examples Definition of an array type X ARRAY 1 10 OF BOOL Instancing an array Tab_1l X Tab 2 ARRAY 1 10 OF BOOL The instances Tab_1 and Tab_2 are of the same type and the same dimension the only difference being that during instancing e the Tab_1 type takes the name X e the Tab_2 type must be defined unnamed table NOTE It is beneficial to name the type as any modification that has to be made will only be done so once otherwise there will be as man
352. es Introduction Illustration A data reference allows the user to access the instance of this data either by e immediate value true only for data of type EDT e address settings true only for data of type EDT e name symbol true for all EDT DDT EFB DFB data types as well as for SFC objects Possible data references according to data type dark gray Variables Function blocks Device DDT By value By name By name By name symbol symbol symbol By name symbol lt By addressing 35006144 07 2012 249 General Overview of Data Syntax Rules for Type Instance Names Introduction The syntax of names of types and variables can be written up with or without the extended character set This option can be selected in the Language extensions tab of the Tools gt Project settings menu e With Allow extended character set option selected the application is compliant with the IEC standard e With Allow extended character set option not selected the user has a certain degree of flexibility but the application is not compliant with the IEC standard The extended character set used for names entered into the application concerns e DFB Derived Function Block user function blocks or DDT Derived data type e the internal elements composing a DFB EFB function block data type or a derived data type DDT e the data instances If the Allow extended Checkbox is Selected The n
353. esentation Objects An SFC section provides the following objects for creating a program Properties Steps Macro steps embedded sub step sequences Transitions transition conditions Transition sections Action sections Jumps Links Alternative sequences Parallel sequences Text objects to comment on the logic The SFC editor has a background grid that divides the section into 200 rows and 32 columns The program can be entered using the mouse or the keyboard Input Aids The SFC editor offers the following input aids Toolbars for quick and easy access to the desired objects Automatic step numbering Direct access to actions and transition conditions Syntax and semantics are checked as the program is being written e Incorrect objects are displayed in blue e Unknown words e g undeclared variables or unsuitable data types are marked with a red wavy line e Brief description of errors in the Quickinfo Tooltip Information for variables and for transitions can be displayed in a Quickinfo Tooltip e type name address and comment of a variable expression e type name and comment of transitions Different zoom factors Show hide the allocated actions Tracking of links Optimization of link routes 35006144 07 2012 55 Presentation Step Properties Step properties Step Properties General Actions Comment Step name C initial Step Supervision times and delay time SFCSTEP_T
354. esentation Description Jump NEXT When the status of the left link is 1 a jump is made to a label in the current gt section To generate a conditional jump a jump object is linked to a Boolean FFB output To generate an unconditional jump the jump object is assigned the value 1 for example using the AND function Label LABEL Labels jump targets are indicated as text with a colon at the end This text is limited to 32 characters and must be unique within the entire section The text must conform to general naming conventions Jump labels can only be placed between the first two grid points on the left edge of the section Note Jump labels may not cut through networks i e an assumed line from the jump label to the right edge of the section may not be crossed by any object This is also valid for links Return RETURN objects can not be used in the main program lt RETURN gt e Ina DFB a RETURN object forces the return to the program which called the DFB e The rest of the DFB section containing the RETURN object is not executed e The next sections of the DFB are not executed The program which called the DFB will be executed after return from the DFB If the DFB is called by another DFB the calling DFB will be executed after return e Ina SR a RETURN object forces the return to the program which called the SR e The rest of the SR containing the RETURN object is not executed The program which called the SR will be executed after
355. est Yes Initialization of the application micro cut No qar Setting of bit S0 to 1 ay and setting of bit Setting of bit S0 to 0 SW10 0 to 0 and setting of bit SW10 0 to 1 M Updating of outputs 136 35006144 07 2012 Operating Modes Operation The table below describes the program execution restart phases on cold restart Phase Description 1 The startup is performed in RUN or in STOP depending on the status of the Automatic start in RUN parameter defined in the configuration or if this is in use depending on the state of the RUN STOP input Program execution is resumed at the start of the cycle The system carries out the following Deactivating tasks other than the master task until the end of the first master task cycle Initializing data bits I O image words etc with the initial values defined in the data editor value set to 0 if no other initial value has been defined For MW words the values can be retrieved on cold restart if the two conditions are valid e the Initialize of MW on cold restart option see Unity Pro Operating Modes is unchecked in the processor s configuration screen e the internal flash memory has a valid backup see SW96 see page 193 Note If the number of MW words exceeds the backup size see the memory structure of M340 PLCs see page 117 during the save oper
356. est to update the inputs of the second drop i 2 4 Request to update e the inputs of the third drop i 3 e the outputs of the first drop i 1 5 Request to update e the inputs of the fourth drop i 4 e the outputs of the second drop i 2 6 Request to update e the inputs of the last drop i 5 e the outputs of the third drop i 3 7 Request to update the outputs of the fourth drop i 4 Adjustment of the Drop Hold Up Time Value In order for the remote outputs to be correctly updated and avoid fallback values to be applied the drop hold up time must be set to at least twice the mast task cycle time Therefore the default value 300 ms must be changed if the MAST period is set to the maximum value 255 ms The adjustment of the Drop Hold Up time see Modicon Quantum Hot Standby System User Manual must be done on all configured drops 96 35006144 07 2012 Program Structure 3 4 Multitasking Execution Subject of this Section This section describes how a multitasking application operates What Is in This Section This section contains the following topics Topic Page Multitasking Software Structure 98 Sequencing of Tasks in a Multitasking Structure 100 Task Control 102 Assignment of Input Output Channels to Master Fast and Auxiliary Tasks 105 Management of Event Processing 107 Execution of TIMER type Event Processing 108 Input Output Exchanges in Event Processing 112
357. etermined by IO scanning The bits of words SW160 to SW167 are associated with devices that have been IO scanned The bit is set to 0 if the device has a detected error It is set to 1 if the device is operating correctly SW160 0 device No 1 SW160 1 device No 2 SW167 15 device No 128 Note These system words are only available for Quantum coprocessors and are unavailable for NOE modules 35006144 07 2012 229 System Objects RIO Communications Drop error status the Drop is not operating correctly It is set to 1 if the connection is operating correctly SW172 0 Drop No 1 SW172 1 Drop No 2 SW173 14 Drop No 31 NOTE In a Hot Standby system these are for the Primary CPU Word Function Description Initial Symbol state SW168 to SW171 Operating status of The bits of words SW168 to SW171 are associated VALID GD Global Data with Global Data The bit is set to 0 if the device has a detected error It is set to 1 if the device is operating correctly SW168 0 device No 1 SW168 1 device No 2 SW171 15 device No 64 SW172 to SW173 Standalone and Hot The bits of words SW172 to SW173 are associated ERIO_CONNECT__ Standby Primary with the Ethernet RIO Drop connection status STATUS Detected Ethernet The bit is set to 0 if the connection between the PLC and SW176 to SW177 SDBY_ERIO CONNECT_ STATUS Hot Standby Detected Ethernet RIO Com
358. explicitly In SFC action sections subroutine calls are only allowed when Multitoken Operation is enabled 496 35006144 07 2012 Instruction List IL Labels and Jumps Introduction Label Properties Jump Properties Labels serve as destinations for Jumps Label properties Labels must always be the first element in a line The name must be clear throughout the directory and it is not upper lower case sensitive Labels can be 32 characters long max Labels must conform to the IEC name conventions Labels are separated by a colon from the following instruction Labels are only permitted at the beginning of Expressions otherwise an undefined value can be found in the battery Example start LD A AND B OR C ST D JMP start Jump properties With JMP operation a jump to the label can be restricted or unrestricted JMP can be used with the modifiers c and CN only if the battery content is data type BOOL Jumps can be made within program and DFB sections Jumps are only possible in the current section Possible destinations are the first LD instruction of an EFB DFB call with assignment of input parameters see start2 a normal LD instruction see start1 a CAL instruction which does not work with assignment of input parameters see start3 a JMP instruction see start 4 the end of an instruction list see start5 35006144 07 2012 497 Instruction List IL Exa
359. features listed in the see page 664 the Unity Pro programming environment inherited a number of features from the PL7 programming environment These extensions are optionally provided they can be checked or not in a corresponding options dialog The dialog and the features are described in detail in a chapter of the online help titled Data and Languages see Unity Pro Operating Modes Not included in the options dialog is another extension which is inherited both from the PL7 and the Concept programming environments Unity Pro provides the construct of the so called Section in all programming languages which allows to subdivide a Program Organization Unit POU This construct introduces the possibility to mix several languages e g FBD sections SFC sections in a POU body a feature which if used for this purpose constitutes an extension of the IEC syntax A compliant POU body should contain a single section only Sections do not create a distinct name scope the name scope for all language elements is the POU Purpose of Sections Sections serve different purposes e Sections allow to subdivide large POU bodies according to functional aspects the user has the possibility to subdivide his POU body into functionally meaningful parts The list of sections represents a kind of functional table of contents of a large otherwise unstructured POU body e Sections allow to subdivide large POU bodies according to graphical aspects the user
360. formal parameter is not assigned a value and the function block DFB instance is invoked more than once then the subsequently executed invocations are run with the last effective actual value NOTE Unassigned data structures will always be initialized with value 0 initial values can not be defined Public Variables In addition to inputs and outputs some function blocks also provide public variables These variables transfer static values values that are not influenced by the process to the function block They are used for setting parameters for the function block Public variables are a supplement to IEC 61131 3 The assignment of values to public variables is made using their initial values Public variables are read via the instance name of the function block and the names of the public variables 35006144 07 2012 349 Function Block Language FBD Example D ACT 1 The function block has the public variables AREA _NR D_ACT and OP_CTRL ED ERR DTIMEL ACT DTIMEA TRIGR UNLOCK REACT Instance Name Public Variable AND 1 2 AND FBI_1 0P_CTRL IN1 OUT Var3 Var2 IN2 Private Variables In addition to inputs outputs and public variables some function blocks also provide private variables Like public variables private variables are used to transfer statistical values values that are not influenced by the process to the function block Private va
361. ftware function A function has no internal status information Multiple invocations of the same function using the same input parameters always supply the same output values Details of the graphic form of the function invocation can be found in the Functional block instance In contrast to the invocation of the function blocks function invocations only have a single unnamed output whose name is the same as the function In FBD each invocation is denoted by a unique number via the graphic block this number is automatically generated and can not be altered You position and set up these functions in your program in order to carry out your application You can also develop other functions using the SDKC development kit Is the abbreviation for Elementary Function Block This is a block which is used in a program and which performs a predefined software function EFBs have internal statuses and parameters Even where the inputs are identical the output values may be different For example a counter has an output which indicates that the preselection value has been reached This output is set to 1 when the current value is equal to the preselection value 35006144 07 2012 703 Glossary Elementary Function see EF EN ENO enable error notification Event processing Fast task EN means ENable this is an optional block input If EN 0 the block is not activated its internal program is not execute
362. function block with the VAR_IN_OUT parameter The accumulator now contains a reference to a VAR_IN_OUT parameter AND V2 AND operation on accumulator contents and v2 variable Error The operation cannot be performed since the VAR_IN_OUT parameter accumulator contents cannot be accessed from outside the function block call 516 35006144 07 2012 Instruction List IL Invalid call example 2 LD V1 Loading a V1 variable in the accumulator AND InOutFB inout AND operation on accumulator contents and a reference to a VAR_IN_OUT parameter Error The operation cannot be performed since the VAR_IN_OUT parameter cannot be accessed from outside the function block call The following function block calls are always valid Valid call example 1 CAL InOutFB IN1 V1 inout V2 Calling a function block with the VAR_IN_OUT parameter and assigning the actual parameter within the function block call Valid call example 2 LD V1 Loading a V1 variable in the accumulator ST InOutFB IN1 Assigning the accumulator contents to the IN1 parameter of the IN1 function block CAL InOutFB inout V2 Calling the function block with assignment of the actual parameter v2 to the VAR_IN_OUT parameter 35006144 07 2012 517 Instruction List IL Calling Procedures Procedure Parameter Procedures are provided in the form of libraries The logic of the procedure
363. g until this input returns to 0 Event Processing Synchronization The Phase parameter is used to trigger different TIMER type event processing tasks at constant time intervals This parameter set a temporal offset value with an absolute time origin which is the last passage of the PLC from STOP to RUN Operating condition e The event processing tasks must have the same time base and preset values e The RESET and HOLD inputs must not be set to 1 Example 2 event processing tasks Timer1 and Timer2 to be executed at 70ms interval Timer1 can be defined with a phase equal to 0 and the second Timer2 with a phase of 70ms phase of 7 and time base of 10ms Any event triggered by the timer associated with the Timer1 processing task shall be followed after an interval of 7Oms by an event from the timer associated with the Timer2 processing task 110 35006144 07 2012 Program Structure Timing Diagram STOP RUN Transition Timing diagram of the example provided above with the same preset value of 16 160ms for Timer1 and Timer2 STOP RUNftransition ENABLE Preset VALUE Timerl Preset VALUE Timer2 a a ae i i Event 0 Event cessessesseesseesees Event n 1 Pa oe P 3 les Paar LHA eee 70 eon PoP oy tf e Event 1 Event 2 PEER S Event n y Event 0 Operation after PLC STOP RUN The following table describes the operation of the PLC after a transit
364. gnificant EN and ENO can be used for this type of call 35006144 07 2012 575 Structured Text ST Calling a procedure with formal parameter names Procedure Name Formal Parameters Inputs Formal Parameters Outputs oc ee PROC IN1 var1 IN2 var2 OUT1 gt result1 OUT2 gt result2 ee ow Actual Parameters Inputs Actual Parameters Outputs Calling the same procedure in FBD PROC vari IN1 ouT1 result var2 JIN2 OUT2 result2 With formal calls it is not necessary to assign a value to all formal parameters see also Parameter page 574 PROC IN1 varl OUT1 gt result1 OUT2 gt result2 Calling the same procedure in FBD PROC varl IN1 OUT1 rcsult1 IN2 OUT2 result2 Informal Call With informal calls call without formal parameter names procedures are called using an instruction made from the procedure name followed by a bracketed list of the inputs and outputs actual parameters The order that the actual parameters are enumerated in a procedure call is significant EN and ENO cannot be used for this type of call Calling a procedure without formal parameter names Procedure Name Actual Parameters Inputs PROC varl var2 resultl result2 i Actual Parameter Output 576 35006144 07 2012 Structured Text ST EN and ENO Calling the same procedure in FBD PROC vari
365. gram Structure Description of Subroutines Overview of Subroutines Subroutines are programmed as separate entities either in Ladder language LD Functional block language FBD Instruction List IL Structured Text ST The calls to subroutines are carried out in the sections or from another subroutine The number of nestings is limited to 8 A subroutine cannot call itself non recursive Subroutines are also linked to a task The same subroutine cannot be called from several different tasks Example The following diagram shows a task structured into sections and subroutines _ MAST 4 Sections ca Ee SR Sections Ly Control_1 L Detection Characteristics of a Subroutine The following table describes the characteristics of a subroutine Characteristic Description Name 32 characters maximum accents are possible but spaces are not allowed Language LD FBD IL or ST Task Master fast or auxiliary Comment 512 characters maximum 88 35006144 07 2012 Program Structure 3 3 Mono Task Execution Subject of this Section This section describes how a mono task application operates What Is in This Section This section contains the following topics Topic Page Description of the Master Task Cycle 90 Mono Task Cyclic Execution 92 Periodic Execution 93 Control of Cycle Time 94
366. h approximately represents a maximum duration of 49 days The units of time authorized to represent the value are days D hours H minutes M seconds S milliseconds MS This table shows the possible ways of entering the maximum value of the Time type according the authorized units of time Diagram Comment T 4294967295MS value in milliseconds T 4294967S_295MS value in seconds milliseconds T 71582M_47S_295MS value in minutes seconds milliseconds T 1193H_2M_47S_295MS value in hours minutes seconds milliseconds T 49D_17H_2M_47S_295MS value in days hours minutes seconds milliseconds 262 35006144 07 2012 Data Types 8 2 Elementary Data Types EDT in BCD Format Subject of this section This section describes BCD format Binary Coded Decimal data types These are e Date type e Time of Day type TOD e Date and Time DT type What Is in This Section This section contains the following topics Topic Page Overview of Data Types in BCD Format 264 The Date Type 266 The Time of Day TOD Type 267 The Date and Time DT Type 268 35006144 07 2012 263 Data Types Overview of Data Types in BCD Format Introduction Reminder Concerning BCD Format The data types in BCD format belong to the EDT Elementary data type family which includes single rather than derived data types tables structures function blocks The Binary Coded Decim
367. h called the DFB e The rest of the DFB section containing the RETURN operator is not executed e The next sections of the DFB are not executed The program which called the DFB will be executed after return from the DFB If the DFB is called by another DFB the calling DFB will be executed after return In a SR a RETURN operator forces the return to the program which called the SR e The rest of the SR containing the RETURN operator is not executed The program which called the SR will be executed after return from the SR Processing deferred operations A right bracket starts the processing of the deferred operator The number of right bracket operations must be equal to the number of left bracket modifiers Brackets can be nested Example In the example E is 1 if c and or D is 1 and A and B are 1 LD A AND B AND C OR D ST E 35006144 07 2012 495 Instruction List IL Subroutine Call Call Subroutine A subroutine call consists of the CAL operator followed by the name of the subroutine section followed by an empty parameter list optional Subroutine calls do not return a value The subroutine to be called must be located in the same task as the IL section called Subroutines can also be called from within subroutines e g STA CAL SubroutineName LD B or STA CAL SubroutineName LD B Subroutines are a supplement to IEC 61131 3 and must be enabled
368. has the possibility to design substructures of a large POU body according to an intended graphical presentation He can create small or large graphical sections according to his taste e The subdivision of large POU bodies allows quick online changes in Unity Pro the Section serves as the unit for online change If a POU body is modified during runtime at different locations automatically all sections affected by the changes are downloaded on explicit request 35006144 07 2012 687 IEC Compliance e Sections allow to rearrange the execution order of specific labeled parts of a POU body the section name serves as a label of that part of the body which is contained inside the section and by ordering these labels the execution order of those parts is managable e Sections allow to use different languages in parallel in the same POU this feature is a major extension of the IEC syntax which allows only one single IEC language to be used for a POU body In a compliant body SFC has to be used to manage different languages inside a body each transition and action may be formulated in its own language 688 35006144 07 2012 IEC Compliance B 4 Textual language syntax Textual Language Syntax Description The Unity Pro V1 0 programming environment does not yet provide support for an import or export of text files complying with the full textual language syntax as specified in Annex B of IEC 61131 3 2nd Edition Howev
369. he address of the instance is completed with the rank of the extracted bit lt j gt WORD lt i gt lt j gt Examples MW10 4 Bit No 4 of word MW10 SW8 4 Bit No 4 of system word Sw8s KW100 14 Bit No 14 of constant KW100 QWO 5 1 0 10 Bit No 10 of word 0 of channel 1 of output module 5 of rack 0 It is possible to extract one of the bits of a byte The address of the extracted bit is accessible via e The name of the corresponding byte e The rank defining its position in the byte a number between 0 and 7 Example MyByte is a variable of type BYTE MyByte i is a valid BOOL if 0 lt lt 7 MyByte 0 MyByte 3 and MyByte 7 are valid BOOL MyByte 8 is invalid Creating a Structure type with extracted bit The user can create structure type using extracted bit see Unity Pro Operating Modes The Bit Rank dialog box is accessible by right clicking on the instance or data type which type must be e WORD UINT INT BYTE e e e e an extracted bit with a compatible parent 35006144 07 2012 335 Data References Bit and Word Tables These are a series of adjacent objects bits or words of the same type and of a defined length OBJECT lt i gt L Presentation of bit tables Type Address Write access Discrete I O input bits lx lt i gt L No Discrete I O output bits Qx lt i gt L Yes Internal bits M lt i gt L Yes Presentation of word tables
370. he animation of variables e Section animation All programming languages FBD LD SFC IL and ST can be animated The variables and connections are animated directly in the section ST1 MAST A E TIMER IN NOT pulse t ls Blink timer pulse TLIEL Count every pulse IF pulse 1 THEN feelers a END_IF Animate lights according to counter CASE OF 1 outl TRUE 2 out2 TRUE ELSE All lights are on switch then off again and start from outl FALSE oul FALSE FBD1 MAST 35006144 07 2012 63 Presentation e Tooltips A tooltip with the value of a variable is displayed when the mouse pointer passes over that variable ST1 MAST BA m TIMER IN NOT pulse t ls Blink timer puse IEE Count every pulse IF pulse 1 THEN ooe oA END_IF Animate lights according to counter CASE OF 1 outl TRUE 2 out2 TRUE ELSE All lights are on switch then off again and start from outl FALSE out FALSE e Inspection window An inspection window can be created for any variable This window displays the value of the variable the address and any comments if available This function is available in all programming languages ST1 MAST 1 1 TIMER IN NOT pulse t ls Blink timer pulse Ti fee es Count every pulse IF pulse 1 THEN Co Bagh ast tate END_IF Animate lights according t
371. he data type of the operand must be the same as the data type of the accumulator Example In this example the value of A is loaded into the accumulator the value of B then added and the result saved in E LD A ADD B ST E The old result is used in subsequent calculations depending on whether or not an LD follows an ST Example In this example the value of A is loaded into the accumulator the value of B then added and the result saved in E The value of B is then subtracted from the value of E current accumulator content and the result saved in C LD A ADD B ST E SUB 3 ST C 35006144 07 2012 487 Instruction List IL Set and Reset Operators Set and reset operators of the IL programming language Operator Modifier Meaning Operands Description S Sets the Variable direct s sets the operand to 1 when the current content operand to 1 address of BOOL of the accumulator is a Boolean 1 when the data type Example In this example the value of A is loaded accumulator to the accumulator If the content of the content is 1 accumulator value of A is 1 then OUT is setto 1 LD A S OUT Usually this operator is used together with the reset operator R as a pair Example This example shows a RS flip flop reset dominant that is controlled through the two Boolean variables A and C LD A S OUT LD C R OUT R Sets the Variable direct R sets the operand to 0 when the curr
372. he example is copied to the history bit and the value bit is set to 1 If the left link is 0 the value bit variable c in the example is copied to the history bit but the value bit is not changed This means that whatever value the left link has before the set or reset coil the history bit is always updated In the example a positive edge of the variable c should be recognized and set D for a cycle Code Behavior in LD Corresponds to in ST line 1 Original situation c 0 History bit 0 IF A AND B A B c THEN C 1 ELSE C C s is EJ ENDIE A 1 B 1 c 1 History bit 0 2 E 5 a ee a NOT B R ELSE C C END_IF A 1 B 1 c 1 History 1 3 C D j p P J C 1 History 1 D 0 as the value bit and history bit of c are identical The rising edge of C shown in code line 1 is not recognized by the code in line 2 as this forces the history bit to be updated If the condition is FALSE the present value of C is again assigned to C see ELSE statement in code line 2 in ST example 402 35006144 07 2012 Ladder Diagram LD Execution Sequence and Signal Flow Execution Sequence of Networks The following rules apply to network execution sequences Executing a section is completed network by network based on the object links from above and below Links may not be used to create loops since the sequence of execution in th
373. he logic result on the output the transition variable is done automatically i e the instruction assignment is not allowed The expression is not terminated by a semicolon Example A AND B or A AND WORD _TO BOOL B Properties of Transition Sections Transition sections have the following properties Transition sections only have one single output transition variable whose data type is BOOL The name of these variables are identical to the names of the transition sections The transition variable can only be used once in written form The transition variable can be read in any position within the project Only functions can be used function blocks or procedures cannot Only one coil may be used in LD There is only one network i e all functions used are linked with each other either directly or indirectly Transition sections can only be used once Transition sections belong to the SFC section in which they were defined If the respective SFC section is deleted then all transition sections of this SFC section are also deleted automatically Transition sections can be called exclusively from transitions 35006144 07 2012 439 SFC Sequence Language 13 5 Jump Jump General Jumps are used to indicate directional links that are not represented in their full length Representation of a jump E Properties of Jumps Jumps have the following properties e More than one jump m
374. his bit is not available on Quantum safety PLCs S40 Rack 0 The S40 bit is assigned to rack 0 1 YES YES NO RACKOERR input output Normally set to 1 this bit is set to O when a fault fault occurs on the rack s I Os In this case e the S10 bit is set to 0 the I O processor LED is on e the lr m c Err module bit is set to 1 This bit is reset to 1 when the fault disappears S41 Rack 1 Idem S40 for rack 1 1 YES YES NO RACK1ERR_ input output fault S42 Rack 2 Idem S40 for rack 2 1 YES YES NO RACK2ERR_ input output fault S43 Rack 3 Idem S40 for rack 3 1 YES YES NO RACK3ERR_ input output fault S44 Rack 4 Idem S40 for rack 4 1 YES YES NO RACK4ERR_ input output fault S45 Rack 5 Idem S40 for rack 5 1 YES YES NO RACK5ERR_ input output fault SA6 Rack 6 Idem S40 for rack 6 1 YES YES NO RACK6ERR_ input output fault S4A7 Rack 7 Idem S40 for rack 7 1 YES YES NO RACK7ERR_ input output fault 168 35006144 07 2012 System Objects Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S50 Updating of Normally set to O this bit is set to 1 or 0 by 0 YES YES YES RTCWRITE time and date the program or the terminal via words e setto 0 update of system words SW50 SW50 to to SW53 by the date and time supplied SW53 by the PLC real time clock e set to 1 system words SW50 to SWS53 are no longer updated therefore making it possible
375. i gt data detect edges and manage forcing 35006144 07 2012 319 Data Instances Memory organization MWO MW1 MW2 MW3 MW4 MWS5 MDO MFO MD2 JoOMF2 MD4 TOMF4 MDI TMF 1 MD3 JoOMF3 Not available for Modicon M340 NOTE The modification of MW lt i gt involves the corresponding modifications of MD lt i gt and MF lt i gt K Constants Access syntax Syntax Format Program access rights Word constant KW lt i gt 16 bits INT R Double word constant KD lt i gt 1 32 bits DINT R Real floating point KF lt i gt 1 32 bits REAL R constant Legend 1 Not available for Modicon M340 lt i gt represents the instance number NOTE The memory organization is identical to that of internal variables It should be noted that these variables are not available on Quantum PLCs 320 35006144 07 2012 Data Instances l Constants Access syntax Syntax Format Program access rights Bit constant l lt i gt 3 bits EBOOL R Word constant IW lt i gt 16 bits INT R lt i gt represents the instance number NOTE These data are only available on Quantum and Momentum PLCs S System Variables Access syntax Syntax Format Program access rights Bit S lt i gt or SX lt i gt 1 bit BOOL R W or R Word SW lt i gt 32 bits INT R W or R lt i
376. ibrary Introduction The following tables show the error codes and error values created for the EFBs of the IO Management Library Analog I O Configuration Table of error codes and errors values created for EFBs of the Analog 1 0 Configuration family EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex _FILTER E_EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration _SET E_EFB_USER_ERROR_1 F 30200 16 8A08 The input IN_REG is not connected with the number of an input word IW _SET E_EFB_USER_ERROR_2 F 30201 16 8A07 The input IN_REG is connected with an invalid number of an input word IW _SET E_EFB_USER_ERROR_3 F 30202 16 8A06 MN_RAW MX_RAW _SET E_EFB_USER_ERROR_4 F 30203 16 8A05 Unknown value for MN_PHYS _SET E_EFB_USER_ERROR_5 F 30204 16 8A04 Unknown value for MX_PHYS _SET E_EFB_USER_ERROR_11_ F 30210 16 89FE ST_REG not entered _SET E_EFB_USER_ERROR_12 F 30211 16 89FD ST_REG too large _SET E_EFB_USER_ERROR_13 F 30212 16 89FC ST_CH not entered O_FILTER E_EFB_NOT_CONFIGURED F 30188 16 8A14 EFB configuration does not match hardware configuration O_SET E_EFB_USER_ERROR_1 F 30200 16 8A08 The input OUT_REG is not connected with the number of an
377. ifth bit of the output module in position 4 of rack 0 35006144 07 2012 333 Data References References by Indexed Address Addressing is considered indexed when the address of the instance is completed with an index The index is defined either by e a value belonging to an Integer type e an arithmetical expression made up of Integer types An indexed variable always has a non indexed equivalent S MW lt i gt lt index gt lt gt MW lt j gt The rules for calculating lt j gt are as follows Object lt i gt index Object lt j gt M lt i gt index lt j gt lt i gt lt index gt MW lt i gt index lt j gt lt i gt lt index gt KW lt i gt index lt j gt lt i gt lt index gt MD lt i gt index lt j gt lt i gt lt index gt x 2 KD lt i gt index lt j gt lt i gt lt index gt x 2 MF lt i gt index lt j gt lt i gt lt index gt x 2 KF lt i gt index lt j gt lt i gt lt index gt x 2 Examples MD6 10 lt gt MD26 MW10 My_Var 8 lt gt MW20 with My_Var 2 During compilation of the program a check verifies that e the index is not negative e the index does not exceed the space in the memory allocated to each of these three data types 334 35006144 07 2012 Data References Word Extract Bits Byte Extract Bits It is possible to extract one of the 16 bits of single words AMW SW KW IW QW T
378. ignal of 12 V indicates a logical 0 e a signal of 12 V indicates a logical 1 There is however in the case of any attenuation of the signal detection provided up to the limits 3 V and 3 V Between these two limits the signal will be considered as invalid RS 232 connections are quite sensitive to interference The standard specifies not to exceed a distance of 15 m or a maximum of 9600 bauds bits s Serial connection standard that operates in 10 V 5 V differential It uses two wires for send receive Their 3 states outputs enable them to switch to listen mode when the transmission is terminated Function enabling the startup of the application program of the PLC Function enabling the execution of the PLC application program to be started automatically in the case of a cold start A rung is the equivalent of a sequence in LD other related terms are Ladder network or more generally Network A rung is inscribed between two potential bars of an LD editor and is composed of a group of graphic elements interconnected by means of horizontal or vertical connections The dimensions of a rung are 17 to 256 lines and 11 to 64 columns maximum S Program module belonging to a task which can be written in the language chosen by the programmer FBD LD ST IL or SFC A task can be composed of several sections the order of execution of the sections corresponding to the order in which they are created and being modifiable
379. ing Description TIMER type event processing is any process triggered by the ITCNTRL see Unity Pro System Block Library function This timer function periodically activates event processing every time the preset value is reached Reference The following parameters are selected in the event processing properties Parameter Value Default value Role Time base 1 ms 10ms 100ms 1 sec 10ms Timer time base Note the time base of 1ms should be used with care as there is a risk of overrun if the processing triggering frequency is too high Preset 1 1023 10 Timer preset value The time period obtained equals Preset x Time Base Phase 0 1023 The value of the temporal offset between the STOP RUN transition of the PLC and the first restart of the timer from 0 The temporal value equals Phase x Time Base NOTE The Phase must be lower than Preset in TIMER type Event ITCNTRL Function Representation in FBD ITCNTRL Enable ENABLE STATUS Reset_Timer RESET Hold_Timer J HOLD Nb_Task_Event EVENT VALUE Status_Timer Current_Value 108 35006144 07 2012 Program Structure The following table describes the input parameters Parameter Type Comment Enable BOOL Enable input selected Reset_Timer BOOL At 1 resets the timer Hold Timer BOOL At 1 freezes timer incrementation Nb_ Task Event BYTE
380. ing of bit SW10 0 to 1 Updating of outputs Yes The diagram below describes how a cold restart operates gt Processor stopped Application context saved i Power return Configuration self test Y Initialization of the application Setting of bit S0 to 1 and setting of bit SW10 0 to 0 148 35006144 07 2012 Operating Modes Operation The table below describes the program execution restart phases on cold restart Phase Description 1 The startup is performed in RUN or in STOP depending on the status of the Automatic start in RUN parameter defined in the configuration or if this is in use depending on the state of the RUN STOP input Program execution is resumed at the start of the cycle The system carries out the following the initialization of data bits I O image words etc with the initial values defined in the data editor value set to 0 if no other initial value has been defined For MW words the values can be retained on cold restart if the Reset of MW on cold restart option is unchecked in the Configuration screen of the processor the initialization of elementary function blocks on the basis of initial data the initialization of data declared in the DFBs either to 0 or to the initial value declared in the DFB type the initialization of system bits and words the deactivation of tasks
381. ing the assignment The sequence in which the input formal parameters and output formal parameters are enumerated is not significant EN and ENO can be used for this type of call Calling a function block with formal parameter names Instance Names MY_COUNT Formal Parameters Inputs Formal Parameters Outputs CU varl R reset PV 100 value Q gt out CV gt current Actual Parameters Inputs Actual Parameters Outputs Calling the same function block in FBD MY_COUNT cTU vari CU QF out reset 7R 100 value PV cv current Assigning the value of a function block output is made by entering the actual parameter name followed by the assignment instruction followed by the instance name of the function block and loading the formal parameter of the function block output Separated by a full stop E g MY COUNT CU varl R reset PV 100 value Q MY COUNT out CV MY COUNT current NOTE Type Array DDTs cannot be assigned this way However Type Structure DDTs may be assigned It is not necessary to assign a value to all formal parameters see also Parameter page 566 MY COUNT CU varl R reset Q gt out CV gt current Calling the same function block in FBD vari CU reset R MY_COUNT CTU out PV cv current lt 35006144 07 2012 569 Structured Text ST Informal Call
382. ing the formal parameter Loading and saving function block outputs Instance Name Formal Parameter Output LD MY_COUNT Q ST out LD MY_COUNT CV ST current Actual Parameter Output Informal Form of CAL with a List of Input Parameters With this type of call call without formal parameter names the function block is called using a CAL instruction that follows the instance name of the function block and a bracketed list of actual parameter for the inputs and outputs The order in which the actual parameters are listed in a function block call is significant The list of actual parameters cannot be wrapped EN and ENO cannot be used for this type of call Function block call in the informal form of CAL with a list of input parameters Instance Name Actual Parameter Input CAL MY_COUNT varl reset 100 out current Actual Parameter Output Calling the same function block in FBD MY_COUNT cTU val CU QE out rest 7R 100 PV cv current With informal calls it is not necessary to assign a value to all formal parameters see also Parameter see page 506 35006144 07 2012 511 Instruction List IL This is a supplement to IEC 61131 3 and must be enabled explicitly An empty parameter field is used to omit a parameter Call with empty parameter field CAL MY COUNT varl 100 out current Calling the same function block in FBD MY_COUNT CTU vari C
383. ing was successful e 1 if the diagnostics buffer has not been configured e 2 if the diagnostics buffer is full YES YES YES 35006144 07 2012 193 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW77 Diagnostics Result of the last de registration 0 YES YES YES DLASTDEREG function e O if the non recording was non recording successful e 1 if the diagnostics buffer has not been configured e 21 if the error identifier is invalid 22 if the error has not been recorded SW78 Diagnostics Number of errors currently in the 0 YES YES YES DNBERRBUF function diagnostics buffer number of errors 194 35006144 07 2012 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW80 Message These words are updated by the 0 YES YES YES MSGCNTO management system and can also be reset SW81 using S80 MSGCNT1 For Premium e sSws0 Number of message sent by the system to the terminal port Uni Telway port e Sw8s1 Number of message received by the system to the terminal port Uni Telway port For Modicon M340 e Sws0 Number of message sent by the system to the terminal port Modbus serial port Sw8s1 Number of message received by the system to the terminal port Modbus serial port For Quantum e Sws0 Nu
384. ining 100 SEGMENT type structures DRAW Color INT Anchor COORD Pattern ARRAY 0 15 0 15 OF WORD Contour OUTLINE Access to the data of a DRAW type structure instance Cartoon DRAW Instance of DRAW type structure Cartoon Pattern 15 15 yAccess to last data item in the Pattern table of the Cartoon structure Cartoon Contour 0 Origin X 7Access to data item X of the COORD structure belonging to the first SEGMENT structure of the Contour table 35006144 07 2012 287 Data Types DDT Mapping Rules At a Glance The DDTs are stored in the PLC s memory in the order in which its elements are declared However the following rules apply Principle for Premium and Quantum The storage principle for Premium and Quantum is as follows e the elements are stored in the order in which they are declared in the structure e the basic element is the byte alignment of data on the memory bytes e each element has an alignment rule e the BOOL and BYTE types are indiscriminately aligned on the odd or even bytes e all the other elementary types are aligned on the even bytes e the structures and tables are aligned according to the alignment rule for the BOOL and BYTE types if they only contain BOOL and BYTE elements otherwise they are aligned on the memory s even bytes A WARNING RISK OF INCOMPATIBILITY AFTER CONCEPT CONVERSION With the Concept programming application the data structures do
385. inputs Outputs Outputs If the EN input parameter of an instance is assigned the value 0 FALSE then e the section s that make up the code of the DFB is are not executed this is managed by the system e the ENO output parameter is set to 0 FALSE by the system If the EN input parameter of an instance is assigned the value 1 TRUE then e the section s that make up the code of the DFB is are executed this is managed by the system e the ENO output parameter is set to 1 TRUE by the system 35006144 07 2012 593 Description of DFBs If an error is detected for example a processing error by the DFB instance the user has the option of setting the ENO output parameter to 0 FALSE In this case e either the output parameters are frozen in the state they were in during the previous process until the fault disappears e or the user provides a function in the DFB code whereby the outputs are forced to the required state until the fault disappears VAR_IN_OUT Variable Function blocks are often used to read a variable at an input input variables to process it and to output the updated values of the same variable output variables This special type of input output variable is also called a VAR_IN_OUT variable The following special features are to be noted when using function blocks DFBs with VAR_IN_OUT variables e All VAR_IN_OUT inputs must be assigned a variable e VAR_IN_OUT inputs may not have l
386. inputs outputs Structure without Memory Extension Card The data and program are supported by the internal RAM of the processor module The following diagram describes the memory structure Located data Internal RAM Unlocated data Program Structure with Memory Extension Card The data is supported by the internal RAM of the processor module The program is supported by the extension memory card The following diagram describes the memory structure Internal A RAM Located data Unlocated data External I memory card Program 35006144 07 2012 121 Memory Structure Memory Backup The internal RAM is backed up by a Ni Cad battery supported by the processor module The RAM memory cards are backed up by a Ni Cad battery Specificities of Memory Cards Three types of memory card are offered e application these cards contain the application program The cards offered use either RAM or Flash EPROM technology e application file storage in addition to the program these cards also contain a zone which can be used to backup restore data using the program The cards on offer use either RAM or Flash EPROM technology e file storage these cards can be used to backup restore data using the program These cards use SRAM technology The following diagram describes the memory structure with an application and file storage card Internal RAM A Located data
387. instances can be called multiple times also see Multiple Function Block Instance Call see page 383 Multiple Function Block Instance Call EN and ENO Function block DFB instances can be called more than once other than instances from communication EFBs and function blocks DFBs with an ANY output but no ANY input these can only be called once Calling the same function block DFB instance more than once makes sense for example in the following cases If the function block DFB has no internal value or it is not required for further processing In this case memory is saved by calling the same function block DFB instance more than once since the code for the function block DFB is only loaded once The function block DFB is then handled like a Function If the function block DFB has an internal value and this is supposed to influence various program segments for example the value of a counter should be increased in different parts of the program In this case calling the same function block DFB means that temporary results do not have to be saved for further processing in another part of the program One EN input and one ENO output can be used in all FFBs If the value of EN is equal to 0 when the FFB is invoked the algorithms defined by the FFB are not executed and ENO is set to 0 If the value of EN is equal to 1 when the FFB is invoked the algorithms defined by the FFB will be executed After the algorith
388. int overflow Divide by zero E_FP_STATUS_FAILED_OE_ZE_IE 30163 16 8A2D Illegal floating point operation Overflow Divide by zero E_FP_NOT_COMPARABLE 30166 16 8A2A Internal error 660 35006144 07 2012 IEC Compliance Overview This chapter contains the compliance tables required by IEC 61131 3 What Is in This Chapter This chapter contains the following sections Section Topic Page B 1 General Information regarding IEC 61131 3 662 B 2 IEC Compliance Tables 664 B 3 Extensions of IEC 61131 3 687 B 4 Textual language syntax 689 35006144 07 2012 661 IEC Compliance B 1 General Information regarding IEC 61131 3 General information about IEC 61131 3 Compliance At a Glance The IEC 61131 3 Standard cf its subclause 1 4 specifies the syntax and semantics of a unified suite of programming languages for programmable controllers These consist of two textual languages IL Instruction List and ST Structured Text and two graphical languages LD Ladder Diagram and FBD Function Block Diagram Additionally Sequential Function Chart SFC language elements are defined for structuring the internal organization of programmable controller programs and function blocks Also configuration elements are defined which support the installation of programmable controller programs into programmable controller systems NOTE Unity Pro uses the English acronyms for the progra
389. ion can read or write these words in order to perform duration calculations SD18 is incremented systematically even in STOP mode and equivalent states However times when the PLC is switched off are not taken into account since the function is not linked to the real time scheduler but only to the real time clock For Quantum safety PLC knowing that the 2 processors must process exactly the same data the value of SD18 is updated at the beginning of the mast task and then frozen during the application execution 186 35006144 07 2012 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SD20 SW20 and SW21 MSCOUNTER Absolute time counter For M340 and Quantum PLCs SD20 is incremented every 1 1000th of a second by the system even when the PLC is in STOP SD20 is no longer incremented if the PLC is powered down sSD20 can be read by the user program or by the terminal SD20 is reset on a cold start SD20 is not reset on a warm start For Premium TSX P57 1 4M 2 4M 3e4M C024M 024M and TSX PCI57 204M 354M PLCs SD20 is incremented by 5 every 5 1000th of a second by the system For all the others Premium PLCs SD20 is time counter at 1 ms like Quantum and M340 PLCs For Quantum safety PLC knowing that the 2 processors must process exactly the same data the value of SD18 is updated at the beginni
390. ion from STOP into RUN see timing diagram above Phase Description 1 ON a STOP RUN transition of the PLC timing is triggered so that the preset value is reached at the end of a time period equal to Phase x time base when the first event is sent out The current value VALUE of the timer increases from 0 towards the preset value at a rate of one unit for each pulse of the time base An event is generated when the current value has reached the preset value the timer is reset to 0 and then reactivated The associated event processing is also triggered if the event is not masked If can be deferred if there is an event processing task of higher or identical priority already in progress 35006144 07 2012 111 Program Structure Input Output Exchanges in Event Processing General Operation With each type of event processing it is possible to use other input output channels than those for the event As with tasks exchanges are then performed implicitly by the system before l and after Q application processing The following table describes the exchanges and processing performed Phase Description 1 The occurrence of an event reroutes the application program to perform the processing associated with the input output channel which caused the event All inputs associated with event processing are acquired automatically The event processing is executed It must be as
391. ion is the size of the PLC memory Initial Values The initial values of the parameters and public variables that you defined when creating the DFB type can be modified for each DFB instance Not all DFB parameters have an initial value Modification of the initial values of the elements in the DFB instances EDT except String EDT DDT FB ANY_ARRAY IODDT ANY String type Type structure Inputs Yes No No No No No Input Output No No No No No No No Outputs Yes Yes No Yes No Public variables Yes Yes Yes Yes Private Variables No No No No No Modification of the initial values of the elements in the DFB type EDT except String EDT DDT FB ANY_ARRAY IODDT ANY String type Type structure Inputs Yes No No No No No Input Output No No No No No No No Outputs Yes Yes No Yes No Public variables Yes Yes Yes Yes Private Variables Yes Yes Yes Yes No 602 35006144 07 2012 DFB instance Execution of a DFB Instance Operation A DFB instance is executed as follows Step Action 1 Loading the values in the input and input output parameters On initialization or on cold restart all non assigned inputs take the initial value defined in the DFB type They then keep the last value assigned to them Execution of the internal program of the DFB
392. ions e Jumps are only possible in the current section Example IF varl THEN JMP START START 35006144 07 2012 557 Structured Text ST Comment Description In the ST editor comments always start with the string and end in the string Any comments can be entered between these character strings Comments can be entered in any position in the ST editor except in keywords literals identifiers and variables Nesting comments is not permitted according to IEC 61131 3 If comments are nested nevertheless then they must be enabled explicitly 558 35006144 07 2012 Structured Text ST 15 3 Calling Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures Overview Calling Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures in the ST programming language What Is in This Section This section contains the following topics Topic Page Calling Elementary Functions 560 Call Elementary Function Block and Derived Function Block 566 Procedures 574 35006144 07 2012 559 Structured Text ST Calling Elementary Functions Elementary Functions Elementary functions are provided in the form of libraries The logic of the functions is created in the programming language C and may not be modified in the ST editor Functions have no internal states If the input values are the same the value a
393. ions will be executed if A is less than or equal to B they will not be executed IF A gt B THEN C SIN A COS B B C Aj END _IF Example IF NOT THEN END IF The condition can be inverted using NOT execution of both instructions at 0 IF NOT FLAG THEN C SIN REAL A COS REAL B Bias An END_IF See Also SSE see page 545 ELSIF see page 546 544 35006144 07 2012 Structured Text ST Select Instruction ELSE Description The ELSE instruction always comes afteran IF THEN ELSIF THENOrCASE instruction n If the ELSE instruction comes after an IF or ELSIF instruction the instruction or group of instructions will only be executed if the associated Boolean expressions of the IF and ELSIF instruction are 0 false If the condition of the IF or ELSIF instruction is 1 true the instruction or group of instructions will not be executed If the ELSE instruction comes after CASE the instruction or group of instructions will only be executed if no tag contains the value of the selector If an identification contains the value of the selector the instruction or group of instructions will not be executed NOTE Any number of IF THEN ELSE END_ IF instructions may be nested to generate complex selection instructions Example ELSE IF A gt B THEN C SIN A COS B B C A
394. ique within the section The connector name has the following structure depending on the type of source object for the connection e For functions Function counter formal parameter for the source of the connection 3 4 1 2 AND AND INI OUT 30UT gt HN OUT IN2 gt gt 3OUT IN2 e For function blocks Instance name formal parameter for the source of the connection FBI_2 4 1 2 TON AND IN OUT FBI_200T gt gt INI OUT PT ET gt gt FBI 20UT IN2 35006144 07 2012 357 Function Block Language FBD Text Object Description Text can be positioned as text objects using FBD Function Block language The size of these text objects depends on the length of the text The size of the object depending on the size of the text can be extended vertically and horizontally to fill further grid units Text objects may not overlap with FFBs however they may overlap with links 358 35006144 07 2012 Function Block Language FBD Execution Sequence of the FFBs Introduction The execution sequence is determined by the position of the FFBs within the section executed from left to right and from top to bottom If the FFBs are then linked graphically the execution sequence is determined by the signal flow The execution sequence is indicated by the execution number number in the top right corner of the FFB frame Execution Sequence on Networks F
395. is case cannot be clearly determined Loops must be created using actual parameters see Loop Planning page 405 The execution sequence of networks which are only linked by the left power rail is determined by the graphical sequence from top to bottom in which these are connected to the left power rail This does not apply if the sequence is influenced by control elements Processing on a network is ended completely before the processing begins on another network No element of a network is deemed to be processed until the status of all inputs of this element have been processed Processing on a network is only ended if all outputs on this network have been processed This also applies if the network contains one or more control elements Signal Flow within a Network For signal flow within a network rungs the following rules apply The signal flow for Boolean links is e left to right with horizontal Boolean links and e from top to bottom with vertical Boolean links The signal flow with FFB links is from the FFB output to the FFB input regardless of which direction they are made in An FFB is only processed if all elements FFB outputs etc to which it s inputs are linked are processed The execution sequence of FFBs that are linked with various outputs of the same FFB runs from top to bottom The execution sequence of objects is not influenced by their positions within the network The execution sequence for FFBs is rep
396. is created in the programming language C and may not be modified in the IL editor Procedures like functions have no internal states If the input values are the same the value on the output is the same every time the procedure is executed For example the addition of two values gives the same result every time In contrast to functions procedures do not return a value and support VAR_IN_OUT variables Procedures are a supplement to IEC 61131 3 and must be enabled explicitly Inputs and outputs are required to transfer values to or from procedures These are called formal parameters The current process states are transferred to the formal parameters These are called actual parameters The following can be used as actual parameters for procedure inputs e Variable e Address e Literal The following can be used as actual parameters for procedure outputs e Variable e Address The data type of the actual parameter must match the data type of the formal parameter The only exceptions are generic formal parameters whose data type is determined by the actual parameter When dealing with generic ANY BIT formal parameters actual parameters of the INT or DINT not UINT and UDINT data types can be used This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed AND AnyBitParam IntVarl AnyBitParam2 IntVar2 Not allowed AND WORD WordParaml IntVarl WordParam2 IntVar2 In this
397. is read only ST7 Full This bit is set to 1 by the system when 0 YES YES YES DIAGBUFFF diagnostics the buffer that receives errors from the FULL buffer diagnostics function blocks is full This bit is read only S78 Stop inthe Normally at 0 this bit can be set to 1 by 0 YES YES YES HALTIFERROR event of the user to program a PLC stop on error application fault 5515 S18 20 On Quantum safety PLCs the Halt state is replaced by the Error state when you are in Safe mode Note also that S15 and 20 are not available S79 Modbus This bit change the behavior of the 0 NO NO YES MBFBCTRL forced bit Quantum Modbus server regarding control forced bits e at0 default value standard management bit value is changed even if the bit is forced e if set to 1 by the user write bits request on forced bits do not change their value There is no error in the response of the request As other accesses the history bit is always updated whatever the forcing state 35006144 07 2012 173 System Objects Description of System Bits S80 to S96 Detailed Description Description of system bits S80 to S96 Bit Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium S80 Reset Normally set to 0 this bit can be set to 1 by 0 YES YES YES RSTMSGCNT message _ the user to reset the message counters counters SW80 to SW8E S82 MB PCMC This bit is used to change the request 0 NO YES NO IA po
398. iterals or constants assigned to them e VAR_IN_OUT outputs may not have values assigned to them e VAR_IN_OUT variables cannot be used outside the block call Calling a function block with a VAR_IN_OUT variable in IL CAL MY FBLOCK IN1 V1 IN2 V2 I01 V3 OUT1 gt V4 OUT2 gt V5 Calling the same function block in FBD MY_FBLOCK FBLOCK V1 IN1 OUT1 V4 v2 IN2 OUT2 V5 V3 I01 101 V3 VAR_IN_OUT variables cannot be used outside the function block call The following function block calls are therefore invalid Invalid call example 1 LD V1 Loading a V1 variable in the accumulator CAL InOutFB_ Calling a function block with the VAR_IN_OUT parameter The accumulator now contains a reference to a VAR_IN_OUT parameter AND V2 AND operation on accumulator contents and v2 variable Error The operation cannot be performed since the VAR_IN_OUT parameter accumulator contents cannot be accessed from outside the function block call 594 35006144 07 2012 Description of DFBs Invalid call example 2 LD V1 Loading a V1 variable in the accumulator AND InOutFB inout AND operation on accumulator contents and a reference to a VAR_IN_OUT parameter Error The operation cannot be performed since the VAR_IN_OUT parameter cannot be accessed from outside the function block call The following function block calls are always valid Valid call example 1
399. ition condition a is true then a sequence isruntoS 7 lands 7 2 If steps S_7 1 ands _ 7 2 are activated then the strings run independently of one another If transition condition d is true then a sequence runs to S_7_5 If transition condition b is true and c is false then a sequence runs toS_7_ 3 Since s_7_3 S_7_4 and s_7_5 are linked with a parallel merge no sequence can follow toS_7 6 becauses 7 3 and s_7 4 can never be active at the same time Either S_7_ 3 is activated with transition condition b or S_7_4 with transition condition c never both at the same time Therefore S 7 3 S 7 4 ands 7 5 can never be active at the same time either The string is blocked The same problem occurs if transition condition b is false and c is true when entering the alternative branch 35006144 07 2012 455 SFC Sequence Language Asymmetric Parallel String Selection Introduction According to IEC 61131 3 a parallel branch must always be terminated with a parallel merge The number of parallel branches must not coincide with the number of parallel merges however Greater Amount of Merges String with 1 Parallel Branch and 2 Parallel Merges mE a S_19_2 S_19_3 S_19_4 m b S_19_5 a c If Then If transition condition a is true then a sequence runs to S 19 2 S 19 3andS 19 4 IfstepsS_19 2 S 19 3andSs 19 4 are activated then the
400. ity 1 Priority 0 j Priority G Management of Priorities e EVTO event processing is the highest priority processing It can itself interrupt other types of event processing e EVTi event processing triggered by input output modules priority 1 take priority over TIMERi event processing triggered by timers priority 2 e On Modicon M340 Premium and Atrium PLCs types of event processing with priority level 1 are stored and processed in order e On Quantum PLC the priority of priority 1 processing types is determined e by the position of the input output module in the rack e by the position of the channel in the module The module with the lowest position number has the highest level of priority e Event processing triggered by timer is given priority level 2 The processing priority is determined by the lowest timer number Control The application program can globally validate or inhibit the various types of event processing by using the system bit S38 If one or more events occur while they are inhibited the associated processing is lost Two elementary functions of the language MASKEVT and UNMASKEVT used in the application program can also be used to mask or unmask event processing If one or more events occur while they are masked they are stored by the system and the associated processing is carried out after unmasking 35006144 07 2012 107 Program Structure Execution of TIMER type Event Process
401. ized with the execution of a program element containing the watch point in order to ascertain their values at this precise point of the program WORD The WORD type is coded in 16 bit format and is used to carry out processing on bit strings This table shows the lower upper limits of the bases which can be used Base Lower limit Upper limit Hexadecimal 16 0 16 FFFF Octal 8 0 8 177777 Binary 2 0 2 1111111111111111 Representation examples Data content Representation in one of the bases 0000000011010011 16 D3 1010101010101010 8 125252 0000000011010011 2 11010011 35006144 07 2012 717 Glossary 718 35006144 07 2012 Index Symbols S 158 SSW generic 179 Modicon M340 238 Premium 208 Quantum 221 A ADD IL 490 addressing data instances 379 input output 379 Alignment constraint 288 AND IL 489 ST 537 ANY_ARRAY 302 ARRAY 282 automatic start in RUN 737 BOOL 255 BYTE 279 C CAL 494 CASE OF END_CASE ST 547 channel data structure 291 293 cold start 131 142 comparison IL 486 LD 388 ST 534 compatibility data types 306 D D SFC 432 data instances 311 data types 251 DATE 266 DDT 281 derived data types DDT 281 285 derived function block DFB 581 representation 295 586 Device derived data types DDDT 281 DFB representation 586 diagnostics DFB 625 DINT 260 DIV IL 4
402. j ELSE C A B B C A END_IF See Also IF see page 544 ELSIF see page 546 CASE see page 547 35006144 07 2012 545 Structured Text ST Select Instruction ELSIF THEN Description Example ELSIF The ELSE instruction always comes after an IF THI EN instruction The ELSIF instruction determines that an instruction or group of instructions is only executed if the associated Boolean expression for the IF instruction has the value 0 false and the associated Boolean expression of the ELSIF instruction has the value 1 true If the condition of the IF instruction is 1 true or the condition of the ELSIF instruction is 0 false the command or group of commands will not be executed The THEN instruction identifies the end of the of the instruction s ELSIF condition s and the beginning NOTE Any number of IF THEN IF A gt B THEN C SIN A COS B B SUB C A ELSIF A B THEN C ADD A B B MUL C A END _IF For Example Nested Instructions See Also IF A gt B THEN IF B C THEN THE may be nested to generate complex selection instructions r N ELSIF C SIN A COS B ELSE B SUB C A END_IF ELSIF A B THEN C ADD A B B MUL C A ELSE C DIV A B END _IF IF see page 544 ELSE see page 545 r r THE Nii END_IF instructions
403. j Sections i g process i 9 Unused M m Actions 8 5 5 o Transitions 822 OR_BOOL l AND BOOL INI onf NI OUTI HA Er Proportioning Process IL1 x gt E lt HAAA Generate ImporExport_7 Ready 35006144 07 2012 23 Presentation Legend Number Description Menu bar see Unity Pro Operating Modes Toolbar see Unity Pro Operating Modes Project Browser see Unity Pro Operating Modes Editor window programming language editors data editor etc Register tabs for direct access to the editor window OJA AJOJN Information window see Unity Pro Operating Modes provides information about errors which have occurred signal tracking import functions etc Status bar see Unity Pro Operating Modes 24 35006144 07 2012 Presentation Project Browser Introduction The Project Browser displays all project parameters The view can be shown as structural topological and or functional view Project Browser Te Structural View OES Functional View 3 Station J Proportioning Machine 2 Configuration Proportioning H 6 0 X Bus
404. k is represented graphically as a frame with inputs and outputs The inputs are always represented on the left and the outputs always on the right of the frame Function blocks can have more than one output The name of the function block i e the function block type is displayed in the center of the frame The execution number see page 359 for the function block is shown to the right of the function block type The instance name is displayed above the frame The instance name serves as a unique identification for the function block in a project The EFB instance name is created automatically and has the following structure TYPE_n where e TYPE is the type of the function block e nis the sequential number of the function block type in the project For exmple e First instance of a type EFB type TON is named TON_1 e First instance of a type EFB type MOTOR is named MOTOR_1 e Second instance of a type EFB type TON is named TON_2 This automatically generated name can be modified for clarification The instance name max 32 characters must be unique throughout the project and is not case sensitive The instance name must conform to general naming conventions NOTE To conform to IEC61131 3 only letters are permitted as the first character of the name If you want to use a numeral as your first character however this must be enabled explicitly Elementary Function Block CTU 1 1 CTU CTU Q R PV
405. kens are running parallel to one another i e S 5 2 ands _5 3 are active at the same time Token 1 S_5_3 Token 2 S_5_2 If Then If Then Step s_5_3 is active Step s_5_2 is active If the transition condition c is true then a sequence runs to Sape3 Token If s_5_3 is still active token 1 then token 2 is ended and the string is further processed as Single Token IfS_5 3 is no longer active token 1 then it is reactivated by token 2 and both tokens continue running parallel Multi 466 35006144 07 2012 SFC Sequence Language Terminating a Parallel String with an Alternative Branch variation 2 ee a S51 b S52 If Then If the transition condition a is true then a sequence runstoS 5 lands 5 2 A second token is created by the sequence running on the alternative merge out of the parallel string These two tokens are now running parallel to one another i e s_5_1 ands 5 2 are active at the same time Token 1 S_5_2 Token 2 S_5_ 1 If Then If Then Step S_5 2 is active Step s_5_1 is active If transition condition b is then a sequence runs to true S_5_2 If S_5 2 is still active token 1 then token 2 is ended and the string is further processed as Single Token IfS_5 2 is no longer active token 1 then it is reactivated by token 2 and both tokens continue running para
406. l Function Description Initial state SWEE6 CCOTF_ STATUS Status of an Ethernet I O configuration change Meaning of the bytes of the word SW66 XXYY e Xx The higher byte of the word is associated with the CCOTF status codes 00 to 1F in hex 00 01 02 03 04 05 06 07 08 09 OA OB 0C OD OE OF 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F Idle Request length invalid Request header invalid Request descriptor invalid Request signature invalid Request server invalid FDR server invalid Header request ID invalid Header Drop ID invalid Header device name invalid Descriptor length invalid Descriptor RTE invalid Descriptor offset invalid Signature length invalid Signature data invalid Signature count invalid FDR IP invalid FDR subnet mask invalid FDR gateway invalid EIP CID invalid EIP device number invalid EIP IP invalid EIP vender ID invalid EIP product type invalid EIP product code invalid EIP time out invalid EIP OT RPI invalid EIP TO RPI EIP path invalid Process succeed Process busy Drop does not exist 0 35006144 07 2012 225 System Objects Word Function Description Initial Symbol state SW66 Status of an Continued 0 CCOTF_ Ethernet I O XX The higher byte of the word is associated with the CCOTF status STATUS configuration codes 20 to FF in hex change 20 Drop already exist
407. l bar Note page 681 62 Coil Negated coil SET latch coil RESET unlatch coil Positive transition sensing coil oo AJOJN Negative transition sensing coil Only graphical representation 35006144 07 2012 681 IEC Compliance Implementation dependent parameters Implementation dependent parameters IEC compliance table for implementation dependent parameters Parameters Limitations Behavior Maximum length of identifiers 32 characters Maximum comment length Within the Unity Pro 1024 characters for each editor object Import limited by XML constraints or UDBString usage in the persistent layer Syntax and semantics of pragmas Unity V1 0 only implements 1 pragma used for legacy convertor ConvError error text any other pragma construct is ignored a warning message is given Syntax and semantics for the use of the double quote character when a particular implementation supports Feature 4 but not Feature 2 of Table 5 2 of table 5 is supported Range of values and precision of representation for variables of type TIME DATE TIME OF DAY and DATE AND TIME for TIME t 0ms t 4294967295ms t 49D 17H 2M 47S 295Ms for DATE D 1990 01 01 D 2099 12 31 for TOD TOD 00 00 00 TOD 23 59 59 Precision of representation of seconds in types TIME TIME OF DAY and DATE AND TIME TIME precision 1 ms TIME _O
408. le 6 35006144 07 2012 623 Use of DFBs Elements of the DFB Block The following table lists the different elements of the DFB block labeled in the above illustration Label Element 1 Name of the DFB instance Name of the DFB type Input assigned by an object symbol Input assigned by a value Connected input Input parameters Output parameter INI OJ a AI OJIN Input assigned by an object address Use of EN ENO Parameters See EN and ENO Parameters page 593 624 35006144 07 2012 User Diagnostics DFB 20 Presentation of User Diagnostic DFBs General Advantages The Unity Pro application is used to create your own diagnostic DFBs see Unity Pro Operating Modes These diagnostic DFBs are standard DFBs that you will have configured beforehand with the Diagnostic property and in which you will have used the following two functions e REGDFB see Unity Pro Diagnostics Block Library to save the alarm date e DEREG see Unity Pro Diagnostics Block Library to de register the alarm NOTE It is strongly recommended to only program a diagnostic DFB instance once within the application These DFBs enable you to monitor your process They will automatically report the information you will have chosen in the Viewer You can thus monitor changes in state or variations in your process The main advantages inherent in this service
409. le but only the first 2 are used SW185 module health bits of the S908 station 2 rack 1 SW186 module health bits of the S908 station 2 rack 2 SW 187 is reserved SW 188 is reserved SW 189 is reserved SW335 module health bits of the S908 station 32 rack 1 SW336 module health bits of the S908 station 32 rack 2 SW337 is reserved SW338 is reserved SW339 is reserved Bits 0 to 15 of each of these words are associated with the modules located in positions 16 to 1 of these racks The bit equals 0 if the module is inoperative and equals 1 if the module is operating correctly Example SW185 5 0 the module located in station 2 rack 1 slot 11 is inoperative NOTE Modules 140 XBE 100 00 see Quantum with Unity Pro Hardware Reference Manual require a special management NOTE Extension racks are not used in Safety PLCs only the PLCs main rack system words SW180 SW185 SW190 SW335 are available in Safety PLCs 0 35006144 07 2012 231 System Objects Word Function Description Initial Symbol state SW340 Slot number of Slot number of the processor with the built in Modbus Plus link for MB DIOSLOT the processor connection to the first DIO network The slot number is coded of the second DIO network SW406 operating status of the station 1 modules SW407 operating status of the station 2 modules SW469 operating status of the station 64 modules
410. left link is ON then the respective sub program indicated by xxx is called The subroutine to be called must be located in the same task as the calling LD section Subroutines can also be called from within subroutines Subroutines are a supplement to IEC 61131 3 and must be enabled explicitly In SFC action sections call coils subroutine calls are only allowed when Multitoken Operation is enabled 35006144 07 2012 375 Ladder Diagram LD Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures FFBs Introduction FFB is the generic term for e Elementary Function EF see page 376 e Elementary Function Block EFB see page 377 e Derived Function Block DFB see page 378 e Procedure see page 379 FFBs occupy 1 to 3 columns depending on the length of the formal parameter names and 2 to 33 lines depending on the number of formal parameter rows Elementary Function Functions have no internal states If the input values are the same the value on the output is the same every time the function is called For example the addition of two values always gives the same result An elementary function is represented graphically as a frame with inputs and one output The inputs are always represented on the left and the output is always on the right of the frame The name of the function i e the function type is displayed in the center of the frame The execution number see page
411. lel branches are combined at the end by a parallel joint Jumps into a parallel branch or out of a parallel branch are not possible 35006144 07 2012 449 SFC Sequence Language Alternative String Alternative Strings According to IEC 61131 3 only one switch 1 off n select can be made from the transitions The branch to be run is determined by the result of the transition conditions of the transitions that follow the alternative branch Branch transitions are processed from left to right If a transition condition is satisfied the remaining transitions are no longer processed The branch with the satisfied transition is activated This results in a left to right priority for branches If none of the transitions are switched the step that is currently set remains set Alternative Strings S_5_10 M a b S_5_11 S_512 a ae c d S_5_13 If Then If s_5_10 is active and transition condition a is true then a sequence is runfroms 5 10tos 5 11 independent of b If S_5_10 is active and transition condition b is true and then a sequence is runfroms 5 10toS 5 12 a is false 450 35006144 07 2012 SFC Sequence Language Sequence Jumps and Sequence Loops Sequence Jump A sequence jump is a special type of alternative branch that can be used to skip several steps of a sequence A sequence jump can be made with jumps or with links Sequ
412. libraries The logic of the functions is created in the programming language C and may not be modified in the IL editor Functions have no internal states If the input values are the same the value on the output is the same every time the function is called For example the addition of two values always gives the same result With some elementary functions the number of inputs can be increased Elementary functions only have one return value output Inputs and one output are required to transfer values to or from a function These are called formal parameters The current process states are transferred to the formal parameters These are called actual parameters The following can be used as actual parameters for function inputs e Variable e Address e Literal The following can be used as actual parameters for function outputs e Variable e Address The data type of the actual parameters must match the data type of the formal parameters The only exceptions are generic formal parameters whose data type is determined by the actual parameter When dealing with generic ANY BIT formal parameters actual parameters of the INT or DINT not UINT and UDINT data types can be used This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed D AnyBitParam IntVarl AnyBitParam2 IntVar2 A Not allowed AND WORD WordParaml IntVarl WordParam2 IntVar2 n this case AND_INT must be u
413. line line feed N or n go to the start of the next line new line P or p go to the next page R or r carriage return T or t tabulation Tab represents the character in a string represents the quote character in a string The user can use the syntax nn to display in a STRING variable caracters which must not be printed It can be a carriage return ASCII code 16 0D for instance Examples Entry examples Type Entry Contents of the string e represents the end of string character represents empty bytes STRING ABCD ABCDe 16 characters STRING 4 john johne STRING 10 It s john It s johne STRING 5 s SERER STRING 5 Aii STRING 5 the number the noe STRING 13 0123456789 0123456789 STRING 5 R L lt cr gt lt lf gt e STRING 5 1 00 1 00 35006144 07 2012 275 Data Types STRING Type Variable Declaration A STRING type variable can be declared in two different ways e STRING and e STRING lt Number of elements gt Behavior differs depending on usage Type Variable FFB input parameter EF output parameter FB output declaration parameter STRING Fixed size The size is equal to the actual The size is equal to the actual Fixed size of 16 characters size of the input parameter size of the input parameter 16 characters STRING lt n gt Fixed size
414. llback position e either they are assigned the fallback value or e the current value is maintained depending on the choice made in the configuration After power restoral the outputs remain in the fallback position until they are updated by the task NOTE after a power on while the CPU is not started outputs are in security mode state equal to 0 After the CPU start if the module didn t stay powered on the maintain state is lost and the output stay in state 0 35006144 07 2012 153 Operating Modes Output Changes for Quantum As soon as a power outage is detected e the local outputs are set to zero e the outputs of the remote or distributed extension racks are set in the fallback position After power restoral the outputs remain in the fallback position until they are updated by the task Output Changes for Extension Rack If power outage occurs on rack where CPU is located e Fallback state as soon as CPU loss is detected e Security state during I O configuration e State calculated by CPU after the first run of the task driving this output After power is restored the outputs remain in the fallback position until they are updated by the task 154 35006144 07 2012 Operating Modes Automatic Start in RUN for Premium Quantum Description Automatic start in RUN is a processor configuration option This option forces the PLC to start in RUN after a cold restart see page 147 except after an appli
415. llel Multi Token 35006144 07 2012 467 SFC Sequence Language Using an Alternative Branch in a Parallel String If one single alternative branch is used in a parallel string it may block the string Using an Alternative Branch in a Parallel String Le el a S_7_1 S_7_2 T Le bs el b c d S_7_3 S_7_4 S_7_5 a e If Then If transition condition a is true then a sequence is run to s_7_1 ands 7 2 If steps S_7_1 and s_7_2 are activated then the strings run independently of one another If transition condition d is true then a sequence runs to S_7_5 If transition condition b is true then a sequence runs to S_7_ 3 Since S_7 3 S_7 4 andS_7_5 are linked by a parallel merge the parallel string cannot be departed because S_7_3ands_7 4 can never be active at the same time Either S_7_ 3 is activated with transition condition b or S_7_4 with transition condition c ThereforeS 7 3 S 7 4 ands _7_ 5 cannot be active at the same time either The string is blocked This block can be removed for example by a second timed token that runs via transition c 468 35006144 07 2012 SFC Sequence Language Jump into a Parallel String Description The ability to jump into a parallel string or out of a parallel string can be enabled optionally with multi token A jump into a parallel string does not acti
416. lling exchange mode with MB MBP100 adjust PCMCIA By default value 0 the system sends a request to the card and will poll fora reponse in the next Mast cycle This mode is recommended for small Mast duration When set to 1 the system sends a request to the card and waits for a response This mode is recommended for large Mast duration S90 Refresh Normally set to 0 this bit is set to 1 on 0 NO YES NO COMRF SH common receiving common words from another words network station This bit can be set to 0 by the program or the terminal to check the common words exchange cycle S91 Lock When this bit is set to 1 the asynchronous 0 NO YES NO LCKASYNREQ asynchro communication requests processed in the nous monitoring task are entirely executed request without interruption from the other MAST or FAST tasks thus ensuring the data is read or written consistently Reminder the request server of the monitoring task is addressed via gate 7 X Way S92 Measure Normally set to 0 this bit can be set to 1 by 0 YES YES NO EXCHGTIME ment mode the user to set communication functions to of the com performance measurement mode munication The communication functions time out function parameter see Unity Pro Communication Block Library in the management table then displays the round trip exchange time in milliseconds Note The communication functions are executed with a time base of 100 ms
417. llocation predefined in M100 Var_2 BOOL AT 12 1 0 ERR Instance of EDT family of Boolean type with 1 byte memory allocation predefined in 12 1 0 2RR Var_3 INT AT MW10 Instance of EDT family of integer type with 2 byte memory allocation predefined in MW10 Var_4 DINT AT MW1 Prohibited for Modicon M340 Double type located data instances must have a topological address even MW2 S MW1O0 es Var_5 WORD AT MW10 Instance of EDT family of WORD type with 2 byte memory allocation predefined in MW10 Var_6 ARRAY 1 10 OF INT AT MW50 Instance of EDT family of table type with 20 byte memory allocation predefined from MW50 COORD X INT Y INT Var_7 COORD AT MW20 Instance of DDT family of COORD structure type with 4 byte memory allocation predefined from MW20 Var_8 DINT AT MDO 6 0 11 Instance of EDT family of DINT type with 4 byte memory allocation predefined from the topologic address of the I O object of the application specific module Var_9 REAL AT MFO 6 0 31 Instance of EDT family of REAL type with 4 byte memory allocation predefined from the topologic address of the I O object of the application specific module NOTE Sequential Function Chart SFC data type instances are created the moment they are inserted in the application program with a default name that the user can modify 314 35006144 07 2012 Data Instances Direct Addressing
418. loaded into the accumulator GT 10 10 is compared with the contents of the accumulator STA The result of the comparison is stored in the variable A If B is less than or equal to 10 the value of both variable A and the accumulator content is O FALSE If B is greater than 10 the value of both variable A and the accumulator content is 1 TRUE Section Size The length of an instruction line is limited to 300 characters The length of an IL section is not limited within the programming environment The length of an IL section is only limited by the size of the PLC memory 478 35006144 07 2012 Instruction List IL Syntax Identifiers and Keywords are not case sensitive Spaces and tabs have no influence on the syntax and can be used as and when required Exception Not allowed spaces and tabs keywords literals values identifiers variables and limiter combinations e g for comments Execution Sequence Error Behavior Instructions are executed line by line from top to bottom This sequence can be altered with the use of parentheses If for example A B C and D have the values 1 2 3 and 4 and are calculated as follows LDA ADD B SUB C MUL C ST E the result in E will be 0 In the case of the following calculation LDA ADD B SUB LDC MUL D ST E the result in E will be 9 The following conditions are handled as an error when executing an expression
419. lows forward compatibility between the different versions of Unity Pro There is 2 ways to create a STA file e STA file can be created manually by accessing the File Save Archive menu in the Unity Pro main window e STA file is created automatically every time the project is saved as a STU file if it is in Built state NOTE The STA file created automatically is saved into the same directory and with the same filename as the STU project file except that a Auto suffix is appended to the filename If an existing automatic STA file already exists it is overwritten without any confirmation NOTE If the project is in Built state saving a STU file through a Unity Pro Server creates a STA file as well The following table presents the STA file advantages and drawbacks Advantages Drawbacks e Fast project saving e Can be created only after the project has been generated e Projects can be shared vie e mail or low Opening of the project is long as the project size memory supports file is rebuilt before operation e Capability to connect in Equal Online Mode to the PLC after opening the project on a new version of Unity Pro For additional information see Connection Disconnection see Unity Pro Operating Modes Allow online modifications with the PLC without any prior download into the PLC e Generated STA file is compatible with all Unity Pro versions NOTE In order to load a STA file crea
420. mber of Modbus messages sent by the system as client on all communication ports NOTE Modbus messages sent by the system as Master are not counted in this word e SW81 Number of Modbus messages received by the system as client on all communication port NOTE Modbus messages received as response to the requests sent by the system as Master are not counted in this word 35006144 07 2012 195 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW82 Message These words are updated by the 0 NO YES YES SW83 management system and can also be reset using S80 For Premium Sw82 Number of messages sent by the system to the PCMCIA module e Sw83 Number of messages received by the system from the PCMCIA module For Quantum Sw82 Number of Modbus messages sent or received on serial port 1 SWw83 Number of Modbus messages sent or received on serial port 2 SW84 Premium These words are updated by the 0 YES YES NO MSGCNT4 Telegram system and can also be reset SW85 management using S80 MSGCNT5 Modicon M340 For Premium Message e sSws84 Number of telegrams management sent by the system e sws5 Number of telegrams received by the system For Modicon M340 SW84 Number of messages sent to the USB port SW85 Number of messages received by the USB port
421. me Station FIP Clients connected Name of the client IP address local host 127 000 000 001 sg avail aut schneider 139 158 107 005 oO Reset XY Power Cycle Structure of the Simulator The simulator controller offers the following views Type of simulated PLC Current status of the simulated PLC Name of the loaded project IP address and DNS name of the host PC for the simulator and all connected Client PCs Dialog box for simulating I O events Reset button to reset the simulated PLC simulated cold restart Power Off On button to simulate a warm restart Shortcut menu right mouse button for controlling the Simulator 35006144 07 2012 59 Presentation Export Import Introduction Export Import The export and import functions allow you to use existing data in a new project The XML export import format makes is possible to provide or accept data from external software The following objects can be exported Complete projects including configuration Sections of all programming languages Subroutine sections of all programming languages Derived function blocks DFBs Derived data types DDTs Device derived data types Device DDTs Variable declarations Operator Screen All objects that can be exported can naturally be imported as well There are two types of import e Direct import Imports the object exactly as it was exported e Import with the assistant The assistant allo
422. mming languages Further more features are defined which facilitate communication among programmable controllers and other components of automated systems Unity Pro compliance to IEC 61131 3 The current version of the Unity Pro Programming System supports a compliant subset of the language elements defined in the Standard Compliance in this context means the following e The Standard allows an implementer of an IEC Programming System to choose or to drop specific language features or even complete languages out of the Feature Tables which form an inherent part of the specifications a system claiming compliance to the Standard just has to implement the chosen features according to the specifications given in the Standard e Further on the Standard allows an implementer to use the defined programming language elements in an interactive programming environment Since the Standard explicitely states that the specification of such environments is beyond its scope the implementer has certain degrees of freedom in providing optimized presentation and handling procedures for specific language elements to the benefit of the user e Unity Pro uses these degrees of freedom e g by introducing the notion of Project for the combined handling of the IEC language elements Configuration and Resource It also uses them e g in the mechanisms provided for handling variable declarations or function block instantiations 662 35006144 07 2012 I
423. mode for the master task excludes using auxiliary tasks Measurement of Task Durations The duration of tasks is continually measured This measurement represents the duration between the start and the end of execution of the task This measurement includes the time taken up by tasks of higher priority which may interrupt the execution of the task being measured The following system words see page 189 give the current maximum and minimum cycle times for each task value in ms Measurement of times MAST FAST AUX0O AUX1 AUX2 AUX3 Current SW30 3SW33 SSW36 SSW39 SSW42 SSW45 Maximum SSW31 SSW34 SSW37 SSW40 SSW43 SSW46 Minimum SSW32 SSW35 SSW38 SSW41 SSW44 SSW47 NOTE The maximum and minimum times are taken from the times measured since the last cold restart Task Periods The task periods are defined in the task properties They can be modified by the following system words System words Task Values Default values Observations SSwo MAST 0 255ms Cyclic 0 cyclic operation SSW1 FAST 1 255ms 5ms SSW2 AUX0 10ms 2 55s 100ms The values of the period are SSW3 AUX1 10ms 2 55s 200ms Expressedin MOMS SSwW4 AUX2 10ms 2 55s 300ms SSW5 AUX3 10ms 2 55s 400ms When the cycle time of the task exceeds the period the system sets the system bit S19 of the task to 1 and continues with the following cycle NOTE The values of the period
424. modules MMS are not reported on bits S10 S16 and S119 Failure to follow these instructions can result in injury or equipment damage 164 35006144 07 2012 System Objects Bit Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum S17 CARRY Rotate shift output Normally at 0 During a rotate shift operation this bit takes the state of the outgoing bit 0 YES YES YES S18 OVERFLOW Overflow or arithmetic error Normally set to 0 this bit is set to 1 in the event of a capacity overflow if there is e aresult greater than 32 767 or less than 32 768 in single length e result greater than 65 535 in unsigned integer aresult greater than 2 147 483 647 or less than 2 147 483 648 in double length result greater than 4 294 967 296 in double length or unsigned integer real values outside limits division by 0 the root of a negative number forcing to a non existent step on a drum stacking up of an already full register emptying of an already empty register There is only one case for which bit 3S18 is not raised by the Modicon M340 PLCs when real values are outside limits It is only if denormalized operands or some operations which generate denormalized results are used gradual underflow It must be tested by the user program after each operation where there is a risk of overflow then reset to 0 by the user if the
425. mple start2 startl start3 start4 starts S Li S O O 5 J L O S Hg wA OOQ E H G n OC MEG O E D A T counter CU D B T counter R DC l counter PV L counter PCN start4 A DB Cc D PC start3 A DE P startd L counter 5 D Zo OU H W O ll gt V C P starti D A RB RC T D MPC starti DC RB TA 498 35006144 07 2012 Instruction List IL Comment Description In the IL editor comments always start with the string and end in the string Any comments can be entered between these character strings Nesting comments is not permitted according to IEC 61131 3 If comments are nested nevertheless then they must be enabled explicitly 35006144 07 2012 499 Instruction List IL 14 2 Calling Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures Overview Calling Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures in the IL programming language What Is in This Section This section contains the following topics Topic Page Calling Elementary Functions 501 Calling Elementary Function Blocks and Derived Function Blocks 506 Calling Procedures 518 500 35006144 07 2012 Instruction List IL Calling Elementary Functions Using Functions Parameters Elementary functions are provided in the form of
426. ms have been executed successfully the value of ENO is set to 1 If an error occurs when executing these algorithms ENO is set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if EN equals to 1 Please refer to Maintain output links on disabled EF see Unity Pro Operating Modes 35006144 07 2012 383 Ladder Diagram LD e Function blocks e EN ENO handling with function blocks that only have one link as an output ENO is set to 0 caused by 1 EN 0 or an error during execution parameter FUNCBLOCK 1 FUNCBLOCK 2 EN ENO EN ENO INI OUT INI OUT m IN2 If 1 maintains the old status it had during the last correctly executed cycle EN ENO handling with function blocks that have one variable and one link as f EN of FUNCBLOCK_1 is set to 0 the link on output OUT of FUNCBLOCK_1 output parameters FUNCBLOCK 1 FUNCBLOCK 2 EN ENO EN ENO INI1 OUT OUTI INI OUT IN2 IN2 If EN of FUNCBLOCK_1 is set to 0 the link on output OUT of FUNCBLOCK_1 maintains the old status it had during the last correctly executed cycle The OUT1 variable on the same pin either retains its previous status or can be changed externally without influencing the link The variable and the link are saved independently of ea
427. munications Drop error status The bits of words SW176 to SW177 are associated with Ethernet RIO Drop connection status The bit is set to 0 if the connection is not operating correctly It is set to 1 if the connection is operating correctly SW176 0 Drop No 1 SW176 1 Drop No 2 SW177 14 Drop No 31 NOTE In a Hot Standby system these are for the Standby CPU They are not significant in a Standalone PLC 230 35006144 07 2012 System Objects Description of Quantum System Words SW180 to SW702 Detailed Description Description of system words SW180 to SW702 Word Symbol Function Description Initial state SW180 to SW339 IOHEALTHij i 1 32 j 1 5 Health bits of the PLC modules Including Hot Standby CPUs Words SW180 and SW181 are associated with PLC stations 1 for Standalone and Hot Standby local PLC s main 1 and extension 2 racks SW180 module health bits of the station 1 rack 1 SW181 module health bits of the station 1 rack 2 Words SW182 and SW183 are associated with PLC stations 1 for only the Hot Standby peer PLC s main 1 and extension 2 racks SW182 module health bits of the station 1 rack 1 SW183 module health bits of the station1 rack 2 NOTE SW182 SW183 are not used in a Standalone PLC e SW184 is reserved Words SW185 and SW339 are associated with PLC stations 2 to 32 Each station has 5 words availab
428. n Quantum with Unity Ethernet Network Modules User Manual e SY MAX specific Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual e TCP IP EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual WRITE_REG_ W_WARN_OUT_OF_ RANGE 30110 16 759E Parameter out of range WRITE_REG E_EFB_NOT_STATE RAM_4X 30531 16 88BD Variable not mapped to MW 4x area WRITE_REG E_EFB_MSTR_ERROR 30191 16 8A11 MSTR communication error WRITE_REG 8195 16 2003 Value displayed in status word Comes together with W_WARN_OUT_OF_RANGE WRITE_REG 8206 16 200E Value displayed in status word Comes together with E _EFB_NOT_STATE_RAM_4X 35006144 07 2012 635 EFB Error Codes and Values EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex WRITE_REG F See tables of Modbus Plus and SY MAX EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual SY MAX specific Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual TCP IP EtherNet Error Codes see Modicon Quantum with Unity Ethernet Network Modules User Manual 636 35006144 07 2012 EFB Error Codes and Values Tables of Error Codes for the IO Management L
429. n of HALT instruction e 16 DE87 calculation error on floating point numbers S18 these errors are listed in the word SW17 e 16 DEBO Watchdog overflow S11 e 16 DEFO division by 0 S18 e 16 DEF1 character string transfer error S15 e 16 DEF2 arithmetic error S18 e 16 DEF3 index overflow S20 NOTE The following codes 16 8xF4 16 9xF4 and 16 DEF7 indicate an error on Sequence Function Chart SFC YES YES YES SW126 ERRADDRO SW127 ERRADDR1 Blocking error instruction address Address of the instruction that generated the application blocking error For 16 bit processors TSX P57 1 e 2ee SW126 contains the offset for this address e SW127 contains the segment number for this address For 32 bit processors e SW126 contains the least significant word for this address e SW127 contains the most significant word for this address For a system STOP due a watchdog overflow SW126 contains the number of the MAST task with the overflow SW127 contains the value of the MAST task with the overflow YES YES YES 35006144 07 2012 207 System Objects 6 3 Atrium Premium specific System Words Subject of this Section This section describes the system words SW128 to SW167 for Premium and Atrium PLCs A WARNING UNEXPECTED APPLICATION BEHAVIOR Do not use system objects Si SWi as variable when they are not d
430. n section can be created This is a section containing the logic of the transition condition and it is automatically linked with the transition Name of Transition Section The name of the transition section is always identical to the assigned transition see Transition Name page 436 Programming Languages FBD LD IL and ST are possible as programming languages for transition sections Suggested Networks for Transition Section Language Suggested Network Description FBD OE The suggested network contains an AND block with 2 inputs for which the output is linked with a variable having the name of the J OUL tt transition section iy fee The suggested block can either be linked or it can be deleted if desired LD Tl The suggested network contains a coil which is linked with a variable having the name of the transition section The suggested coil can either be linked or it can be deleted if desired IL The suggested network is empty The content may only be created of Boolean logic The assignment of the logic result on the output the transition variable is done automatically i e the memory assignment ST is not allowed Example LD A AND B 438 35006144 07 2012 SFC Sequence Language Language Suggested Network Description ST The suggested network is empty The content may only be created of Boolean logic in the form of a nested expression The assignment of t
431. n the Diagnostic viewer some information are available if the entry is selected to clarify error type on the bus This information can identify the correct remote bus with the bus number RIO DIO NO NO YES except for safety PLCs S121 DIOERRNOM1 DIO bus fault NAME No 1 Normally set to 1 this bit is set to 0 by the system when a fault occurs on a device connected to the DIO bus managed by the first 140 NAME 2e module This bit is not available on Quantum safety PLCs In the Diagnostic viewer some information are available if the entry is selected to clarify error type on the bus This information can identify the correct remote bus with the bus number RIO DIO NO NO YES except for safety PLCs S122 DIOERRNOM2 DIO bus fault NAME No 2 Normally set to 1 this bit is set to 0 by the system when a fault occurs on a device connected to the DIO bus managed by the second 140 NAME 2 module This bit is not available on Quantum safety PLCs In the Diagnostic viewer some information are available if the entry is selected to clarify error type on the bus This information can identify the correct remote bus with the bus number RIO DIO NO NO YES except for safety PLCs S123 ADJBX Adjust Bus X This bit is used by the system and cannot be used by the user application YES YES NO 178 35006144 07 2012 System O
432. nactive as well If the step becomes inactive before the internal time has elapsed then the action does not become active Note For this qualifier an additional duration of data type TIME must be defined Pulse If the step becomes active the action becomes 1 and this remains for one program cycle independent of whether or not the step remains active 35006144 07 2012 433 SFC Sequence Language Qualifier Meaning Description DS Delayed and If the step becomes active the internal timer is started and the action becomes active saved after the process of the manually defined time duration The action first becomes inactive again when qualifier R is used for a reset in another step If the step becomes inactive before the internal time has elapsed then the action does not become active Note For this qualifier an additional duration of data type TIME must be defined Pl Pulse rising If the step becomes active 0 gt 1 edge the action becomes 1 and this remains for edge one program cycle independent of whether or not the step remains active Note Independent of their position in the action list field actions with the qualifier P1 are always processed first More information can be found in the Action see page 429 of the SFC sequence language PO Pulse falling If the step becomes inactive 1 gt 0 edge the action becomes 1 and this remains for edge one program cycle Note Indepe
433. nction Accuracy of numerical functions INTEL floating point processing or emulation Effects of type conversions between time data types and other data types not defined in Table 30 See online help Maximum number of function block specifications and instantiations Only limited by the maximum size of a section Function block input variable assignment when EN is FALSE No assignment Pymin Pvmax of counters INT base counters Pvmin 32768 0x8000 Pvmax 32767 Ox7FFF UINT base counters Pvmin 0 0x0 Pvmax 65535 OxFFFF DINT base counters Pvmin 2147483648 0x80000000 Pvmax 2147483647 Ox7FFFFFFF UDINT base counters Pvmin 0 0x0 e Pvmax 4294967295 OxFFFFFFFF Effect of a change in the value of a PT input during a timing operation The new PT values are immediatelytaken at once into account even during a running timing operation immediately works with the new values Program size limitations Depends on controller type and memory 35006144 07 2012 683 IEC Compliance Parameters Limitations Behavior Precision of step elapsed time 10 ms Maximum number of steps per SFC 1024 steps per SFC section Maximum number of transitions per SFC and per step Limited by the available area for entering steps transitions and by the maximum number of steps per SFC section 1024 Steps 32 transition per step
434. nction Description Initial Symbol state SW548 to SWE40 Status of The words SW548 to SW640 are used to describe the status MODUNHEALTHi decentralized of the decentralized stations Three status words are used for IOERRCNTi stations each station IORETRYi e SW548 displays the global communication status for 1 2 32 station 2 SW548 15 1 communication operating correctly SW548 14 1 communication on cable A operating correctly SW548 13 1 communication on cable B operating correctly SW548 11 to 8 lost communications counter SW548 7 to 0 retry totalizer counter SW549 is the global error totalizer counter for cable A station 2 e most significant byte counts the errors detected e least significant byte counts non responses SW550 is the global error totalizer counter for cable B station 2 e most significant byte counts the errors detected e least significant byte counts non responses The words SW551 to 553 are assigned to station 3 SW554 to 556 are assigned to station 4 SWE38 to 640 are assigned to station 32 236 35006144 07 2012 System Objects ERIO MOD HEALTH Module Health bit status module health bits SW641 health bits of the modules on rack 1 drop 1 SWE41 e rack 0 in BMX CRA 312 0 drop 1 e rack 1 in 140 CRA 312 00 drop 1 SWE42 rack 1 in BMX CRA 312 0 drop 1 e rack 2 in 140 CRA 312 00 drop 1 NO
435. nction block and the names of the public variables Example FBL1 Ree The function block has the public E variables AREA_NF and OP_CTRL ED ERR jDTIMEL ACT DTIMEA JTRIGR UNLOCK REACT Instance Name Public Variable SE 1 1 S AND FBI_1 0P_CTRL N1 OUT Var3 var2 jIN2 In addition to inputs outputs and public variables some function blocks also provide private variables Like public variables private variables are used to transfer statistical values values that are not influenced by the process to the function block Private variables can not be accessed by user program These type of variables can only be accessed by the animation table NOTE Nested DFBs are declared as private variables of the parent DFB So their variables are also not accessible through programming but trough the animation table Private variables are a supplement to IEC 61131 3 382 35006144 07 2012 Ladder Diagram LD Programming Notes Attention should be paid to the following programming notes FFBs will only be processed when they are directly or indirectly connected to the left bus bar If the FFB will be conditionally executed the EN input may be pre linked through contacts or other FFBs also see EN and ENO see page 383 Boolean inputs and outputs can be inverted Special conditions apply when using VAR_IN_OUT variables see page 386 Function block DFB
436. nd subroutines executed cyclically or periodically for the MAST task or periodically for the FAST task A task possesses a level of priority and is linked to inputs and outputs of the PLC These I O are refreshed in consequence The type TIME expresses a duration in milliseconds Coded in 32 bits this type makes it possible to obtain periods from 0 to 2 to the power of 32 1 milliseconds The units of type TIME are the following the days d the hours h the minutes m the seconds s and the milliseconds ms A literal value of the type TIME is represented by a combination of previous types preceded by T t TIME or time Examples T 25h15m t 14 7S TIME 5d10h23m45s3ms In communication projects The Time out is a delay after which the communication is stopped if there is no answer of the target device see TOD TOD is the abbreviation of Time of Day The TOD type coded in BCD in 32 bit format contains the following information e the hour coded in a 8 bit field e the minutes coded in an 8 bit field e the seconds coded in an 8 bit field NOTE The 8 least significant bits are unused The Time of Day type is entered as follows TOD lt Hour gt lt Minutes gt lt Seconds gt 35006144 07 2012 715 Glossary Token UDINT UINT Unlocated variable This table shows the lower upper limits in each field Field Limits Comment Hour 00 23 The left 0 is always
437. ndent of their position in the action list field actions with the qualifier PO are always processed last More information can be found in the Action see page 429 of the SFC sequence language 434 35006144 07 2012 SFC Sequence Language 13 4 Transitions and Transition Sections Overview This section describes the transition objects and transition sections of the SFC sequence language What Is in This Section This section contains the following topics Topic Page Transition 436 Transition Section 438 35006144 07 2012 435 SFC Sequence Language Transition Introduction A transition provides the condition through which the checks of one or more pre transition steps pass on one or more consecutive steps along the corresponding link Transition Condition Transition Name Every transition is allocated with a transition condition of data type BOOL The following are authorized as transaction conditions e an address input or output e a variable input or output e a Literal or e a Transition Section see page 438 The type of transition condition determines the position of the name Transition Condition Position of the Name e Address Variable Trans_Yariable Literal 1 e Transition Section Trans bes If an address or a variable is used as a transition condition then the transition name is defined with that name e g
438. ne or more Operands see page 481 Should several operands be used they are separated by commas It is possible for a Label see page 497 to be in front of the instruction This label is followed by a colon A Comment see page 499 can follow the instruction Example Label Operators Operands START LD A Key 1 ANDN B and not key 2 ja Ventilator on Modifier se Comments 35006144 07 2012 477 Instruction List IL Structure of the Programming Language IL is a so called accumulator orientated language i e each instruction uses or alters the current content of the accumulator a form of internal cache IEC 61131 refers to this accumulator as the result For this reason an instruction list should always begin with the LD operand Load in accumulator command Example of an addition Command Meaning LD 10 Load the value 10 into the accumulator ADD 25 25 is added to the contents of the accumulator STA The result is stored in the variable A The content of the variable A and the accumulator is now 35 Any further instruction will work with accumulator contents 35 if it does not begin with LD Compare operations likewise always refer to the accumulator The Boolean result of the comparison is stored in the accumulator and therefore becomes the current accumulator content Example of a comparison Command Meaning LD B The value B is
439. nes the type of startup to be performed e if the application context has changed i e loss of system context or new application the PLC initializes the application cold start e if the application context is the same the PLC carries out a restart without initialization of data warm restart Power Outage on a Rack Other than Rack 0 All the channels on this rack are seen as in error by the processor but the other racks are not affected The values of the inputs in error are no longer updated in the application memory and are reset to zero in a discrete input module unless they have been forced in which case they are maintained at the forcing value If the duration of the outage is less than the filtering time it has no effect on the program which continues to run normally 146 35006144 07 2012 Operating Modes Processing on Cold Start for Premium Quantum PLCs Cause of a Cold Start The following table describes the different possible causes of a cold start Causes Startup characteristics Loading of an application Cold start forced in STOP RESET button pressed on processor Cold start forced in STOP or RUN mode as Premium defined in the configuration RESET button pressed on the processor Cold start forced in STOP after a processor or system error Premium Movement of handle or insertion removal of Cold start forced in STOP or RUN mode as a PCMCIA memory card defined in the config
440. ng of the mast task and then frozen during the application execution 0 YES YES YES SW23 Rotary switch value The least significant byte contains the Ethernet processor rotary switch It can be read by the user program or by the terminal YES NO NO SW26 Number of requests processed This system word allows to verifiy on server side the number of requests processed by PLC per second YES NO NO 35006144 07 2012 187 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW27 System SW27 is the last system YES NO NO SW28 overhead overhead time SW29 time SW28 contains the maximum system overhead time SW29 contains the minimum system overhead time The system overhead time depends on the configuration number of I O and on the current cycle requests communication diagnostics System overhead time Mast Cycle Time User code execution time These can be read and written by the user program or by the terminal 188 35006144 07 2012 System Objects Description of System Words SW30 to SW47 Detailed Description Description of system words SW30 to SW35 Word Function Description Initial Modicon Premium Quantum Symbol state M340 SW30 Master task This word indicates the execution YES YE
441. ng as an interface with the application e a processing algorithm that operates input variables and completes the output variables e private and public internal variables operated by the processing algorithm Illustration Function block Algorithm 3o v 0 00 30o v o Internal variables 35006144 07 2012 295 Data Types User Function Block DFB The user function block types Derived Function Blocks are developed by the user using one or more languages according to the number of sections These languages are Ladder language e Structured Text language e Instruction List language e Functional block language FBD A DFB type can have one or more instances where each instance is referenced by a name symbol and possesses DFB data types Elementary Function Block EFB Elementary Function Blocks EFBs are provided by the manufacturer and are programmed in C language The user can create his own EFB for which he will need an optional software tool SDKC An EFB type can have one or more instances where each instance is referenced by a name symbol and possesses EFB type data 296 35006144 07 2012 Data Types Characteristics of Function Block Data Types EFB DFB Type Definition The type of an EFB or DFB function block is defined by e the type name see page 250 defined by the user for the DFBs e an optional comment The authorized char
442. ng workshop Validity Note This documentation is valid from Unity Pro V7 0 Product Related Information A WARNING UNINTENDED EQUIPMENT OPERATION The application of this product requires expertise in the design and programming of control systems Only persons with such expertise should be allowed to program install alter and apply this product Follow all local and national safety codes and standards Failure to follow these instructions can result in death serious injury or equipment damage User Comments We welcome your comments about this document You can reach us by e mail at techcomm schneider electric com 35006144 07 2012 13 14 35006144 07 2012 General Presentation of Unity Pro 35006144 07 2012 General Presentation 16 35006144 07 2012 Presentation Overview This chapter describes the general design and behavior of a project created with Unity Pro What Is in This Chapter This chapter contains the following topics Topic Page Capabilities of Unity Pro 18 User Interface 23 Project Browser 25 User Application and Project File Formats 27 Configurator 33 Data Editor 38 Program Editor 46 Function Block Diagram FBD 49 Ladder Diagram LD Language 51 General Information about SFC Sequence Language 53 Instruction List IL 57 Structured Text ST 58 PLC Simulator 59 Export Import
443. nking Data type conflict in VAR_ACCESS Not applicable A task fails to be scheduled or to meet its execution deadline 4 error is reported during execution Numerical result exceeds range for data type 4 error is reported during execution 35006144 07 2012 685 IEC Compliance Note Error conditions Treatment see Note page 686 Current result and operand not of same data type 2 error is reported during programming Division by zero 4 error is reported during execution Numerical result exceeds range for data type 4 error is reported during execution Invalid data type for operation 4 error is reported during execution Return from function without value assigned Not applicable Iteration fails to terminate 4 error is reported during execution Same identifier used as connector label and element name Not applicable Uninitialized feedback variable 1 error is not reported Identifications for the treatment of error conditions according to IEC 61131 3 subclause 1 5 1 d e 1 error is not reported e 2 error is reported during programming e 3 error is reported during analyzing loading linking e 4 error is reported during execution 686 35006144 07 2012 IEC Compliance B 3 Extensions of IEC 61131 3 Extensions of IEC 61131 3 2nd Edition At a Glance In addition to the standardized IEC
444. nly variables that can be accessed by the application program are public variables To make this possible the following syntax must be used in the program DFB_Name Variable_Name DFB_Name represents the name of the instance of the DFB used maximum of 32 characters Variable_Name represents the name of the public variable maximum of 8 characters Example Control Gain indicates the public variable Gain of the DFB instance called Control 596 35006144 07 2012 Description of DFBs Saving Public Variables Setting the S94 system bit to 1 causes the public variables you have modified to be saved by program or by adjustment in place of the initial values of these variables defined in the DFB instances Replacement is only possible if the backup attribute is correctly set for the variable NOTICE APPLICATION UPLOAD NOT SUCCESSFUL The bit S94 must not be set to 1 during an upload If the bit S94 is set to 1 upload then the upload may be impossible Failure to follow these instructions can result in equipment damage 35006144 07 2012 597 Description of DFBs DFB Code Section General The code section s define s the process the DFB is to carry out as a function of the declared parameters If the IEC option is set a single section may be attached to the DFB Otherwise a DFB may contain several code sections the number of sections being unlimited Programming Languages To
445. not handle any shift in offsets each element is set one after the other in the memory regardless of its type Consequently we recommend that you check everything in particular the consistency of the data when using DDTs located on the State RAM risk of shifts or functions for communication with other devices transfers with a different size from those programmed in Concept Failure to follow these instructions can result in death serious injury or equipment damage Principle for Modicon M340 The storage principle for Modicon M340 PLCs is as follows e elements are stored in the order in which they are declared in the structure e the basic element is the byte e one alignment rule and function of the element e the BOOL and BYTE types are aligned on either even or uneven bytes e the INT WORD and UINT types are aligned on even bytes e the DINT UDINT REAL TIME DATE TOD DT and DWORD are aligned on double words e structures and tables are aligned according to the rules of their elements 288 35006144 07 2012 Data Types Examples 4 WARNING BAD EXCHANGES BETWEEN A MODICON M340 AND A PREMIUM OR QUANTUM Check if the structure of the exchanged data have the same alignments in the two projects Otherwise the data will not be exchanged properly Failure to follow these instructions can result in death serious injury or equipment damage NOTE It is possible that
446. not zero indicates in ms the value of the first FAST 0 TCRFAST cycle time task network cycle time TCRFAST SW150 Number of This word indicates the number of frames sent by the Fipio channel 0 NBFRSENT frames sent manager SW151 Number of This word indicates the number of frames received by the Fipio 0 NBFRREC frames received channel manager SW152 Number of This word indicates the number of messages resent by the Fipio 0 NBRESENTMSG messages resent channel manager 216 35006144 07 2012 System Objects Description of System Word SW153 Detailed Description Description of the Bits Description of system word SW153 Word Function Description Initial Symbol state SW153 List of Fipio Each bit is set to 1 by the system and reset 0 FipioERRO channel to 0 by the user manager faults See the list below bit 0 overrun station fault corresponds to loss of a MAC symbol while receiving this is linked to the receiver reacting too slowly bit 1 message refusal fault indicates that a message with acknowledgment was refused or that it was not acknowledged in the first place receiving MAC bit 2 interrupt variable refusal fault bit 3 underrun station fault corresponds to the station being unable to respect transfer speed on the network bit 4 physical layer fault corresponds to a prolonged transmission absence in the physical layer bit 5 non echo fault co
447. ns 5 SR Sections J AUXO E Sections lo i B SR Sections Ek 4 Events E Timer event E Timero 1 Timer1 E 1O Events fr Evto E pt Evt1 46 35006144 07 2012 Presentation Tasks Unity Pro supports multiple tasks Multitasking The tasks are executed parallel and independently of each other whereby the execution priorities are controlled by the PLC The tasks can be adjusted to meet various requirements and are therefore a powerful instrument for structuring the project A multitask project can be constructed from e A Master task MAST The Master task is executed cyclically or periodically It forms the main section of the program and is executed sequentially e A Fast task FAST The Fast task is executed periodically It has a higher priority than the Master task The Fast task is used for processes that are executed quickly and periodically e One to four AUX task s The AUX tasks are executed periodically They are used for slow processing and have the lowest priority The project can also be constructed with a single task In this case only the Master task is active Event Processing Event processing takes place in event sections Event sections are executed with higher priority than the sections of all other tasks They are suited to processing that requires very short reaction times after an event is triggered The following sec
448. nt the value The range of values is 0 23 _ 1 Bits number of bits format 35006144 07 2012 253 Data Types Data Types in Binary Format List of data types Type Designation Format Default bits value BOOL Boolean 8 0 False EBOOL Boolean with forcing and edge 8 0 False detection INT Integer 16 0 DINT Double integer 32 0 UINT Unsigned integer 16 0 UDINT Unsigned double integer 32 0 TIME Unsigned double integer 32 T 0s 254 35006144 07 2012 Data Types Boolean Types At a Glance There are two types of Boolean These are e BOOL type which contains only the value FALSE 0 or TRUE 1 e EBOOL type which contains the value FALSE 0 or TRUE 1 but also information concerning the management of falling or rising edges and forcing Principle of the BOOL Type This type takes up one memory byte but the value is only stored in one bit The default value for this type is FALSE 0 It is accessible via an address containing the offset of the corresponding byte Address settings Memory Offset In the case of the word extracted bit it is accessible via an address containing the following information e an offset of the corresponding byte e the rank defining its position in the word Address settings Memory Offset Rank 35006144 07 2012 255 Data Types Principle of the
449. nter should be increased in different parts of the program In this case calling the same function block DFB means that temporary results do not have to be saved for further processing in another part of the program EN and ENO With all function blocks DFBs an 1 EN is equal to 0 when the function block DFB is called the ned by the function block DFB are not executed and ENO is set to 0 If the value of 1 algorithms defi EN input and an ENO output can be configured If the value of EN is equal to 1 when the function block DFB is invoked the algorithms which are defined by the function block DFB will be executed After the algorithms have been executed successfully the value of ENO is set to 1 If an error occurs when executing these algorithms 1 ENO is set to 0 If the EN pin is not assigned a value when the FFB is invoked the algorithm defined by the FFB is executed same as if 1 EN equals to 1 If ENO is set to 0 results from EN 0 or an error during execution the outputs of the function block DFB retain the status from the last cycle in which they were correctly executed The output behavior of the function blocks DFBs does not depend on whether the function blocks DFBs are called without EN variables to CAL Y COUNT EN 1 CU varl R ENO or with EN 1 If EN ENO are used the function block call must be formal The a
450. nternal A RAM Located data Unlocated data External memory carg Program Memory Backup The internal RAM is backed up by a Ni Cad battery supported by the processor module The RAM memory cards are backed up by a Ni Cad battery Start up with Application Saved in Backup Memory The following table describes the different results according to the PLC state according to the PLC mem switch see Quantum with Unity Pro Hardware Reference Manual and also indicates if the box Auto RUN is checked or not checked PLC State PLC Mem Auto RUN in Results Switch Appl NONCONF Start or Off Off Cold Start application is loaded from Backup memory to RAM of the PLC The PLC remains in STOP NONCONF Start or Off On Cold Start application is loaded from Backup memory to RAM of the PLC The PLC remains in RUN NONCONF Mem Prt or Stop Not Applicable No application loaded PLC power up in NONCOMF state 1 Start and Stop are valid for the 434 and 534 models only and Off is valid for the 311 only Mem Prt is valid on all models 2 The Automatic RUN in the application refers to the application that is loaded 126 35006144 07 2012 Memory Structure PLC State PLC Mem Auto RUN in Results Switch Appl Configured Start or Off Off Cold Start application is loaded from Backup memory to RAM of the PLC The PLC remains in STOP Configured Start or Off On Cold Start appli
451. o Drive control Block Library description in the Motion Library 652 35006144 07 2012 EFB Error Codes and Values Tables of Error Codes for the Obsolete Library Introduction The following tables show the error codes and error values created for the EFBs of the Obsolete Library CLC Table of error codes and errors values created for EFBs of the CLC family EFB name Error code ENO state Error Error Error description in case of value in value in error Dec Hex DELAY E_ERR_DEN F 30152 16 8A38 Not a valid floating point number INTEGRATOR1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number INTEGRATOR1 E_ERR_IB_MAX_MIN_ FF 30102 16 8A6A YMAX lt YMIN INTEGRATOR1 FP_ERROR F See table Common Floating Point Errors page 660 LAG1 E_ERR_DEN 30152 16 8A38 Not a valid floating point number LAG1 FP_ERROR F See table Common Floating Point Errors page 660 LEAD_LAG1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number LEAD_LAG1 FP_ERROR See table Common Floating Point Errors page 660 LIMV E_ERR_DEN F 30152 16 8A38 Not a valid floating point number LIMV E_ERR_AB1_MAX_MIN F 30101 16 8A6B YMAX lt YMIN LIMV FP_ERROR See table Common Floating Point Errors page 660 PI1 E_ERR_DEN F 30152 16 8A38 Not a valid floating point number PI1 E_ERR_PI_MAX_MIN FF 30103 16 8A69 YMAX lt YMIN Plt FP_ERROR
452. o counter CASE OF 1 outl TRUE 2 out2 TRUE ELSE All lights are on switch then off again and start from outl FALSE out FALSE 64 35006144 07 2012 Presentation e Variables window This window displays all variables used in the current section Variables window Name Value Type Comment PUMp__1 start 1 Bool pump_1 cmd 1 Bool pump_1 speed 100 Int high_anim 0 Bool jack_1_out 1 Bool jack_3_out 0 Bool midle_anim 1 Bool Low_anim 0 Bool hole_anim1 0 Bool End_threadingx O Bool Unblocking x 0 Bool hole_anim2 0 Bool End_drilling x 0 Bool e Animation table The value of all variables in the project can be displayed changed or forced in animation tables Values can be changed individually or simultaneously together Table FBD Editor FBD1 MAST Belk if FEE M Name Value Setvalue Type Comment start 1 Bool El Indexing_blocki SFCSTEP_STAT t Os Time x 1 Bool tminErr 0 Bool tmaxErr 0 Bool text String vari 120 120 Int var2 Int 35006144 07 2012 65 Presentation Watch Point Watch points allow you to view PLC data at the exact moment at which it is created 1 and not only at the end of a cycle Animation tables can be synchronized with the watch point 2 A counter 3 determine
453. ocumented Failure to follow these instructions can result in death serious injury or equipment damage What Is in This Section This section contains the following topics Topic Page Description of System Words SWE0 to SW65 209 Description of System Words SW128 to SW143 213 Description of System Words SW144 to SW146 214 Description of System Words SW147 to SW152 216 Description of System Word SW153 217 Description of System Word SW154 219 Description of Premium Atrium System Words SW155 to SW167 220 208 35006144 07 2012 System Objects Description of System Words SW60 to SW65 Detailed Description Description of system words SWE60 to SW65 on Premium and Atrium Hot e SW60 2 e 0 sets PLC B to OFFLINE mode e 1 sets PLC B to RUN mode SW60 4 OS Version Mismatch e 0 If OS Versions Mismatch with Primary Standby goes to Offline mode e 1 If OS Versions Mismatch with Primary PLC Standby stays in standby mode Firmware OS Mismatch This relate to main processor OS version embedded copro OS version monitored ETY OS version and enables a Hot Standby system to operate with different versions of the OS running on the Primary and Standby Standby Word Function Description Initial Premium Atrium Symbol state SW60 Premium Meaning of the different bits of the word SW60 0 YES NO HSB_CMD Hot SW60 1 Standby e 0 sets P
454. odules When a problem is detected on a communication module used to access a network number x X WAY it is possible to switch to another communication module connected to the same network by entering the network number in the Sw99 word SW99 is reset to 0 by the system 0 NO YES NO SW992 CRA_COMPAT_ HIGH CRA compatibility high status register NOTE This word is used for Premium and Quantum module but has a different function see Modicon Quantum Change Configuration On The Fly User Guide Word used to manage the CCOTF compatibility when a new module is inserted When a module is inserted in the RIO drop the corresponding bit is at 1 and indicates that the module is connected on the drop and CCOTF compatible NO NO YES SW100 CCOTF_COUNT CCOTF counting status register Word is incremented each time a CCOTF modification is performed in a PLC SW100 XXYY where e XxX is incremented each time an I O configuration is done in RUN state in a RIO drop e YY is incremented each time an I O configuration is done in RUN state in local rack NO NO YES 204 35006144 07 2012 System Objects Description of System Words SW108 to SW116 Detailed Description Description of system words SW108 to SW116 exchange in which it is being tested This word is to be reset to O by the user More details on bi
455. of a group of networks O This is an editor that is integrated into Unity Pro which is used to facilitate the operation of an automated process The user regulates and monitors the operation of the installation and in the event of any problems can act quickly and simply 710 35006144 07 2012 Glossary Periodic execution Procedure Protection The master task is executed either cyclically or periodically In periodic mode you determine a specific time period in which the master task must be executed If it is executed under this time a waiting time is generated before the next cycle If it is executed over this time a control system indicates the overrun If the overrun is too high the PLC is stopped Procedures are functions view technically The only difference to elementary functions is that procedures can take up more than one output and they support data type VAR_IN_OUT To the eye procedures are no different than elementary functions Procedures are a supplement to IEC 61131 3 Option preventing the contents of a program element to be read read protected or to write or modify the contents of a program element read write protected The protection is confirmed by a password 35006144 07 2012 711 Glossary REAL Real literals Real type is a coded type in 32 bits The ranges of possible values are illustrated in gray in the following diagram os E 7 E INF 3 4028235e 38 1 1754
456. ogram runtime the values from the process are transferred to the FFB via the actual parameters and then output again after processing Only one object actual parameter of the following types may be linked to FFB inputs e Variable e Address e Literal e ST Expression see page 529 ST expressions on FFB inputs are a supplement to IEC 61131 3 and must be enabled explicitly e Link The following combinations of objects actual parameters can be linked to FFB outputs e one variable e avariable and one or more connections but not for VAR_IN_OUT see page 353 outputs e an address e an address and one or more connections but not for VAR_IN_OUT see page 353 outputs e one or more connections but not for VAR_IN_OUT see page 353 outputs The data type of the object to be linked must be the same as that of the FFB input output If all actual parameters consist of literals a suitable data type is selected for the function block 35006144 07 2012 347 Function Block Language FBD Exception For generic FFB inputs outputs with data type ANY BIT itis possible to link objects of data type INT or DINT not UINT and UDINT This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed AND_1 IntVarl IN1 IntVar2 jIN2 AND OUT IntVar3 Not allowed AND_WORD_1 IntVarl INI1 IntVar2 jIN2 AND_WORD OUT m IntVar3 In this case AND_
457. omplete Description of the Task Sequence The following diagram illustrates the task sequence of multitasking processing with a cyclic master task a fast task with a 20ms period and event processing Event Fast Master System Legend A IPI me IPO IPO HA IPO 20ms 20ms 20ms 20ms l acquisition of inputs P program processing O updating of outputs 100 35006144 07 2012 Program Structure Task Control The execution of fast and event processing tasks can be controlled by the program using the following system bits e S30 is used to control whether or not the MAST master task is active e S31 is used to control whether or not the FAST task is active e S32 to S35 are used to control whether or not the auxiliary tasks AUXO to AUX3 are active e S38 is used to control whether EVTi event processing is active NOTE The elementary functions MASKEVT and UNMASKEVT also allow the global masking and unmasking of events by the program 35006144 07 2012 101 Program Structure Task Control Cyclic and Periodic Operation In multitasking operation the highest priority task shall be used in periodic mode in order to allow enough time for lower priority tasks to be executed For this reason only the task with the lowest priority should be used in cyclic mode Thus choosing cyclic operating
458. on _PHYS E_EFB_NO_WARNING_ F 30189 16 8A13 Module delivers no warning STATUS_AVAILABLE status I_PHYS E_INPUT_VALUE_OUT_ F 30183 16 8A19 Input value is out of range OF_RANGE _PHYS E_EFB_NO_ F 30185 16 8A17 Internal error MEASURING_RANGE _PHYS E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE _PHYS E _EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE I_PHYS E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration _PHYS_WARN E _EFB_NO_WARNING_ F 30189 16 8A13 Module delivers no warning STATUS_AVAILABLE status _PHYS_WARN E_EFB_FILTER_SQRT F 30195 16 8A0D Filter SQRT is not available NOT_AVAIL _PHYS_WARN E_INPUT_VALUE_OUT_ F 30183 16 8A19 Input value is out of range OF_RANGE I_PHYS_WARN E_EFB_NO_ F 30185 16 8A17 Internal error MEASURING_RANGE _PHYS_WARN E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE 638 35006144 07 2012 EFB Error Codes and Values EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex I_PHYS_WARN E _EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE _PHYS_WARN E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration _RAW E EFB_OUT_OF_ F 30192 16 8A10 Internal error EFB has RANGE detected a violation
459. on M340 after an operating mode outputs are in security mode state equal to 0 while the bit is set 4 Note On Quantum inputs outputs distributed via DIO bus are not affected by the word sw9 This word is not available on Quantum safety PLCs 4 CAUTION UNEXPECTED APPLICATION BEHAVIOR Before setting the SW9 value to 1 ensure that the output behavior will remain appropriate On Premium Atrium Module outputs located on the X Bus automatically switch to the configured mode fallback or maintain On the Fipio bus certain devices do not manage fallback mode then only maintain mode is possible On Quantum All outputs as well as the local or remote rack RIO are maintained in the state that preceded the switch to 1 of the SW9 bit corresponding to the task The Distributed Inputs Outputs DIO are not assigned by the system word SW9 Failure to follow these instructions can result in injury or equipment damage 182 35006144 07 2012 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW10 TSKINIT First cycle after cold start If the value of the current task bit is set to 0 this means that the task is performing its first cycle after a cold start SW10 0 assigned to the MAST task SW10 1 assigned to the FAST task SW10 2 to 5 assigned to the AUX 0 3 tasks This
460. on of DFBs Definition of DFB Function Block Internal Data At a Glance There are two types of DFB internal data The parameters Input Output or Input Output Public or Private variables The internal data of the DFB must be defined using symbols this data cannot be addressed as an address Elements to Define for Each Parameter When the function block is created the following must be defined for each parameter Types of Objects Name Name of DFB type max 32 characters This name must be unique in the libraries the authorized characters used depend on the choice made in the Identifiers area of the Language extensions tab in Project Settings see Unity Pro Operating Modes A type of object BOOL INT REAL etc A comment of a maximum of 1024 characters optional Formatting characters carriage return tab etc are not allowed An initial value The read write attribute that defines whether the variable may or may not be written in runtime R read only or R W read write This attribute must only be defined for public variables The backup attribute that defines whether the variable may or may not be saved The types of objects that may be defined for the DFB parameters belong to the following families Elementary data family EDT This family includes the following object types Boolean BOOL EBOOL Integer INT DINT etc Real REAL Character string STRING Bit string BYTE WORD etc etc
461. ool HW Firmware Unity loader Legend available 1 Availability of the blocks depends on the hardware platforms see Unity Pro Standard Block Library 2 Available on all PLC except platforms CPU 651 60 S CPU 671 60 S not available 35006144 07 2012 21 Presentation Naming Convention In the following documentation Unity Pro is used as general term for Unity Pro S Unity Pro M Unity Pro L Unity Pro XL and Unity Pro XLS 22 35006144 07 2012 Presentation User Interface Overview The user interface consists of several configurable windows and toolbars User interface 1 2 3 4 Unity Pro My_Project Debug Window Help HH ee B JN STOP oy dd aA l ai h M w f Project Browser Ta Structural View E 3 Station J Configuration i E 0 0 XBus Rees 2 Cabinet Alam Cycle OK 5 Derived Data Types Jy i s i i Derived FB Types Variables l S 7 i d 3 Variables amp FB instanc Temp selecton PID OK J Communication r Filter s aa count countok valid count EL Tasks fy ee a ee oa Eh MAST I jes E U i Q
462. or EBOOL type static variables with Quantum PLCs 4 CAUTION UNEXPECTED APPLICATION BEHAVIOR ARRAY INDEX Take into account the shift of the index for ARRAY variables that have a not null start index on ANY_ARRAY_x entry the shift equals the start index value Failure to follow these instructions can result in injury or equipment damage 35006144 07 2012 591 Description of DFBs DFB Parameters Illustration This illustration shows some examples of DFB parameters Inputs Control Outputs Deviation Accel Speed Error Enable Inputs Actions Outputs Description of the Parameters This table shows the role of each parameter Parameter Maximum Role number Inputs 32 1 These parameters can be used to transfer the values of the application program to the internal program of the DFB They are accessible in read only by the DFB but are not accessible by the application program Outputs 32 2 These parameters can be used to transfer the values of the DFB to the application program They are accessible for reading by the application program except for ARRAY type parameters Inputs 32 These parameters may be used to transfer data from the Outputs application program to the DFB which can then modify it and return it to the application program These parameters are not accessible by the application program Legend 1 Number of
463. or Premium Quantum PLCs Processing on Warm Restart for Premium Quantum PLCs Automatic Start in RUN for Premium Quantum 005 PLG HALT Mode panera tes ee ence ee ea ek GG SR Keen PLG HALT Mode 2 22 2 aune petites a a Weta s Shia bt She 84 85 87 88 89 90 92 93 94 95 97 98 100 102 105 107 108 112 113 115 116 117 121 123 124 125 128 131 132 133 135 139 142 143 144 145 147 152 155 156 156 35006144 07 2012 Chapter 6 System Objects 0 0 c cece eee eee eee 157 6d System eg ee 158 System Bit Introduction 1 0 0 0 0 cece eee 159 Description of System Bits SO to S7 1 2 eee 160 Description of System Bits S9 to S13 20 00 cee 162 Description of System Bits S15 to S21 2 0 164 Description of System Bits S30 to S59 0 ee eee 167 Description of System Bits S65 to S79 1 eee 170 Description of System Bits S80 to S96 1 eee eee 174 Description of System Bits S100 to S123 000 e eee 177 6 2 System Words ys eee ek einen be Sew Ri ATES ae ed 179 Description of System Words SWO to SW11 2 ee eee 180 Description of System Words SW12 to SW29 2 eee eee 184 Description of System Words SW30 to SW47 2 0 ee eee 189 Description of System Words SW48 to SW59 0 0 eee 191 Description of System Words SW70 to SW100 0 00 193 Description of System Words
464. or network execution sequences the following rules apply Executing a section is completed network by network based on the FFB links from above and below Links may not be used to create loops since the sequence of execution in this case cannot be clearly determined Loops must be created using actual parameters see Loop Planning page 367 The execution sequence for networks that are not linked is determined by the graphic sequence from top right to bottom left This execution sequence can be influenced see Change Execution Sequence page 362 Processing on a network is ended completely before the processing begins on another network for which outputs are used on the previous network No element of a network is deemed to be processed as long as the status of all inputs of this element are not calculated Processing on a network is only ended if all outputs on this network have been processed Signal Flow within a Network For execution sequences within a network the following rules apply An FFB is only processed if all elements FFB outputs etc with which its inputs are linked are processed The execution sequence of FFBs that are linked with various outputs of the same FFB runs from top to bottom The execution sequence of FFBs is not influenced by the location within the network This does not apply if more than one FFB is linked to the same output of the calling FFB In this case the execution sequence is determined by
465. ory in a data or program zone depending on the type of information e Configuration other data relating to the configuration hardware configuration software configuration e System data used by the operating system task stack etc e Diagnostics information relating to process or system diagnostics diagnostics buffer 35006144 07 2012 129 Memory Structure 130 35006144 07 2012 Operating Modes Subject of this Chapter The chapter describes the operating modes of the PLC in the event of power outage and restoral the impacts on the application program and the updating of inputs outputs What Is in This Chapter This chapter contains the following sections Section Topic Page 5 1 Modicon M340 PLCs Operating Modes 132 5 2 Premium Quantum PLCs Operating Modes 144 5 3 PLC HALT Mode 156 35006144 07 2012 131 Operating Modes 5 1 Modicon M340 PLCs Operating Modes Subject of this Section This section describes the operating modes of the Modicon M340 PLCs What Is in This Section This section contains the following topics Topic Page Processing of Power Outage and Restoral of Modicon M340 PLCs 133 Processing on Cold Start for Modicon M340 PLCs 135 Processing on Warm Restart for Modicon M340 PLCs 139 Automatic Start in RUN for Modicon M340 PLCs 142 Processing of State RAM on STOP Mode for Modicon M340 PLCs 143 132 35006144 0
466. ossary DWORD DWORD is the abbreviation of Double Word The DWORD type is coded in 32 bit format This table shows the lower upper limits of the bases which can be used Base Lower limit Upper limit Hexadecimal 16 0 16 FFFFFFFF Octal 8 0 8 37777777777 Binary 2 0 2 11111111111111111111111111111111 Representation examples Data content Representation in one of the bases 00000000000010101101110011011110 16 ADCDE 000000000000000 10000000000000000 8 200000 00000000000010101011110011011110 2 10101011110011011110 EBOOL a value 0 FALSE or 1 TRUI capabilities EBOOL is the abbreviation of Extended Boolean type A EBOOL type variable brings E but also rising or falling edges and forcing An EBOOL type variable takes up one byte of memory The byte split up into e one bit for the value e one bit for the history bit each time the state s object changes the value is copied inside the history bit e one bit for the forcing bit equals to 0 if the object isn t forced equal to 1 if the bit is forced The default type value of each bit is O FALSE a 702 35006144 07 2012 Glossary EDT EF EFB EDT is the abbreviation of Elementary Data Type These types are as follows BOOL EBOOL WORD DWORD Is the abbreviation of Elementary Function This is a block which is used in a program and which performs a predefined so
467. ot a valid floating point number SCALING E ERR _NULL_INPUT_S F 30121 16 8A57 Null input scale max and min limit CALE must be different SCALING FP_ERROR F See table Common Floating Point Errors page 660 SCALING Status word values T F For details about the SCALING status word refer to the SCALING description see Unity Pro Control Block Library TOTALIZER W_WARN_OUT_OF_ T 30110 16 759E Parameter out of range RANGE TOTALIZER FP_ERROR F See table Common Floating Point Errors page 660 TOTALIZER W_WARN_TOTALIZER_ T 30113 16 75A1 Maximum value of cter has been CTER_MAX reached TOTALIZER Status word values T F For details about the TOTALIZER status word refer to the TOTALIZER description see Unity Pro Control Block Library VEL_LIM E_ERR_DEN 30152 16 8A38 Not a valid floating point number VEL_LIM E_ERR_AB1_MAX_MIN F 30101 16 8A6B YMAX lt YMIN VEL_LIM FP_ERROR See table Common Floating Point Errors page 660 35006144 07 2012 645 EFB Error Codes and Values Controller Table of error codes and errors values created for EFBs of the Controller family EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex AUTOTUNE W_WARN_OUT_OF_ T 30110 Parameter out of range RANGE 16 759E AUTOTUNE E_ERR_NULL_INPUT F 30121 16 8A57 Null input scale max and min limit SCALE
468. ou a better overview Step names maximum 32 characters must be unique over the entire project i e no other step variable or section etc may exist with the same name There are no case distinctions The step name must correspond with the standardized name conventions 35006144 07 2012 421 SFC Sequence Language Step Times Each step can be assigned a minimum supervision time a maximum supervision time and a delay time e Minimum Supervision Time The minimum supervision time sets the minimum time for which the step should normally be active If the step becomes inactive before this time has elapsed an error message is generated In animation mode the error is additionally identified by a colored outline yellow around the step object If no minimum supervision time or a minimum supervision time of 0 is entered step supervision is not carried out The error status remains the same until the step becomes active again e Maximum Supervision Time The maximum supervision time specifies the maximum time in which the step should normally be active If the step is still active after this time has elapsed an error message is generated In animation mode the error is additionally identified by a colored outline pink around the step object If no maximum supervision time or a maximum supervision time of 0 is entered step supervision is not carried out The error status remains the same until the step becomes inactive e Del
469. out the Structured Text ST Overview This section contains a general overview of the structured text ST What Is in This Section This section contains the following topics Topic Page General Information about Structured Text ST 529 Operands 532 Operators 534 528 35006144 07 2012 Structured Text ST General Information about Structured Text ST Introduction With the programming language of structured text ST it is possible for example to call up function blocks perform functions and assignments conditionally perform instructions and repeat tasks Expression The ST programming language works with Expressions Expressions are constructions consisting of operators and operands that return a value when executed Operator Operators are symbols representing the operations to be executed Operand Operators are used for operands Operands are variables literals FFB inputs outputs etc Instructions Instructions are used to assign the values returned from the expressions to actual parameters and to structure and control the expressions Representation of an ST Section Representation of an ST section Operator Operand Instruction fi D B B 4 A C IF D lt 0 0 THEN NROOTS 0 ELSIF D 0 0 THEN NROOTS 1 XI B 2 0 A Instruction ELSE NROOTS 2 X1 B SQRT D 2 0 A X2 B SQRT D 2 0 A E
470. output word MW O_SET E_EFB_USER_ERROR_2 F 30201 16 8A07 The input OUT_REG is connected with an invalid number of an output word MW O_SET E_EFB_USER_ERROR_3 F 30202 16 8A06 MN_RAW MX_RAW O_SET E_EFB_USER_ERROR_4 F 30203 16 8A05 Unknown value for MN_PHYS O_SET E_EFB_USER_ERROR_5 F 30204 16 8A04 Unknown value for MX_PHYS O_SET E_EFB_USER_ERROR_11 F 30210 16 89FE ST_REG not entered O_SET E_EFB_USER_ERROR_12 F 30211 16 89FD ST_REG too large O_SET E_EFB_USER_ERROR_13 F 30212 16 89FC ST_CH not entered 35006144 07 2012 637 EFB Error Codes and Values Analog I O Scaling Table of error codes and errors values created for EFBs of the Analog 1 0 Scaling family EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex _NORM E _EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE _NORM E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configuration INORM_WARN E_EFB_NO_WARNING_ F 30189 16 8A13 Module delivers no warning STATUS_AVAILABLE status INORM_WARN E_EFB_POS_OVER F 30186 16 8A16 Positive overflow RANGE INORM_WARN E_EFB_NEG_OVER F 30187 16 8A15 Negative overflow RANGE I_LNORM_WARN_ E_EFB_NOT_ F 30188 16 8A14 EFB configuration does not CONFIGURED match hardware configurati
471. outputs etc Instructions are used to structure and control the expressions Input Aids The ST editor offers the following input aids e Syntax and semantics are checked as the program is being written e Keywords and comments are displayed in color e Unknown words e g undeclared variables or unsuitable data types are marked with a red wavy line e Brief description of errors in the Quickinfo Tooltip Tabular display of the functions and function blocks Input assistance for functions and function blocks Operands can be entered and displayed as symbols or topological addresses Display of inspection windows 58 35006144 07 2012 Presentation PLC Simulator Introduction Representation The PLC simulator enables error searches to be carried out in the project without being connected to a real PLC All project tasks Mast Fast AUX and Event that run on a real PLC are also available in the Simulator The difference from a real PLC is the lack of I O modules and communication networks such as e g ETHWAY Fipio and Modbus Plus non deterministic realtime behavior Naturally all debugging functions animation functions breakpoints forcing variables etc are available with the PLC simulator Representation of a dialog box PLC Simulator Control z Simulation Premium outa Host PC name sg6157 aut schneider CH2 CHO RUN ERR Host IP address 139 158 106 116 CH3 CH1 TER I O Project na
472. owing families e Elementary Data Types EDT e Derived Data Types DDT Rules A conventional data type is compatible with the genetic data types related to it hierarchically A generic data type is compatible with the generic data types related to it hierarchically 308 35006144 07 2012 Data Types Example The INT type is compatible with the ANY_INT or ANY NUM or ANY_MAGNITUDE types The INT type is not compatible with the ANY_BIT or ANY_REAL types The ANY_INT generic type is compatible with the ANY_NUM type The ANY_INT generic type is not compatible with the ANY REAL type 35006144 07 2012 309 Data Types 310 35006144 07 2012 Data Instances What s in this Chapter This chapter describes data instances and their characteristics These instances can be e unlocated data instances e located data instances e direct addressing data instances What Is in This Chapter This chapter contains the following topics Topic Page Data Type Instances 312 Data Instance Attributes 316 Direct Addressing Data Instances 319 35006144 07 2012 311 Data Instances Data Type Instances Introduction What is a data type instance see page 247 A data type instance is referenced either by e a name symbol in which case we say the data is unlocated because its memory allocation is not defined but is carried out automatically by the system
473. pe MW lt i gt SKW lt i gt Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD 1D SMF lt i gt SKF lt i gt SOF IF by using their topological address for example 3MD0 6 0 11 3MFO 6 0 31 For Modicon M340 PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt are not available According to the IEC standard M indicates a memory bit type language object 692 35006144 07 2012 Glossary MD MF MW Q According to the IEC standard smw indicates a memory double word type language object For Premium Atrium PLCs double type instances of located data SMD lt i gt sKD lt i gt or floating SMF lt i gt SKF lt i gt should be located by an integer type SMW lt i gt SKW lt i gt Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt SKF lt i gt SQF IF by using their topological address for example 3MD0 6 0 11 3MFO 6 0 31 For Modicon M340 PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt are not available According to the IEC standard mw indicates a memory real type language object For Premium Atrium PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt should be located by an integer type SMW lt i gt KW lt i gt
474. ple In this example e cis1ifAis 7 andBis2 e cis1ifAis 7 andB is 2 cis 1ifAis 7 and Bis 2 e Cis 1 if A is 7 and B is 2 LD A MOD B ST C 35006144 07 2012 491 Instruction List IL Comparison Operators IL programming language comparison operators Operator Modifier Meaning Operands Description GT Comparison gt Literal variable The GT operator compares the contents of the direct address of accumulator with the contents of the operand If data type BOOL the contents of the accumulator are greater than BYTE WORD DWORD the contents of the operands the result is a STRING INT DINT Boolean 1 If the contents of the accumulator are UINT UDINT REAL less than equal to contents of the operands the TIME DATE DT Oor result is a Boolean 0 TOD Example In the example the value of Dis 1 if Ais greater than 10 otherwise the value of D is 0 LD A GT 10 ST D GE Comparison Literal variable The GE operator compares the contents of the gt direct address of accumulator with the contents of the operand If data type BOOL the contents of the accumulator are greater BYTE WORD DWORD than equal to the contents of the operands the STRING INT DINT result is a Boolean 1 If the contents of the UINT UDINT REAL accumulator are less than the contents of the TIME DATE DT or operands the result is a Boolean 0 TOD Example In the example the value of Dis 1 if Ais greater
475. processor version of the PLC processor patch patch It is coded onto the least significant version byte of the word Coding 0 no patch 1 A 2 B Example 16 0003 corresponds to patch C SW16 Firmware This word contains the Firmware YES YES YES OSINTVERS version version number in hexadecimal of number the PLC processor firmware Example 16 0011 version 2 1 VN 17 35006144 07 2012 185 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW17 Error status When an error in a floating 0 YES YES YES FLOATSTAT on floating arithmetic operation is detected bit Only on operation S18 is set to 1 and SW17 error safety status is updated according to the PLCs following coding SW17 0 Invalid operation result is not a number SW17 1 Denormalized operand result is acceptable flag not managed by Modicon M340 or Quantum Safety PLCs SW17 2 Division by 0 result is infinity SW17 3 Overflow result is infinity SW17 4 Underflow result is 0 SW17 5 to 15 not used This word is reset to 0 by the system on cold start and also by the program for re usage purposes SD18 Absolute SW18 represents the least 0 YES YES YES SW18 and time counter significant bytes and Sw19 the SW19 most significant bytes of the double 100MSCOUNTER word 3SD18 which is incremented by the system every 1 10 of a second The applicat
476. quence string i e e the qualifier assigned to the called action section does not affect the subroutine e the subroutine also remains active when the called step is deactivated No diagnosis functions diagnosis function blocks or diagnosis procedures may be used in action sections Action sections can have any amount of networks Action sections belong to the SFC section in which they were defined and can be assigned any number of actions within this SFC section including all of their macro sections Action sections which are assigned an qualifier with duration can only be activated one time Action sections belong to the SFC section that they were defined in If the respective SFC section is deleted then all action sections of this SFC section are also deleted automatically Action sections can be called exclusively from actions 35006144 07 2012 431 SFC Sequence Language Qualifier Introduction Each action that is linked to a step must have a qualifier which defines the control for that action Available Qualifiers The following qualifiers are available Qualifier Meaning Description N None Not Stored If the step is active then action is 1 and if the step is inactive the action is 0 R Overriding The action which is set in another step with the qualifier S is reset The activation of reset any action can also be prevented Note Qualifiers are automatically declared as unbuffered Thi
477. r screen Diagnostic viewer System diagnostics Project diagnostics 2 Application converter PL7 converter PL7 converter Concept Converter PL7 converter Concept Converter PL7 converter Concept Converter Managing multi stations Supported plat forms Modicon M340 BMX P34 1000 BMX P34 20 BMX P34 1000 BMX P34 20 BMX P34 1000 BMX P34 20 BMX P34 1000 BMX P34 20 BMX P34 1000 BMX P34 20 20 35006144 07 2012 Presentation Unity Pro S Unity Pro M Unity Pro L Unity Pro XL Unity Pro XLS Premium P57 0244M All CPUs except All CPUs All CPUs P57 CA 0244M P57 554M P57 CD 0244M P57 5634M P57 104M P57 154M P57 1634M P57 204M P57 254M P57 2634M H57 24M Quantum 140 CPU 311 10 CPU 311 10 CPU 311 10 140 CPU 434 12 U A CPU 434 12 U A CPU 434 12 U A 140 CPU 534 14 U A CPU 534 14 U A CPU 534 14 U A Upgrade using Unity OS CPU 651 50 CPU 651 50 CPU 651 60 CPU 651 60 CPU 652 60 CPU 652 60 CPU 670 60 CPU 670 60 CPU 671 60 CPU 671 60 CPU 672 60 CPU 672 60 CPU 672 61 CPU 672 61 CPU 651 60 S CPU 671 60 S Atrium PCI 57 204 All CPUs All CPUs All CPUs Simulator Openess Hyperlinks Unity Pro Server for OFS UAG Software components contained in the software package Documenta tion as context help and PDF OS Loadert
478. r SFC section Multi Token A maximum of 20 actions can be assigned to each SFC step The nesting depth of macros i e macro steps within macro steps is to 8 levels For a description of the extent to which the SFC programming language conforms to IEC see IEC Conformity see page 667 418 35006144 07 2012 SFC Sequence Language Link Rules Link Rules The table indicates which object outputs can be linked with which object inputs From object output of To object input of Step Transition Alternative Branch Parallel joint Transition Step Jump Parallel Branch Alternative joint Alternative Branch Transition Alternative joint Step Jump Parallel Branch Alternative joint Parallel Branch Step Jump Alternative joint only with Multi Token see page 459 Parallel joint Transition Alternative branch only with Multitoken see page 459 Alternative joint 35006144 07 2012 419 SFC Sequence Language 13 2 Steps and Macro Steps Overview This section describes the step and macro step objects of the SFC sequence language What Is in This Section This section contains the following topics Topic Page Step 421 Macro Steps and Macro Sections 424 420 35006144 07 2012 SFC Sequence Language
479. r a cold restart see page 135 except after an application has been loaded onto the PLC For Modicon M340 this option is not taken into account when the power supply RESET button is pressed after a processor error except in the case of a watchdog error A WARNING UNEXPECTED SYSTEM BEHAVIOR UNEXPECTED PROCESS START The following actions will trigger automatic start in RUN e Restoring the application from memory card e Unintentional or careless use of the reset button To avoid an unwanted restart when in RUN mode use e The RUN STOP input on Modicon M340 Failure to follow these instructions can result in death serious injury or equipment damage 142 35006144 07 2012 Operating Modes Processing of State RAM on STOP Mode for Modicon M340 PLCs General With Unity Pro 6 1 or later and Modicon M340 firmware 2 4 or later you can access the modules either via topological or State RAM addresses Please also refer to Memory Tab see Unity Pro Operating Modes NOTE The State RAM is refreshed in PLC RUN mode only The State RAM is not refreshed in PLC STOP mode 35006144 07 2012 143 Operating Modes 5 2 Premium Quantum PLCs Operating Modes Subject of this Section This section describes the operating modes of the Premium and Quantum PLCs What Is in This Section This section contains the following topics Topic Page Processing of Power Outage and Restoral for P
480. rOfElements is not a multiple of 16 IEC_BMDI E _EFB_USER_ERROR_13 IF 30212 16 89FC Warning Address overlap of input and output addresses LIFO E_INPUT_VALUE_OUT_OF_ F 30183 16 8A19 Input value is out of range RANGE PUT_4X E_INPUT_VALUE_OUT_OF_ F 30183 16 8A19 Input value is out of range RANGE MUX_DINTARR_125 E_ SELECTOR_OUT_OF_ F 30175 16 8A21 Selector is out of range RANGE SET_BIT E_INPUT_VALUE_OUT_OF_ F 30183 16 8A19 Input value is out of range RANGE 35006144 07 2012 659 EFB Error Codes and Values Common Floating Point Errors Introduction The following table shows the commen error codes and error values created for floating point errors Common Floating Point Errors Table of common floating point errors Error codes Error value Error value Error description in Dec in Hex FP_ERROR 30150 16 8A3A Base value not apearing as an error value E_FP_STATUS_FAILED_IE 30151 16 8A39 Illegal floating point operation E_FP_STATUS_FAILED_DE 30152 16 8A38 Operand is denormalized not a valid REAL number E_FP_STATUS_FAILED_ZE 30154 16 8A36 Illegal divide by zero E_FP_STATUS_FAILED_ZE_IE 30155 16 8A35 Illegal floating point operation Divide by zero E_FP_STATUS_FAILED_OE 30158 16 8A32 Floating point overflow E_FP_STATUS_FAILED_OE_IE 30159 16 8A31 Illegal floating point operation Overflow E_FP_STATUS_FAILED_OE_ZE 30162 16 8A2E Floating po
481. racter string format is used to represent a string of ASCII characters with each character being coded in an 8 bit format The characteristics of character string types are as follows e 16 characters by default in a string excluding end of string characters e a string is composed of ASCII characters between 16 20 and 16 FF hexadecimal representation e in an empty string the end of string character code ASCII ZERO is the first character of the string e the maximum size of a string is 65535 characters The size of the character string can be optimized during the definition of the type using the STRING lt size gt command lt size gt being an unsigned integer UINT capable of defining a string of between 1 and 65535 ASCII characters NOTE The ASCII characters 0 127 are common to all languages but the characters 128 255 are language dependent Be careful is the language of the Unity Pro is not the same as the OS language If the two languages are not the same CHAR MODE communication can be disturbed and sending characters greater than 127 cannot be guaranteed to be correct In particular if the Stop on Reception character is greater than 127 it is not taken into account 274 35006144 07 2012 Data Types Syntax Rules The entry is preceded by and ends with the quote character ASCII code 16 27 The dollar sign is a special character followed by certain letters which indicate L or I go to the next
482. ral to variables The instruction C 25 is used for example to assign the value 25 to the variable c Assigning the Value of an Operation to a Variable Assignments are used to assign to a variable a value which is the result of an operation The instruction X A B C D is used for example to assign the result of the operation A B C D to the variable X 35006144 07 2012 541 Structured Text ST Assigning the Value of an FFB to a Variable Assignments are used to assign a value returned by a function or a function block to a variable The instruction B MOD C A is used for example to call the MOD Modulo function and assign the result of the calculation to the variable B The instruction A MY TON Q is used for example to assign the value of the Q output of the My_ TON function block instance of the TON function block to the variable A This is not a function block call Multiple Assignments Multiple assignments are a supplement to IEC 61131 3 and must be enabled explicitly Even after being enabled multiple assignments are NOT allowed in the following cases e inthe parameter list for a function block call e inthe element list to initialize structured variables The instruction AS LoS 2 is allowed The instructions FB inl 1 In2 In3 2 and strucVar compl 1 comp2 comp3 2 are not allowed 542 35006144 07 2012 Structured
483. rameter Error The operation cannot be carried out as with this type of procedure call only the VAR_IN_OUT parameter would be stored in the accumulator for later use 524 35006144 07 2012 Instruction List IL The following procedure calls are always valid Valid call example 1 CAL InOutProc Calling a procedure with the VAR_IN_OUT parameter and IN1 V1 inout V2 formal assignment of the actual parameter within the procedure call Valid call example 2 InOutProc Calling a procedure with the VAR_IN_OUT parameter and IN1 V1 inout V2 formal assignment of the actual parameter within the procedure call Valid call example 3 CAL InOutProc V1 V2 Calling a procedure with the VAR_IN_OUT parameter and informal assignment of the actual parameter within the procedure call 35006144 07 2012 525 Instruction List IL 526 35006144 07 2012 Structured Text ST 15 Overview This chapter describes the programming language structured text ST which conforms to IEC 61131 What Is in This Chapter This chapter contains the following sections Section Topic Page 15 1 General Information about the Structured Text ST 528 15 2 Instructions 539 15 3 Calling Elementary Functions Elementary Function Blocks 559 Derived Function Blocks and Procedures 35006144 07 2012 527 Structured Text ST 15 1 General Information ab
484. rary 637 Tables of Error Codes for the CONT_CTL Library 644 Tables of Error Codes for the Motion Library 651 Tables of Error Codes for the Obsolete Library 653 Common Floating Point Errors 660 35006144 07 2012 629 EFB Error Codes and Values Tables of Error Codes for the Base Library Introduction The following tables show the error codes and error values created for the EFBs of the Base Library Date amp Time Table of error codes and errors values created for EFBs of the Date amp Time family EFB name Error code ENOstate Error Error Error description in case of value in value in error Dec Hex DIVTIME E_DIVIDE_BY_ZERO F 30176 16 8A20 Divide by zero DIVTIME E_NEGATIVE_INPUT_ F 30177 16 8A1F A negative value cannot be FOR_TIME_OPERATION converted to data type TIME DIVTIME E_ARITHMETIC_ ERROR F 30170 16 8A26 Arithmetic error DIVTIME E_ERR_ARITHMETIC F 30003 16 8ACD Arithmetic overflow S18 set DIVTIME FP_ERROR See table Common Floating Point Errors page 660 MULTIME E_ERR_ARITHMETIC F 30003 16 8ACD Arithmetic overflow S18 set MULTIME E_ARITHMETIC_ERROR_ F 30172 16 8A24 Arithmetic error Muliplication MUL_OV overflow MULTIME E_ARITHMETIC_ERROR_ F 30173 16 8A23 Arithmetic error Addition overflow ADD_OV MULTIME E_ARITHMETIC_ERROR_ F 30171 16 8A25 Arithmetic error Parameter BIG_PAR exceeds range MULTIME E_NEGATIVE_INPUT_ F 3017
485. ray type only use arrays with Failure to follow these instructions can result in death serious injury or 35006144 07 2012 301 Data Types 8 8 Generic Data Types GDT Overview of Generic Data Types At a Glance Generic Data Types are conventional groups of data types EDT DDT specifically intended to determine compatibility among these conventional groups of data types These groups are identified by the prefix ANY_ARRAY but these prefixes can under no circumstances be used to instance the data Their field of use concerns function block EFB DFB and elementary function EF data type families in order to define which data types are compatible with their interfaces for the following e inputs e input outputs e outputs Available Generic Data Types The generic data types available in Unity Pro are the following types ANY_ARRAY_WORD ANY_ARRAY_UINT ANY_ARRAY_UDINT ANY_ARRAY_TOD ANY_ARRAY_TIME ANY_ARRAY_STRING ANY_ARRAY_REAL ANY_ARRAY_INT ANY_ARRAY_EBOOL ANY_ARRAY_DWORD ANY_ARRAY_DT ANY_ARRAY_DINT ANY_ARRAY_DATE ANY_ARRAY_BYTE ANY_ARRAY_BOOL 302 35006144 07 2012 Data Types Example This gives us the following DFB FBL1 Parts_Counter l10 4 1 Part_OK Pre_Val Preset M2 Nb_parts_attained The Preset input parameter may be defined of GDT type NOTE The authorized objects for the various parameters are defined in this table
486. re is indeed an overflow When the S18 bit switches to 1 the application stops in error state if the S78 bit has been to set to 1 YES YES YES S19 OVERRUN Task period overrun periodical scanning Normally set to 0 this bit is set to 1 by the system in the event of a time period overrun i e task execution time is greater than the period defined by the user in the configuration or programmed into the SW word associated with the task The user must reset this bit to 0 Each task manages its own S19 bit YES YES YES 35006144 07 2012 165 System Objects Bit Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum S20 INDEXOVF Index overflow Normally set to 0 this bit is set to 1 when the address of the indexed object becomes less than 0 or exceeds the number of objects declared in the configuration In this case it is as if the index were equal to 0 It must be tested by the user program after each operation where there is a risk of overflow then reset to 0 if there is indeed an overflow When the S20 bit switches to 1 the application stops in error state if the S78 bit has been to set to 1 This bit is not available on Quantum safety PLCs 0 YES YES YES except for safety PLCs S21 1RSTTASKRUN First task cycle Tested in a task Mast Fast Aux0 Aux1 Aux2 Aux3
487. re labeled with a name that is unique within the section The connector name has the following structure depending on the type of source object for the connection e For functions Function counter formal parameter for the source of the connection 3 4 1 a AND AND IN1 OUT 30UT gt gt N1 OUT IN2 gt gt 30UT IN2 e For function blocks Instance name formal parameter for the source of the connection 3 4 1 2 TON AND IN OUT FH_20Ur gt N1 OUT Pr ET gt gt FEL 20Ur IN2 e For contacts OUT1_sequential number 4 2 AND OUT1_3 gt gt NI OUT gt gt OUT1_3 IN2 Vertical Links The Vertical Link is special The vertical link serves as a logical OR With this form of the OR link 32 inputs contacts and 64 outputs coils links are possible 392 35006144 07 2012 Ladder Diagram LD Text Object Introduction Text can be positioned as text objects in the Ladder Diagram LD The size of these text objects depends on the length of the text The size of the object depending on the size of the text can be extended vertically and horizontally to fill further grid units Text objects may overlap with other objects 35006144 07 2012 393 Ladder Diagram LD Edge Recognition Introduction During the edge recognition a bit is monitored during a transition from 0 gt 1 positive edge
488. re of the following types Ch l IW ID VIF YQ QW QD QF KW KD KF MW MD and MF The objects topological address depends on the module s position on the rack or the device s position on the bus For Premium Atrium PLCs double type instances of located data SMD lt i gt sKD lt i gt or floating SMF lt i gt SKF lt i gt should be located by an integer type SMW lt i gt SKW lt i gt Only I O objects make it possible to locate type instances SMD lt i gt SKD lt i gt QD SID SMF lt i gt SKF lt i gt SQF IF by using their topological address for example 3MD0 6 0 11 3MFO 6 0 31 For Modicon M340 PLCs double type instances of located data SMD lt i gt SKD lt i gt or floating SMF lt i gt SKF lt i gt are not available International standard Programmable Logic Controls Part 3 Programming languages IL is the abbreviation of Instruction List This language is a series of basic instructions This language is very close to the assembly language used to program processors Each instruction is composed of an instruction code and an operand Used to indicate that a number overruns the allowed limits For a number of Integers the value ranges shown in gray are as follows ag E J E INF 3 402824e 38 1 1754944e 38 0 0 4 17549448 38 3 4028240 38 When a calculation result is e less than 3 402824e 38 the symbol INF for infinite is displayed e greater than 3 402824e 38 the
489. reater clarity when reading you can use the sign _ between bits Example 16 F_F or 16 FF in decimal 255 16 F_F or 16 FF in decimal 224 696 35006144 07 2012 Glossary Base 2 literals Base 8 literals BCD BIT BOOL A literal value in base 2 is used to represent a binary integer The base is determined by the number 2 and the sign The signs and are not allowed For greater clarity when reading you can use the sign _ between bits Example 2 1111_1111 or 2 11111111 in decimal 255 2 1110 0000 or 2 11100000 in decimal 224 A literal value in base 8 is used to represent an octal integer The base is determined by the number 8 and the sign The signs and are not allowed For greater clarity when reading you can use the sign _ between bits Example 8 3 77 or 8 377 in decimal 255 8 34 0 or 8 340 in decimal 224 The Binary Coded Decimal BCD format is used to represent decimal numbers between 0 and 9 using a group of four bits half byte In this format the four bits used to code the decimal numbers have a range of unused combinations Example of BCD coding e the number 2450 e is coded 0010 0100 0101 0000 This is a binary unit for a quantity of information which can represent two distinct values or statuses O or 1 BOOL is the abbreviation of Boolean type This is the elementary data item in computing A BOOL type variable has a value of either O FALSE or
490. relevant instructions must be followed Failure to use Schneider Electric software or approved software with our hardware products may result in injury harm or improper operating results Failure to observe this information can result in injury or equipment damage 2012 Schneider Electric All rights reserved 35006144 07 2012 Table of Contents Part Chapter 1 Part Il Chapter 2 Chapter 3 3 1 Safety Information 00 cece ee eee eee About the BOOK osicfe ewe Mere whe wees General Presentation of Unity Pro Presentation ecinic awe awe ad ee Capabilities of Unity Pro 2 eee User Intertace tii asf nie canes aoe te ale anna a EAA era at ees Project BrowS hs oriin ee edit eae wie ed Mea ee ea User Application and Project File Formats Configurator tt d bud Oe plete ates Be a a a E tie ae Data Editorii icf 64 Maced eatin ews cia teeny Gene ee Beggs a Program Editor Aea acetate Son bag ok pee ie ee aie bo Function Block Diagram FBD 2 0 0 eee eee eee Ladder Diagram LD Language anura eee eee General Information about SFC Sequence Language Instruction Listes i Sick ee ee id Ae ta ea ee fe Structured Text ST maretia ve eae eee oe te ea nee ad PEG SIMU ons 05 5 Soe ce Epacar ater due the Er ape lect So ieee dee ieee Export IMport essi ve eal eee ea eee i aed Pe ee E User Documentation 0 0 0 0 ce
491. remium Quantum PLCs 145 Processing on Cold Start for Premium Quantum PLCs 147 Processing on Warm Restart for Premium Quantum PLCs 152 Automatic Start in RUN for Premium Quantum 155 144 35006144 07 2012 Operating Modes Processing of Power Outage and Restoral for Premium Quantum PLCs General If the duration of the outage is less than the power supply filtering time it has no effect on the program which continues to run normally If this is not the case the program is interrupted and power restoral processing is activated Filtering time PLC Alternating Current Direct Current Premium 10ms ims Atrium 30ms Quantum 10ms ims Illustration The illustration shows the different types of power restoral detected by the system RUN Application Power failure Awaiting power Power restoral Yes Save Context OK Outage detected No Identical memory card Vv Warm restart Cold start Normal program execution 35006144 07 2012 145 Operating Modes Operation The table below describes the power outage processing phases Phase Description 1 On power outage the system stores the application context and the time of outage 2 It sets all the outputs in the fallback state state defined in configuration 3 On power restoral the saved context is compared to the current one which defi
492. rences to Data Instances by Name 00e eee aee 330 References to Data Instances by Address 0 0 0000 333 Data Naming Rules 0 cee eee 337 35006144 07 2012 Part IV Programming Language 20e0ee00 339 Chapter 11 Function Block Language FBD 0 341 General Information about the FBD Function Block Language 342 Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures FFBs 0 0 e eee eee eee eee eee 344 Subroutine Calls i whee sei Sis weed Vol e bee Ace a a 354 Control Elements ceense ame aa a veo tee ae ded 355 Ll Kee hed ee te ett Ragone Ok ears ean eR ney ere e bk pee ok Rake Gedo eae 356 Text Obj ct oreen e ee ee ee ee eet ag Ht Cee ey 358 Execution Sequence of the FFBS 0 0 ee eee eee 359 Change Execution Sequence 0 cece eee 362 Loop PIanningss siete sea atte eigen eee aye ee A eee ae a 367 Chapter 12 Ladder Diagram LD 0 00sec ee eee eens 369 General Information about the LD Ladder Diagram Language 370 COMACIS n e pr Band wig dea a Tho ett ohana willie vane whee d 373 GC OUS seiner pid gee oes aves T E T ae ASA Uae Rede E E EE ae 374 Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures FFBs 0 0 e eee eee eee eee 376 Control EIGMONS vi ss Racers wad aise aud a ara Bone Pe wie deals 387 Operate Blocks and Compare
493. resented as execution number by the FFB 35006144 07 2012 403 Ladder Diagram LD Priorities Priorities when defining the signal flow within a section Priority Rule Description 1 Link Links have the highest priorities in defining the signal flow within an LD section 2 Network by Processing on a network is ended completely before the Network processing begins on another network 3 Output sequence Outputs of the same function block or outputs to vertical links are processed from top to bottom 4 Rung by Rung Lowest priority The execution sequence of networks which are only linked by the left power rail is determined by the graphical sequence from top to bottom in which these are connected to the left power rail Only applies if none of the other rules apply Example Example of the execution sequence of objects in an LD section 22 1 10 lie INT_TO_BOOL 2 2 EN ENO 4 5 ADD INT_TO_BOOL g e a DS H EN ENO EN ENO Vara D m H 2 3 VarB gt 2 r m gt r 2 9 ADD EN ENO Varc b Varb b gt NOTE The execution numbers for contacts and coils is not shown They are only shown in the graphic to provide a better overview 404 35006144 07 2012 Ladder Diagram LD Loop Planning Non Permitted Loops Creating loops using links alone is not permitted because i
494. riable a variable and one or more connections but not for VAR_IN_OUT see page 386 outputs an address an address and one or more connections but not for VAR_IN_OUT see page 386 outputs one or more connections but not for VAR_IN_OUT see page 386 outputs The data type of the object to be linked must be the same as that of the FFB input output If all actual parameters consist of literals a suitable data type is selected for the function block Exception For generic FFB inputs outputs with data type ANY BIT itis possible to link objects of data type INT or DINT not UINT and UDINT This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed 1 AND IntVarl IN1 OUT IntVar3 IntVar2 IN2 380 35006144 07 2012 Ladder Diagram LD Not allowed 1 AND_WORD IntVarl IN1 IntVar2 IN2 OUT IntVar3 In this case AND_ INT must be used Not all formal parameters have to be assigned an actual parameter However this does not apply in the case of negated pins These must always be assigned an actual parameter This is also the case with some formal parameter types These types are shown in the following table Table of formal parameter types Parameter type EDT STRING ARRAY ANY_ARRAY IODDT STRUCT FB ANY EFB Input 4 F DFB Output EFB VAR_IN_OUT
495. riables can not be accessed by user program These type of variables can only be accessed by the animation table NOTE Nested DFBs are declared as private variables of the parent DFB So their variables are also not accessible through programming but trough the animation table Private variables are a supplement to IEC 61131 3 Programming Notes Attention should be paid to the following programming notes e FFBs are only executed if the input EN 1 or if the input EN is grayed out see also EN and ENO see page 351 e Boolean inputs and outputs can be inverted Special conditions apply when using VAR_IN_OUT variables see page 353 e Function block DFB instances can be called multiple times see also Multiple Function Block Instance Call see page 351 350 35006144 07 2012 Function Block Language FBD Multiple Function Block Instance Call Function block DFB instances can be called more than once other than instances from communication EFBs and function blocks DFBs with an ANY output but no ANY EN and ENO input these can only be called once Calling the same function block DFB instance more than once makes sense for example in the following cases e f the function block DFB has no internal value or it is not required for further processing In this case memory is saved by calling the same function block DFB instance more than once since the code for the function block DFB is only loaded
496. rresponds to a fault which occurs when the transmitter is currently sending with a transmission current in the operating range and when at the same time there is detection of an absence of signal on the same channel bit 6 talking fault corresponds to a fault whereby the transmitter is controlling the line for longer than the maximum set operating limit This fault is caused for example by deterioration of the modulator or by a faulty data link layer bit 7 undercurrent fault corresponds to a fault whereby the transmitter generates when solicited a current weaker than the minimum set operating limit This fault is caused by increased line impedance e g open line etc bit 8 pierced frame fault indicates that a pause has been received in the frame body after identifying a delimiter at the start of the frame and before identifying a delimiter at the end of the frame The appearance of a pause in normal operating conditions takes place after a delimiter has been identified at the end of a frame bit 9 Receiving frame CRC fault indicates that the CRC calculated on a normally received frame and the CRC contained within this frame have different values bit 10 Receiving frame code fault indicates that certain symbols belonging exclusively to delimitation sequences at the start and end of frames have been received within the body of the frame bit 11 received frame length fault more than 256 bytes have been receiv
497. rror code ENO state Error Error Error description in case of valuein value in error Dec Hex STEP2 FP_ERROR F See table Common Floating Point Errors page 660 STEP2 Status word values T F For details about the STEP2 status word refer to the STEP2 description see Unity Pro Control Block Library STEP3 W_WARN_OUT_OF_ T 30110 Parameter out of range RANGE 16 759E STEP3 FP_ERROR F See table Common Floating Point Errors page 660 STEP3 Status word values T F For details about the STEP3 status word refer to the STEP3 description see Unity Pro Control Block Library Mathematics Table of error codes and errors values created for EFBs of the Mathematics family EFB name Error code ENO state Error Error Error description in case of valuein value in error Dec Hex COMP_DB_ W_WARN_OUT_OF_ T 30110 16 759E Parameter out of range RANGE COMP_DB_ FP_ERROR F See table Common Floating Point Errors page 660 K_SQRT W_WARN_OUT_OF_ T 30110 16 759E Parameter out of range RANGE K_SQRT FP_ERROR F See table Common Floating Point Errors page 660 MULDIV_W FP_ERROR F See table Common Floating Point Errors page 660 SUM_W FP_ERROR F See table Common Floating Point Errors page 660 35006144 07 2012 647 EFB Error Codes and Values Measurement Table of error codes and errors values created for
498. rrorl Resultl Error2 Result2 The objects of the FBD programming language Function Block Diagram help to divide a section into a number of e EFs and EFBs Elementary Functions see page 344 and Elementary Function Blocks see page 345 e DFBs Derived Function Blocks see page 346 e Procedures see page 346 and e Control Elements see page 355 These objects combined under the name FFBs can be linked with each other by e Links see page 356 or e Actual Parameters see page 347 Comments regarding the section logic can be provided using text objects see Text Object page 358 342 35006144 07 2012 Function Block Language FBD Section Size One FBD section consists of a window containing a single page This page has a grid background A grid unit consists of 10 coordinates A grid unit is the smallest possible space between 2 objects in an FBD section The FBD programming language is not cell oriented but the objects are still aligned with the grid coordinates An FBD section can be configured in number of cells horizontal grid coordinates and vertical grid coordinates IEC Conformity For a description of the extent to which the FBD programming language conforms to IEC see IEC Conformity see page 661 35006144 07 2012 343 Function Block Language FBD Elementary Functions Elementary Function Blocks Derived Function Blocks and Procedures FFBs Introduction FFB is the generi
499. rt processing the critical section is unmarked If a power failure hits into critical section this could be detected if this state is active at the beginning as the scan is aborted and MAST task is restarted from the beginning In this case the workspace might be inconsistent and is restored from the saved data Additional information from SFCSTEP_STATE in located data area is used to reconstruct the state machine 140 35006144 07 2012 Operating Modes Output Changes When a power failure occurs e during first scan S1 1 Mast is executed but Fast and Event tasks are not executed On power restoral e Clears chart deregisters diagnostics keeps set actions e sets steps from saved area e sets step times from SFCSTEP_STATE e restores elapsed time for timed actions NOTE SFC interpreter is independent if the transition is valid the SFC chart evolves while S1 is true As soon as a power outage is detected the outputs are set in the fallback position e either they are assigned the fallback value e or the current value is maintained depending on the choice made in the configuration After power restoral the outputs stay in security mode equal to 0 until they are updated by a running task 35006144 07 2012 141 Operating Modes Automatic Start in RUN for Modicon M340 PLCs Description Automatic start in RUN is a processor configuration option This option forces the PLC to start in RUN afte
500. s Aim of this Section This section describes the sections and the subroutines that make up a task What Is in This Section This section contains the following topics Topic Page Description of Sections 85 Description of SFC sections 87 Description of Subroutines 88 84 35006144 07 2012 Program Structure Description of Sections Overview of the Sections Sections are autonomous programming entities The identification tags of the instruction lines the contact networks etc are specific to each section no program jump to another section is possible These are programmed either in Ladder language LD Functional block language FBD Instruction List IL Structured Text ST or Sequential Function Charting SFC on condition that the language is accepted in the task The sections are executed in the order of their programming in the browser window structure view An execution condition can be associated with one or more sections in the master fast and auxiliary tasks but not in the event processing tasks The sections are linked to a task The same section cannot belong simultaneously to several tasks Example The following diagram shows a task structured into sections a ara Sections i Airlock k Oven 1 a E Dryer I SR Sections 35006144 07 2012 85 Program Structure Characteristics of a
501. s e avariable e a function block Data is defined in three phases These are e the data types phase which specifies the following e its category e its format e the data instances phase which defines its storage location and property which is e located or e unlocated e the data references phase which defines its means of access e by immediate value e by name e by address Illustration The following are the three phases that characterize the data Instantiate Reference Instantiating a data item consists in allocating it a memory slot according to its type Referencing a data item consists in defining a reference for it name address etc allowing it to be accessed in the memory 244 35006144 07 2012 General Overview of Data General Overview of the Data Type Families Introduction A data type is a piece of software information which specifies for a data item e its structure e its format e alist of its attributes e its behavior These properties are shared by all instances of the data type Illustration The data type families are filed in different categories dark gray EDT DDT Device DDT EFB DFB Definitions Data type families and their definitions Family Definition EDT Elementary data types such as Bool Int Byte Word Dword etc 35006144 07 2012 245 General Overview of Data Family Definition DDT Derived Data
502. s see page 510 Assignments cannot be made outside the function block call The instruction My Var My SAH OUT is invalid if the output OUT of the SAH function block is of type ANY The instruction Cal My SAH OUT gt My Var is valid Special conditions apply when using VAR_IN_OUT variables see page 516 The use of function blocks consists of two parts e the Declaration see page 509 e calling the function block There are four ways of calling a function block e Formal Form of CAL with a list of input parameters see page 510 call with formal parameter names In this case variables can be assigned to outputs using the gt operator e Informal form of CAL with a list of input parameters see page 511 call without formal parameter names e CAL and Load Save see page 512 the input parameter e Use of the input operators see page 513 e Function block DFB instances can be called multiple times other than instances of communication EFBs these can only be called once see Multiple Call of a Function Block Instance see page 515 Declaration Before calling a function block it must be declared in the variables editor 35006144 07 2012 509 Instruction List IL Formal Form of CAL with a List of Input Parameters With this type of call call with formal parameter names the function block is called using a CAL instruction which follows the instance name of the function block and a bracket
503. s 21 Drop not reachable 22 Process device manager detected error 23 Process FDR builder detected error 24 Process FDR server detected error 25 Process EIP scanner detected error 26 Process EIP signature mismatch 27 Process EIP connection rejected 28 Process unknown detected error 29 3F Reserved 4C Maximum CCOTF retries reached 4D Invalid signature detected by CPU 4E For CPU Detected error for communication to CRP 4F For CPU IOPL error build or swap 50 CRA received wrong communication parameter detected error 51 FDR server did not respond 52 Detected error when downloading PRM file from server 53 CRA downloaded a zero size file from FDR server 54 Invalid configuration in PRM for example invalid CRC invalid Conf or Signature mismatch managed by MC 55 PRM download time out e 56 All other detected error for example CCOTF count difference between new and old conf more greater than 1 e 57 FE Reserved e FF Unknown detected error e YY The lower byte of the word is associated with the CCOTF processing status in hex 00 Idle 01 In progress 02 Completed 03 Did not complete but can recover 04 Did not complete cannot recover 05 Did not complete CCOTF was rejected by the Drop 226 35006144 07 2012 System Objects Description of Quantum System Words SW98 to SW109 Detailed Description Description system words SW98 to SW109
504. s are accessible from the application in read only mode Definition of the SFCSTEP_TIMES Structure Type This structure includes all types of data linked to the definition of the runtime parameters of the step or of the Macro step These data types are delay TIME elementary data type EDT defining the polling delay time of the transition situated downstream from the active step tmin TIME elementary data type EDT containing the minimum value during which the step must at least be executed If this value is not respected the data tmin Err switches to the value TRUE tmax TIME elementary data type EDT containing the maximum value during which the step must at least be executed If this value is not respected the data tmax Err switches to the value TRUE These data types are only accessible from the SFC editor Data Access Syntax of the Structure SFCSTEP_STATE The instance names of this structure correspond to the names of the steps or macro steps of the sequential function chart Syntax Comment Name_Step x Used to find out the status of the step active inactive Name_Step t Used to find out the current or total activation time for the step Name_Step tminErr Used to find out if the minimum activation time of the step is less than the time programmed in Name_Step tmin Name_Step tmaxErr Used to find out if the maximum activation time of the step is greater than the time programmed in Name_Step tmax
505. s do not depend on the priority of tasks It is possible to define the period of a fast task which is larger than the master task 102 35006144 07 2012 Program Structure Watchdog The execution of each task is controlled by a configurable watchdog by using the task properties The following table gives the range of watchdog values for each of the tasks Tasks Watchdog values Default watchdog value ms Associated system word min max ms MAST 10 1500 250 SSW11 FAST 10 500 100 AUX0O 100 5000 2000 AUX1 100 5000 2000 AUX2 100 5000 2000 AUX3 100 5000 2000 S If watchdog overflow should occur the application is declared in error which causes the PLC to stop immediately HALT state The word SW11 contains the watchdog value of the master task in ms This value is not modifiable by the program The bit S11 indicates a watchdog overflow It is set to 1 by the system when the cycle time becomes greater than the watchdog NOTE e The reactivation of the task requires the terminal to be connected in order to analyze the cause of the error correct it reinitialize the PLC and switch it to RUN e Itis not possible to exit HALT by switching to STOP To do this you must reinitialize the application to ensure consistency of data 35006144 07 2012 103 Program Structure Task Control When the application program is being executed it is possible to ac
506. s from the under side of the predecessor step to the top side of the successive step A transition is enabled if the steps immediately preceding it are active Transitions whose immediately preceding steps are not active are not normally analyzed A transition is triggered when the transition is enabled and the associated transition conditions are satisfied Triggering a transition leads to the disabling resetting of all immediately preceding steps that are linked to the transition followed by the activation of all immediately following steps If more than one transition condition in a row of sequential steps has been satisfied then one step is processed per cycle Steps cannot be activated or deactivated by other non SFC sections The use of macro steps is possible Only one branch is ever active in alternative branches The branch to be run is determined by the result of the transition conditions of the transitions that follow the alternative branch If a transition condition is satisfied the remaining transitions are no longer processed The branch with the satisfied transition is activated This gives rise to a left to right priority for branches All alternative branches are combined at the end by an alternative joint or jumps With parallel branches switching a single transition leads to the activation of more than one step branch After this common activation the individual branches are processed independent of one another All paral
507. s how often the watch point has been updated ST section with watch point Watch Point SWPe amp Si ST Section My_ST MAST li pump_1 start end_if Mociticati Force then pump_1 cmd true else pump_1 cmd false Value ifpump_lemdthnp i eel end i ie ease SOO then Meee LOO en eke animation drilling amp threading lugh anm not jack_1_out and not jack _3 out Table FBD Editor My_ST MAST Comment Indexing_blocki SFCST t Time x Bool 5 tminErr Bool 66 35006144 07 2012 Presentation Breakpoint Single Step Mode Breakpoints allow you to stop processing of the project at any point ST section with breakpoint ST1 MAST TIMER IN NOT pulse t ls Blink timer ECR MS Res Breakpoint Count every pulse IF pulse 1 THEN oot e AATU E A END _IF Animate lights according to counter CASE OF 1 outl TRUE 2 out2 TRUE ELSE All lights are on switch then off agam and start from outl FALSE out FALSE Single step mode allows you to execute the program step by step Single step functions are provided if the project was stopped by reaching a breakpoint or if it is already in single step mode ST section in single step mode 5 ST Section testi MAST Ei Gear counter varl sl Ea a
508. s means that the value is reset to 0 after stop and cold restart e g when voltage is on off Should a buffered output be required please use the RS or SR function block from the standard block library 432 35006144 07 2012 SFC Sequence Language Qualifier Meaning Description S Set saved The set action remains active even when the associated step becomes inactive The action only becomes inactive when it is reset in another step of the current SFC section using the qualifier R Note If an action variable is modified outside of the current SFC section it may no longer reflect the action s activation state Section_1 Section_2 l IF S2 x true THEN A1 false END_IF Note A maximum of 100 actions are permitted using the s qualifier per SFC Section Time limited If the step is active the action is also active After the process of the time duration defined manually for the action the action returns to 0 even if the step is still active The action also becomes 0 if the step is inactive Note For this qualifier an additional duration of data type TIME must be defined Delayed If the step is active the internal timer is started and the action becomes 1 after the process of the time duration which was defined manually for the action If the step becomes inactive after that the action becomes i
509. s word is exchanged from the primary to the standby PLC to inform the standby PLC of the safe or maintenance mode 16 A501 NO NO YES Only on safety PLCs SW13 XWAYNETWADDR Main address of the station This word indicates the following for the main network Fipway or Ethway the station number least significant byte from 0 to 127 the network number most significant byte from 0 to 63 value of the micro switches on the PCMCIA card 254 16 00FE NO YES NO see SW13 below 184 35006144 07 2012 System Objects Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW13 Mode of the For Quantum safety PLC only this NO NO YES INTELMODE Intel word indicates the operating mode Only on processor of the Intel Pentium processor of the safety CPU module PLCs e 16 501A maintenance mode e 16 5AFE safe mode Any other value is interpreted as an error Note In a HotStand By safety system this word is exchanged from the primary to the standby PLC to inform the standby PLC of the safe or maintenance mode SW14 Commercial This word contains the current YES YES YES OSCOMMVERS version of Operating System OS version of PLC the PLC processor processor Example 16 0135 version 01 issue number 35 SW15 PLC This word contains the commercial YES YES YES OSCOMMPATCH
510. section e Multi Token A maximum of 100 initial steps can be placed per section including all their macro sections 35006144 07 2012 425 SFC Sequence Language Using macro sections Sequence control section Macro section Macro section MS_1_1 MS_1_2 S141 MS_1_1_IN MS_1_2_IN I n N i MS_1_1 16 MS_1_2 111 A a a a Ds el i S_1_3 S_1_7 S_1_9 MS_1_2_OUT I ad a L MS_1_1_OUT The name of the macro section is identical to the name of the macro step that it is called from If the name of the macro step is changed then the name of the respective macro section is changed automatically A macro section can only be used once Macro Step Processing Macro Step Processing Phase Description 1 A macro step is activated if the previous transition condition is TRUE At the same time the input step in the macro section is activated 2 The sequence string of the macro section is processed The macro step remains active as long as at least one step in the macro section is active 3 If the output step of the macro section is active then the transitions following the macro step are enabled 4 The macro step becomes inactive when the output step is activated which causes the following tran
511. sed AND ARRAY WORD ArrayInt n this case an explicit type conversion must be carried out using INT ARR TO WORD ARR 35006144 07 2012 501 Instruction List IL Not all formal parameters must be assigned a value for formal calls Which formal parameter types must be assigned a value can be seen in the following table Parameter type EDT STRING ARRAY ANY_ARRAY IODDT STRUCT FB ANY Input VAR_IN_OUT Output B Actual parameter required Actual parameter not required not applicable If no value is assigned to a formal parameter the initial value will be used when the function is executed If no initial value has been defined the default value 0 is used Programming Notes Attention should be paid to the following programming notes e Functions are only executed if the input EN 1 or the EN input is not used see also EN and ENO see page 505 e All generic functions are overloaded This means the functions can be called with or without entering the data type E g LD il ADD i2 ST i3 is identical to LD il ADD INT i2 ST i3 e Incontrast to ST functions in IL cannot be nested e There are two ways of invoking a function e Formal call calling a function with formal parameter names e Informal call calling a function without formal parameter names 502 35006144 07 2012
512. see page 591 35006144 07 2012 303 Data Types 8 9 Data Types Belonging to Sequential Function Charts SFC Overview of the Data Types of the Sequential Function Chart Family Introduction The Sequential Function Chart SFC data type family includes derived data types such as the structures that restore the properties and status of the chart and its component actions Each step is represented by two structures These are e the SFCSTEP_STATE structure e the SFCSTEP_TIMES structure Illustration SFC a a Step 1 Step N NOTE The two structure types SECSTEP_STATE and SFCSTEP_TIMES are also linked to each Macro step of the sequential function chart 304 35006144 07 2012 Data Types Definition of the SFCSTEP_STATE Structure Type This structure includes all types of data linked to the status of the step or of the Macro step These data types are x BOOL elementary data type EDT containing the value TRUE when the step is active t TIME elementary data type EDT containing the activity time of the step When deactivated the step value is maintained until the next activation tminErr BOOL elementary data type EDT containing the value TRUE if the activity time of the step is less than the minimum programmed activity time tmaxErr BOOL elementary data type EDT containing the value TRUE if the activity time of the step is greater than the maximum programmed activity time These data type
513. short as possible All the outputs associated with the event processing are updated Premium Atrium PLCs Quantum PLCs Programming Rule The inputs acquired and the outputs updated are e the inputs associated with the channel which caused the event e the inputs and outputs used during event processing NOTE These exchanges may relate e to a channel e g counting module or e toa group of channels discrete module In this case if the processing modifies for example outputs 2 and 3 of a discrete module the image of outputs 0 to 7 is then transferred to the module The inputs acquired and the outputs updated are selected in the configuration Only local inputs outputs can be selected The inputs and the associated group of channels exchanged during the execution of event processing are updated loss of historical values and thus edges You should therefore avoid testing fronts on these inputs in the master MAST fast FAST or auxiliary AUXi tasks 112 35006144 07 2012 Program Structure How to Program Event Processing Procedure The table below summarizes the essential steps for programming event processing Step Action 1 Configuration phase for events triggered by input output modules In offline mode from the configuration editor select Event Processing EVT and the event processing number for the channel of the input output module concerned 2 Unmasking phase
514. simultaneously e Use of a DFB with at least one output or I O parameter of dynamic array type ANY ARRAY XXX e Inthe coding of a DFB use of a function or function block FFB of type FIFO LIFO MOVE MVX T2T SAH or SEL Note that the function or FFB needs two ANY type parameters with at least one defined on the output e The DFB parameter of the dynamic array is used in writting during the FFB call on the ANY type parameter For other ANY parameters an array with a fixed size is used e The size of the fixed size array is bigger than the size of the dynamic array calculated to store the result Example for checking the size of arrays The following example shows how to check the size of arrays using the function LENGTH _ARWORD in a DFB LENGTH_ARWORD 2 Table_1_ oui EQ_INT 4 MOVE 9 IN1 OUT EN1 ENo_ LENGTH ARworD 3 M Table 1 N OUT _Table2 Table_2__ IN OUT In this example Table_1 is an array with a fixed size Table 2 is a dynamic array of type ANY ARRAY WORD This program checks the size of each array The functions LENGTH ARWORD compute the size of each array in order to condition the execution of the MOVE function 610 35006144 07 2012 Use of DFBs Use of IODDTs in a DFB At a Glance The following tables present the different IODDTs for the Modicon M340 Premium and Quantum PLCs that can be used in a DFB exclusively as input o
515. sition condition 44 S47 Topological Boolean address Alternative junction 7s Parallel junction a Li gt Transition condition Boolean Literal MS_4_1 T Macro Step Retur _Var 416 35006144 07 2012 SFC Sequence Language Structure of an SFC Section An SFC section is a Status Machine i e the status is created by the active step and the transitions pass on the switch change behavior Steps and transitions are linked to one another through directional links Two steps can never be directly linked and must always be separated by a transition The active signal status processes take place along the directional links and are triggered by switching a transition The direction of the chain process follows the directional links and runs from the end of the preceding step to the top of the next step Branches are processed from left to right Every step has zero or more actions A transition condition is necessary for every transition The last transition in the chain is always connected to another step in the chain via a graphic link or jump symbol to create a closed loop Step chains are therefore processed cyclically SFCCHART_STATE Variable When an SFC section is created it is automatically assigned a variable of data type SFCCHART_ STATE The variable that is created always has the name of the respective SFC section This variable is used to assign th
516. sition conditions to be enabled and the transition condition to be TRUE At the same time the output step in the macro section is activated 426 35006144 07 2012 SFC Sequence Language Step Names When creating a step it is assigned with a suggested number Meanings of the Suggested Numbers Step Type Suggested Number Description Macro Step MS ij MS Macro Step i internal current sequential number of the current section j internal current sequential macro step number of the current section Input step MS_k 1_IN MS Macro Step k internal current sequential number of the calling section 1 internal current sequential macro step number of the calling section IN Input Step Output step MS_k_1_OUT MS Macro Step k internal current Sequential number of the calling section 1 internal current Sequential macro step number of the calling section OUT Output Step Normal Step within a macro section S Step k internal current Sequential number of the calling section m internal current Sequential step number of the calling section You can change the suggested numbers to give you a better overview Step names maximum 28 characters for macro step names maximum 32 characters for step names must be unique within the entire project i e no other step variable or section with the exception of the name of th
517. smatch occurs SW60 4 e 0 authorizes an update of the firmware only after the application has stopped e 1 authorizes an update of the firmware without the application stopping SW60 5 e Ono action default e 1 request for an application transfer from the Primary to the Standby SW60 8 e 0 address switch on Modbus port 1 during a primary swap e 1 no address switch on Modbus port 1 during a primary swap 222 35006144 07 2012 System Objects Word Function Description Initial Symbol state SW60 Quantum Hot continued 0 HSB_ CMD Standby SW60 9 command e 0 address switch on Modbus port 2 during a primary swap register e 1 no address switch on Modbus port 2 during a primary swap e SW60 10 e 0 address switch on Modbus port 3 during a primary swap e 1 no address switch on Modbus port 3 during a primary swap SWE61 Quantum Meaning of the different bits of the word SW61 0 HSB_STS status SW61 0 and SW61 1 PLC operating mode bits register SW61 1 0 SW61 0 1 OFFLINE mode SW61 1 1 SW61 0 0 primary mode SW61 1 1 SW61 0 1 secondary mode Standby e SW61 2 and SW61 3 operating mode bits from the other PLC SW61 3 0 SW61 2 1 OFFLINE mode SW61 3 1 SW61 2 0 primary mode SW61 3 1 SW61 2 1 secondary mode Standby SW61 3 0 SW61 2 0 the remote PLC is not accessible switched off no communica
518. ssignment of ENO must be made using the gt operator reset PV value ENO gt error Q gt out CV gt current 35006144 07 2012 515 Instruction List IL Calling the same function block in FBD MY_COUNT CTU 1 EN ENO error vari CU Q out reset jR value PV CV current VAR_IN_OUT Variable Function blocks are often used to read a variable at an input input variables to process it and to output the updated values of the same variable output variables This special type of input output variable is also called a VAR_IN_OUT variable The following special features are to be noted when using function blocks DFBs with VAR_IN_OUT variables e All VAR_IN_OUT inputs must be assigned a variable e VAR_IN_OUT inputs may not have literals or constants assigned to them e VAR_IN_OUT outputs may not have values assigned to them e VAR_IN_OUT variables cannot be used outside the block call Calling a function block with a VAR_IN_OUT variable in IL CAL MY FBLOCK IN1 V1 IN2 V2 I01 V3 OUT1 gt V4 OUT2 gt V5 Calling the same function block in FBD MY_FBLOCK FBLOCK V1 IN1 OUT1 V4 v2 IN2 OUT2 V5 V3 101 101 V3 VAR_IN_OUT variables cannot be used outside the function block call The following function block calls are therefore invalid Invalid call example 1 LD V1 Loading a V1 variable in the accumulator CAL InOutFB Calling a
519. strings run independently of one another If transition condition b is true then a sequence runs toS_19 5 If steps S_19 2ands_ 19 5 are active and transition then the parallel string is departed condition c is true 456 35006144 07 2012 SFC Sequence Language Greater Amount of Branches String with 2 Parallel Branches and 1 Parallel Merge a a S_19_2 S_19_3 rl b S_19_4 S_19_5 c If Then If transition condition a is true then a sequence runs toS 19 2ands_ 19 3 IfstepsS_19 2ands 19 3 are activated then the strings run independently of one another If transition condition b is true then a sequence runs toS 19 4ands 19 5 IfstepsS_19 4ands_19_ 5 are activated then the strings run independently of one another IfstepsS_19 2 S 19 4ands 19 5 are active and then the parallel string is departed transition condition c is true 35006144 07 2012 457 SFC Sequence Language Nested Parallel Strings Nested Parallel Strings a a S_8_10 S_8_11 eel J b c I S_8_12 S_8 13 S_8_14 S_8_15 S_8_16 a d S_8 17 az e f S_8_18 S_8_19 el g If Then If transition condition a is true then a sequence runstosS 8 10 ands 8 11 If transition condition b is true
520. symbol INF for infinite is displayed 35006144 07 2012 707 Glossary Instantiate INT Integer literals IODDT Keyword To instantiate an object is to allocate a memory space whose size depends on the type of object to be instantiated When an object is instantiated it exists and can be manipulated by the program INT is the abbreviation of single integer format coded on 16 bits The lower and upper limits are as follows 2 to the power of 31 to 2 to the power of 31 1 Example 32768 32767 2 1111110001001001 16 9FA4 Integer literal are used to enter integer values in the decimal system The values can have a preceding sign Individual underlines _ between numbers are not significant Example 12 0 123 456 986 IODDT is the abbreviation of Input Output Derived Data Type The term IODDT designates a structured data type representing a module or a channel of a PLC module Each application expert module possesses its own IODDTs K A keyword is a unique combination of characters used as a syntactical programming language element See annex B definition of the IEC standard 61131 3 All the key words used in Unity Pro and of this standard are listed in annex C of the IEC standard 61131 3 These keywords cannot be used as identifiers in your program names of variables sections DFB types etc 708 35006144 07 2012 Glossary LD Located variable Macro step M
521. t INT Other Element BOOL ELEMENT 2 ELEMENT 3 Element type structure INT Other Element BOOL ELEMENT 3 ELEMENT 4 type structure Other Element BOOL My Elemen ELEMENT 4 t INT type structure Compatibility between the structure types Types ELEMENT_1 ELEMENT_2 ELEMENT_3 ELEMENT_4 ELEMENT_1 YES NO NO ELEMENT_2 YES NO NO ELEMENT_3 NO NO NO ELEMENT_4 NO NO NO Rules concerning the tables Two tables are compatible if e their dimensions and the order of their dimensions are identical e each corresponding dimension is of the same type 35006144 07 2012 307 Data Types There are five types of table TAB_1 ARRAY TAB 2 ARRAY TAB 3 ARRAY TAB 4 ARRAY TAB _5 ARRAY 7 Table two dimensions of type 10 20 OF INT Table one dimension of TAB 1 type 20 30 OF INT 7 Table one dimension of TAB 2 type 20 30 OF INT Table one dimension of TAB 3 type 20 30 OF TAB 1 7 Table one dimension of TAB 4 type 20 30 10 20 OF INT Compatibility between the table types TAB 5 Type and type are TAB_1 TAB_2 incompatible TAB_2 TAB_3 compatible TAB_4 TAB_5 compatible TAB_4 25 TAB_5 28 compatible The Generic Data Type GDT Family The Generic Data Type GDT family is made up of groups organized hierarchically which contain data types belonging to the foll
522. t Typical case Counters Floating must be used carefully especially when it needs to add a small number to itself In case of small increments the counter won t count properly giving wrong results and stopping to rise when the increment will be lower than the less significant bit of the counter To get correct values it is recommended to count on an double integer UDINT and multiply the result by the increment 272 35006144 07 2012 Data Types Example e Increment a value by 0 001 from 33000 to 1000000 e Count from 33000000 to 1000000000 value times 1000 with 1 as increment e Get the result multiplying the value by 0 001 The accuracy F minimum per range will be From to F minimum 3300 65536 0 004 65536 131072 0 008 524288 1000000 0 063 This counter can raise up to 4294967295 x 0 001 4294967 5 with a minimum accuracy of 0 5 NOTE The real value here are the binary value encoded It may differs from the display in an operator screen as rounding is done 4 294968e 006 35006144 07 2012 273 Data Types 8 4 Elementary Data Types EDT in Character String Format Overview of Data Types in Character String Format Introduction Data types in character string format belong to the EDT Elementary data type family which includes single rather than derived data types tables structures function blocks The Character String Type The cha
523. t bit SI lt i gt EBOOL EBOOL ARRAY OF EBOOL This kind of variables only exists on Qantum PLCs Flat word SIW lt i gt INT All types are allowed except EBOOL ARRAY OF EBOOL This kind of variables only exists on Qantum PLCs Common word SNWi j k INT INT Topological variables oe an R Ore Same Type On some digital I O modules it is allowed to map arrays of EBOOL on IX lt topo gt and QX lt topo gt objects Extract bits SMWi j BOOL BOOL 35006144 07 2012 675 IEC Compliance Note 6 Note 7 Note 8 Note 9 Note 10 Note 11 Note 12 Note 13 Note 14 Only operator for ADD for SUB for MUL or for DIV in ST language This feature is only presented in the expanded view of the chart This feature is presented in the expanded view of the chart but not as concatenated blocks but as a scrollable list of action names with associated qualifiers inside one single block symbol There is only a one to one mapping of program instance to task The textual format is replaced by a property dialog The textual format is replaced by a property dialog All variables are retentive RETAIN qualifier implicitly assumed in variable declarations The textual format is replaced by the project browser representation Using Mask IT instruction the user is able to get a non preemptive
524. t is not possible to clearly define the signal flow the output of one FFB is the input of the next FFB and the output of this one is the input of the first again Non permitted loops via links 1 AND AND EN ENO EN ENO IN2 Generating Via an Actual Parameter This type of logic must be generated using feedback variables so that the signal flow can be determined Feedback variables must be initialized The initial value is used during the first execution of the logic Once they have been executed the initial value is replaced by the actual value Pay attention to the two different types of execution sequences number in brackets after the instance name for the two blocks Loop generated with an actual parameter Type 1 EN ENO N1 oe OUTIL ouT1 IN2 35006144 07 2012 405 Ladder Diagram LD Loop generated with an actual parameter Type 2 m OUTIL OUTI IN2 EN AND ENO 406 35006144 07 2012 Ladder Diagram LD Change Execution Sequence Introduction Original Situation The order of execution in networks and the execution order of objects within a network are defined by a number of rules see page 403 In some cases the execution order suggested by the system should be changed The procedure for defining changing the execution sequence of networks is as
525. t the output is the same for all executions of the function For example the addition of two values gives the same result at every execution Some elementary functions can be extended to more than 2 inputs Elementary functions only have one return value Output Parameters Inputs and one output are required to transfer values to or from a function These are called formal parameters The current process states are transferred to the formal parameters These are called actual parameters The following can be used as actual parameters for function inputs e Variable Address Literal ST Expression The following can be used as actual parameters for function outputs e Variable e Address The data type of the actual parameters must match the data type of the formal parameters The only exceptions are generic formal parameters whose data type is determined by the actual parameter When dealing with generic ANY BIT formal parameters actual parameters of the INT or DINT not UINT and UDINT data types can be used This is a supplement to IEC 61131 3 and must be enabled explicitly Example Allowed AND AnyBitParam IntVarl AnyBitParam2 IntVar2 Not allowed AND WORD WordParaml IntVarl WordParam2 IntVar2 In this case AND_ INT must be used AND ARRAY WORD ArrayInt In this case an explicit type conversion must be carried out using INT ARR TO WORD ARR 560 35006144 07 2012
526. ta instances These references can be e value based references e name based references e address based references What Is in This Chapter This chapter contains the following topics Topic Page References to Data Instances by Value 328 References to Data Instances by Name 330 References to Data Instances by Address 333 Data Naming Rules 337 35006144 07 2012 327 Data References References to Data Instances by Value Introduction At a Glance What is a data instance reference see page 249 A reference to a data instance by a value is an instance which does not have a name symbol or topological address This corresponds to an immediate value which can be assigned to a data type instance belonging to the EDT family Standard IEC 1131 authorizes immediate values on instances of the following data types Booleans e BOOL e EBOOL integers e INT UINT DINT UDINT TIME reals e REAL dates and times e DATE e DATE AND TIME e TIME OF DAY character strings e STRING The programming software goes beyond the scope of the standard by adding the bit string types BYTE WORD DWORD 328 35006144 07 2012 Data References Examples of Immediate Values This table associates immediate values with types of instance Immediate value Type of instance I am a character string STRING T 1s TIME D 2000 01 01 DATE TOD 12 25
527. task can be controlled by program by bits and system words System objects Description SW1 Task period S31 Fast task activation S11 Watchdog error S19 Period overrun SW33 Execution time in ms of the last cycle SW34 Execution time in ms of the longest cycle SW35 Execution time in ms of the shortest cycle 80 35006144 07 2012 Program Structure Presentation of Auxiliary Tasks General Structure Execution Control The auxiliary tasks are intended for slower processing tasks These are the least priority tasks It is possible to program up to 4 auxiliary tasks AUX0 AUX1 AUX2 or AUX3 on the Premium TSX P57 5e e and Quantum 140 CPU 6eeee PLCs Auxiliary tasks are not available for Modicon M340 PLCs The auxiliary tasks AUX are made up of sections and subroutines Each section of the auxiliary task is programmed in one of the following languages LD FBD IL or ST The SFC language is not usable in the sections of an auxiliary task A maximum of 64 subroutines can be programmed in the LD FBD IL or ST language These are called in the task sections The execution of auxiliary tasks is periodic They are the least priority The auxiliary task period can be fixed from 10ms to 2 55s The auxiliary tasks can be controlled by program by bits and system words System objects Description SW2 Period of auxiliary task
528. tc Tabular display of FFBs Actual parameters can be entered and displayed as symbols or topological addresses Different zoom factors Tracking of FFB links Optimizing the link routes of FFB links Display of inspection windows 52 35006144 07 2012 Presentation General Information about SFC Sequence Language Introduction The sequence language SFC Sequential Function Chart which conforms to IEC 61131 3 is described in this section IEC conformity restrictions can be lifted through explicit enable procedures Features such as multi token multiple initial steps jumps to and from parallel strings etc are then possible 35006144 07 2012 53 Presentation Representation Representation of an SFC section a S41 Y hnitial Step aa Tim Transition condition Boolean Variable Parallel branch S_4 2 S_4_5 Step T4424 Ree Ped Alternative branch 1 110 1 VarX 110 Transition condition S return value of a E1061 Undefined Symbol VarX Transition section i 843 S46 S49 S47 y Jump A TAL L aa io ANOA l10 Transition condition Alternative joint S44 S47 Topological Boolean address Teg Parallel joint a gt Transition condition Boolean Literal MS_4_1 ee Macro Step Returh_Var 54 35006144 07 2012 Pr
529. ted with another version of Unity Pro all the features used in the application have to be supported by the current version 28 35006144 07 2012 Presentation Create Unity Pro Archived Application File STA The following table describes the procedure for generating STA files Step Action 1 Launch the current Unity Pro software Start Programs Schneider Electric SoCollaborative Unity Pro Open the project STU file 1 File Open 2 Select the project STU file 3 Click on Open File Save Archive see note below Choose a location for the file to be saved Do not save files in the default Schneider Electric directory C Program Files Schneider Electric Unity Pro Files saved in this directory may be deleted during Unity Pro installation Click on Save Remember the location where the STA file is stored on the terminal as it will be needed when recovering the project NOTE The Save Archive function is only available if e The project has been generated e In Tools Project Settings in the Upload Information section if Include is selected at least one of the two check boxes underneath must be checked Restoring Unity Pro Archived Application File STA This restoration consists of importing the STA files previously created and stored The STA files are used when the PLC cannot be stopped To restore STA files follow the
530. tem Words SW123 to SW127 Detailed Description Description of system words SW123 to SW127 Word Function Description Initial Modicon Premium Quantum Symbol state M340 Atrium SW123 System This system word is used by the system YES YES NO ADJBUSX allowance and cannot be used by the user application to BUS X SW124 Type of The last type of system fault encountered YES YES YES CPUERR processor is written into this word by the system or system these codes are unchanged on a cold error restart e 16 30 system code fault e 16 53 time out fault during I O exchanges 16 60 to 64 stack overrun e 16 65 Fast task period of execution is too low e 16 81 detection of backplane see Premium and Atrium using Unity Pro Processors racks and power supply modules Implementation manual error NOTE 16 81 system code is not managed by Quantum PLCs NOTE If this error is detected all racks have to be re initialized e 16 90 system switch fault Unforeseen IT 206 35006144 07 2012 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW125 BLKERRTYPE Last fault detected The code of the last fault detected is given in this word The following error codes cause the PLC to stop if S78 is set to 1 S15 S18 and S20 are always activated independently of S78 e 16 2258 executio
531. ter sets e g 6 6 can be used except in project and DFB names Underlines are significant in identifiers e g A BCD and AB_CD are interpreted as different identifiers Multiple leading underlines and consecutive underlines are invalid Identifiers cannot contain spaces Not case sensitive e g ABCD and abcd are interpreted as the same identifier According to IEC 61131 3 leading digits are not allowed in identifiers Nevertheless you can use them if you activate the check box Allow leading digits in the Tools Project settings Variables dialog Identifiers cannot be keywords Used to indicate that a result of an operation is not a number NAN Not A Number Example calculating the square root of a negative number NOTE The IEC 559 standard defines two classes of NAN quiet NAN QNAN and signaling NaN SNaN QNAN is a NAN with the most significant fraction bit set and a SNAN is a NAN with the most significant fraction bit clear Bit number 22 QNANs are allowed to propagate through most arithmetic operations without signaling an exception SNAN generally signal an invalid operation exception whenever they appear as operands in arithmetic operations See SW17 and S18 Mainly used in communication a network is a group of stations which communicate among one another The term network is also used to define a group of intercon nected graphic elements This group forms then a part of a program which may be composed
532. ter task is executed either cyclically or periodically Cyclical execution consists of stringing cycles together one after the other with no waiting time between the cycles 698 35006144 07 2012 Glossary DATE DATE_AND_TIME DBCD DDT The DATE type coded in BCD in 32 bit format contains the following information e the year coded in a 16 bit field e the month coded in an 8 bit field e the day coded in an 8 bit field The DATE type is entered as follows D lt Year gt lt Month gt lt Day gt This table shows the lower upper limits in each field Field Limits Comment Year 1990 2099 Year Month 01 12 The left 0 is always displayed but can be omitted at the time of entry Day 01 31 For the months 01 03 05 07 08 10 12 01 30 For the months 04 06 09 1 1 01 29 For the month 02 leap years 01 28 For the month 02 non leap years see DT Representation of a Double BCD format double integer The Binary Coded Decimal BCD format is used to represent decimal numbers between 0 and 9 using a group of four bits In this format the four bits used to code the decimal numbers have a range of unused combinations Example of DBCD coding e the number 78993016 e is coded 0111 1000 1001 1001 0011 0000 0001 0110 DDT is the abbreviation of Derived Data Type A derived data type is a set of elements of the same type ARRAY or of various types structure 35
533. ters 32 characters Comment 1024 characters 1024 characters Input Data 32 maximum 32 maximum Input Output data 32 maximum 32 maximum Output data 32 maximum 32 maximum Number of interfaces Inputs Outputs Inputs Outputs 32 maximum 2 32 maximum 2 Public data No limits 1 No limits 1 Private data No limits 1 No limits 1 Programming language C language Language e Structured Text Instruction List e Ladder language e function block Section A section is defined by e aname maximum 32 characters a validation condition a comment maximum 256 characters e a protection e without e read only e read write mode A section cannot access declared variables in the application except for e system double words SDi e system words SWi e system bits Si 1 the only limit is the size of the PLC s memory 2 the EN input and ENO output are not taken into account 298 35006144 07 2012 Data Types Characteristics of Elements Belonging to Function Blocks What is an element Each element interface data or internal data is defined by e aname see page 250 maximum 32 characters defined by the user e atype which can belong to the following families Elementary Data Types EDT e Derived Data Type DDT e Device Derived Data Type Device DDT e Function Block data types EFB DFB e an optional comment maximum 1024 char
534. th formal parameter names the procedure is called using an optional CAL instruction sequence followed by the name of the procedure and a bracketed list of actual parameter to formal parameter assignments The assignment of the input formal parameter is made using the assignment and the output formal parameter is made using the gt assignment The order in which the input formal parameters and output formal parameters are listed is not significant The list of actual parameters may be wrapped immediately following a comma EN and ENO can be used for this type of call 35006144 07 2012 519 Instruction List IL Calling a procedure with formal parameter names Formal Parameters Inputs Formal Parameters Outputs a eae ee PROC IN1 varl IN2 varl OUT1l gt resultl1 OUT2 gt result2 Actual Parameters Inputs Actual Parameters Outputs Procedure Name or CAL PROC IN1 varl IN2 varl OUT1 gt resultl OUT2 gt result2 or PROC IN1 varl IN2 varl OUT1 gt resultl OUT2 gt result2 or CAL PROC IN1 varl IN2 varl OUT1 gt resultl OUT2 gt result2 Calling the same procedure in FBD PROC varl IN1 OUT1 result1 var2 IN2 OUT2 result2 With formal calls values do not have to be assigned to all formal parameters see also Parameter see page 518 PROC IN1 varl OUT1 gt resultl OUT2 gt result2 or CAL PROC IN1 varl OUT1 gt resul
535. the alignment of data are not the same when the project is transferred from the simulator of Unity Pro to a M340 PLC So check the structure of the data of the project NOTE Unity Pro see Unity Pro Operating Modes indicates where the alignment seems to be different Check the corresponding instances in the data editor See the page of Project settings see Unity Pro Operating Modes to know how enable this option The table below gives some examples of data structures In the following examples structure type DDTs are addressed to 2Mwi The word s 1 byte corresponds to the least significant 8 bits and the word s 2 byte corresponds to the most significant 8 bits For all the following structures the first variable is mapped to the address sMW100 First Memory Address Description of the structure Modicon M340 Premium Para_PWM1 2mw100 15t byte 2mw100 15t byte t_period TIME MW102 15t byte MW102 15t byte t_min TIME 3Mw104 15t byte 3mMw104 15t byte in_max REAL Mode_TOTALIZER MW100 15t byte MW100 1 byte hold BOOL MW100 2 byte MW100 2 9 byte rst BOOL Info_TOTALIZER 2mw100 15t byte 2mw100 15t byte outc REAL 35006144 07 2012 289 Data Types First Memory Address Description of the structure 2Mw102 15t byte 2Mw102 15t byte cter UINT 2Mw103 15t byte MW103 15t byte done BOOL
536. the bases 0000000011010011 16 D3 1010101010101010 8 125252 0000000011010011 2 11010011 35006144 07 2012 279 Data Types the Dword Type The Dword type is coded in 32 bit format This table shows the lower upper limits of the bases which can be used Base Lower limit Upper limit Hexadecimal 16 0 16 FFFFFFFF Octal 8 0 8437777777777 Binary 2 0 2 11111111111111111111111111111111 Representation examples Data content Representation in one of the bases 00000000000010101101110011011110 16 ADCDE 00000000000000010000000000000000 8 200000 00000000000010101011110011011110 2 10101011110011011110 280 35006144 07 2012 Data Types 8 6 Derived Data Types DDT IODDT Device DDT Subject of this Section This section presents Derived Data Types These are e tables DDT e structures e structures concerning input output data IODDT e structures concerning other data DDT e structures concerning input output data of Modicon M340 Modules in Modicon M340 remote I O drops What Is in This Section This section contains the following topics Topic Page Arrays 282 Structures 285 Overview of the Derived Data Type family DDT 286 DDT Mapping Rules 288 Overview of Input Output Derived Data Types IODDT 291 Overview of Device Derived Data Types Device DDT 293 35006144 07 2012 281 Data Typ
537. the graphic sequence from top to bottom 35006144 07 2012 359 Function Block Language FBD Priorities Priorities in Defining the Signal Flow Within a Section Priority Rule Description 1 Link Links have the highest priorities in defining the signal flow within a FBD section User Definition User Access to Execution Sequence 3 Network by Processing on a network is ended completely before the Network processing begins on another network 4 Output Sequence FFBs that are linked to the outputs of the same calling FFB are processed from top to bottom 5 Rung by Rung Lowest priority Only applies if none of the other rules apply 360 35006144 07 2012 Function Block Language FBD Example Example of the Execution Sequence of Objects in an FBD Section NW1 NW2 NW3 9 EN AND 14 4 3 AND AND ENO 15 5 AND 17 10 AND 16 9 AND 18 11 AND AND AND EN ENO 20 AND NW4 AND 35006144 07 2012 361 Function Block Language FBD Change Execution Sequence Introduction Original Situation The execution order of networks and the execution order of objects within a network are defined by a number of rules see page 360 In some cases the execution order suggested by the system should be changed
538. the memory card with a non Schneider tool The memory card needs a structure to contain program and data Formatting with another tool destroys this structure Failure to follow these instructions can result in injury or equipment damage MW Backup The values of the MWi can be saved in the internal Flash memory using SW96 see page 193 These values will be restored at cold start including application download if the option Initialize of MW on cold start is unchecked in the processor Configuration screen see Unity Pro Operating Modes For sMw words the values can be saved and restored on cold restart or download if the option Reset of Mw on cold restart is not checked in the processor Configuration screen With the sSw96 word management of memory action MW internal words save delete and information on the actions states Mw internal words is possible Memory Card Specifics Two types of memory card are available e application these cards contain the application program and Web pages e application file storage these cards contain the application program data files from Memory Card File Management EFBs and Web pages 120 35006144 07 2012 Memory Structure Memory Structure of Premium and Atrium PLCs General The PLC memory supports e located application data e unlocated application data e the program task descriptors and executable code constant words initial values and configuration of
539. the mouse or the keyboard Input Aids The FBD editor offers the following input aids Toolbars for quick and easy access to the desired objects Syntax and semantics are checked as the program is being written e Incorrect functions and function blocks are displayed in blue e Unknown words e g undeclared variables or unsuitable data types are marked with a red wavy line e Brief description of errors in the Quickinfo Tooltip Information for variables and pins can be displayed in a Quickinfo Tooltip e type name address and comment of a variable expression e type name and comment of an FFB pin Tabular display of FFBs Actual parameters can be entered and displayed as symbols or topological addresses Different zoom factors Tracking of links Optimization of link routes Display of inspection windows 50 35006144 07 2012 Presentation Ladder Diagram LD Language Introduction The LD editor is used for graphical ladder diagram programming according to IEC 61131 3 Representation Representation of an LD section Left Power Rail Right Power Rail Topological Addresses IX1 5 6 IX1 5 5 QX2 1 Kd IX1 5 6 Fa Execution number Coil Inspection window Variabl Contact Function N A ARIE N IX1 5 6 XOR a EA Error EN ENO Q2 vas INI OUT Q3 E1061 Undefined Symbol Varx IN2 v4 Tooltip 35006144 07 2012 5
540. the queue for urgent aperiodic variables exchange requests is saturated for the time being the bus arbiter is in no position to latch onto nor to comply with a request bit 3 non urgent update command refused indicates that the queue for non urgent aperiodic variable exchange requests is saturated for the time being the bus arbiter is in no position to latch onto nor to comply with a request bit 4 pause fault the bus arbiter has not detected any bus activity during a time period larger than the standardized WorldFip time period bit 5 a network collision has occurred on identifier transmission indicates activity on the network during theoretical pause periods Between a transmission and awaiting a reply from the bus arbiter there should be nothing circulating on the bus If the bus arbiter detects activity it will generate a collision fault for example when several arbiters are active at the same time on the bus bit 6 bus arbiter overrun fault indicates a conflict on accessing the bus arbiter station memory bit 7 unused non significant value bit 8 to bit 15 reserved on 0 35006144 07 2012 219 System Objects Description of Premium Atrium System Words SW155 to SW167 Detailed Description Description of system words SW155 to SW167 Word Function Description Initial Symbol state SW155 Number of explicit Number of explicit exchanges currently being processed on Fipio 0 NBEX
541. the workstation as it is needed when recovering the project Restoring Unity Pro Application Exchange File ZEF or XEF This restoration consists of importing the ZEF or XEF files previously created and stored Importing from a ZEF or XEF format involves the re generation of the project To restore ZEF or XEF files follow the procedure below for each project Step Action 1 Launch Unity Pro Start Programs Schneider Electric SoCollaborative Unity Pro 2 Open the ZEF or XEF file from File Open menu The file type selected must be Unity Pro Full Application Exchange File ZEF or Unity Pro Application Exchange File XEF Click on Open Save the project as an STU file Computability Information The STU files are not compatible across Unity Pro versions In order to use a project with different Unity Pro versions users must either store the e Unity Pro Archived Application Files STA With the STA file it is possible to reuse the current built project with the new Unity Pro version installed on the computer e Unity Pro Application Exchange Files ZEF The ZEF file must be used if the project has been built e Unity Pro Application Exchange Files XEF The XEF file must be used if the project has been built 35006144 07 2012 31 Presentation Comparative File Types The following table gives a summary of the 4 files types
542. ting mode using the PLC MEM switch on the processor front panel For detailed information on how this switch works you can consult the Quantum manual see Quantum with Unity Pro Hardware Reference Manual e off position The application contained in this zone is automatically transferred to internal RAM when the PLC processor is powered up cold restart of the application on position The application contained in this zone is not transferred to internal RAM warm restart of the application 35006144 07 2012 151 Operating Modes Processing on Warm Restart for Premium Quantum PLCs Cause of a Warm Restart A warm restart may be caused e by a power restoral without loss of context e by the system bit S1 being set to 1 by the program e by Unity Pro from the terminal e bypressing the RESET button of the power supply module of rack 0 on Premium PLC Illustration The diagram below describes how a warm restart operates Acquisition of inputs Processor stopped Application context saved Power restoral TOP program execution If S1 1 processing of warm restart Configuration self test Vv Outage detected gt Setting of bit S1 to 1 lt j Setting of bit S1 to 0 Updating of outputs 152 35006144 07 2012 Operating Modes Operation The table below describes the program execu
543. tion e SW61 4 0 the applications are identical on both PLCs e SW61 5 Othe PLC is used as unit A 1 the PLC is used as unit B e SW61 6 indicates if the CPU sync link between the two PLC is valid e 0 The CPU sync link is operating properly The contents of bit 5 are significant 1 the CPU sync link is not valid In this case the contents of the bit 5 is not significant because the comparison of the two MAC addresses cannot be performed SW61 7 e 0 Same PLC OS version e 1 Different PLC version SW61 8 0 Same Copro OS version e 1 Different Copro version SW61 12 e 0 Information given by bit 13 is not relevant e 1 Information given by bit 13 is valid SW61 13 e 0 NOE address set to IP e 1 NOE address set to IP 1 e SW61 15 e 0 Hot Standby not activated e 1 Hot Standby activated 35006144 07 2012 223 System Objects Word Function Description Initial Symbol state SW62 Hot Standby These 4 words may be modified is the Hot Standby MAST task first section of 0 HSBY _ reverse the user application program REVERSEO transfer word They are then transferred automatically from the Standby processor to update SW63 the Primary PLC HSBY__ They may be read on the Primary PLC and used in the Hot Standby REVERSE1 application SW64 HSBY __ REVERSE2 SW65 HSBY REVERSE3 224 35006144 07 2012 System Objects Word Symbo
544. tion block Public variables are a supplement to IEC 61131 3 The assignment of values to public variables is made via their initial values or assignments Example Instance Name Public Variable D_ACT1 is an instance of the function se block D_ACT and has the public variables AREA_NR and OP_CTRL wr D_ACT1 OP_CTRL 1 Public variables are read via the instance name of the function block and the names of the public variables Example Instance Name Public Variable Varl D_ACT1 OP_CTRL 35006144 07 2012 567 Structured Text ST Private Variables In addition to inputs outputs and public variables some function blocks also provide private variables Like public variables private variables are used to transfer statistical values values that are not influenced by the process to the function block Private variables can not be accessed by user program These type of variables can only be accessed by the animation table NOTE Nested DFBs are declared as private variables of the parent DFB So their variables are also not accessible through programming but trough the animation table Private variables are a supplement to IEC 61131 3 Programming Notes Attention should be paid to the following programming notes e Functions blocks are only executed if the input EN 1 or the EN input is not used see also EN and ENO page 572 e The assignment of variables to ANY or ARRAY output types must be
545. tion languages Structured Text Instruction List etc These comprise e input variables internal variables output variables e a processing algorithm 246 35006144 07 2012 General Overview of Data Overview of Data Instances Introduction A data instance is an individual functional entity which has all the characteristics of the data type to which it belongs One or more instances can belong to a data type The data instance can have a memory allocation that is e unlocated or e located Illustration Memory allocation of instances dark gray belonging to the different types Function blocks Variables Device DDT Unlocated Unlocated Unlocated Unlocated Located Located 35006144 07 2012 247 General Overview of Data Definitions Definition of the memory allocations of data instances Data instance Definition Unlocated The memory slot of the instance is automatically allocated by the system and can change for each generation of the application The instance is located by a name symbol chosen by the user Located The memory slot of the instance is fixed predefined and never changes The instance is located by a name symbol chosen by the user anda topological address defined by the manufacturer or by the topological address of the manufacturer only 248 35006144 07 2012 General Overview of Data Overview of the Data Referenc
546. tion restart phases on warm restart Phase Description 1 Program execution resumes starting from the element where the power outage occurred without updating the outputs 2 At the end of the restart cycle the system carries out the following the initialization of message and event queues e the sending of configuration parameters to all discrete input output and application specific modules e the deactivation of the fast task and event processing until the end of the master task cycle 3 The system performs a restart cycle during which it e re acknowledges all the input modules e relaunches the master task with the bits S1 warm restart set to 1 resets bit S1 to 0 at the end of this first master task cycle e reactivates the fast task the auxiliary tasks and event processing at the end of this first cycle of the master task Processing a Warm Restart by Program In the event of warm restart if you want the application to be processed in a particular way you must write the corresponding program conditional on the test that S1 is set to 1 at the start of the master task program For Quantum PLCs the switch on the front panel of the processor can be used to configure operating modes For further details see Quantum documentation see Quantum with Unity Pro Hardware Reference Manual Output Changes for Premium and Atrium As soon as a power outage is detected the outputs are set in the fa
547. tion to this rule for internal word sMW lt i gt Flat word SIW lt i gt and constant word SKwW lt i gt memory variables any declared variable type is allowed Allowed mappings Syntax Data type Allowed variable types Internal bit SM lt i gt or MX lt i gt EBOOL EBOOL ARRAY OF EBOOL Internal word SMW lt i gt INT All types are allowed except EBOOL ARRAY OF EBOOL Internal double word SMD lt i gt DINT No mapping because of overlapping between SMW lt i gt and SMD lt i gt and SMF lt i gt Internal real SMF lt i gt REAL No mapping because of overlapping between SMW lt i gt and SMD lt i gt and SMF lt i gt 674 35006144 07 2012 IEC Compliance Syntax Data type Allowed variable types Constant word SKW lt i gt INT All types are allowed except EBOOL ARRAY OF EBOOL Constant double word KD lt i gt DINT No mapping because of overlapping between KW lt i gt and KD lt i gt and SKF lt i gt This kind of variables only exists on Premium PLCs Constant real SKF lt i gt REAL No mapping because of overlapping between SKW lt i gt and SKD lt i gt and SKF lt i gt This kind of variables only exists on Premium PLCs System bit SS lt i gt Or SX lt i gt EBOOL EBOOL System word SSW lt i gt INT INT System double word SSD lt i gt DINT DINT Fla
548. tion types are available for event processing e Sections for processing time controlled events Timerx Section e Sections for processing hardware controlled events Evtx Section The following programming languages are supported FBD Function Block Diagram LD Ladder Diagram Language IL Instruction List ST Structured Text 35006144 07 2012 47 Presentation Sections Subroutine Sections are autonomous program units in which the logic of the project is created The sections are executed in the order shown in the project browser structural view Sections are connected to a task The same section cannot be belong to more than one task at the same time The following programming languages are supported e FBD Function Block Diagram LD Ladder Diagram Language SFC Sequential Function Chart IL Instruction List ST Structured Text e e e e Subroutines are created as separate units in subroutine sections Subroutines are called from sections or from another subroutine Nesting of up to 8 levels is possible A subroutine cannot call itself not recursive Subroutines are assigned a task The same subroutine cannot be called by different tasks The following programming languages are supported e FBD Function Block Diagram LD Ladder Diagram Language IL Instruction List ST Structured Text 48 35006144 07 2012 Presentation Function Block Diagram FBD Introduction The
549. tions viewed technically The only difference to elementary functions is that procedures can occupy more than one output and they support data type VAR_IN OUT To the eye procedures are no different than elementary functions Procedures are a supplement to IEC 61131 3 and must be enabled explicitly Procedure 1 PROC EXAMP EN ENO INI OUTI IN2 OUT2 101 I0l Inputs and outputs are required to transfer values to or from an FFB These are called formal parameters Objects are linked to formal parameters these objects contain the current process states They are called actual parameters Formal and actual parameters Actual Parameters FBI_1 CTU EN ENO Actual Parameters CTU Clock 4 Q Output 11 1 3 R MUX 1 varl var2 py CV Current_Value Formal Parameters At program runtime the values from the process are transferred to the FFB via the actual parameters and then output again after processing 35006144 07 2012 379 Ladder Diagram LD Only one object actual parameter of the following types may be linked to FFB inputs Contact Variable Address Literal ST Expression ST expressions on FFB inputs are a supplement to IEC 61131 3 and must be enabled explicitly Link The following combinations of objects actual parameters can be linked to FFB outputs one or more coils one or more contacts one va
550. tivate or inhibit a task by using the following system bits System bits Task 530 MAST S31 FAST S32 AUXO S33 AUX1 S34 AUX2 835 AUX3 The task is active when the associated system bit is set to 1 These bits are tested by the system at the end of the master task When a task is inhibited the inputs continue to be read and the outputs continue to be written On startup of the application program for the first execution cycle only the master task is active At the end of the first cycle the other tasks are automatically activated except if one of the tasks in inhibited associated system bit set to 0 by the program Controls on Input Reading and Output Writing Phases The bits of the following system words can be used only when the PLC is in RUN to inhibit the input reading and output writing phases Inhibition of MAST FAST AUX0 AUX1 AUX2 AUX3 phases reading of SSW8 0 SSW8 1 SSW8 2 SSW8 3 SSW8 4 SSW8 5 inputs writing of SSwW9 0 SSwW9 1 SSW9 2 SSwW9 3 SSwW9 4 SSW9 5 outputs NOTE By default the input reading and output writing phases are active bits of system words SW8 and SW9 set to 0 On Quantum inputs outputs which are distributed via DIO bus are not assigned by the words SW8 and SW9 104 35006144 07 2012 Program Structure Assignment of Input Output Channels to Master Fast and Auxiliary Tasks General Each task writes and
551. tl OUT2 gt result2 Calling the same procedure in FBD PROC varl JIN1 OUT1 result1 IN2 OUT2 result2 520 35006144 07 2012 Instruction List IL Informal Call without CAL Instruction With this type of call call without formal parameter names procedures are called using an instruction sequence consisting of the first actual parameter loaded into the accumulator followed by the procedure name followed by a list of the input and output actual parameters The order in which the actual parameters are listed is significant The list of actual parameters cannot be wrapped EN and ENO cannot be used for this type of call Calling a procedure with formal parameter names Actual Parameters Inputs LD varl PROC var2 resultl result2 Actual Parameters Outputs Procedure Name Calling the same procedure in FBD PROC varl JIN1 OUT1 result1 var2 IN2 OUT2 result2 NOTE Note that when making an informal call the list of actual parameters cannot be put in brackets IEC 61133 3 requires that the brackets be left out in this case to illustrate that the first actual parameter is not a part of the list Invalid informal call for a procedure LD A LIMIT B C If the value to be processed first actual parameter is already in the accumulator the load instruction can be omitted EXAMP1 var2 result1 result2 35006144 07 2012 521 Instruction
552. to 1 by the system when all the detected errors disappear S118 General Normally set to 1 this bit is set to 0 by the YES YES YES REMIOERR Remote I O system when a fault occurs on a device fault connected to the RIO Fipio for Premium or Drop S908 for Quantum remote input output bus This bit is reset to 1 by the system when the fault disappears This bit is not updated if an error occurs on the other buses DIO ProfiBus ASI S119 General in Normally set to 1 this bit is set to 0 by the YES YES YES LOCIOERR rack I O system when a fault occurs on an I O fault module placed in one of the racks This bit is reset to 1 by the system when the fault disappears CAUTION S119 for Quantum PLCs On Quantum network communication errors with remote devices detected by communication modules NOM NOE NWM CRA CRP and motion modules MMS are not reported on bits 3S10 S16 and S119 Failure to follow these instructions can result in injury or equipment damage 35006144 07 2012 177 System Objects Bit Symbol Function Description Initial state Modicon M340 Premium Quantum Atrium S120 DIOERRPLC DIO bus fault CPU Normally set to 1 this bit is set to 0 by the system when a fault occurs on a device connected to the DIO bus managed by the Modbus Plus link built into the CPU This bit is not available on Quantum safety PLCs I
553. to modify them e The switch from 1 to O updates the real time clock with the values entered in words SW50 to SW53 S51 Time lossin This system managed bit set to 1 indicates YES YES YES RTCERR real time that the real time clock is missing or that its clock system words SW50 to SW53 are meaningless In this case the clock must be reset to the correct time S59 Incremental Normally set to 0 this bit can be set to 1 or 0 YES YES YES RTCTUNING update of the 0 by the program or the terminal time and date e setto 0 the system does not manage the via word system word SW59 SW59 e set to 1 the system manages edges on word SW59 to adjust the date and current time by increment 35006144 07 2012 169 System Objects Description of System Bits S65 to S79 Detailed Description Description of system bits 3S65 to S79 Bit Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum S65 CARDIS memory card disable This bit is used to ensure information consistency when a memory card is extracted from the CPU To do this it is necessary to generate a rising edge on the bit 3S65 before extracting the memory card On a rising edge detection the card accessing LED turns off when the current accesses are finished reading and writing of files application saving The CARDERR LED is unchanged Now the memory card can be extracted the CARDERR LED remains or
554. tomatically and has the following structure TYPE_n where TYPE is the function block type name TYPE_n e TYPE Function block type name e n sequential number of the function block in the project NOTE Prior to Unity Pro V6 0 the instance name was created automatically with the structure FBI_n where FBI Function Block Instance This automatically generated name can be modified for clarification The instance name max 32 characters must be unique throughout the project and is not case sensitive The instance name must conform to general naming conventions NOTE To conform to IEC61131 3 only letters are permitted as the first character of the name If you want to use a numeral as your first character however this must be enabled explicitly 35006144 07 2012 377 Ladder Diagram LD Elementary Function Block CTU 1 1 CTU EN ENO CTU Q R RV CV DFB Derived function blocks DFBs have the same properties as elementary function blocks The user can create them in the programming languages FBD LD IL and or ST The only difference to elementary function blocks is that the derived function block is represented as a frame with double vertical lines Derived Function Block DFB_EXAMP 1 1 DFB_EXAMP EN ENO IN1 OUTI IN2 IN3 OUT2 378 35006144 07 2012 Ladder Diagram LD Procedure Parameters Procedures are func
555. ts of word SW116 SW116 0 1 explicit exchange error variable has not been exchanged on the bus SW116 1 1 time out onan explicit exchange no reply at the end of time out SW116 2 1 maximum number of explicit exchanges achieved at the same time SW116 3 1 a frame is invalid SW116 4 1 the length of frame received is greater than the length that was declared SW116 5 reserved on 0 SW116 6 1 a frame is invalid or an agent is initializing SW116 7 1 absence of a configured device SW116 8 1 channel fault at least one device channel is indicating a fault SW116 9 to 15 reserved on 0 Word Function Description Initial Modicon Quantum Premium Symbol state M340 Atrium SW108 Forced bit Word SW108 0 YES YES YES FORCEDIOIM counting increments each time an discrete bit status l Q or M is forced register e decrements each time an discrete bit is unforced SW109 Forced Word SW109 0 YES YES YES FORCEDANA analog e increment each time an analog channel channel is forced counting decrement each time an analog status channel is unforced register SW116 Fipio I O Normally set to 0 each bit for this word NO NO YES REMIOERR error signifies the Fipio exchange status of the 1 Limited to analog channels of Modicon M340 Analog Modules in M340 remote I O drops 35006144 07 2012 205 System Objects Description of Sys
556. ty PLCs SW1 Fast task This word is used to modify the period of 0 YES YES YES FASTPERIOD scanning the fast task via the user program or via except period the terminal for safety The period is expressed in milliseconds PLCs 1 255 ms On a cold restart it takes the value defined by the configuration This word is not available on Quantum safety PLCs SW2 Auxiliary This word is used to modify the period of 0 NO YES 1 YES 1 AUXOPERIOD task the tasks defined in the configuration via except SW3 scanning the user program or via the terminal for safety AUX1PERIOD period The period is expressed in tens of ms PLCs SW4 10ms to 2 55s AUX2 PERIOD SW5 1 only on 140 CPU 6ee and TSX 57 5ee AUX3PERIOD PLCs These words are not available on Quantum safety PLCs SWE IP Address Gives the IP address of the CPU Ethernet YES NO NO SW7 port Modification is not taken into account Is 0 if the CPU does not have an Ethernet link 180 35006144 07 2012 System Objects Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW8 TSKINHIBIN Acquisition of task input monitoring Normally set to 0 this bit can be set to 1 or 0 by the program or the terminal It inhibits the input acquisition phase of each task SW8 0 1 inhibits the acquisition of inputs relating to the MAST task SW8
557. ucture of a Sequence Controller IEC conforming sequential control is created in Unity Pro from SFC sections top level transition sections and action sections These SFC sections are only allowed in the Master Task of the project SFC sections cannot be used in other tasks or DFBs In Single Token each SFC section contains exactly one SFC network sequence In Multi Token an SFC section can contain one or more independent SFC networks Objects An SFC section provides the following objects for creating a program Step see page 421 Macro Step embedded sub step see page 424 Transition transition condition see page 436 Jump see page 440 Link see page 441 Alternative branch see page 443 Alternative junction see page 443 Parallel branch see page 445 Parallel junction see page 445 Comments regarding the section logic can be provided using text objects related topics Text Object page 447 35006144 07 2012 415 SFC Sequence Language Representation of an SFC Section Appearance gT Link S_4_1 way Initial Step t Transition condition Boolean Variable i Parallel branch S_4_2 S_4_5 Step associated to an action Ta T_4_2 ee Se Alternative branch 110 Mir Transition condition return value of a transition section S _4_3 S_4 6 S_4_9 S_4 7 oe Jump 14 4 lion 1106 Tran
558. uctures The IODDT types are structures whose size the number of elements of which they are composed depends on the channel or the input output module that they represent A given input output module can have more than one IODDT The difference with a conventional structure is that e the IODDT structure is predefined by the manufacturer e The elements comprising the IODDT structure do not have a contiguous memory allocation but rather a specific address in the module Examples IODDT structure for an input output channel of an analog module ANA_IN_GEN ANA_IN_ GEN type structure Value INT Input value Err BOOL Channel error 35006144 07 2012 291 Data Types Access to the data of an instance of the ANA_IN_GEN type Cistern Level ANA_IN_GEN ANA IN GEN type instance which corresponds for example to a tank level sensor Cistern Level Value Reading of the channel input value Cistern_Level Err Reading of channel error bit Access by direct addressing For channel 0 of module 2 of rack 0 we obtain Cistern Level corresponds to CH0 2 0 Cistern Level Value corresponds to IW0 2 0 0 Cistern Level Err corresponds to 10 2 0 ERR 292 35006144 07 2012 Data Types Overview of Device Derived Data Types Device DDT At a Glance A Device DDT is a DDT predefined by the manufacturer and not modifiable by user and contain the I O language elements of an I O Module Illustration Device DDT structures
559. uration Initialization from Unity Pro Start in STOP or in RUN retaining the Forcing the system bit SO operating mode in progress at downtime without initialization of discrete input output and application specific modules Restoral after power supply outage with loss Cold start forced in STOP or RUN mode as of context defined in the configuration CAUTION LOSS OF DATA ON APPLICATION TRANSFER Loading or transferring an application to the PLC typically involves initialization of unlocated variables To save located variables with Premium and Quantum PLCs e Save and restore 3M and MW by clicking PLC Transfer Data For Premium PLCs e Avoid the initialization of Mw by unchecking Initialize MWi on cold start in the configuration screen of the CPU For Quantum PLCs e Avoid the initialization of sMw by unchecking MWi Reset in the configuration screen of the CPU It is necessary to assign a topological address to the data if the process requires keeping the current values of the data when transferring the application Failure to follow these instructions can result in injury or equipment damage 35006144 07 2012 147 Operating Modes Illustration Acquisition of inputs Vv TOP program execution If SW10 0 0 possible processing of cold restart Power failure gt micro cut No BOT Vv Setting of bit S0 to 0 and sett
560. urrent value is maintained depending on the choice made in the configuration After power restoral the outputs remain at zero until they are updated by the task Output Changes for Quantum As soon as a power outage is detected e the local outputs are set to zero e the outputs of the remote or distributed extension racks are set in the fallback position After power restoral the outputs remain at zero until they are updated by the task NOTE The behavior of forced outputs was changed between Modsoft NxT Concept and Unity Pro With Modsoft NxT Concept you cannot force outputs if the Quantum processor memory protection switch is set to On With Unity Pro you can force outputs if the Quantum processor memory protection switch is set to On With Modsoft NxT Concept forced outputs retain their status after a cold start With Unity Pro forced outputs lose their status after a cold start A CAUTION UNEXPECTED APPLICATION BEHAVIOR FORCED VARIABLES Check your forced variables and memory protection switch when shifting betweenModsoft NxT Concept and Unity Pro Failure to follow these instructions can result in injury or equipment damage 150 35006144 07 2012 Operating Modes For Quantum 140 CPU 31 9 41 e 51 These processors have a Flash EPROM memory of 1 435 KB which can be used to save the program and the initial values of variables On power restoral you can choose the desired opera
561. us declaration In this case the data type is assigned to the address directly The assignment is made using the Large prefix The different large prefixes are given in the following table Large prefix Example Data type Symbol no prefix 110 SCH203 MOD 3CH203 MOD ERR BOOL x SMX20 BOOL B QB102 3 BYTE W SKW43 INT D QD100 DINT F SMF100 REAL Using Other Data Types Should other data types be assigned as the default data types of an address this must be done through an explicit declaration This variable declaration takes place comfortably using the variable editor The data type of an address can not be declared directly in an ST section e g declaration AT MW1 UINT not permitted The following variables are declared in the variable editor UnlocV1l ARRAY 1 10 OF INT LocV1 ARRAY 1 10 OF INT AT MW100 Locv2 TIME AT MW100 The following calls then have the correct syntax SMW200 5 ST Unlocv1 2 LD t 3s ST Locv2 D LocV1 SMW200 482 35006144 07 2012 Instruction List IL Accessing Field Variables When accessing field variables ARRAY only literals and variables of INT DINT UINT and UDINT types are permitted in the index entry The index of an ARRAY element can be negative if the lower threshold of the range is negative Example Saving a field variable LD var1 i ST var2 otto 4 35006144 07 2012
562. ut followed by the assignment instruction then the function name and then by a bracketed list of value assignments actual parameters to the formal parameter The order in which the formal parameters are enumerated in a function call is not significant EN and ENO can be used for this type of call Calling a function with formal parameter names Actual Parameter Output Formal Parameters out LIMIT MN 0 IN varl MX 5 var Function Name Actual Parameters Inputs Calling the same function in FBD LIMIT 0 MN M out vari IN 5 var MX With formal calls it is not necessary to assign a value to all formal parameters see also Parameters page 560 out LIMIT MN 0 IN varl Calling the same function in FBD LIMIT 0 MN OUT out vari IN 562 35006144 07 2012 Structured Text ST Informal Call With informal calls calls without formal parameter names the call consists of the actual parameter of the output followed by the symbol of the assignment instruction then the function name and then by a bracketed list of the inputs actual parameters The order that the actual parameters are enumerated in a function call is significant EN and ENO cannot be used for this type of call Calling a function without formal parameter names Actual Parameter Output out LIMIT 0 Vari 5 var Function Name Actual Parameters
563. ut aids e Syntax and semantics are checked as the program is being written e Keywords and comments are displayed in color e Unknown words e g undeclared variables or unsuitable data types are marked with a red wavy line e Brief description of errors in the Quickinfo Tooltip Tabular display of the functions and function blocks Input assistance for functions and function blocks Operands can be entered and displayed as symbols or topological addresses Display of inspection windows 35006144 07 2012 57 Presentation Structured Text ST Introduction The ST editor is used for programming in structured text according to IEC 61131 3 Representation Representation of an ST section Operator Operand Comment Instruction D B B 4 A C Basis Calculation IF D lt 0 0 THEN NROOTS 0 ELSIF D 0 0 THEN Inspection window NROOTS 1 X1 B 2 0 A ELSE Expression NROOTS 2 CA X1 CB SORT D 0 A P X2 CB SQRT D 2 0 A END IF Tooltip Varx 15 Undeclared Variable Wie E1061 Undefined Symbol Varx Objects The ST programming language works with Expressions Expressions are constructions consisting of operators and operands that return a value when executed Operators are symbols representing the operations to be executed Operators are used for operands Operands are variables literals function and function block inputs
564. utput see page 591 parameters IOODT that Can Be Used in a DFB The following table lists the IODDTs of the differente application for Modicon M340 Premium and Quantum PLCs that can be used in a DFB IODDT families Modicon M340 Premium Quantum Discrete application T_DIS_IN_GEN No No No T_DIS_IN_STD No No No T_DIS_EVT No No No T_DIS_OUT_GEN No No No T_DIS_OUT_STD No No No T_DIS_OUT_REFLEX No No No Analog application T_ANA_IN_GEN No No No T_ANA_IN_STD No No No T_ANA_IN_CTRL No Yes No T_ANA_IN_EVT No Yes No T_ANA_OUT_GEN No No No T_ANA_OUT_STD No No No T_ANA_IN_BMX Yes No No T_ANA_IN_T_BMX Yes No No T_ANA_OUT_BMX Yes No No T_ANA_IN_VE No No No T_ANA_IN_VWE No No No T_ANA_BI_VWE No No No T_ANA_BI_IN_VWE No No No Counting application T_COUNT_ACQ No Yes No T_COUNT_HIGH_SPEED No Yes No T_COUNT_STD No Yes No 35006144 07 2012 611 Use of DFBs IODDT families Modicon M340 Premium Quantum T_SIGN_CPT_BMX Yes No No T_UNSIGN_CPT_BMX Yes No No T_CNT_105 No No No Electronic cam application T_CCY_GROUPO No No No T_CCY_GROUP1_2 3 No No No Axis control application T_AXIS_AUTO No Yes No T_AXIS_STD No Yes No T_INTERPO_STD No Yes No T_STEPPER_STD No Yes No Sercos application T_CSY_CMD No Yes No T_CSY_TRF No Yes No T_CSY_R
565. uts of the procedure are set to 0 The output behavior of the procedure does not depend on whether the function is called without EN or with EN 1 35006144 07 2012 577 Structured Text ST If EN ENO are used the procedure call must be formal The assignment of variables to ENO must be made using the gt operator PROC EN 1 IN1 varl IN2 var2 ENO gt error OUT1 gt resultl OUT2 gt result2 Calling the same procedure in FBD PROC 1 EN ENO error vari IN1 OUT1 result1 var2 IN2 OUT2 result2 VAR_IN_OUT Variable Procedures are often used to read a variable at an input input variables to process it and to restate the altered values of the same variable output variables This special type of input output variable is also called a VAR_IN_ OUT variable The following special features are to be noted when using procedures with VAR_IN_OUT variables e All VAR_IN_OUT inputs must be assigned a variable e VAR_IN_OUT inputs may not have literals or constants assigned to them e VAR_IN_OUT outputs may not have values assigned to them e VAR_IN_OUT variables cannot be used outside of the procedure call Calling a procedure with VAR_IN_OUT variable in ST PROC2 IN1 V1 IN2 V2 I01 V3 OUT1 gt V4 OUT2 gt V5 Calling the same procedure in FBD PROC2 vV1 IN1 OUT1 V4 v2 IN2 OUT2 V5 V3 101 101 V3 VAR_IN_OUT
566. v CV 35006144 07 2012 345 Function Block Language FBD DFB Procedure Derived function blocks DFBs have the same properties as elementary function blocks The user can create them in the programming languages FBD LD IL and or ST The only difference to elementary function blocks is that the derived function block is represented as a frame with double vertical lines Derived Function Block DFB_EXAMP 1 1 DFB_EXAMP m1 OUTI IN2 IN3 OUT2 Procedures are functions viewed technically The only difference to elementary functions is that procedures can occupy more than one output and they support data type VAR_IN_ OUT Procedures are a supplement to IEC 61131 3 and must be enabled explicitly To the eye procedures are no different than elementary functions Procedure PROC EXAMP 2 PROC_EXAMP INI OUTI IN2 OUT2 101 101 346 35006144 07 2012 Function Block Language FBD Parameters Inputs and outputs are required to transfer values to or from an FFB These are called formal parameters Objects are linked to formal parameters these objects contain the current process states They are called actual parameters Formal and actual parameters Actual Parameters CTU 2 1 Actual Parameters CTU Clock CTU Q Output 11 1 3 R MUX 1 varl var2 PV CV Current_Value Formal Parameters At pr
567. variables cannot be used outside of the procedure call 578 35006144 07 2012 Structured Text ST The following procedure calls are therefore invalid Invalid call example 1 InOutProc inout V Assigning the variables v1 to a VAR_IN_OUT parameter Error The operation cannot be executed since the VAR_IN_OUT parameter cannot be accessed outside of the procedure call Invalid call example 2 V1 InOutProc inout Assigning a VAR_IN_OUT parameter to the v1 variable Error The operation cannot be executed since the VAR_IN_OUT parameter cannot be accessed outside of the procedure call The following procedure calls are always valid Valid call example 1 InOutProc inout V1 Calling a procedure with the VAR_IN_OUT parameter and formal assignment of the actual parameter within the procedure call Valid call example 2 InOutProc V1 Calling a procedure with the VAR_IN_OUT parameter and informal assignment of the actual parameter within the procedure call 35006144 07 2012 579 Structured Text ST 580 35006144 07 2012 User Function Blocks DFB In This Part This part presents What Is in This Part This part contains the following chapters The user function blocks DFB The internal structure of DFBs Diagnostics DFBs The types and instances of DFBs The instance calls using different languages
568. vate all branches Since the transition after the parallel joint is only evaluated if all steps which directly precede the transition are set the parallel string can no longer be departed the string is blocking Jump into a Parallel String Jump into a Parallel String a gt Sii S_1_2 b S_1_3 c S_1_1 If Then If the transition condition a is true then a sequence runs to S_1_1 ands_1 2 If steps Ss_1_1 and s_1_2 are activated then the strings run independently of one another IfS_1 2 is active and transition condition b is true then a sequence runs from s 1 2toS 1 3 IfS_1 1ands_1 3 are active and transition condition c which belongs to the common transition is true then a sequence runs from S_1 1 ands _ 1 3 to a jump tos 11 If S_1_1 is activated by the jump then only the branch from s_1_ 1 is active The branch from s_1 2 is not active Since S_1 1 ands _1 3 are not active at the same time the string cannot continue The string is blocked This block can removed by e g a second timed token that is set to reactivate step S_1 2 35006144 07 2012 469 SFC Sequence Language Jump out of a Parallel String Introduction The ability to jump into a parallel string or out of a parallel string can be enabled optionally with multi token Extra tokens are generated in all cases Jump out of a Parallel
569. ved data type are as follows e 10 nesting levels tables structures e 6 dimensions per table e 4 digits figures to define the index of a table element 318 35006144 07 2012 Data Instances Direct Addressing Data Instances At a Glance Access Syntax What is a direct addressing data instance see page 315 The syntax of a direct addressing data instance is defined by the symbol followed by a memory location prefix and in certain cases some additional information The memory location prefix can be M Internal Variables Access syntax M for internal variables K for constants Premium and Modicon M340 S for system variables N for network variables l for input variables Q for output variables Syntax Format Example Program access rights Bit M lt i gt or 3 bits EBOOL M1 R W MX lt i gt Word MW lt i gt 16 bits INT MW10 R W Word extracted MW lt i gt lt j gt 1 bit BOOL MW15 5 R W bit Double word MD lt i gt 1 32 bits DINT MD8 R W Real floating MF lt i gt 1 32 bits REAL MF15 R W point Legend 1 Not available for Modicon M340 lt i gt represents the instance number starts a 0 for Premium and 1 for Quantum For Modicon M340 double type instance double word or floating instance real must be located in an integer type MW The index lt i gt of the MW has to be even NOTE The M lt i gt or MX lt
570. word is not available on Quantum safety PLCs 0 YES YES YES except for safety PLCs SW11 WDGVALUE Watchdog duration Reads the duration of the watchdog The duration is expressed in milliseconds 10 1500 ms This word cannot be modified NOTE The duration range in Quantum Safety PLCs is 20 990 ms YES YES YES 35006144 07 2012 183 System Objects Description of System Words SW12 to SW29 Detailed Description Description of system words SwW12 to sSW29 Word Symbol Function Description Initial state Modicon M340 Premium Atrium Quantum SW12 UTWPORTADDR Processor serial port address For Premium Uni Telway address of terminal port in slave mode as defined in the configuration and loaded into this word on cold start The modification of the value of this word is not taken into account by the system For Modicon M340 Gives the Modbus slave address of the CPU serial port Modification is not taken into account Is 0 if the CPU does not have a Serial Port link YES YES NO see SW12 below SW12 APMODE Mode of the application processor For Quantum safety PLC only this word indicates the operating mode of the application processor of the CPU module 16 A501 maintenance mode e 16 5AFE safe mode Any other value is interpreted as an error Note In a HotStand By safety system thi
571. ws you to change the variables names sections or functional modules The mapping of addresses can also be modified 60 35006144 07 2012 Presentation User Documentation User Documentation Scope of the user documentation Documentation BE lki Es Station B Titl Exclude all headings T NE Qol x B y 7 7 arameter E A co ax Structure documentation file El View Print filling feeding box E xD Mixing 0 EFEN IL1 Exclude heading l loat Include headings o E C Ee SRsec Print H x Events a Q Animation tables f Footer E The following are just some of the services provided for documenting the project Print the entire project 2 or in sections 3 Selection between structural and functional view 1 Adjustment of the result footer general information etc Local printing for programming language editors configurator etc Special indication bold for keywords Paper format can be selected Print preview 4 Documentation save 35006144 07 2012 61 Presentation Debug Services Searching for Errors in the User Application The following are just some of the features provided to optimize debugging in the project Set breakpoints in the programming language editors e Step by step program execution including step into step out and step over e Call memor
572. xample for a Derived Function Block DFB Use of the DFBs from the Different Programming Languages ici Geet hice en a eee aN eames Rules for Using DFBs ina Program 0 0 eee eee eee Use of IODDTs inaDFB raa i a T a a a a Use of a DFB in a Ladder Language Program 44 Use of a DFB in a Structured Text Language Program Use of a DFB in an Instruction List Program 2 0 05 Use of a DFB in a Program in Function Block Diagram Language User Diagnostics DFB 200e ee ee eens Presentation of User Diagnostic DFBs 0a eae EFB Error Codes and Values 000se0ees Tables of Error Codes for the Base Library 00 0 0 ee Tables of Error Codes for the Diagnostics Library Tables of Error Codes for the Communication Library Tables of Error Codes for the IO Management Library 552 553 554 555 556 557 558 559 560 566 574 581 583 584 586 589 590 592 596 598 601 602 603 604 35006144 07 2012 Appendix B B 1 B 2 B 3 B 4 Glossary Index Tables of Error Codes for the CONT_CTL Library 644 Tables of Error Codes for the Motion Library 00 651 Tables of Error Codes for the Obsolete Library 653 Common Floating Point Errors 2 2 0 0 0 cece eee 660 IEC Compliance 232 s6 asset
573. y Pro 4 1 If this project setting is set to O the value of the link is set to O If this project setting is set to 1 the link maintains the old value it had during the last correctly executed cycle For detailed information please refer to Maintain output links on disabled EF see Unity Pro Operating Modes The OUT 1 variable on the same pin either retains its previous status or can be changed externally without influencing the link The variable and the link are saved independently of each other The output behavior of the FFBs does not depend on whether the FFBs are invoked without EN ENO or with EN 1 NOTE For disabled function blocks EN 0 with an internal time function e g function block DELAY time seems to keep running since it is calculated with the help of a system clock and is therefore independent of the program cycle and the release of the block 35006144 07 2012 385 Ladder Diagram LD VAR_IN_OUT Variable FFBs are often used to read a variable at an input input variables to process it and to output the altered values of the same variable output variables This special type of input output variable is also called a VAR_IN_OUT variable The link between input and output variables is represented by a line in the FFB VAR_IN_OUT variable a 1 EXAMP1 EN ENO Input IN1 OUTI Output Input2 IN2 OUT2 Output2 Comb_IN_O
574. y bit is updated during the coil execution The following examples show the different behavior depending on the variable type Variable A is define as BOOL whenever A is set to 1 sMW1 is incremented by 1 A OPERATE P YMW1 MW1 1 398 35006144 07 2012 Ladder Diagram LD Variable B is defined as EBOOL the behavior is different when compared with variable A While B is set to 1 sMW2 is incremented by 1 because the history bit is not updated B OPERATE WMW2 MW2 1 35006144 07 2012 399 Ladder Diagram LD Variable c is defined as EBOOL the behavior is identical than variable A The history bit is updated C OPERATE P AMW3 MW3 1 MW3 Forcing of Coils Can Cause the Loss of Edge Recognition Forcing of coils can cause the loss of edge recognition In the example when A equals 1 B should equal 1 and with a rising edge from A the coil B will be set for a cycle In this example the variable B is first assigned to the coil and then to the link to recognize positive edges A B on Mae of Z O 8 8 8 7 B E 1 A Value bit z z z z mwee ae a a ST sea idio i B History Bit i i i eres C Value bit l 400 35006144 07 2012 Ladder Diagram LD At the beginning of the second cycle the value bit of B equals 0 When forcing B within this cycle the force bit and v
575. y for recalling the entire program path e Control inputs and outputs Online Mode Online mode is when a connection is established between the PC and the PLC Online mode is used on the PLC for debugging for animation and for changing the program A comparison between the project of the PC and project of the PLC takes place automatically when the connection is established This comparison can produce the following results e Different projects on the PC and the PLC In this case online mode is restricted Only PLC control commands e g start stop diagnostic services and variable monitoring are possible Changes cannot be made to the PLC program logic or configuration However the downloading and uploading functions are possible and run in an unrestricted mode same project on PC and PLC e Same projects on the PC and the PLC There are two different possibilities e ONLINE SAME BUILT The last project generation on the PC was downloaded to the PLC and no changes were made afterwards i e the projects on the PC and the PLC are absolutely identical In this case all animation functions are available and unrestricted e ONLINE EQUAL NOT BUILT The last project generation on the PC was downloaded to the PLC however changes were made afterwards In this case the animation functions are only available in the unchanged project components 62 35006144 07 2012 Presentation Animation Different possibilities are provided for t
576. y modifications as there are instances This table presents the instances of arrays of different dimensions Entry Comments Tab_1 ARRAY 1 2 OF BOOL 1 dimensional array with 2 Boolean words Tab_2 ARRAY 10 20 OF WORD 1 dimensional array with 31 WORD type structures structure defined by the user Tab_3 ARRAY 1 10 1 20 OF INT 2 dimensional arrays with 10x20 integers Tab_4 ARRAY 0 2 1 1 201 300 0 1 OF 4 dimensional arrays with 3x3x100x2 reals REAL NOTE Many functions READ_VAR WRITE_VAR for example don t recognize the index of an array of words starting by a number different from 0 If you use such an index the functions will look at the number of words in the array but not at the starting index set in the definition of the array A WARNING UNEXPECTED APPLICATION BEHAVIOR INVALID ARRAY INDEX When applying functions on variables of array type check that the functions are compatible with the arrays starting index value when this value is greater than 0 Failure to follow these instructions can result in death serious injury or equipment damage 35006144 07 2012 283 Data Types Access to a data item in array Tab_1 and Tab_3 Tab_1 2 7TO access second element Tab_3 4 18 7To access eighteenth element of the fourth sub array Inter Arrays Assignment Rules There are the 4 following arrays Tab _1 ARRAY 1 10 OF INT Tab 2 ARRAY 1 10 OF
577. y the defined value It can be changed by the user Exploitation of Master Task Execution Times The following system words can be used to obtain information on the cycle time e SW30 contains the execution time of the last cycle e SW31 contains the execution time of the longest cycle e SW232 contains the execution time of the shortest cycle NOTE These different items of information can also be accessed explicitly from the configuration editor 94 35006144 07 2012 Program Structure Execution of Quantum Sections with Remote Inputs Outputs General Quantum PLCs have a specific section management system It applies to stations with remote inputs outputs These stations are used with following RIO modules e 140 CRA 931 00 e 140 CRA 932 00 This system allows remote inputs outputs to be updated on sections with optimum response times without waiting for the entire task cycle before updating the inputs outputs Operation The following diagram shows the IO phases when 5 drops are associated to client task sections Process USER EXEC pozcozosa Update query li inputs of drop No i Qi outputs of drop No i i drop number 35006144 07 2012 95 Program Structure Description Phase Description 1 Request to update e the inputs of the first drop i 1 e the outputs of the last drop i 5 2 Processing the program e Updating the inputs of the first drop i 1 e Requ
578. zard exists which will result in personal injury if the instructions are not followed personal injury hazards Obey all safety messages that follow this symbol to avoid possible injury or death A DANGER DANGER indicates an imminently hazardous situation which if not avoided will result in death or serious injury A WARNING WARNING indicates a potentially hazardous situation which if not avoided can result in death or serious injury This is the safety alert symbol It is used to alert you to potential 35006144 07 2012 11 PLEASE NOTE A CAUTION CAUTION indicates a potentially hazardous situation which if not avoided can result in minor or moderate injury NOTICE NOTICE is used to address practices not related to physical injury Electrical equipment should be installed operated serviced and maintained only by qualified personnel No responsibility is assumed by Schneider Electric for any consequences arising out of the use of this material A qualified person is one who has skills and knowledge related to the construction and operation of electrical equipment and its installation and has received safety training to recognize and avoid the hazards involved 12 35006144 07 2012 About the Book A At a Glance Document Scope This manual describes the elements necessary for the programming of Premium Atrium and Quantum PLCs using the Unity Pro programmi
Download Pdf Manuals
Related Search
Related Contents
Pourquoi le collectif ? - no JVC AV-20FA44 20" TV user manual DMX-TX module for the LFXHub - movie Samsung AQ12FEN دليل المستخدم Instalacion - Michael Widler DocuColor 8000/7000 EZ3560C Ergotron Neo Flex All-In-One Lift Stand Copyright © All rights reserved.
Failed to retrieve file