The text of a manual · part 25 of 60
SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual: SECTION 5 Instruction Set, pages 219 to 228
Pages 219 to 228 of 520, from SYSMAC CQM1/CPM1/CPM1A/SRM1 Programmable Controllers Programming Manual
The original document is the PDF (2.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Omron CQM1-CPU21
Page 219
Section 5-11
INTERLOCK and INTERLOCK CLEAR – IL(02) and ILC(03) Precautions rDIFU(13) and DIFD(14) operation can be uncertain when the instructions are programmed between IL and ILC, between JMP and JME, or in subroutines. Refer to 5-11 INTERLOCK and INTERLOCK CLEAR – IL(02) and ILC(03), 5-12 JUMP and JUMP END – JMP(04) and JME(05), 5-25 Subroutine Instructions, and 5-26-8 INTERRUPT CONTROL – INT(89).
Example
In this example, IR 10014 will be turned ON for one cycle when IR 00000 goes from OFF to ON. IR 10015 will be turned ON for one cycle when IR 00000 goes from ON to OFF.
00000 DIFU(13) 10014
DIFD(14) 10015
5-9
Address
Instruction
00000 00001 00002
LD DIFU(13) DIFD(14)
Operands 00000 10014 10015
NO OPERATION – NOP(00)
Description
NOP(00) is not generally required in programming and there is no ladder symbol for it. When NOP(00) is found in a program, nothing is executed and the program execution moves to the next instruction. When memory is cleared prior to programming, NOP(00) is written at all addresses. NOP(00) can be input through the 00 function code.
Flags
There are no flags affected by NOP(00).
5-10 END – END(01) Ladder Symbol
END(01)
Description
END(01) is required as the last instruction in any program. If there are subroutines, END(01) is placed after the last subroutine. No instruction written after END(01) will be executed. END(01) can be placed anywhere in the program to execute all instructions up to that point, as is sometimes done to debug a program, but it must be removed to execute the remainder of the program. If there is no END(01) in the program, no instructions will be executed and the error message “NO END INST” will appear.
Flags
END(01) turns OFF the ER, CY, GR, EQ, and LE flags.
5-11 INTERLOCK and INTERLOCK CLEAR – IL(02) and ILC(03)
Description
Ladder Symbol
IL(02)
Ladder Symbol
ILC(03)
IL(02) is always used in conjunction with ILC(03) to create interlocks. Interlocks are used to enable branching in the same way as can be achieved with TR bits, but treatment of instructions between IL(02) and ILC(03) differs from that with TR bits when the execution condition for IL(02) is OFF. If the execution condition of IL(02) is ON, the program will be executed as written, with an ON execution condition used to start each instruction line from the point where IL(02) is located through the next ILC(03). Refer to 4-3-8 Branching Instruction Lines for basic descriptions of both methods.
201
Page 220
Section 5-11
INTERLOCK and INTERLOCK CLEAR – IL(02) and ILC(03)
If the execution condition for IL(02) is OFF, the interlocked section between IL(02) and ILC(03) will be treated as shown in the following table: Instruction
Treatment
OUT and OUT NOT
Designated bit turned OFF.
TIM and TIMH(15)
Reset.
CNT, CNTR(12)
PV maintained.
KEEP(11)
Bit status maintained.
DIFU(13) and DIFD(14)
Not executed (see below).
All other instructions
The instructions are not executed, and all IR, AR, LR, HR, and SR bits and words written to as operands in the instructions are turned OFF.
IL(02) and ILC(03) do not necessarily have to be used in pairs. IL(02) can be used several times in a row, with each IL(02) creating an interlocked section through the next ILC(03). ILC(03) cannot be used unless there is at least one IL(02) between it and any previous ILC(03). DIFU(13) and DIFD(14) in Interlocks
Changes in the execution condition for a DIFU(13) or DIFD(14) are not recorded if the DIFU(13) or DIFD(14) is in an interlocked section and the execution condition for the IL(02) is OFF. When DIFU(13) or DIFD(14) is execution in an interlocked section immediately after the execution condition for the IL(02) has gone ON, the execution condition for the DIFU(13) or DIFD(14) will be compared to the execution condition that existed before the interlock became effective (i.e., before the interlock condition for IL(02) went OFF). The ladder diagram and bit status changes for this are shown below. The interlock is in effect while 00000 is OFF. Notice that 01000 is not turned ON at the point labeled A even though 00001 has turned OFF and then back ON.
00000 IL(02) 00001 DIFU(13) 01000 ILC(03)
A
Address
Instruction
00000 00001 00002 00003 00004
LD IL(02) LD DIFU(13) ILC(03)
Operands 00000 00001 01000
ON
00000
OFF ON
00001
OFF ON
01000
OFF
Precautions
There must be an ILC(03) following any one or more IL(02). Although as many IL(02) instructions as are necessary can be used with one ILC(03), ILC(03) instructions cannot be used consecutively without at least one IL(02) in between, i.e., nesting is not possible. Whenever a ILC(03) is executed, all interlocks between the active ILC(03) and the preceding ILC(03) are cleared. When more than one IL(02) is used with a single ILC(03), an error message will appear when the program check is performed, but execution will proceed normally.
Flags
202
There are no flags affected by these instructions.
Page 221
Section 5-12
JUMP and JUMP END – JMP(04) and JME(05) Example
The following diagram shows IL(02) being used twice with one ILC(03).
00000 IL(02) 00001 TIM 127 #0015
001.5 s
Address
Instruction
00000 00001 00002 00003
LD IL(02) LD TIM
00004 00005 00006 00007 00008 00009 00010
LD IL(02) LD AND NOT LD LD CNT
00011 00012 00013
LD OUT ILC(03)
00000
#
00002 IL(02) 00003 00100
Operands
00004
CP R
CNT 001 IR 010
00005
00003 00004 00100 00100 001 010 00005 00502
00502
ILC(03)
00001 127 0015 00002
When the execution condition for the first IL(02) is OFF, TIM 127 will be reset to 1.5 s, CNT 001 will not be changed, and 00502 will be turned OFF. When the execution condition for the first IL(02) is ON and the execution condition for the second IL(02) is OFF, TIM 127 will be executed according to the status of 00001, CNT 001 will not be changed, and 00502 will be turned OFF. When the execution conditions for both the IL(02) are ON, the program will execute as written.
5-12 JUMP and JUMP END – JMP(04) and JME(05) Ladder Symbols JMP(04) N
Definer Values N: Jump number #
JME(05) N
N: Jump number #
Limitations
Jump numbers 01 through 99 (00 through 49 in CPM1/CPM1A/SRM1 PCs) may be used only once in JMP(04) and once in JME(05), i.e., each can be used to define one jump only. Jump number 00 can be used as many times as desired. Jump numbers run from 00 through 99 in the CQM1 PCs and from 00 through 49 in the CPM1/CPM1A/SRM1 PCs.
Description
JMP(04) is always used in conjunction with JME(05) to create jumps, i.e., to skip from one point in a ladder diagram to another point. JMP(04) defines the point from which the jump will be made; JME(05) defines the destination of the jump. When the execution condition for JMP(04) in ON, no jump is made and the program is executed consecutively as written. When the execution condition for JMP(04) is OFF, a jump is made to the JME(05) with the same jump number and the instruction following JME(05) is executed next.
203
Page 222
JUMP and JUMP END – JMP(04) and JME(05)
Section 5-12
If the jump number for JMP(04) is between 01 and 99, jumps, when made, will go immediately to JME(05) with the same jump number without executing any instructions in between. The status of timers, counters, bits used in OUT, bits used in OUT NOT, and all other status bits controlled by the instructions between JMP(04) and JMP(05) will not be changed. Each of these jump numbers can be used to define only one jump. Because all of instructions between JMP(04) and JME(05) are skipped, jump numbers 01 through 99 (01 through 49 in CPM1/ CPM1A/SRM1 PCs) can be used to reduce cycle time. Jump Number 00 If the jump number for JMP(04) is 00, the CPU Unit will look for the next JME(05) with a jump number of 00. To do so, it must search through the program, causing a longer cycle time (when the execution condition is OFF) than for other jumps. The status of timers, counters, bits used in OUT, bits used in OUT NOT, and all other status controlled by the instructions between JMP(04) 00 and JMP(05) 00 will not be changed. jump number 00 can be used as many times as desired. A jump from JMP(04) 00 will always go to the next JME(05) 00 in the program. It is thus possible to use JMP(04) 00 consecutively and match them all with the same JME(05) 00. It makes no sense, however, to use JME(05) 00 consecutively, because all jumps made to them will end at the first JME(05) 00. DIFU(13) and DIFD(14) in Jumps
Although DIFU(13) and DIFD(14) are designed to turn ON the designated bit for one cycle, they will not necessarily do so when written between JMP(04) and JMP (05). Once either DIFU(13) or DIFD(14) has turned ON a bit, it will remain ON until the next time DIFU(13) or DIFD(14) is executed again. In normal programming, this means the next cycle. In a jump, this means the next time the jump from JMP(04) to JME(05) is not made, i.e., if a bit is turned ON by DIFU(13) or DIFD(14) and then a jump is made in the next cycle so that DIFU(13) or DIFD(14) are skipped, the designated bit will remain ON until the next time the execution condition for the JMP(04) controlling the jump is ON.
Precautions
When JMP(04) and JME(05) are not used in pairs, an error message will appear when the program check is performed. This message also appears if JMP(04) 00 and JME(05) 00 are not used in pairs, but the program will execute properly as written.
Flags
There are no flags affected by these instructions.
Examples
Examples of jump programs are provided in 4-3-9 Jumps.
204
Page 223
Section 5-13
User Error Instructions
5-13 User Error Instructions: FAILURE ALARM AND RESET – FAL(06) and SEVERE FAILURE ALARM – FALS(07) Ladder Symbols
Definer Data Areas
@FAL(06) N
FAL(06) N
N: FAL number # (00 to 99)
N: FAL number
FALS(07) N
# (01 to 99)
Description
FAL(06) and FALS(07) are provided so that the programmer can output error numbers for use in operation, maintenance, and debugging. When executed with an ON execution condition, either of these instructions will output a FAL number 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 Area 25307
25300
X101
X100
FAL(06) produces a non-fatal error and FALS(07) produces a fatal error. When FAL(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. When FALS(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 Errors
FAL 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 by executing FAL(06) 00. Each time FAL(06) 00 is executed, another FAL error will be moved to the FAL area, clearing the one that is already there. FAL error codes are recorded in numerical order. 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) is executed, first remove the cause of the error and then clear the FAL area through the Programming Console or SSS.
205
Page 224
Section 5-14
Step Instructions
5-14 Step Instructions: STEP DEFINE and STEP START–STEP(08)/SNXT(09) Ladder Symbols
Definer Data Areas STEP(08)
STEP(08) B
B: Control bit IR, AR, HR, LR
SNXT(09) B
B: Control bit IR, AR, HR, LR
Limitations
All control bits must be in the same word and must be consecutive.
Description
The step instructions STEP(08) and SNXT(09) are used together to set up breakpoints between sections in a large program so that the sections can be executed as units and reset upon completion. A section of program will usually be defined to correspond to an actual process in the application. (Refer to the application examples later in this section.) A step is like a normal programming code, 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 a section of the program called a step. STEP(08) does not require an execution condition, 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 for STEP(08). If SNXT(09) is executed with an ON execution condition, the step with the same control bit is executed. If the execution condition is OFF, the step is not executed. The SNXT(09) instruction must be written into the program so that it 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 different execution conditions (see example 2, below). Any step in the program that has not been started with SNXT(09) will not be executed. Once SNXT(09) is used in the program, step execution will continue until STEP(08) is executed without a control bit. STEP(08) without a control bit must be preceded by SNXT(09) with a dummy control bit. The dummy control bit may be any unused IR or HR bit. It cannot be a control bit used in a STEP(08).
206
Page 225
Section 5-14
Step Instructions
Execution of a step is completed either by execution of the next SNXT(09) or by turning OFF the control bit for the step (see example 3 below). When the step is completed, all of the IR and HR bits in the step are turned OFF and all timers in the step are reset to their SVs. Counters, shift registers, and bits used in KEEP(11) maintain status. Two simple steps are shown below.
00000 SNXT(09) LR 1500
Starts step execution
STEP(08) LR 1500
Step controlled by LR 1500
1st step
00001 SNXT(09) LR 1501
STEP(08) LR 1501
Step controlled by LR 1501
2nd step
00002 SNXT(09) LR 1502
STEP(08)
Address
Instruction
00000 00001 00002
LD SNXT(09) STEP(08)
Operands
LR LR
00000 1500 1500
Step controlled by LR 1500. 00100 00101
LD SNXT(09)
LR
00001 1501
Ends step execution
Address
Instruction
Operands
00102
STEP(08)
LR
1501
Step controlled by LR 1501. 00200 00201 00202
LD SNXT(09) STEP(08)
LR ---
00002 1502
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 examples given below demonstrate these three types of step execution. Precautions
Interlocks, 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 unless they 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 power interruption. If it is necessary to maintain status to resume execution at the same step, HR bits must be used.
207
Page 226
Section 5-15
Timer and Counter Instructions Flags
25407: Step Start Flag; turns ON for one cycle when STEP(08) is executed and can be used to reset counters in steps as shown below if necessary.
00000 Start
SNXT(09) 01000 01000 STEP(08) 01000 00100
CP CNT 01 25407
25407
R
Address
Instruction
00000 00001 00002 00003
LD SNXT(09) STEP(08) LD
Operands 00000 01000 01000 00100
#0003
Address 00004 00005
1 cycle
Instruction
Operands
LD CNT #
25407 01 0003
5-15 Timer and Counter Instructions TIM and TIMH(15) are decrementing ON-delay timer instructions which require a 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 counter instruction. 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) is also used to stop pulse output. Any one TC number cannot be defined twice, i.e., once it has been used as the definer in any of the timer or counter instructions, it cannot be used again. Once defined, TC numbers can be used as many times as required as operands in instructions other than timer and counter instructions. TC numbers run from 000 through 511 in the CQM1 PCs and from 000 through 127 in the CPM1/CPM1A/SRM1 PCs. No prefix is required when using a TC number as a definer in a timer or counter instruction. Once defined as a timer, a TC number can be prefixed with TIM for use as an operand in certain instructions. The TIM prefix is used regardless of the timer instruction that was used 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 also used 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 accesses a bit that functions as a ‘Completion Flag’ that indicates when the time/count has expired, i.e., the bit, which is normally OFF, will turn ON when the designated SV has expired. When designated as an operand that requires word data, the TC number accesses a memory location that holds the present value (PV) of the timer or counter. The PV of a timer or counter can thus be used as an operand in CMP(20), or any other instruction for which the TC area is allowed. This is done by designating the TC number used to define that timer or counter to access the memory location that holds the PV.
208
Page 227
Section 5-15
Timer and Counter Instructions
Note that “TIM 000” is used to designate the TIMER instruction defined with TC number 000, to designate the Completion Flag for this timer, and to designate the PV of this timer. The meaning of the term in context should be clear, i.e., the first is always an instruction, the second is always a bit operand, and the third is always a word operand. The same is true of all other TC numbers prefixed with TIM or CNT. An SV can be input as a constant or as a word address in a data area. If an IR area word assigned to an Input Unit is designated as the word address, the Input Unit can be wired so that the SV can be set externally through thumbwheel switches or similar devices. Timers and counters wired in this way can only be set externally during RUN or MONITOR mode. All SVs, including those set externally, must be in BCD.
5-15-1 TIMER – TIM Definer Values N: TC number
Ladder Symbol
# TIM
N SV
Operand Data Areas SV: Set value (word, BCD) IR, SR, AR, DM, HR, LR, #
Limitations
SV 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 COUNTER instruction. TC numbers run from 000 through 511 in the CQM1 PCs and from 000 through 127 in the CPM1, CPM1A/SRM1 PCs. TC 000 through TC 015 (TC 000 through TC 003 in the CPM1/CPM1A/SRM1) should not be used in TIM if they are required for TIMH(15). Refer to 5-15-4 HIGH-SPEED TIMER – TIMH(15) for details.
Description
A 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 units of 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 ON until TIM is reset (i.e., until its execution condition is goes OFF). The following figure illustrates the relationship between the execution condition for TIM and the Completion Flag assigned to it. ON
Execution condition
OFF ON
Completion Flag
OFF
SV
Precautions
SV
Timers in interlocked program sections are reset when the execution condition for IL(02) is OFF. Power interruptions also reset timers. If a timer that is not reset under these conditions is desired, SR area clock pulse bits can be counted to produce timers using CNT. Refer to 5-15-2 COUNTER – CNT for details.
209
Page 228
Section 5-15
Timer and Counter Instructions Flags
ER:
SV is not in BCD. Indirectly addressed DM word is non-existent. (Content of DM word is not BCD, or the DM area boundary has been exceeded.)
5-15-2 COUNTER – CNT Definer Values N: TC number
Ladder Symbol
# CP
CNT N
R
Operand Data Areas
SV
SV: Set value (word, BCD) IR, SR, AR, DM, HR, LR, #
Limitations
Each TC number can be used as the definer in only one TIMER or COUNTER instruction. TC numbers run from 000 through 511 in the CQM1 PCs and from 000 through 127 in the CPM1/CPM1A/SRM1 PCs.
Description
CNT is used to count down from SV when the execution condition on the count pulse, CP, goes from OFF to ON, i.e., the present value (PV) will be decremented by one whenever CNT is executed with an ON execution condition for CP and the execution condition was OFF for the last execution. If the execution condition has not changed or has changed from ON to OFF, the PV of CNT will not be changed. The Completion Flag for a counter is turned ON when the PV reaches zero and will remain ON until the counter is reset. CNT is reset with a reset input, R. When R goes from OFF to ON, the PV is reset to SV. The PV will not be decremented while R is ON. Counting down from SV will begin again when R goes OFF. The PV for CNT will not be reset in interlocked program sections or by power interruptions. Changes in execution conditions, the Completion Flag, and the PV are illustrated below. PV line height is meant only to indicate changes in the PV. Execution condition on count pulse (CP)
ON
Execution condition on reset (R)
ON
OFF
OFF ON
Completion Flag
OFF SV
SV
PV
0002
SV – 1 SV – 2
0001 0000
Precautions
Program execution will continue even if a non-BCD SV is used, but the SV will not be correct.
Flags
ER:
SV is not in BCD. Indirectly addressed DM word is non-existent. (Content of DM word is not BCD, or the DM area boundary has been exceeded.)
210