CPM2A_PROGRAMMING MANUAL (W353-E1-2) (986750), страница 61
Текст из файла (страница 61)
When executedwith an ON execution condition, either of these instructions will output a FALnumber to bits 00 to 07 of SR 253. The FAL number that is output can be between 01 and 99 and is input as the definer for FAL(06) or FALS(07). FAL(06)with a definer of 00 is used to reset this area (see below).FAL Area2530725300X101X100FAL(06) produces a non-fatal error and FALS(07) produces a fatal error. WhenFAL(06) is executed with an ON execution condition, the ALARM/ERROR indicator on the front of the CPU Unit will flash, but PC operation will continue. WhenFALS(07) is executed with an ON execution condition, the ALARM/ERROR indicator will light and PC operation will stop.The system also generates error codes to the FAL area.Resetting ErrorsFAL error codes will be retained in memory, although only one of these is available in the FAL area. To access the other FAL codes, reset the FAL area byexecuting FAL(06) 00.
Each time FAL(06) 00 is executed, another FAL error willbe moved to the FAL area, clearing the one that is already there.FAL(06) 00 is also used to clear message programmed with the instruction,MSG(46).If the FAL area cannot be cleared, as is generally the case when FALS(07) isexecuted, first remove the cause of the error and then clear the FAL area throughthe Programming Console or SSS.355Section 7-14Step Instructions7-14 Step Instructions:STEP DEFINE and STEP START–STEP(08)/SNXT(09)Ladder SymbolsDefiner Data AreasSTEP(08)STEP(08) BB: Control bitIR, AR, HR, LRSNXT(09) BB: Control bitIR, AR, HR, LRLimitationsAll control bits must be in the same word and must be consecutive.DescriptionThe step instructions STEP(08) and SNXT(09) are used together to set upbreakpoints between sections in a large program so that the sections can beexecuted as units and reset upon completion.
A section of program will usuallybe defined to correspond to an actual process in the application. (Refer to theapplication examples later in this section.) A step is like a normal programmingcode, except that certain instructions (i.e., END(01), IL(02)/ILC(03),JMP(04)/JME(05), and SBN(92)) may not be included.STEP(08) uses a control bit in the IR or HR areas to define the beginning of asection of the program called a step.
STEP(08) does not require an executioncondition, i.e., its execution is controlled through the control bit. To start execution of the step, SNXT(09) is used with the same control bit as used forSTEP(08). If SNXT(09) is executed with an ON execution condition, the stepwith the same control bit is executed. If the execution condition is OFF, the step isnot executed.
The SNXT(09) instruction must be written into the program so thatit is executed before the program reaches the step it starts. It can be used at different locations before the step to control the step according to two differentexecution conditions (see example 2, below). Any step in the program that hasnot been started with SNXT(09) will not be executed.Once SNXT(09) is used in the program, step execution will continue untilSTEP(08) is executed without a control bit. STEP(08) without a control bit mustbe preceded by SNXT(09) with a dummy control bit. The dummy control bit maybe any unused IR or HR bit. It cannot be a control bit used in a STEP(08).356Section 7-14Step InstructionsExecution of a step is completed either by execution of the next SNXT(09) or byturning OFF the control bit for the step (see example 3 below).
When the step iscompleted, all of the IR and HR bits in the step are turned OFF and all timers inthe step are reset to their SVs. Counters, shift registers, and bits used inKEEP(11) maintain status. Two simple steps are shown below.00000SNXT(09) LR 1005Starts step executionSTEP(08) LR 1005Step controlled by LR 10051st step00001SNXT(09) 20200STEP(08) 20200Step controlled by IR 202002nd step00002SNXT(09) 23000STEP(08)AddressInstruction000000000100002LDSNXT(09)STEP(08)OperandsLRLR0000010051005Step controlled by LR 1005.0010000101LDSNXT(09)0000120200AddressInstruction00102STEP(08)Ends step executionOperands20200Step controlled by IR 20200.002000020100202LDSNXT(09)STEP(08)0000223000---Steps can be programmed in consecutively. Each step must start with STEP(08)and generally ends with SNXT(09) (see example 3, below, for an exception).When steps are programmed in series, three types of execution are possible:sequential, branching, or parallel.
The execution conditions for, and the positioning of, SNXT(09) determine how the steps are executed. The three examplesgiven below demonstrate these three types of step execution.PrecautionsInterlocks, jumps, SBN(92), and END(01) cannot be used within step programs.Bits used as control bits must not be used anywhere else in the program unlessthey are being used to control the operation of the step (see example 3, below).All control bits must be in the same word and must be consecutive.If IR or LR bits are used for control bits, their status will be lost during any powerinterruption. If it is necessary to maintain status to resume execution at the samestep, HR bits must be used.357Section 7-15Timer and Counter InstructionsFlags25407: Step Start Flag; turns ON for one cycle when STEP(08) is executed andcan be used to reset counters in steps as shown below if necessary.00000StartSNXT(09) 2000020000STEP(08) 2000000100CPCNT 0012540725407RAddressInstruction00000000010000200003LDSNXT(09)STEP(08)LDOperands00000200002000000100#0003Address00004000051 cycleInstructionOperandsLDCNT#254070100037-15 Timer and Counter InstructionsTIM and TIMH(15) are decrementing ON-delay timer instructions which requirea TC number and a set value (SV).
STIM(69) is used to control the interval timers, which are used to activate interrupt routines.CNT is a decrementing counter instruction and CNTR(12) is a reversible counterinstruction. Both require a TC number and a SV. Both are also connected to multiple instruction lines which serve as an input signal(s) and a reset. CTBL(63),INT(89), and PRV(62) are used to manage the high-speed counter. INT(89) isalso used to stop pulse output.Any one TC number cannot be defined twice, i.e., once it has been used as thedefiner in any of the timer or counter instructions, it cannot be used again. Oncedefined, TC numbers can be used as many times as required as operands ininstructions other than timer and counter instructions.TC numbers run from 000 through 255 in the CPM2A/CPM2C PCs and from 000through 127 in the CPM1/CPM1A/SRM1(-V2) PCs.
No prefix is required whenusing a TC number as a definer in a timer or counter instruction. Once defined asa timer, a TC number can be prefixed with TIM for use as an operand in certaininstructions. The TIM prefix is used regardless of the timer instruction that wasused to define the timer. Once defined as a counter, a TC number can be prefixed with CNT for use as an operand in certain instructions. The CNT is alsoused regardless of the counter instruction that was used to define the counter.TC numbers can be designated as operands that require either bit or word data.When designated as an operand that requires bit data, the TC number accessesa bit that functions as a ‘Completion Flag’ that indicates when the time/count hasexpired, i.e., the bit, which is normally OFF, will turn ON when the designated SVhas expired.
When designated as an operand that requires word data, the TCnumber accesses a memory location that holds the present value (PV) of thetimer or counter. The PV of a timer or counter can thus be used as an operand inCMP(20), or any other instruction for which the TC area is allowed. This is doneby designating the TC number used to define that timer or counter to access thememory location that holds the PV.358Section 7-15Timer and Counter InstructionsNote that “TIM 000” is used to designate the TIMER instruction defined with TCnumber 000, to designate the Completion Flag for this timer, and to designatethe PV of this timer. The meaning of the term in context should be clear, i.e., thefirst is always an instruction, the second is always a bit operand, and the third isalways a word operand.
The same is true of all other TC numbers prefixed withTIM or CNT.An SV can be input as a constant or as a word address in a data area. If an IRarea word assigned to an Input Unit is designated as the word address, the InputUnit can be wired so that the SV can be set externally through thumbwheelswitches or similar devices. Timers and counters wired in this way can only beset externally during RUN or MONITOR mode. All SVs, including those set externally, must be in BCD.7-15-1 TIMER – TIMDefiner ValuesN: TC numberLadder Symbol#TIMNSVOperand Data AreasSV: Set value (word, BCD)IR, SR, AR, DM, HR, LR, #LimitationsSV is between 000.0 and 999.9. The decimal point is not entered.Each TC number can be used as the definer in only one TIMER or COUNTERinstruction.
TC numbers run from 000 through 255 in the CPM2A/CPM2C PCsand from 000 through 127 in the CPM1/CPM1A/SRM1(-V2) PCs.TC 000 through TC 003 (TC 000 through TC 015 in the CPM2A/CPM2C) shouldnot be used in TIM if they are required for TIMH(15). Refer to 7-15-2 HIGHSPEED TIMER – TIMH(15) for details.In the CPM2A/CPM2C PCs, TC 004 through TC 007 should not be used in TIM ifthey are required for TMHH(––). Refer to 7-15-3 VERY HIGH-SPEED TIMER –TMHH(––) for details.DescriptionA timer is activated when its execution condition goes ON and is reset (to SV)when the execution condition goes OFF.
Once activated, TIM measures in unitsof 0.1 second from the SV.If the execution condition remains ON long enough for TIM to time down to zero,the Completion Flag for the TC number used will turn ON and will remain ONuntil TIM is reset (i.e., until its execution condition is goes OFF).The following figure illustrates the relationship between the execution conditionfor TIM and the Completion Flag assigned to it.ONExecution conditionOFFONCompletion FlagOFFSVPrecautionsSVTimers in interlocked program sections are reset when the execution conditionfor IL(02) is OFF. Power interruptions also reset timers. If a timer that is not resetunder these conditions is desired, SR area clock pulse bits can be counted toproduce timers using CNT. Refer to 7-15-5 COUNTER – CNT for details.359Section 7-15Timer and Counter InstructionsThe Completion Flag may be turned ON one cycle late when reading its statusfrom the user program.Always reset the timer after changing between TIM and TIMH(015) in onlineediting.
The timer will not work properly if it is not reset.If the timer’s set value is set to 0000, the Completion Flag will turn ON as soon asthe timer’s execution condition turns ON. If the timer’s set value is set to 0001,the Completion Flag will turn ON somewhere between 0 and 0.1 s after the timer’s execution condition turns ON (i.e., the timer accuracy will actually determinethe time), and may turn ON as soon as the timer’s execution condition turns ON.Always consider the accuracy of the timer (0 to –0.1 s) in application programs.FlagsER:Indirectly addressed DM word is non-existent. (Content of *DM word isnot BCD, or the DM area boundary has been exceeded.)7-15-2 HIGH-SPEED TIMER – TIMH(15)Definer ValuesN: TC numberLadder Symbol#TIMH(15) NSVOperand Data AreasSV: Set value (word, BCD)IR, SR, AR, DM, HR, LR, #LimitationsSV is between 00.00 and 99.99.