![background image](http://html.mh-extra.com/html/omron/sysmac-cp-series/sysmac-cp-series_user-manual_742262078.webp)
4 Understanding Programming
4-34
CP2E CPU Unit Software User’s Manual(W614)
It is possible to dynamically specify the offset by specifying a word address in I/O memory for the offset
in the brackets. The contents of the specified word address will be used as the offset.
For example, execution can be performed by increasing the address by incrementing the value in the
brackets and using only one instruction.
z
Ladder Program Example
In this example, two areas of consecutive data are used: D0 to D99 and D100 to D199.
The contents of corresponding words are added starting from the specified starting point, W0, to the
end of the areas and the sums are output to D200 to D299 starting from the specified offset from
D200.
For example, if W0 is
3
0, the corresponding words from D
3
0 to D99 and D1
3
0 to D199 are added,
and the sums are output to D2
3
0 to D299.
Each process is performed with an input comparison instruction (<) as the execution condition so
that W1 does not exceed &100 to make sure that the upper limit of the indirect addressing range is
not exceeded.
Program so that the memory area of the start address is not exceeded when using a
word address or symbol for the offset.
For example, write the program so that processing is executed only when the indirect
specification does not cause the final address to exceed the memory area by using
an input comparison instruction or other instruction.
If an indirect specification causes the address to exceed the area of the start address,
the system will access data in other area, and unexpected operation may occur.
4-7-2
Application Examples for Address Offsets
Caution
Set the
v
al
u
e of
W
0 to the offset
w
ord (
W
1)
u
sing the MOV instr
u
ction.
Repeat this process
100 times.
Use the operand of the addition instr
u
ction to specify and exec
u
te D0[
W
1] +
D100[
W
1] = D200[
W
1].
Increment
W
1 to increase the offset.
MOV
W
0
W
1
a
FOR
&100
Exec
u
tion condition
Exec
u
tion condition
++
W
1
a
Starts FOR loop
N
EXT
Ret
u
rns to FOR
+
D0[
W
1]
D100[
W
1]
D200[
W
1]
<
W
1
&100
W
hen exec
u
tion condition a (
u
p
w
ardly
differentiated) t
u
rns O
N
, the
v
al
u
e of
W
0 is
set to
W
1.
If exec
u
tion condition a is O
N
and the
v
al
u
e of
W
1 is less than &100, the data
from the start position
u
ntil D99 and
the data
u
ntil D199 are added, and the
s
u
m for each is o
u
tp
u
t
u
ntil D299.
W
hile exec
u
tion condition a is O
N
,
W
0 is
incremented.
Содержание SYSMAC CP Series
Страница 1: ...USER S MANUAL Cat No W614 E1 01 SYSMAC CP Series CP2E E D CP2E S D CP2E N D CP2E CPU Unit Software ...
Страница 3: ......
Страница 32: ...1 Overview 1 4 CP2E CPU Unit Software User s Manual W614 ...
Страница 44: ...3 CPU Unit Operation 3 8 CP2E CPU Unit Software User s Manual W614 ...
Страница 116: ...6 I O Allocation 6 8 CP2E CPU Unit Software User s Manual W614 ...
Страница 144: ...7 PLC Setup 7 28 CP2E CPU Unit Software User s Manual W614 ...
Страница 170: ...10 Interrupts 10 14 CP2E CPU Unit Software User s Manual W614 ...
Страница 200: ...11 High speed Counters 11 30 CP2E CPU Unit Software User s Manual W614 ...
Страница 272: ...12 Pulse Outputs 12 72 CP2E CPU Unit Software User s Manual W614 ...
Страница 278: ...13 PWM Outputs 13 6 CP2E CPU Unit Software User s Manual W614 ...
Страница 460: ...18 Programming Device Operations 18 28 CP2E CPU Unit Software User s Manual W614 ...
Страница 576: ...Revision 2 CP2E CPU Unit Software User s Manual W614 ...
Страница 577: ......