Sentry Industries CA756 User Manual

Page 71

Advertising
background image

108

109

then Goto 1 returns execution to Lbl 1.
Execution from Lbl 2 will display the sum that has been
stored in memory B. Actually, the display command “ ” is
inserted following B , but here it can be omitted.
The following illustration shows the flow of the program:

Count jumps

The count jumps cause the value in a specified memory to
be increased or decreased by 1. If the value does equal 0,
the following statement is skipped, and the statement
following the next “:” or “ ” is executed. The “lsz” command
is used to increase the value in memory by 1 and decide
the subsequent execution, while the “Dsz” command is
used to decrease the value by 1 and decide.

lsz

Dsz

Increase memory A by one............Isz A

A

Decrease memory B by one ..........Dsz B

Determine the average of 10 input

numeric values.

Program

1,0, ,A,:, 0 , ,C,:,
Lbl, 1,:,?, ,B,:,B,+,C, ,C,:,
Dsz, A,:,Goto,1,:,C,÷,1,0

32 steps

In this program, first 10 is stored in memory A , and 0 is
stored in memory C . Memory A is used as the “counter”
and countdown is performed the specified number of times
by the Dsz commmand. Memory C is used to store the sum
of the inputs, and so first must be cleared by inputting a 0.
The numeric value input in response to “ ? ” is stored in
memory B, and then the sum of the input values is stored
in memory C by “ B+C C”.
The statement Dsz A then decreases the value stored in
memory A by 1. If the result does not equal 0 , the following
statement, Goto 1 is executed. If the result equals 0, the
following Goto 1 is skipped and “C ÷ 10” is executed.

Advertising