240 likes | 375 Vues
This lesson enables learners to program control logic using the Instruction List (IL) Editor, a low-level textual language similar to a simple machine assembler. Students will acquire skills to both write and comprehend IL, including logical, arithmetic, comparison operations, and function blocks (FBs). Advantages include simplicity and optimized code for straightforward problems, while drawbacks involve difficulties in readability and flow tracking. The lesson covers various operations, jumps, and inputs/outputs, emphasizing a structured approach to effectively utilize IL for PLC programming.
E N D
Concept V2.5 • Lesson 18 Objectives: • After completing this lesson, the learner will be able to: • Program control logic using the Instruction List Editor. • Demonstrate an understanding of the Instruction List Editor.
Concept V2.5 • Instruction List (IL) is a low level textual language which has a structure similar to a simple machine assembler. • The IEC has developed IL by reviewing the many low level languages offered by PLC manufacturers. • IL provides a wide range of operators that represent those most commonly found in proprietary instruction list languages of current day PLCs
Concept Programming in IL • Advantages: • The basic structure of IL is very simple and easy to learn • Ideal for solving small straight-forward problems where there are few decision points and a limited number of changes in program execution flow • Tight, optimized and fast code for performance critical sections of a program (e.g., DFBs) • Disadvantages: • Difficult to write, read and understand the program • Difficult to follow the program flow
Concept V2.5 • With IL the following operations can be executed: • logical (AND...), arithmetic (ADD...), compare (GT...) operations and assignments (ST, S, R). • Jumps within a section unconditioned / conditioned (JMP / JMP C, JMP CN) • Functions and function blocks unconditioned / conditioned (CAL / CAL C, CAL CN) • Before invoking an FFB, it has to be declared usingVAR and END_VAR. • Each FFB instance must be invoked once. • Multiple invocation (instantiation) is allowed! • FFB-call: • with CAL and a list of input parameters or • with CAL and Load/Save of the input parameters or • by using the input operators.
Concept V2.5 • LD N Loads the value of the operand into the Accumulator Literal, variable, direct address from data type ANY • ST N Saves the value of the Accumulator in the operandLiteral, variable, direct address from data type ANY • S Sets the operand to 1 if the Accumulator content is 1Literal, variable, direct address from data type BOOL • R Sets the operand to 0 if the Accumulator content is 1 Literal, variable, direct address from data type BOOL OperatorModifierOperand / Significance
Concept V2.5 AND N, N(, ( Logic AND 1 OR N, N(, ( Logic OR 1 XOR N, N(, ( Logic exclusive OR 1 ADD ( Addition 2 SUB ( Subtraction 2 MUL ( Multiplication 2 DIV ( Division 2 OperatorModifier Significance 1 Literal, variable, direct address of data type ANY_BIT 2 Literal, variable, direct address of data type ANY_NUM or TIME
Concept V2.5 GT ( Compare : > GE ( Compare : >= EQ ( Compare : = NE ( Compare : <> LE ( Compare : <= LT ( Compare : < OperatorModifierSignificance Literal, Variable, Direct Address of data type ANY_ELEM
Concept V2.5 JMP C, CN Jump to label Label CAL C, CN FBNAME (name of instance) Invoking a FFB FUNCNAME Executing a function Literal, variable, direct address (data type is subject to function) ) Editing reset operations OperatorModifierOperand/Significance
Concept V2.5 Input Output Default Data Type Possible Data Types %IX, %QX BOOL BOOL%I %Q %IB %QB BYTE BYTE %IW %QW INT INT, UINT, WORD %ID %QD REAL REAL, DINT, UDINT, TIME
Concept V2.5 • When entering keywords, separators and comments, there is an immediate spell check • If a keyword, a separator or a comment is detected, it is identified with a color shading. • If unauthorizedkeywords (instructions or operators) are entered, this will be identified through color shading as well. • Spaces and tabs have no effect on syntax, they can be used anywhere.
Concept Programming in IL • Pull Down Menus
Concept V2.5 • Example: Entering a direct function call • No declaration is required!
Concept V2.5 • Example: Entering a function block IN, PT, Q, and ETare the labels of thepins on a TON timer
Concept V2.5 • Tool bar Compare with FBD CAL FFBs: Declaration Invocation Assignments
Concept V2.5 • Create or open IL Section • Type or select operator and modifier: Objects... • Type or select operand: Edit Lookup variables • Type or select FFB: Objects Insert FFB or click on • Insert FFB see next slide
Concept Programming in IL • Insert FFB • Browse and select FFB • Declaration • Invocation • Assignment
Concept V2.5 • Use Expand statement to complete e.g.,VAR ... END_VAR • Use Go to counterpart to find e.g.,second bracket ( ) • Enter comments, consider Options, Preferences! • Syntax check: Project Analyze Section. • Any errors found are displayed in the message window. • Double click on the first line means: go to the line with the first error in IL.
Concept V2.5 • Handling, syntax check
This area used for Upload function Concept V2.5 • Before closing the IL section, go to Project Code generation options creates additional information forprocess diagnosis during code generation generates a runtimeoptimized code Tests loops within ST (and IL) sections • Code generation together with the syntax check will be performed when the section is closed.
Concept Programming in IL IL example • Comments • FFB-Declaration • AND-Function • Assignment • FFB call • Assignment • AND-Function • FFB call • Assignment
Concept V2.5 Inspect Selected Watch Selected Inspect Selected
Concept V2.5 • Select variable with double click • Animation Selected mode or • Go to Online Watch Selected • Repeat for next variable • Remains open until it is closed or the animation is terminated • A dialog box can be opened for each section
Concept V2.5 • Select variable with double click • go to menu Online Inspect Selected • set cursor to any position on section • click left mouse button • Set cursor into cyan field • depress right mouse button • select operation mode: • Move field to another position • Delete field or • Options... see next slide
Concept V2.5 • Select operation mode options... • Enter Minimum/Maximum • Notice the color change Yellow Magenta