EasyManua.ls Logo

Sentry CA756 - Application of the Array-Type Memories

Sentry CA756
85 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
117
116
A B C D E F
A[1] A[2] A[3] A[4] A[5]
The content of memory C (A[2]) is decreased from 5 to 0
in steps of 1.
Therefore, the content of memory A[2] is displayed as 0.
Application of the array-type memories
It is sometimes required to treat two different types of data
as a single group. In this case, memories for data
processing and those for data storage should be kept
separate.
Store data x and y in memories. When a x
value is input, the corresponding y value is
displayed . There will be a total of 15 pieces of
data.
Example program 1
Memory A is used as the data control memory, and
memory B is used for temporary storage of the x data. The
x data are stored in memories C[1] (memory
D) through C [15] (memory R), and the y data are stored in
memories C[16] (memory S) through C[30] (memory Z (7)).
1, , A , : , Defm , 7 , : ,
Lbl , 1 , : , ? , , C , [ , A , ] , : ,
? , , C , [ , A ,+ ,1 ,5, ] , : ,
Lsz , A , : , A , = , 1 , 6 , , Goto ,2 , : ,Goto , 1 , : ,
Lbl, 2 , : ,1 , 5 , , A , : , ? , , B , : ,
B , = , 0 , , Goto , 5 ,: ,
Lbl , 3, :, B . = , C , [ , A , ] , , , Goto , 4 , :,
Dsz, A , : , Goto , 3 , : , Goto , 2 , : ,
Lbl , 4 , : ,C, [ , A , + , 1 , 5 , ], , Goto , 2 ,: ,
Lbl , 5 98 steps
In this program, memories are used as follows :
x data
C[1] C[2] C[3] C[4] C[5] C[6] C[7] C[8]
D E F G H I J K
C[9] C[10] C[11] C[12] C[13] C[14] C[15]
L M N O P Q R
y data
C[16] C[17] C[18] C[19] C[20] C[21] C[22] C[23]
S T U V W X Y Z
C[24] C[25] C[26] C[27] C[28] C[29] C[30]
Z(1) Z(2) Z(3) Z(4) Z(5) Z(6) Z(7)
A [0] A[1] A[2] A[3] A[4] A[5] A[6] A [23] A[24] A[25] A[26] A[27]
B[-1] B [0] B[1] B[2] B[3] B[4] B[5] B[22] B[23] B[24] B[25] B[26]
C[-2] C[-1]C[0] C[1] C[2] C[3] C[4] C[21] C[22] C[23] C[24] C[25]
. .
. .
. .
G[-6] G[-5] G[-4] G[-3] G[-2] G[-1] G[0] G[17] G[18] G[19] G20] G[21]
.
.
.
X [0] X[1] X[2] X[3] X[4]
Y[-1] Y [0] Y[1] Y[2] Y[3]
Z[-2] Z[-1] Z [0] Z[1] Z[2]
The following shows a case in which array-type memories
overlap with standard format memories. This situation
should always be avoided.
Store the numeric values from 1 through 5 in
memories A[1] though A [5] respectively.
5, , C , : , Lbl, 1 , : , C , , A , [ , C , ] , : ,
Dsz , C , : , Goto , 1 , : ,
A , [ , 1 , ] , , A , [ , 2 , ] , , A , [ , 3 , ] , ,
A , [ , 4 , ] , , A , [ , 5 , ] 44 steps
In this program, the values 1 through 5 are stored in the
array-type memories A[1] through A [5] , and memory C is
used as a counter memory. When this program is
executed, the following results are obtained:
As can be seen, the second displayed value (which should
be 2) in A[2] is incorrect. This problem has occurred
because memory A[2] is the same as memory C.

Table of Contents

Related product manuals