Omron SYSMAC CS Series Programming Manual page 232

Hide thumbs Also See for SYSMAC CS Series:
Table of Contents

Advertisement

Index Registers
1,2,3...
Basic Operation
Basically, Index Registers are used with the following steps:
1. Use MOVR(560) to store the PC memory address of the desired bit or
word in an Index Register.
2. Specify the Index Register as the operand in almost any instruction to in-
directly address the desired bit or word.
3. Offset or increment the original PC memory address (see below) to redi-
rect the pointer to another address.
4. Continue steps 2 and 3 to execute the instruction on any number of ad-
dresses.
Offsetting, Incrementing, and Decrementing Addresses
The following table shows the variations available for indirect addressing.
Variation
Indirect addressing
Indirect addressing with constant offset
Indirect addressing with DR offset
Indirect addressing with auto-increment
Indirect addressing with auto-decrement
Instructions That Directly Address Index Registers
Index registers can be directly addressed by the following instructions.
DOUBLE SIGNED BINARY ADD WITHOUT CARRY: +L(401), DOUBLE
SIGNED BINARY SUBTRACT WITHOUT CARRY: –L(411), DOUBLE
INCREMENT BINARY: ++L(591), and DOUBLE DECREMENT BINARY: – –
L(593)
Example 1
The following example shows how an Index Register in a program loop can
replace a long series of instructions. In this case, instruction A is repeated n+1
times to perform some operation such as reading and comparing a table of
values.
Increment IR0 and repeat
instruction execution
Indirect
addressing
,IR#
Constant ,IR#
(Include a + or – in the constant.)
DR#,IR#
Increment by 1: ,IR#+
Increment by 2: ,IR#++
Decrement by 1: ,–IR#
Decrement by 2: ,– –IR#
Section 6-2
Table data
Syntax
213

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cs1g/h-cpu-ev1 seriesCj1g-cpu seriesSysmac cj series

Table of Contents