The text of a manual · part 10 of 27
SYSMAC C20P/C28P/C40P/C60P P-type Programmable Controllers Operation Manual: SECTION 5, pages 63 to 72
Pages 63 to 72 of 211, from SYSMAC C20P/C28P/C40P/C60P P-type Programmable Controllers Operation Manual
The original document is the PDF (2.2 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 C28P
Page 63
Section 5–8
Jump and Jump End
When the execution condition for the first IL(02) is OFF, TIM 11 will be reset to 1.5 s, CNT 01 will not be changed, and 0502 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 11 will be executed according to the status of 0001, CNT 01 will not be changed, and 0502 will be turned OFF. When the execution conditions for both the IL(02) are ON, the program will execute as written.
5–8
Jump and Jump End – JMP(04) and JME(05) Ladder Symbols JMP(04)
JME(05)
Limitations
A maximum of eight jumps are allowable in any program.
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 as written. When the execution condition for JMP(04) is OFF, a jump is made to the the JME(05) with the same jump number and the instruction following JME(05) is executed next. Jumps, when made, will go immediately from JMP(04) to JME(05) without executing any instructions in between. 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) and JME(05) will not be changed. As all of the instructions between JMP(04) and JME(05) are skipped, jumps can be used to reduce scan time.
DIFU(13) and DIFD(14) in Jumps
Although DIFU(13) and DIFD(14) are designed to turn ON the designated bit for one scan, 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 scan. In a jump, it 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 that skips the DIFU(13) or DIFD(14), 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. Although this message also appears if JMP(04) 00 and JME(05) 00 are not used in pairs, the program will execute properly as written. The High-speed Counter (HDM(98) should not be used within a JMP(04)–JME(05) portion of the program.
Flags
There are no flags affected by these instructions.
Examples
Examples of jump programs are provided in 4–3–5 Jumps.
55
Page 64
Section 5–11
Timer and Counter Instructions
5–9
End – END(01) Ladder Symbol
Description
END(01)
END(01) is required as the last instruction in any program. 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 ER, CY, GR, EQ, and LE.
5–10 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 next instruction is moved to. 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–11 Timer and Counter Instructions TIM and TIMH are decrementing ON-delay timer instructions which require a TC number and a set value (SV). CNT is a decrementing counter instruction and CNTR 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. 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 00 through 47. 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 for operands that require bit data or for operands that require 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 by designating the TC number
56
Page 65
Section 5–11
Timer and Counter Instructions used to define that timer or counter to access the memory location that holds the PV. Note that “TIM 00” is used to designate the Timer instruction defined with TC number 00, 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. In explanations of ladder diagrams, the Completion Flag and PV accessed through a TC number are generally called the Completion Flag or the PV of the instruction (e.g., the Completion Flag of TIM 00 is the Completion Flag of TC number 00, which has been defined using TIM). 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 counter wired in this way can be set externally only during RUN or MONITOR mode. All SVs, including those set externally, must be in BCD.
5–11–1 Timer – TIM Definer Values N: TC number
Ladder Symbol
# (00 through 47) TIM N
SV
Operand Data Areas SV: Set value (word, BCD) IR, HR, #
Limitations
SV may be between 000.0 and 999.9 seconds. The decimal point of SV is not input. Each TC number can be used as the definer in only one timer or counter instruction. TC 00 through TC 47 should not be used in TIM if they are required for TIMH(15). Refer to 5–11–2 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. TIM accuracy is +0.0/–0.1 second. 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 goes OFF). The following figure illustrates the relationship between the execution condition for TIM and the Completion Flag assigned to it.
57
Page 66
Section 5–11
Timer and Counter Instructions 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–11–4 Counter – CNT for details. Program execution will continue even if a non-BCD SV is used, but timing will not be accurate.
Flags
ER:
Examples
All of the following examples use OUT in diagrams that would generally be used to control output bits in the IR area. There is no reason, however, why these diagrams cannot be modified to control execution of other instructions.
Example 1: Basic Application
The following example shows two timers, one set with a constant and one set via input word 01. Here, 0200 will be turned ON 15 seconds after 0000 goes ON and stays ON for at least 15 seconds. When 0000 goes OFF, the timer will be reset and 0200 will be turned OFF. When 0001 goes ON, TIM 01 is started from the SV provided through IR word 01. Bit 0201 is also turned ON when 0001 goes ON. When the SV in 01 has expired, 0201 is turned OFF. This bit will also be turned OFF when TIM 01 is reset, regardless of whether or not SV has expired.
SV is not in BCD.
0000
TIM 00
015.0 s
TIM 00 0200 0001
TIM 01
01
TIM 01 0201
Example 2: Extended Timers
Timers operating longer than 999.9 seconds can be formed in two ways. One is by programming consecutive timers, with the Completion Flag of each timer used to activate the next timer. A simple example with two 900.0-second (15-minute) timers combined to functionally form a 30-minute timer. 0000
TIM 01
900.0 s
TIM 02
900.0 s
TIM 01
TIM 02 0200
58
Page 67
Section 5–11
Timer and Counter Instructions
In this example, 0200 will be turned ON 30 minutes after 0000 goes ON. TIM can also be combined with CNT or CNT can be used to count SR area clock pulse bits to produce longer timers. An example is provided in 5–11–4 Counter – CNT. Example 3: ON/OFF Delays
TIM can be combined with KEEP(11) to delay turning a bit ON and OFF in reference to a desired execution condition. KEEP(11) is described in 5–6–3 Keep – KEEP(11). To create delays, the Completion Flags for two timers are used to determine the execution conditions for setting and resetting the bit designated for KEEP(11). The bit whose manipulation is to be delayed is used in KEEP(11). Turning ON and OFF the bit designated for KEEP(11) is thus delayed by the SV for the two timers. The two SV could naturally be the same if desired. In the following example, 0500 would be turned ON 5.0 seconds after 0000 goes ON and then turned OFF 3.0 seconds after 0000 goes OFF. It is necessary to use both 0500 and 0000 to determine the execution condition for TIM 02; 0000 in an inverse condition is necessary to reset TIM 02 when 0000 goes ON and 0500 is necessary to activate TIM 02 when 0000 goes OFF, setting 0500 by resetting TIM 01. 0000
0500
TIM 01
TIM 02
Example 4: One-shot Bits
TIM 01
5.0 s
TIM 02
3.0 s
0000
S
KEEP 0500 R
The length of time that a bit is kept ON or OFF can be controlled by combining TIM with OUT or OUT NOT. The following diagram demonstrates how this is possible. In this example, 0204 would remain ON for 1.5 seconds after 0000 goes ON regardless of the time 0000 stays ON. This is achieved by using 1000, activated by 0000, to turn ON 0204 . When TIM 01 comes ON (i.e., when the SV of TIM 01 has expired), 0204 will be turned OFF through TIM 01 (i.e., TIM 01 will turn ON for an inverse condition, creating an OFF execution condition for OUT 0204). TIM 01 will also turn OFF 1000 the next scan, resetting the one-shot.
59
Page 68
Section 5–11
Timer and Counter Instructions
1000
0000
1000 TIM 01
1000 TIM 0100 1.5 s
1000 TIM 01 0204
0000
0204 1.5 s
Example 5: Flicker Bits
1.5 s
Bits can be programmed to turn ON and OFF at a regular interval while a designated execution condition is ON by using TIM twice. One TIM functions to turn ON and OFF a specified bit, i.e., the Completion Flag of this TIM turns the specified bit ON and OFF. The other TIM functions to control the operation of the first TIM, i.e., when the first TIM’s Completion Flag goes ON, the second TIM is started and when the second TIM’s Completion Flag goes ON, the first TIM is started.
0000
TIM 02 TIM 01
1.0 s
TIM 02
1.5 s
TIM 01
TIM 01 0205
0000
0205 1.0 s 1.5 s 1.0 s 1.5 s
An easier but more limited method of creating a flicker bit is to AND one of the SR area clock pulse bits with the execution condition that is to be ON when the flicker bit is operating. Although this method does not use TIM, it is included here for comparison. This method is more limited because the ON and OFF times must be the same and they depend on the clock pulse bits available in the SR area.
60
Page 69
Section 5–11
Timer and Counter Instructions
5–11–2 High-speed Timer – TIMH(15)
Definer Values N: TC number
Ladder Symbol
# (00 though 47 ) TIMH(15) N
SV
Operand Data Areas SV: Set value (word, BCD) IR, HR, #
Limitations
SV may be between 00.00 and 99.99 seconds. The decimal point of SV is not input. Each TC number can be used as the definer in only one timer or counter instruction. A scan time of greater than 10 ms may affect the accuracy of the timer.
Description
TIMH(15) operates the same as TIM except that TIMH measures in units of 0.01 second and accuracy is +0.00/–0.01 second. Refer to 5–11–1 Timer – TIM for operational details and examples. All aspects except for the above considerations are the same.
Precautions
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–11–4 Counter – CNT for details. Program execution will continue even if a non-BCD SV is used, but timing will not be accurate.
Flags
ER:
SV is not in BCD.
5–11–3 Analog Timer Unit The Analog Timer Unit uses two I/O words to provide four timers (T0 to T3). Each of the four timers may be set to a specific timer value (SV) within one of four ranges. The SV for each timer may be set using either a variable resistor on the Analog Timer Unit or from an external variable resistor. Each timer is allocated five bits within the IR words allocated to the Analog Timer Units. The function of these is shown below. The words shown in the table are as seen from the CPU, i.e., the input word goes from the Analog Timer Unit to the CPU, the output word, from the CPU to the Analog Timer Unit. The CPU receives the Time Expired Flag from the Unit and sends the Start Control Bit, Pause Control Bit and Range Bits to the Unit.
61
Page 70
Section 5–11
Timer and Counter Instructions Bit
Input word
Output word
00
T0 Time Expired Flag
T0 Start Control Bit
01
T1 Time Expired Flag
T1 Start Control Bit
02
T2 Time Expired Flag
T2 Start Control Bit
03
T3 Time Expired Flag
T3 Start Control Bit
04
T0 Pause Control Bit
05
T1 Pause Control Bit
06
T2 Pause Control Bit
07
T3 Pause Control Bit
08
T0 Range Bits
09
Cannot be used.
10
T1 Range Bits
11 12
T2 Range Bits
13 14
T3 Range Bits
15 There is a SET indicator and a time expired indicator on the Analog Timer Unit for each timer. These indicators are lit when the corresponding timer’s Start Control Bit or Time Expired Flag is ON. When the Start Control Bit is turned ON, the timer begins operation and the SET indicator is lit. When the time set with the internal or external adjustment has expired, the corresponding Time Expired Flag is set. The time up indicator also lights. If the Pause Control Bit for a timer is turned ON from the PC, the timer will cease timing and the present value (PV) will be retained. Timing will resume when the Pause Control Bit is turned OFF. If the Start Control Bit is turned OFF before the set value (SV) of the timer has expired, the Time Expired Flag will not be turned ON. Timer ranges are set in the output words as shown in the following table. Timer
Output word bit
0.1 to 1s
1 to 10s
10 to 60s
1 to 10m
T0
08
OFF
ON
OFF
ON
09
OFF
OFF
ON
ON
10
OFF
ON
OFF
ON
11
OFF
OFF
ON
ON
12
OFF
ON
OFF
ON
13
OFF
OFF
ON
ON
14
OFF
ON
OFF
ON
15
OFF
ON
OFF
ON
T1 T2 T3
Example Setup
62
This example uses an Analog Timer Unit connected to a C28K CPU. Word allocations are shown in the following table.
Page 71
Section 5–11
Timer and Counter Instructions Unit
Input word
Output word
CPU
00
01
Analog Timer Unit
02
03
All four time’s are used. Times for two of them are adjusted on the variable resistors provided on the Analog Timer Unit. The other two times are adjusted using external resistors. These adjustments are made as follows. Refer to the Analog Timer Unit Installation Guide for hardware details.
Programming
Timer
SV
Range
Resistor adjustment
T0
Approx. 0.6 s
0.1 to 1 s
6/10th turn clockwise
T1
Approx. 3 s
1 to 10 s
3/10th turn clockwise
T2
Approx. 2.6 s
10 to 60 s
2/10th turn clockwise
T3
Approx. 8 min
1 to 10 min
8/10th turn clockwise
The following program sections are used to set up the required data and produce outputs from the four timers. The first section moves E400 into IR 06 to set the desired ranges (see table above). The second program section achieves the following operation.
1, 2, 3... 1. 2. 3. 4. 5.
IR 0500 is turned ON approximately 0.6 seconds after IR 0002 turns ON as the result of the action of T0. IR 0501 is turned ON approximately 3 seconds after IR 0003 turns ON as the result of the action of T1. IR 0502 is turned ON approximately 20 seconds after IR 0004 turns ON as the result of the action of T2. IR 0503 is turned ON approximately 8 minutes after IR 0004 turns ON as the result of the action of T3. T2 and T3 are made inoperative if IR 0015 is turned ON. First Scan Flag 1815 MOV(21) #E400 06
Content of IR O6 after MOV(21) 15
14
13
12
11
10
09
08
07
06
05
04
03
02
01
00
1
1
1
0
0
1
0
0
0
0
0
0
0
0
0
0
Range settings
63
Page 72
Section 5–11
Timer and Counter Instructions 0015 0606
Used to inhibit operation of T2 and T3. 0607 T0 Start Control Bit 0002 0600
T0 started.
0500
0500 turned ON when time for T0 expires.
T0 Time Expired Flag 0100
T1 Start Control Bit 0003 0601
T1 started.
0501
0501 turned ON when time for T1 expires.
T1 Time Expired Flag 0101
T2 Start Control Bit 0004 0602 T3 Start Control Bit
T2 and T3 started.
0603
T2 Time Expired Flag 0102 0502
0502 turned ON when time for T2 expires.
0503
0502 turned ON when time for T3 expires.
T3 Time Expired Flag 0103
5–11–4 Counter – CNT Definer Values N: TC number
Ladder Symbol
# (00 through 47) CP R
CNT N SV
Operand Data Areas SV: Set value (word, BCD) IR, HR, #
Limitations
Each TC number can be used as the definer in only one timer or counter instruction.
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 condi-
64