GSE Scale Systems - 171
Chapter 16 Macro Programming Operations Technical Reference Manual
function is executed.
In the following example, Reg #1 is used as a counter to
keep track of the number of boxes weighed on the scale
each day. The Gross Total parameter holds the weight of
boxes procesed that day.
Example:
91,80%C COPY box counter (REG #1) to Var
#0
3,80%/ Divide the total weight (Parameter 3)
by the quantity of boxes. Var #0 now
holds the average weight.
The Math and Copy Commands
%+ add
%- subtract
%* multiply
%/ divide
%C copy
These commands operate on variables. You can supply
an actual value as the first parameter by using a semi-
colon (;) as the separator.
For example:
1,81%C copies the value of parameter 1 to
parameter 81.
however...
1;81%C copies the number 1 to parameter 81.
This ability eliminates the need for a macro to change
modes simply to save away an operator entry. Thus most
macros should be able to perform a task without
changing modes and therefore appear invisible to the
operator when desired.
For example:
KeyinTargt%G GET operator input for target
wt.
;81%C Copy entry to parameter 81
(Var #1).
Note in the above example that if the operator simply
presses <ENTER> without entering any data, then Var
#1 will be cleared to zero. Use of the "%\" IF ENTRY
macro command could be used to handle this situation in
a different manner.
The immediate copy command also works for alpha
parameters, such as ID's 1 through 6.
For example:
big part;21%C copies the words "big part" to
ID 1 (parameter P21).
In the case of subtracts and divides, the first parameter is
the value subtracted or divided by, respectively.
For example:
2;81%/ divides parameter 81 by 2.
1;81%- subtracts 1 from (ie
decrements) parameter 81.
This capability can be used with operator entries in the
following manner:
KeyinPart#%G Prompt for part number entry.
;21%C Store operator entry to ID 1
(parameter 21).
Also, the "%+" command can now be used with alpha
parameters (ID 1 -6) to concatenate (paste together) two
strings.
For example, if ID 1 holds a first name and ID 2 holds a
last name:
Joe ;21%C Set ID 1 to be "Joe ".
Smith;22%C Set ID 2 to be "Smith".
21,23%C Copy ID 1 to ID 3.
22,23%+ Append ID 2 to the end of ID 3. ID 3
should now be "Joe Smith".
These math commands can also operate on time type
parameters (P51 - P54), however both parameters must
be of the same type! The only exception is the "%C"
COPY command. For instance, you cannot add Var #1
to alarm 1. Copy one or the other parameter to a
parameter of the type which the result will be and then
perform the math operation.
Exponent / Root Math Operations
The (%,) command allows square roots to be determined.
Also a value may be raised to a power (ie x
y
). This
command works with a parameter or an immediate value,
as described in item 1, by using the comma (,) or the
semicolon (;) respectively.
For example:
SECTION - 16.9