AB RSLOGIX5000 Structured介绍? AB RSLOGIX5000 Structured Structured Text (ST) Structured Text (ST) is a high level textual language that is a Pascal like language. It is very flexible and intuitive for writing control algorithms. Structured Text uses operators such as logical branching, multiple branching, and loops. People trained in computer programming languages often find it the easiest language to use for programming control logic. When symbolic addressing is used, ST programs resemble sentences, making it highly intelligible to beginner users as well. ST is ideal for tasks requiring complex math, algorithms or decision-making. Its concise format allows a large algorithm to be displayed on a single. Benefits of Structured Text People trained in computer languages can easily program control logic Symbols make the programs easy to understand Programs can be created in any text editor Runs as fast as ladder logic Code The following is few example to show some typical Structured Text code: Example 1 We have a level switch in a tank that indicates that the level of liquid in the tank is extremely high; Hence we want to trigger the siren when this happens. Siren := NOT Level_Switch ; Example 2 We have a light that will be turned on by 2 switches. If any of the switches is in ON position then the light will turn ON. Light := SwitchA OR SwitchB; Examples 3 We have Motor that will be controlled manually by 2 push buttons (Start Push Button, and Stop Push Button). When the Start Push Button is pushed then the Motor will be turned ON. and when the Stop Push Button is Pushed then we want to stop the Motor. (Security logic has been taken off this logic, for the purpose of domonstration.) IF StartPb THEN Motor := 1; END_IF; IF StopPb THEN Motor := 0; END_IF; Introduction In Structured Text you manipulate data using operators and functions. Structured Text is very similar to Pascal, so most of these operators will be familiar to Pascal oor any High Level Programmer. An operator is a code unit that performs an operation on one or more value-returning code elements. Such an operation can be an arithmetic operation such as addition or multiplication; a comparison operation that determines which of two values is greater; a logical operation evaluating whether two expressions are both true. Comparison Operators Comparison Operators compare two values or strings to provide a true or false result. The result of a comparison operation is a boolean value. Comparison operators generate a boolean result. They evaluate the relationship between the values of the operands. A comparison expression produces true if the relationship is true, and false if the relationship is untrue. Logical Operators Logical Operators let you check if multiple conditions are true or false. The result of a logical operation is a boolean value. All logical operators have one output. They are either On or Off, depending on the logic status of their inputs. Bitwise Operators Bitwise Operators manipulate the bits within a value based on two values. Bitwise operators allow you to manipulate individual bits in an integral primitive data type. Bitwise operators perform boolean algebra on the corresponding bits in the two arguments to produce the result. Order of Execution - Precedence Operator precedence defines how an expression evaluates when several operators are present. Structured Text has specific rules that determine the order of execution. The easiest one to remember is that multiplication and division happen before addition and subtraction. Programmers often forget the other precedence rules, so you should use parentheses to make the order of evaluation explicit. Flow Control Statement Structured Text like most high level languages uses execution control statements, so if you've programmed with Pascal, C, or Java most of what you see will be familiar. Most procedural programming languages have some kind of control statements, and there is often overlap among languages. Structured Text have few flow control methods that simplifies and improve the code complexity when trying to read the code. Iterration / Looping In most programming applications you'll need to do the steps over and over again. This process is known as iteration. It is also frequently referred to as looping, because it usually involves setting up the program so that it will loop back and repeat itself. Depending on how a program is written, it can easily get stuck in the loop and keep on repeating itself forever causing the controller to reach its watchdog limit and to generate major fault that will halt the execution of your program. For this reason, there is usually some way to get out of the loop, where by keeping track of just how many times the loop is supposed to repeat itself, or by looping until a condition changes. Looping in Structured Text is a big step in Automation Programming. This task was also achievable with Ladder Logic except that, in Structured Text it is much simpler and very flexible. INTRODUCTION PREREQUISITES GOALS CHAPTERS EXERCISES EXERCISES CODING STANDARDS ERRORS ARITHMETIC OPERATORS COMMENTS := ASSIGNMENT [:=] ASSIGNMENT (NON RETENTIVE) + ADDITION - SUBTRACT * MULTIPLY ** EXPONENT / DIVIDE MOD MODULO - UNARY MINUS AND PLUS OPERATORS EXERCISES COMPARISON OPERATORS < LESS THAN > GREATER THAN <= LESS THAN OR EQUAL >= GREATER THAN OR EQUAL = EQUAL <> NOT EQUAL EXERCISES LOGICAL OPERATORS & , AND LOGICAL AND OR LOGICAL OR XOR LOGICAL EXCLUSIVE OR NOT LOGICAL COMPLEMENT EXERCISES BITWISE OPERATORS & , AND BITWISE AND OR BITWISE OR XOR BITWISE EXCLUSIVE OR NOT BITWISE COMPLEMENT ORDER OF EXECUTION - PRECEDENCE EXERCISES INSTRUCTIONS AND FUNCTIONS ADVANCED MATH ARRAY / MISC ASCII CONVERSION ASCII SERIAL PORT ASCII STRING BIT INSTRUCTION COMPARE COMPUTE / MATH DRIVES INPUT / OUTPUT MATH CONVERSION MOTION CONFIGURATION MOTION EVENT MOTION GROUP MOTION MOVE MOTION STATE MOVE / LOGICAL PROCESS CONTROL PROGRAM CONTROL SELECT / LIMIT SPECIAL STATISTICAL TIMER AND COUNTER INSTRUCTIONS TRIGONOMETRIC FLOW CONTROL STATEMENT IF ... THEN ... ELSE CASE ... OF EXIT FOR ... DO WHILE... DO REPEAT ... UNTIL EXERCISES GLOSSARY INDEX 查看更多0个回答 . 3人已关注