Operators - Structured Text

KronoTech

PLC

Ladder Logic

RSLogix 5000

Structured Text

Introduction

Operators

Functions

HMI

Instruments

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.

Quick Links

PLC Languages

Ladder Logic
Function Block
Structure Text
SFC
Mnemonic

Ladder Logic

Basic
Counters
Timer
Arithmetic
Comparison
Functions
Trig Functions

Instruments

Switches

HMI

Advantages
Alarms
Trends

Other

Bottle Application