CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 55
Текст из файла (страница 55)
In diagram A, below, an OR LOADinstruction will be required to combine the top and bottom instruction lines. Thiscan be avoided by redrawing as shown in diagram B so that no AND LOAD or ORLOAD instructions are required. Refer to 7-7-2 AND LOAD and OR LOAD formore details.Address000002000700001 200070000000001000020000300004InstructionLDLDANDOR LDOUTOperands000000000120007--20007Diagram AAddress00001 20007200070000000000000010000200003InstructionLDANDOROUTOperands00001200070000020007Diagram B329SectionProgram Execution6-76-7Program ExecutionWhen program execution is started, the CPU Unit scans the program from top tobottom, checking all conditions and executing all instructions accordingly as itmoves down the bus bar. It is important that instructions be placed in the properorder so that, for example, the desired data is moved to a word before that wordis used as the operand for an instruction.
Remember that an instruction line iscompleted to the terminal instruction at the right before executing an instructionlines branching from the first instruction line to other terminal instructions at theright.Program execution is only one of the tasks carried out by the CPU Unit as part ofthe cycle time. Refer to Section 8 PC Operations and Processing Time for details.330SECTION 7Instruction SetThe CPM1, CPM1A, CPM2A, CPM2C, and SRM1(-V2) PCs have large programming instruction sets that allow for easyprogramming of complicated control processes.
This section explains instructions individually and provides the ladder diagram symbol, data areas, and flags used with each.The many instructions provided by these PCs are organized in the following subsections by instruction group. These groupsinclude Ladder Diagram Instructions, instructions with fixed function codes, and set instructions.Some instructions, such as Timer and Counter instructions, are used to control execution of other instructions, e.g., a TIMCompletion Flag might be used to turn ON a bit when the time period set for the timer has expired. Although these otherinstructions are often used to control output bits through the Output instruction, they can be used to control execution of otherinstructions as well.
The Output instructions used in examples in this manual can therefore generally be replaced by otherinstructions to modify the program for specific applications other than controlling output bits directly.7-17-27-37-47-57-67-77-87-97-107-117-127-137-147-15Notation . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Instruction Format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Data Areas, Definer Values, and Flags . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .Differentiated Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Coding Right-hand Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .Instruction Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-6-1 CPM1/CPM1A Function Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-6-2 CPM2A/CPM2C Function Codes . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . .7-6-3 SRM1(-V2) Function Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-6-4 Alphabetic List by Mnemonic . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . .Ladder Diagram Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-7-1 LOAD, LOAD NOT, AND, AND NOT, OR, and OR NOT . . . . . . . . . . . . . . . . .7-7-2 AND LOAD and OR LOAD . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .Bit Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-8-1 OUTPUT and OUTPUT NOT – OUT and OUT NOT . . . . . . . . . . . . . . . . . . . . .7-8-2 SET and RESET – SET and RSET . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .7-8-3 KEEP – KEEP(11) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-8-4 DIFFERENTIATE UP and DOWN – DIFU(13) and DIFD(14) . . . . . . . . . . . . . .NO OPERATION – NOP(00) . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .END – END(01) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .INTERLOCK and INTERLOCK CLEAR – IL(02) and ILC(03) . . . . .
. . . . . . . . . . . . . . .JUMP and JUMP END – JMP(04) and JME(05) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .User Error Instructions: FAILURE ALARM AND RESET – FAL(06) andSEVERE FAILURE ALARM – FALS(07) . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . .Step Instructions: STEP DEFINE and STEP START–STEP(08)/SNXT(09) . . . . . . . . . . .Timer and Counter Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15-1 TIMER – TIM . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15-2 HIGH-SPEED TIMER – TIMH(15) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15-3 VERY HIGH-SPEED TIMER: TMHH(––) . . . . . . . . . . . . . . . . . . . . . . . . . .
. . .7-15-4 LONG TIMER: TIML(––) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15-5 COUNTER – CNT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15-6 REVERSIBLE COUNTER – CNTR(12) . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . .7-15-7 REGISTER COMPARISON TABLE – CTBL(63) . . . . . . . . . . . . . . . . . . . . . . . .7-15-8 MODE CONTROL – INI(61) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-15-9 HIGH-SPEED COUNTER PV READ – PRV(62) . . . . . . . . . . . .
. . . . . . . . . . . .3343343343363373403403413423433463463473473473483493503513513513533553563583593603613623643653663693713317-16 Shift Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-16-1 SHIFT REGISTER – SFT(10) . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-16-2 WORD SHIFT – WSFT(16) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-16-3 ARITHMETIC SHIFT LEFT – ASL(25) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-16-4 ARITHMETIC SHIFT RIGHT – ASR(26) . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . .7-16-5 ROTATE LEFT – ROL(27) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-16-6 ROTATE RIGHT – ROR(28) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . .7-16-7 ONE DIGIT SHIFT LEFT – SLD(74) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-16-8 ONE DIGIT SHIFT RIGHT – SRD(75) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-16-9 REVERSIBLE SHIFT REGISTER – SFTR(84) . . . . . . . . . . . . . . .
. . . . . . . . . . .7-16-10 ASYNCHRONOUS SHIFT REGISTER – ASFT(17) . . . . . . . . . . . . . . . . . . . . .7-17 Data Movement Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17-1 MOVE – MOV(21) . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17-2 MOVE NOT – MVN(22) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17-3 BLOCK TRANSFER – XFER(70) . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . .7-17-4 BLOCK SET – BSET(71) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17-5 DATA EXCHANGE – XCHG(73) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17-6 SINGLE WORD DISTRIBUTE – DIST(80) . . . . . . . . . . . . . . . . . . . . . . .
. . . . .7-17-7 DATA COLLECT – COLL(81) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17-8 MOVE BIT – MOVB(82) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-17-9 MOVE DIGIT – MOVD(83) . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . .7-18 Data Control Instructions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-18-1 SCALING – SCL(66) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-18-2 SIGNED BINARY TO BCD SCALING – SCL2(––) . . . .
. . . . . . . . . . . . . . . . . .7-18-3 BCD TO SIGNED BINARY SCALING – SCL3(––) . . . . . . . . . . . . . . . . . . . . . .7-18-4 PID CONTROL – PID(––) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-19 Comparison Instructions . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-19-1 COMPARE – CMP(20) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-19-2 TABLE COMPARE – TCMP(85) . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .7-19-3 BLOCK COMPARE – BCMP(68) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7-19-4 DOUBLE COMPARE – CMPL(60) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .