Industrial Data Systems IDS Scale Basic User Manual

Page 14

Advertising
background image

Scale Basic 4.2E

Tutorial

The permanent storage registers (Fixed43…50) are used for permanent storage of numbers.
These registers are stored in EA-ROM memory, they retain their value if power is lost. They are
set by using the configure function for parameters 43…50 (EZ Link Fixed Registers). It is NOT
good practice to change these registers using Scale Basic; the changes will be lost on power up or
when the configure function is invoked.

The next program prompts the operator for 2 numbers, adds the numbers together, and displays
the sum. It uses registers Memory1 and Memory2 to store the operator’s input, and Memory3 to
store the sum.

Application

Description

Enter 2 numbers from the keyboard, add them together, display the sum.

Results / Outputs

Display the sum of 2 numbers.

Inputs

F1 key to begin program
Operator data entry of 2 numbers.

Sequence of operation

Press the F1 key to begin program

Enter up to 6 digits, then press the Enter key.

Enter up to 6 digits, then press the Enter key.

Add inputs to obtain sum.

The sum is displayed.

The Inputs section lists the F1 key to start the program and the input of 2 numbers. The input
of the 2 numbers will be done in Scale Basic, the F1 key is an event that can be configured.

Event

Function

Comments

F1 key

User1

begin summing program.

Use the sequence of operation to define User Function 1. The F1 key event triggers a function
that requires entry of 2 numbers. From the list of Scale Basic Instructions we find the Get Data
[r]
instruction is used to enter data. The next step is to add the 2 numbers together. The Add [r]
[a] [b]
instruction is used. Finally, the result is displayed. The Display [r] instruction is used.

NOTE: the program listing that follows is formatted in a more compact form than the HELLO
program above. Instead of listing the instructions under Instruction, Operand 1, Operand 2, and
Operand 3, the instructions and operands are listed together separated by commas.

Function

Instructions

Comments

User1

Get data, Memory1

Memory1 = Get operator input

Get data, Memroy2

Memory2 = Get operator input

Add, Memory3, Memory1, Memory2 Memory3 = Memory1 + Memory2

Display,

Memory3

Display

sum

End

End

of

function

Advertising