Make id [r] 235 [r, Mul [r] = [a] * [b] 202 [r] [a] [b – Industrial Data Systems IDS Scale Basic User Manual

Page 29

Advertising
background image

Scale Basic 4.2E

Reference

Set

Memory1,

20

Loop1

For Memory1 = 20 down-to 0

Index

id,

Memory1

Set Id1, 0

ID[Memroy1].register 1 = 0

Dec

Memory1

If

Positive

Next1

End

if

End

For

End

End

of

function

Make

id

[r]

235

[r]

Purpose: to open an ID record. If the ID number in register [r] in not found, open a new ID

record and assign ID[r] to it.

Remarks: condition code Positive is set true if the Id is made or found, condition code Zero is

set true if the Id could not be made (memory full).


Example: Get an ID number from the keyboard, open/make the ID, get tare from keyboard, save

the data.

Get data, Memory1

Get an ID number from the keyboard

If not, Clear key

If NOT Clear key

Make

id,

Memory1

Open/Make

ID

Get data, Id2

put keyboard tare into ID register 2

Write

id Save

ID

data

End

if

End

if

End

End

of

function

Mul

[r] = [a] * [b]

202 [r] [a] [b]

Purpose: multiply register [a] by register [b], put results into register [r].
Remarks: sets condition codes Positive, Negative, and Zero to reflect results. The decimal

position of the result = decimal position of register a + decimal position of register b. NOTE:
it is preferable to use a multiply in place of a divide (see Div instruction example)


Example: convert net weight pounds to tons. Scale is calibrated x10 lb.

Set

Memory1,

5

Dp adjust, Memory1, 4

Memory1 = 0.0005

Mul, Memory2, Net, Memory1

Memory2 = Net * 0.0005

Dp adjust, Memory2, 2

set result to 2 decimal positions

Display,

Memory2

display

tons

End

End

of

function

Advertising