Dp adjust [r] 212 [r, Else (see if instruction) 251, End if (see if instruction) 240 – Industrial Data Systems IDS Scale Basic User Manual

Page 23: End 255, Erase id [r] 236 [r, Error msg (error no.) 239 [nnn

Advertising
background image

Scale Basic 4.2E

Reference

Remarks: sets condition codes Positive, Negative, and Zero to reflect results. The decimal

position of the result before the divide determines the decimal position of the result after the
divide. Divide by 0 sets the result to 0. NOTE: it is preferable to do a multiply instead of a
divide (see Mul example).


Example: convert net weight pounds to tons. Register Fixed43 is set to 2000.

Dp adjust, Memory1, 2

Set memory1 decimal position = 0.00

Div, Memory1, Net, Fixed43

Memory1 = Net / Fixed43

Dp

adjust

[r]

212

[r]

Purpose: set the decimal position of a register.
Remarks: if the new decimal position is less than the previous decimal position, the result is

rounded up by adding 5 to the most significant digit being dropped. Do not use a decimal
position greater than 9.


Example:

Memory1 contains 0.425

Dp adjust, Memory1, 2

Set memory decimal position to 2 (0.00)

The result = (0.425 + 0.005) / 10 = 0.43

Else (see if instruction)

251

End if (see If instruction)

240

End

255

Purpose: to end a function.
Remarks: every function should have an End statement

Example:

Relay off, 1

Turn off relay 1

End

End

of

function.

Erase

id

[r] 236

[r]

Purpose: erase an Id in memory. Use the Id number in the register to find the Id and erase it.
Remarks: condition code Positive is set true if the Id is found, condition code Zero is set true if

the Id is not found.


Example: Get an Id number from the keyboard, then erase the ID from memory.

Prompt, “ID”

Prompt the user to enter an Id number

Get data, Memory1 Get an Id number. Put it into Memory1

Erase id, Memory1 Find the Id record pointed to by Memory1. Erase it.

Error

msg

(error

no.)

239

[nnn]

Purpose: to display user definable error messages on the display in the form “Err xxx” where

xxx is a number between 1 and 255.

Advertising