13.07.2015 Views

CJ2 CPU Unit Software User's Manual - CIP ETI

CJ2 CPU Unit Software User's Manual - CIP ETI

CJ2 CPU Unit Software User's Manual - CIP ETI

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5 Understanding Programming5-7 Index Registers5-7-1 What Are Index Registers?Index Registers function as pointers to specify PLC memory addresses, which are absolute memoryaddresses in I/O memory. After storing a PLC memory address in an Index Register with MOVR(560) orMOVRW(561), input the Index Register as an operand in other instructions to indirectly address thestored PLC memory address.The advantage of Index Registers is that they can specify any bit or word in I/O memory, including timerand counter PVs.PointerAll areas ofI/O MemoryMOVR(560)IRIndex Register5-7-2 Using Index RegistersIndex Registers can be a powerful tool when combined with loops such as FOR-NEXT loops. The contentsof Index Registers can be incremented, decremented, and offset very easily, so a few instructionsin a loop can process tables of consecutive data very efficiently.Increment IR0 and repeatinstruction executionTable dataInstruction,IR0IndirectaddressingIR0Basically, Index Registers are used with the following steps:1 Use MOVR(560) to store the PLC 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 indirectly address thedesired bit or word.3 Offset or increment the original PLC memory address (see below) to redirect the pointer toanother address.4 Continue steps 2 and 3 to execute the instruction on any number of addresses.NoteUse any of the following methods to offset or increment an Index Register.• Indirect Addressing of Index Registers:Indirect addressing with auto-incrementing (,IR@+ or ,IR@++), indirect addressing withauto-decrementing (,−IR@ or ,−−IR@), indirect referencing with a constant offset (constant,IR@),indirect addressing with a DR offset (DR@,IR@)5-84 <strong>CJ2</strong> <strong>CPU</strong> <strong>Unit</strong> <strong>Software</strong> User’s <strong>Manual</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!