Baldor mn1854 manual Logical Operators, Increment/Decrement Variables, Expressions, WTAI12MAX Temp

Models: mn1854

1 105
Download 105 pages 58.42 Kb
Page 85
Image 85

Logical Operators

Conditional commands (IF,WT, LU, LW) support logical operations of AND (&&) and OR (). Two expressions may be logically AND’d or OR’d within one conditional command. For example:

(A)=5 (B)=2.5 IF(A)>2&&(B)=2.5 MS1, “True Statement” EB

In this program, the message “True Statement” appears since BOTH conditional statements are true.

Increment/Decrement Variables

Four syntaxes are supported by variables: ++ (Single Increment), += (Value Increment), –– (Single Decrement), –= (Value Decrement). These operators will initialize any uninitialized variable to zero before incrementing or decrementing it for the first time.

(Variable Name)++

Increments a variable value by 1

(Variable Name)+=n

Increments a variable value by n

(Variable Name)– –

Decrements a variable value by 1

(Variable Name)–=n

Decrements a variable value by n

Expressions

Five conditional expressions are supported: less than (<), equal to (=), greater than (>), less than or equal to (<=), and greater than or equal to (>=). The IF and WT commands can use these expressions to direct program flow or wait for an analog input to meet a condition. The > and < symbols are entered into the keypad editor with the ALPHA+↑ +↑ ...↑

Examples:

IF (X)>10 GS20 EB

If X is greater than 10 gosub to program #20.

WT(AI12)<(MAX TEMP)

Wait for the temperature to go below the maximum

 

before continuing command processing.

Other Programming Samples

These sample programs provide an idea of how to solve simple programming tasks. To aid your program documentation, comments are placed in {brackets}. These comments are stripped from the program as it is downloaded for execution to help conserve memory. Files should be saved before downloading save the comments.

Example:

DI10,2 GO

Moves to load position

DI15,15 GO

Moves to unload position

6-30 Keypad Programming

MN1854

Page 85
Image 85
Baldor mn1854 Logical Operators, Increment/Decrement Variables, Expressions, Other Programming Samples, WTAI12MAX Temp