CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 67
Текст из файла (страница 67)
When theexecution condition is ON, XFER(70) copies the contents of S, S+1, ..., S+N toD, D+1, ..., D+N.ER:SD3 4 5 23 4 5 2S+1D+13 4 5 13 4 5 1S+2D+23 4 2 23 4 2 2S+ND+N6 4 5 26 4 5 2N is not BCDS and S+N or D and D+N are not in the same data area.Indirectly addressed DM word is non-existent. (Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)7-17-4 BLOCK SET – BSET(71)Operand Data AreasS: Source dataLadder SymbolsIR, SR, AR, DM, HR, TC, LR, #BSET(71)@BSET(71)SSStStEESt: Starting wordIR, SR AR, DM, HR, TC, LRE: End WordIR, SR, AR, DM, HR, TC, LRLimitationsSt must be less than or equal to E, and St and E must be in the same data area.DM 6144 to DM 6655 cannot be used for St or E.DescriptionWhen the execution condition is OFF, BSET(71) is not executed.
When theexecution condition is ON, BSET(71) copies the content of S to all words from Stthrough E.SSt3 4 5 23 4 5 2St+13 4 5 2St+23 4 5 2E3 4 5 2BSET(71) can be used to change timer/counter PV. (This cannot be done withMOV(21) or MVN(22).) BSET(71) can also be used to clear sections of a dataarea, i.e., the DM area, to prepare for executing other instructions. It can also beused to clear words by transferring all zeros.384Section 7-17Data Movement InstructionsFlagsER:St and E are not in the same data area or St is greater than E.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)ExampleThe following example shows how to use BSET(71) to copy a constant (#0000)to a block of the DM area (DM 0000 to DM 0500) when IR 00000 is ON.00000@BSET(71)#0000AddressInstruction0000000001LD@BSET(71)DM 0000Operands00000#DMDMDM 05000000000005007-17-5 DATA EXCHANGE – XCHG(73)Ladder SymbolsOperand Data AreasE1: Exchange word 1XCHG(73)@XCHG(73)E1E1E2E2IR, SR, AR, DM, HR, TC, LRE2: Exchange word 2IR, SR, AR, DM, HR, TC, LRLimitationsDM 6144 to DM 6655 cannot be used for E1 or E2.DescriptionWhen the execution condition is OFF, XCHG(73) is not executed.
When theexecution condition is ON, XCHG(73) exchanges the content of E1 and E2.E1E2If you want to exchange content of blocks whose size is greater than 1 word, usework words as an intermediate buffer to hold one of the blocks using XFER(70)three times.FlagsIndirectly addressed DM word is non-existent. (Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)ER:7-17-6 SINGLE WORD DISTRIBUTE – DIST(80)Operand Data AreasS: Source dataLadder SymbolsIR, SR, AR, DM, HR, TC, LR, #DIST(80)@DIST(80)SSDBsDBsCCDBs: Destination base wordLimitationsIR, SR, AR, DM, HR, TC, LRC: Control word (BCD)IR, SR, AR, DM, HR, TC, LR, #C must be BCD.DM 6144 to DM 6655 cannot be used for DBs or C.385Section 7-17Data Movement InstructionsDescriptionDIST(80) can be used for single-word distribution or for a stack operation depending on the content of the control word, C.Single-word DistributionWhen bits 12 to 15 of C=0 to 8, DIST(80) can be used for a single word distributeoperation.
The entire contents of C specifies an offset, Of (0000 to 2047 in BCD).When the execution condition is OFF, DIST(80) is not executed. When theexecution condition is ON, DIST(80) copies the content of S to DBs+Of, i.e., Of isadded to DBs to determine the destination word.Note DBs and DBs+Of must be in the same data area and cannot be betweenDM 6144 and DM 6655.ExampleThe following example shows how to use DIST(80) to copy #00FF to HR 10 + Of.The content of LR 10 is #3005, so #00FF is copied to HR 15 (HR 10 + 5) whenIR 00000 is ON.00000@DIST(80)#00FFAddressInstruction0000000001LD@DIST(80)HR 10Operands00000#HRLRLR 10LR 10#00FFHR 103 0 0 50 0 F F0 0 0 000FF1010HR 150 0 F FStack OperationWhen bits 12 to 15 of C=9, DIST(80) can be used for a stack operation.
The other3 digits of C specify the number of words in the stack (000 to 999 in BCD). Thecontent of DBs is the stack pointer.When the execution condition is OFF, DIST(80) is not executed. When theexecution condition is ON, DIST(80) copies the content of S to DBs+1+the content of DBs. In other words, 1 and the content of DBs are added to DBs to determine the destination word.
The content of DBs is then incremented by 1.Note3861. DIST(80) will be executed every cycle unless the differentiated form(@DIST(80)) is used or DIST(80) is used with DIFU(13) or DIFD(14).2. Be sure to initialize the stack pointer before using DIST(80) as a stack operation.Section 7-17Data Movement InstructionsExampleThe following example shows how to use DIST(80) to create a stack betweenDM 0001 and DM 0005. DM 0000 acts as the stack pointer.00000@DIST(80)200AddressInstruction0000000001LD@DIST(80)Operands00000DM 0000216FlagsIR 200FFFFIR 2169005DM 0000DM 0001DM 0002DM 0003DM 0004DM 0005000000000000000000000000First executionStack pointerincrementedER:DMDM 0000DM 0001DM 0002DM 0003DM 0004DM 00050001FFFF0000000000000000DM 0000DM 0001DM 0002DM 0003DM 0004DM 0005SecondexecutionStack pointerincremented20000002160002FFFFFFFF000000000000The offset or stack length in the control word is not BCD.Indirectly addressed DM word is non-existent.
(Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)During stack operation, the value of the stack pointer+1 exceeds thelength of the stack.EQ:ON when the content of S is zero; otherwise OFF.7-17-7 DATA COLLECT – COLL(81)Operand Data AreasSBs: Source base wordLadder SymbolsIR, SR, AR, DM, HR, TC, LRCOLL(81)@COLL(81)SBsSBsCCDDC: Control word (BCD)LimitationsIR, SR, AR, DM, HR, TC, LR, #D: Destination wordIR, SR, AR, DM, HR, TC, LRC must be BCD.DM 6144 to DM 6655 cannot be used for D.DescriptionCOLL(81) can be used for data collection, an FIFO stack operation, or an LIFOstack operation depending on the content of the control word, C.Data CollectionWhen bits 12 to 15 of C=0 to 7, COLL(81) is used for data collection. The entirecontents of C specifies an offset, Of (0000 to 2047 in BCD).When the execution condition is OFF, COLL(81) is not executed.
When theexecution condition is ON, COLL(81) copies the content of SBs + Of to D, i.e., Ofis added to SBs to determine the source word.Note SBs and SBs+Of must be in the same data area.387Section 7-17Data Movement InstructionsExampleThe following example shows how to use COLL(81) to copy the content ofDM 0000+Of to LR 00. The content of 200 is #0005, so the content of DM 0005(DM 0000 + 5) is copied to LR 00 when IR 00001 is ON.00001@COLL(81)DM 0000AddressInstruction0000000001LD@DIST(80)Operands00001200DMLR 00LR200DM 0000LR 000 0 0 50 0 0 00 0 F F000020000DM 00050 0 F FFIFO Stack OperationWhen bits 12 to 15 of C=9, COLL(81) can be used for an FIFO stack operation.The other 3 digits of C specify the number of words in the stack (000 to 999, inBCD). The content of SBs is the stack pointer.When the execution condition is ON, COLL(81) shifts the contents of each wordwithin the stack down by one address, finally shifting the data from SBs+1 (thefirst value written to the stack) to the destination word (D).
The content of thestack pointer (SBs) is then decremented by one.Note COLL(81) will be executed every cycle unless the differentiated form(@COLL(81)) is used or COLL(81) is used with DIFU(13) or DIFD(14).ExampleThe following example shows how to use COLL(81) to create a stack betweenDM 0001 and DM 0005. DM 0000 acts as the stack pointer.When IR 00000 goes from OFF to ON, COLL(81) shifts the contents of DM 0002to DM 0005 down by one address, and shifts the data from DM 0001 to IR 001.The content of the stack pointer (DM 0000) is then decremented by one.00000@COLL(81)DM 0000AddressInstruction0000000001LD@COLL(81)216Operands00000DM001LIFO Stack Operation388IR 2169005DM 0000DM 0001DM 0002DM 0003DM 0004DM 00050005AAAABBBBCCCCDDDDEEEEStack pointerdecremented DM 0000DM 0001DM 0002DM 0003DM 0004DM 00050004BBBBCCCCDDDDEEEEEEEEIR 0010000216001AAAAWhen bits 12 to 15 of C=8, COLL(81) can be used for an LIFO stack operation.The other 3 digits of C specify the number of words in the stack (000 to 999).
Thecontent of SBs is the stack pointer.Section 7-17Data Movement InstructionsWhen the execution condition is ON, COLL(81) copies the data from the wordindicated by the stack pointer (SBs+the content of SBs) to the destination word(D). The content of the stack pointer (SBs) is then decremented by one.The stack pointer is the only word changed in the stack.Note COLL(81) will be executed every cycle unless the differentiated form(@DIST(80)) is used or DIST(80) is used with DIFU(13) or DIFD(14).ExampleThe following example shows how to use COLL(81) to create a stack betweenDM 0001 and DM 0005.