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.

6 I/O Memory AreasPrecautions for Correct UseIt is possible to specify regions outside of I/O memory and generate an Illegal Access Error whenindirectly addressing memory with Index Registers. Refer to A-4 Memory Map of PLC MemoryAddresses for details on the limits of PLC memory addresses.The following table shows the variations available when indirectly addressing I/O memory with IndexRegisters.Variation Function Syntax ExampleIndirect addressing The content of IR@ is treated as thePLC memory address of a bit or word.,IR@ LD , IR0 Loads the bit at the PLC memoryaddress contained in IR0.Indirect addressingwith constant offsetIndirect addressingwith DR offsetIndirect addressingwith auto-incrementIndirect addressingwith auto-decrementNote IR@ represents an Index Register from IR0 to IR15. ExampleThe constant prefix is added to thecontent of IR@ and the result is treatedas the PLC memory address of a bit orword.The constant may be any integer from−2,048 to 2,047.The content of the Data Register isadded to the content of IR@ and theresult is treated as the PLC memoryaddress of a bit or word.After referencing the content of IR@ asthe PLC memory address of a bit orword, the content is incremented by 1or 2.The content of IR@ is decremented by1 or 2 and the result is treated as thePLC memory address of a bit or word.Constant ,IR@(Include a + or − inthe constant.)LD +5, IR0Adds 5 to the contents of IR0 andloads the bit at that PLC memoryaddress.DR@ , IR@ LD DR0 , IR0 Adds the contents of DR0 to thecontents of IR0 and loads the bit atthat PLC memory address.Increment by 1:, IR@+Increment by 2:, IR@++Decrement by 1:,− IR@Decrement by 2:,− − IR@LD , IR0++Loads the bit at the PLC memoryaddress contained in IR0 and thenincrements the content of IR0 by 2.LD , − −IR0 Decrements the content of IR0 by 2and then loads the bit at that PLCmemory address.This example shows how to store the PLC memory address of a word (CIO 2) in an Index Register(IR0), use the Index Register in an instruction, and use the auto-increment variation.MOVR(560) 2 IR0 Stores PLC memory address of CIO 2 in IR0.MOV(021) #1 ,IR0 Writes #1 to PLC memory address contained in IR0, i.e., to CIO 2.MOV(021) #20 +1, IR0 Reads IR0, adds 1, and writes #20 to that PLC memory address, i.e., toCIO 3.Regulardata areaaddress0123I/O memory#0001#0020MOV #01 ,IR0PLC memoryaddress0C000 hex0C001 hex0C002 hex0C003 hexPointerMOVE TO REGISTER instructionMOVR(560) 2 IR00D7FF hex0D800 hex0D9FF hex0DE00 hex0DFFF hex6-36 <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!