beautypg.com

Reference, Instruction reference, Add [r] = [a] + [b] 200 [r] [a] [b – Industrial Data Systems IDS Scale Basic User Manual

Page 21: All off 229, Beep (n) 233 [n, Compare [a] - [b] 208 [a] [b

background image

Scale Basic 4.2E

Reference

Reference

The reference is divided into 3 sections:

1. Instruction Reference: details each Scale Basic instruction and provides examples.
2. Condition Codes: details the condition codes and how they are used.
3. Built in Functions: the built in functions that can be used with Gosub and Goto instructions.

Instruction Reference

Add [r] = [a] + [b]

200 [r] [a] [b]

Purpose: add registers [a] & [b], put the result into register [r].
Remarks: add any two registers together, and put the results into a third register. Sets condition

codes Positive, Negative, and Zero to reflect results.

Example:

Add, Memory1, Memory2, Memory3

Memory1 = Memory2 + Memory3

Add, Memory5, Memory5, Net

Add Net weight to register 5.

All

off 229

Purpose: turn off all setpoints, relays, and timers.
Remarks: this instruction is usually used to turn off everything when an error occurs, or to make

sure everything is off at the end of a process.


Example:

All off

Turn off all setpoints, relays, and timers.

Beep

(n)

233

[n]

Purpose: Sound the beeper [n] times.

Compare [a] - [b]

208 [a] [b]

Purpose: compare 2 registers. The condition codes (Positive, Minus, and Zero) are set as a

result of subtracting register [a] from register [b], therefore:

Positive =

True if register a > register b

Negative = True if register a < register b

Zero =

True if register a = register b

Remarks: the Compare instruction does not change the value of any registers, it only changes

the value of the Positive, Negative, and Zero condition codes.


Example: register Fixed43 contains a setpoint. Turn off relay 1 if Net > Fixed43

Compare,

Net,

Fixed43

If, Positive

If Net > Setpoint Fixed43

Relay off, 1

turn off relay 1

End

if

End

if