CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 59
Текст из файла (страница 59)
Logic blockinstructions are used to relate more complex parts.7-7-1 LOAD, LOAD NOT, AND, AND NOT, OR, and OR NOTLadder SymbolsOperand Data AreasBB: BitLOAD – LDIR, SR, AR, HR, TC, LR, TRB: BitBLOAD NOT – LD NOTIR, SR, AR, HR, TC, LRB: BitBAND – ANDIR, SR, AR, HR, TC, LRB: BitBAND NOT – AND NOTIR, SR, AR, HR, TC, LRB: BitOR – ORBOR NOT – OR NOTBIR, SR, AR, HR, TC, LRB: BitIR, SR, AR, HR, TC, LRLimitationsThere is no limit to the number of any of these instructions, or restrictions in theorder in which they must be used, as long as the memory capacity of the PC isnot exceeded.DescriptionThese six basic instructions correspond to the conditions on a ladder diagram.As described in Section 6 Ladder-diagram Programming, the status of the bitsassigned to each instruction determines the execution conditions for all otherinstructions.
Each of these instructions and each bit address can be used asmany times as required. Each can be used in as many of these instructions asrequired.The status of the bit operand (B) assigned to LD or LD NOT determines the firstexecution condition. AND takes the logical AND between the execution condition and the status of its bit operand; AND NOT, the logical AND between theexecution condition and the inverse of the status of its bit operand. OR takes thelogical OR between the execution condition and the status of its bit operand; ORNOT, the logical OR between the execution condition and the inverse of the status of its bit operand.Flags346There are no flags affected by these instructions.SectionBit Control Instructions7-87-7-2 AND LOAD and OR LOADAND LOAD – AND LDLadder Symbol00000000020000100003OR LOAD – OR LD00000000010000200003Ladder SymbolDescriptionWhen instructions are combined into blocks that cannot be logically combinedusing only OR and AND operations, AND LD and OR LD are used.
WhereasAND and OR operations logically combine a bit status and an execution condition, AND LD and OR LD logically combine two execution conditions, the currentone and the last unused one.In order to draw ladder diagrams, it is not necessary to use AND LD and OR LDinstructions, nor are they necessary when inputting ladder diagrams directly, asis possible from the SSS. They are required, however, to convert the program toand input it in mnemonic form.In order to reduce the number of programming instructions required, a basic understanding of logic block instructions is required.
For an introduction to logicblocks, refer to 6-3-6 Logic Block Instructions.FlagsThere are no flags affected by these instructions.7-8Bit Control InstructionsThere are seven instructions that can be used generally to control individual bitstatus. These are OUT, OUT NOT, DIFU(13), DIFD(14), SET, RSET, andKEEP(11). These instructions are used to turn bits ON and OFF in differentways.7-8-1 OUTPUT and OUTPUT NOT – OUT and OUT NOTOUTPUT – OUTLadder SymbolOperand Data AreasB: BitBOUTPUT NOT – OUT NOTLadder SymbolIR, SR, AR, HR, LR, TROperand Data AreasB: BitBIR, SR, AR, HR, LRLimitationsAny output bit can generally be used in only one instruction that controls its status.DescriptionOUT and OUT NOT are used to control the status of the designated bit accordingto the execution condition.347SectionBit Control Instructions7-8OUT turns ON the designated bit for an ON execution condition, and turns OFFthe designated bit for an OFF execution condition.
With a TR bit, OUT appears ata branching point rather than at the end of an instruction line. Refer to 6-3-8Branching Instruction Lines for details.OUT NOT turns ON the designated bit for a OFF execution condition, and turnsOFF the designated bit for an ON execution condition.OUT and OUT NOT can be used to control execution by turning ON and OFF bitsthat are assigned to conditions on the ladder diagram, thus determining execution conditions for other instructions. This is particularly helpful and allows acomplex set of conditions to be used to control the status of a single work bit, andthen that work bit can be used to control other instructions.The length of time that a bit is ON or OFF can be controlled by combining theOUT or OUT NOT with TIM.
Refer to Examples under 7-15-1 TIMER – TIM fordetails.FlagsThere are no flags affected by these instructions.7-8-2 SET and RESET – SET and RSETLadder SymbolsOperand Data AreasSET BB: BitIR, SR, AR, HR, LRRSET BB: BitIR, SR, AR, HR, LRDescriptionSET turns the operand bit ON when the execution condition is ON, and does notaffect the status of the operand bit when the execution condition is OFF.
RSETturns the operand bit OFF when the execution condition is ON, and does not affect the status of the operand bit when the execution condition is OFF.The operation of SET differs from that of OUT because the OUT instruction turnsthe operand bit OFF when its execution condition is OFF. Likewise, RSET differsfrom OUT NOT because OUT NOT turns the operand bit ON when its executioncondition is OFF.Note On the Programming Console, input SET by pressing the FUN and SET Keysand input RSET by pressing the FUN and RESET Keys.PrecautionsThe status of operand bits for SET and RSET programmed between IL(02) andILC(03) or JMP(04) and JME(05) will not change when the interlock or jumpcondition is met (i.e., when IL(02) or JMP(04) is executed with an OFF executioncondition).FlagsThere are no flags affected by these instructions.ExamplesThe following examples demonstrate the difference between OUT and SET/RSET.
In the first example (Diagram A), IR 20000 will be turned ON or OFFwhenever IR 00000 goes ON or OFF.348SectionBit Control Instructions7-8In the second example (Diagram B), IR 10000 will be turned ON when IR 00001goes ON and will remain ON (even if IR 00001 goes OFF) until IR 00002 goesON.0000020000Address0000000001Diagram AInstructionOperandsLDOUT000002000000001SET 2000000002RSET 20000Diagram BAddress00000000010000200003InstructionOperandsLDSETLDRSET000012000000002200007-8-3 KEEP – KEEP(11)Ladder SymbolOperand Data AreasSB: BitKEEP(11)BRIR, SR, AR, HR, LRLimitationsAny output bit can generally be used in only one instruction that controls its status.DescriptionKEEP(11) is used to maintain the status of the designated bit based on twoexecution conditions.
These execution conditions are labeled S and R. S is theset input; R, the reset input. KEEP(11) operates like a latching relay that is set byS and reset by R.When S turns ON, the designated bit will go ON and stay ON until reset, regardless of whether S stays ON or goes OFF.
When R turns ON, the designated bitwill go OFF and stay OFF until reset, regardless of whether R stays ON or goesOFF. The relationship between execution conditions and KEEP(11) bit status isshown below.S execution conditionR execution conditionStatus of BFlagsThere are no flags affected by this instruction.349SectionBit Control InstructionsPrecautions7-8Exercise caution when using a KEEP reset line that is controlled by an externalnormally closed device.
Never use an input bit in an inverse condition on the reset (R) for KEEP(11) when the input device uses an AC power supply. The delayin shutting down the PC’s DC power supply (relative to the AC power supply tothe input device) can cause the designated bit of KEEP(11) to be reset. This situation is shown below.Input UnitASKEEP(11)NEVERBARBits used in KEEP are not reset in interlocks. Refer to the 7-11 INTERLOCK –and INTERLOCK CLEAR IL(02) and ILC(03) for details.7-8-4 DIFFERENTIATE UP and DOWN – DIFU(13) and DIFD(14)Ladder SymbolsOperand Data AreasDIFU(13) BB: BitIR, SR, AR, HR, LRDIFD(14) BB: BitIR, SR, AR, HR, LRLimitationsAny output bit can generally be used in only one instruction that controls its status.DescriptionDIFU(13) and DIFD(14) are used to turn the designated bit ON for one cycleonly.Whenever executed, DIFU(13) compares its current execution with the previousexecution condition.
If the previous execution condition was OFF and the current one is ON, DIFU(13) will turn ON the designated bit. If the previous execution condition was ON and the current execution condition is either ON or OFF,DIFU(13) will either turn the designated bit OFF or leave it OFF (i.e., if the designated bit is already OFF). The designated bit will thus never be ON for longerthan one cycle, assuming it is executed each cycle (see Precautions, below).Whenever executed, DIFD(14) compares its current execution with the previousexecution condition. If the previous execution condition was ON and the currentone is OFF, DIFD(14) will turn ON the designated bit.