The text of a manual · part 19 of 49
FX3G Series Programmable Controllers User's Manual [Hardware Edition]: 11. Use of High-speed Counters
Pages 136 to 145 of 384, from FX3G Series Programmable Controllers User's Manual [Hardware Edition]
The original document is the PDF (11 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.
Filed in the catalog under the Mitsubishi FX-16EYR
Page 136
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11.1 Outline
11. Use of High-speed Counters 11.1
Outline High-speed counters use input terminals X000 to X007 of the main unit for inputs, and offer counting up to 60kHz (1 phase). Input terminals not used for high-speed counters are available for general-purpose inputs. → For the input specifications for X000 to X007 of the main unit, refer to Section 10.2.
11.2
Types of Counting and Operations The main unit has built-in 32-bit high speed bi-directional counters (1-phase 1-count input, 1-phase 2-count input and 2-phase 2-count input). For some high-speed counters, external reset input terminals or external start input terminals (start of counting) can be selected.
11.2.1 Types and input signal forms The types and input signals (waveforms) of high-speed counters (1-phase 1-count input, 1-phase 2-count input and 2-phase 2-count input) are shown below. Counter type
Input signal form
1-phase 1-count input
UP/ DOWN
1-phase 2-count input
UP
Counting direction Down-count or up-count is specified by turning on or off M8235 to M8245. ON:Down-counting OFF:Up-counting
+1
+1 -1
Up-count or down-count The counting direction can be checked with M8246 to M8250. ON:Down-counting OFF:Up-counting
-1
DOWN Phase A 2-phase 2-count input
+1
+1
-1
-1
Phase B Up-counting
Down-counting
Automatic up-count or down-count according to change in input status of phase A/B The counting direction can be checked with M8251 to M8255. ON:Down-counting OFF:Up-counting
11.2.2 High-speed counter device notations The input terminal assignments for FX 3G PLC high-speed counters can be switched when used in combination with a special auxiliary relay. This section classifies these high-speed counter devices under the following notations. Note that an "(OP)" input cannot be programmed. Standard Device Numbers
Switched Device Numbers
C248
C248(OP)
C253
C253(OP)
C254
C254(OP)
11.2.3 Cautions in connecting mating device Encoders with the output forms in the following table can be connected to the input terminals. (The encoders may not function correctly depending on electrical compatibility. Check the specifications in advance.) Voltage output type encoders and absolute encoders cannot be connected to the high-speed counter input terminals. Terminals for connecting Input terminals of main unit
130
Output form that can be directly connected Open collector transistor output form (applicable to 24V DC)
Page 137
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11
List of Device Numbers and Functions → For details on the counter number (OP), refer to Subsection 11.2.2 Counter type
Device No. (counter)
C236 C237 C238 C239
10
C241
60
C249 C250
10
C252 C253 C254 C255
Provided
Provided
14
None
None
Provided
None
Provided
Provided
None
None
Provided
None
Provided
Provided
15
5
32-bit bi-directional counter
When using multiple high-speed counters, make sure that the sum of used frequency does not exceed the overall frequency. → For details on the overall frequency, refer to Section 11.7.
16 Input/Output Extension Blocks
*1.
32-bit bi-directional counter
30
C254(OP) 2-phase 2-count input
None
Input/Output Powered Extension Units
C251 C253(OP)
Provided
Test Run, Maintenance, Troubleshooting
C247 C248
60
12
13
10
C245
1-phase 2-count input
None
32-bit bi-directional counter
C242
C246 C248(OP)
None
60 10
C244
External start input terminal
60
C240
C243
External reset input terminal
Wiring for Various Uses
1-phase 1-count input
Data length
Output Wiring
C235
Response Frequency*1 (kHz)
High-Speed Counters
11.3
11.3 List of Device Numbers and Functions
17 Extension Power Supply Unit
18 Other Extension Units and Options
19 Display Module
20 Terminal Block
131
Page 138
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11.4
11.4 Allocation of Device Numbers to Input Numbers
Allocation of Device Numbers to Input Numbers The high-speed counter numbers are allocated to the input terminals X000 to X007 as shown in the following table. The input terminals not allocated for high-speed counters can be used as general input terminals.
11.4.1 Allocation table U: Up-count input R: External reset input Counter type
D: Down-count input S: External start input
Counter No. C235
A: A-phase input Input allocation
X000
X001
X002
X003
C236
U/D U/D U/D
R
C242
U/D
R
C243
U/D U/D
S U/D
C246
U
D
C247
U
D
R
S
R
C248
U
D
U
D
U
D
R
C253
A
B
R
C253(OP)*1
A
B
C248(OP)*1 U
D
C251
A
B
C252
A
B
C254
A
B
R
R
C250
2-phase 2-count input
R
R
C245
C249
S S
R
R
S A
C254(OP)*1 C255
*1.
X007
U/D
C240
C244
X006
U/D
C239 C241
X005
U/D
C238
1-phase 2-count input
X004
U/D
C237
1-phase 1-count input
B: B-phase input
A
B
R
B S
When a special auxiliary relay is driven in a program, the input terminals and their associated functions are switched. → For the function switching method, refer to Subsection 11.8.2.
11.4.2 Restriction of redundant use of input numbers The input terminals X000 to X007 can be used for high-speed counters, input interruption, pulse catch, SPD, ZRN and DSZR instructions and general-purpose inputs. Take care not to overlap the input numbers. For example, when C251 is used, X000 and X001 are occupied. Therefore, it is impossible to use C235, C236, C241, C244, C246, C247, C249, C252 and C254, input interruption pointers I000 and I101, pulse catch contacts M8170 and M8171 and SPD, ZRN and DSZR instructions at the same time.
132
Page 139
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11
Handling of High-speed Counters
High-Speed Counters
11.5
11.5 Handling of High-speed Counters
11.5.1 1-phase 1-count input
12 • C235 counts the number of times the input terminal X000 switches from OFF to ON while X012 is on.
Output Wiring
Examples of program
• While X011 is on, the counter resets when RST instruction is executed.
13
1) For C235 X010 M8235
Down-count/ up-count
X011 RST
Reset
C235
C235
K-5
Wiring for Various Uses
• The counters C235 to C245 switch to the down-count or up-count mode by turning on or off M8235 to M8245.
X012
Count input
14
X000
2) For C244 X010
Down-count/ up-count
RST
C244
• C244 starts counting immediately when the input terminal X006 turns on while X012 is on. The count input terminal is X000. The setting for this example is the data of the indirectly designated data register (D1,D0).
X011 Reset
X012 C244
D0(D1) The setting is (D1,D0).
External reset input
External start input
X001
X006
X000
• C244 can be reset by X011 on the sequence. For C244, X001 is allocated as the external reset input. The counter resets immediately when X001 turns on. • The counters C235 to C245 switch to the down-count or up-count mode by turning on or off M8235 to M8245.
16 Input/Output Extension Blocks
Count input
17
Main unit
Extension Power Supply Unit
Example of operation The above counter C235 operates as shown below. X010
Up-count
X011
Reset input
X012
Start input
Up-count
Down-count
18 Other Extension Units and Options
X000 Count input
4
5
4
3
2
1
0 -1
When output has operated
19
0 -2
-3
-4
-5
-4 -6
-7
-8
-7
-6
Display Module
C235 2 Current 1 0 value
3
15 Input/Output Powered Extension Units
M8244
Test Run, Maintenance, Troubleshooting
Main unit
-3
-5
20
C235 output contact
Terminal Block
133
Page 140
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11.5 Handling of High-speed Counters
C235 is set to the up-count or down-count mode through interruption by the count input X000. • When the current value increases from -6 to -5, the output contact is set, and when the value decreases from -5 to -6, it is reset. • The current value increases and decreases regardless of the operation of the output contact. However, when the counter’s value increments from 2,147,483,647, it changes to -2,147,483,648. In the same manner, when it decrements from -2,147,483,648, it changes to 2,147,483,647. (This type of counter is called a ring counter.) • When RST instruction is executed after the reset input X011 turns on, the current counter's value resets to 0, and the output contact is restored. • The current value, output contact operation and reset status of counters are backed up (kept) even if the power is turned off.
11.5.2 1-phase 2-count input These counters are 32-bit up-count/down-count binary counters. The operations of the output contact according to the current value are the same as those of the abovementioned 1-phase 1-count input high-speed counters. Examples of program 1) For C246 • While X012 is on, C246 increments the value when the input terminal X000 switches from OFF to ON and decrements the value when the input terminal X001 switches from OFF to ON.
X011 RST
C246
X012 C246
• The down-count/up-count operations of C246 to C250 can be monitored through the ON/OFF operations of M8246 to M8250.
D2(D3)
The setting is (D3,D2) Up-counting Down-counting input input X000
ON: Down-counting OFF: Up-counting
X001
Main unit
2) For C249 • While X012 is on, C249 starts counting immediately when the input terminal X006 turns on. The up-counting input terminal is X000, and the downcounting input terminal is X001.
X011 RST
C249
X012 C249
K1234
• C249 can be reset on the sequence by X011. For C249, X002 is allocated as reset input. When X002 turns External start on, C249 is immediately reset. input
Down-counting input External Up-counting reset input input X000
X001
X002
Main unit
134
X006
• The down-count/up-count operations of C246 to C250 can be monitored through the ON/OFF operations of M8246 to M8250. ON: Down-counting OFF: Up-counting
Page 141
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11.5 Handling of High-speed Counters
11
These counters are 32-bit up-count/down-count binary counters. The operations of the output contact according to the current value are the same as those of the abovementioned 1-phase 1-count input high-speed counters. Examples of program
RST
• While X012 is on, C251 counts the operation of the input terminals X000 (A-phase) and X001 (B-phase) through interruption.
C251
X012 C251
• When the current value exceeds the setting, Y002 turns on, and when the current value becomes lower than the setting, Y002 turns off.
Y002 M8251 Y003
• Y003 turns on (down-count) or off (up-count) according to the counting direction.
A-phase input B-phase input
2) For C254 RST
C254
X012 C254
D0(D1)
Y004
The setting is (D1,D0).
C254
Y005
External start input B-phase input External reset A-phase input input
• Y005 turns on (down-count) or off (up-count) according to the counting direction.
17
X006
Main unit
• A 2-phase encoder generates A-phase output and B-phase output between which there is a 90 phase difference. The high-speed counter automatically counts up or down according to the output as shown below. +1
-1
-1
Phase B Up-counting
18 Other Extension Units and Options
Phase A +1
16
Extension Power Supply Unit
X002
• When the current value exceeds the setting (D1,D0), Y004 operates, and when the current value becomes lower than the setting, Y004 turns off.
Input/Output Extension Blocks
M8254
• C254 is reset by X011 on the sequence, and it is reset immediately when X002 is turned on.
15 Input/Output Powered Extension Units
• C254 starts counting immediately when the input terminal X006 is turned on while X012 is on. The count input terminals are X000 (A-phase) and X001 (B-phase).
X011
X001
14 Test Run, Maintenance, Troubleshooting
X001
Main unit
X000
Wiring for Various Uses
C251
X000
13
• While X011 is turned on, the counter is reset when RST instruction is executed.
K1234
12 Output Wiring
1) For C251 X011
High-Speed Counters
11.5.3 2-phase 2-count input
Down-counting
19 Display Module
• The down-count/up-count operations of C251 to C255 can be monitored through the ON/OFF operations of M8251 to M8255. ON: Down-counting OFF: Up-counting
20 Terminal Block
135
Page 142
FX3G Series Programmable Controllers User's Manual - Hardware Edition
11.6
11 Use of High-speed Counters 11.6 Timing of Updating of Current Value and Comparison of Current Value
Timing of Updating of Current Value and Comparison of Current Value
11.6.1 Timing of updating of current value When pulses are input to an input terminal for a high-speed counter, the high-speed counter executes upcounting or down-counting. The current values of devices are updated when counting is input.
11.6.2 Comparison of current value To compare and output the current value of a high-speed counter, the following two methods are available.
1. Use of comparison instruction (CMP), band comparison instruction (ZCP) or contact comparison instruction Use the comparison instruction (CMP), band comparison instruction (ZCP) or contact comparison instruction if the comparison result is necessary at counting. Use these instructions only when high-speed processing is not required because these instructions are processed in the operation cycle of the PLC, and operation delay is generated before the comparison output result is obtained. Use the comparison instructions for high-speed counters (HSCS, HSCR and HSZ) described below if it is necessary to execute comparison and change the output contact (Y) at the same time when the current values of high-speed counters change.
2. Use of Comparison instruction for high-speed counters (HSCS/HSCR/HSZ instruction) Comparison instructions for high-speed counters (HSCS, HSCR and HSZ instructions) perform comparison and output the comparison results with the relevant high-speed counting operation. These instructions have limitations on the number of times of use as shown in the following table. When the output relay (Y) has been designated for comparison results, the ON/OFF status of the output is affected directly until the END instruction output is refreshed. When the PLC is a relay output type, a mechanical delay in operation (approx. 10ms) is caused. Therefore, it is best to use a transistor output type PLC. Applied instruction
Limitation on number of times of use of instruction
HSCS*1 HSCR*1
Up to 6 times
HSZ*1
*1.
136
The overall frequency changes when the HSCS, HSCR or HSZ instruction is used. → For details on the overall frequency, refer to Section 11.7.
Page 143
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11
Response Frequency and Overall Frequency
High-Speed Counters
11.7
11.7 Response Frequency and Overall Frequency
1. Response Frequency and Overall Frequency
• When two or more high speed counters are used. • When the HSCS, HSCR, HSZ, PLSY, PLSR, DSZR, TBL, ZRN, PLSV, DRVI or DRVA instruction is used. • When the pulse width/cycle measurement function is used. When HSCS, HSCR or HSZ instruction is not used
When HSCS, HSCR or HSZ instruction is used
200kHz
60kHz
- (Number of positioned axes*1 + Number of pulse width/cycle measurement inputs) x 40kHz
- (Number of positioned axes*1 x 5kHz) - (Number of pulse width/cycle measurement inputs x 20kHz)
60kHz
14
10kHz 60kHz
C251, C253(OP) 2-phase 2count input C252, C253, C254, C254(OP), C255
30kHz
10kHz
5kHz
Test Run, Maintenance, Troubleshooting
C246, C248(OP) 1-phase 2count input C247, C248, C249, C250
15
Number of axes used in the following positioning instructions: PLSY(FNC57), PLSR(FNC59), DSZR(FNC150), TBL(FNC152), ZRN(FNC156), PLSV(FNC157), DRVI(FNC158), DRVA(FNC159)
Input/Output Powered Extension Units
*1.
Wiring for Various Uses
C235, C236, C238, 1-phase 1- C239, C241 count input C237, C240, C242, C243, C244, C245
13
Overall frequency determined by condition of used instruction
Response Frequency
Counter type
12 Output Wiring
When any of the following functions/instructions is used, the overall frequency is restricted without regard to the operand of the instruction. Consider this restriction when examining the system or creating programs, and observe the specified overall frequency range.
2. Calculation of overall frequency Obtain the overall frequency using the following expression:
16
Overall frequency phase counters)]
Input/Output Extension Blocks
[(Sum of used frequency of 1-phase counters) + (Sum of used frequency of 2-
3. Example of calculation
Overall frequency : 200kHz - (2 axes x 40kHz) = 120kHz <Contents of use>
C235(1-phase 1-count input):
50kHz is input.
C236(1-phase 1-count input):
50kHz is input.
C237(1-phase 1-count input):
10kHz is input.
C253(2-phase 2-count input):
5kHz is input. Total
115kHz
18 Other Extension Units and Options
<Counter No.>
120kHz (Overall frequency)
Overall frequency : 200 kHz - [(1 axes + 1 input) x 40 kHz] = 120 kHz
C235(1-phase 1-counting):
50kHz is input.
C236(1-phase 1-counting):
20 Terminal Block
<Contents of use> 50kHz is input. Total
100kHz
19 Display Module
Example2: When HSCS, HSCR or HSZ instruction is not used, and instructions related to positioning (DRVI instruction [Y000]) are used, Number of pulse width/cycle measurement inputs(X003)
<Counter No.>
17 Extension Power Supply Unit
Example1: When HSCS, HSCR or HSZ instruction is not used, and instructions related to positioning (DRVI instruction [Y000] and DRVA instruction [Y001]) are used
120kHz (Overall frequency)
137
Page 144
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11.8
11.8 Related Devices and Function Switching Procedures
Related Devices and Function Switching Procedures
11.8.1 Related devices 1. For switching 1-phase 1-count input counter mode to up-count or down-count Counter type
1-phase 1-count input
Counter No.
Specifying device
C235
M8235
C236
M8236
C237
M8237
C238
M8238
C239
M8239
C240
M8240
C241
M8241
C242
M8242
C243
M8243
C244
M8244
C245
M8245
Up-counting
Down-counting
OFF
ON
2. For monitoring of up-count/down-count counting direction of 1-phase 2-count input and 2phase 2-count input counters Counter type
1-phase 2-count input
2-phase 2-count input
Counter No.
Monitoring device
C246
M8246
C247
M8247
C248
M8248
C249
M8249
C250
M8250
C251
M8251
C252
M8252
C253
M8253
C254
M8254
C255
M8255
OFF
ON
Up-counting
Down-counting
3. For switching high-speed counter function Device No. M8388
138
Name
Description
Contact for changing high-speed counter Changes the function of high-speed counter function
Reference -
M8392
Function switching devices
Switches the function of C248 and C253
Subsection 11.8.2
M8395
Function switching devices
Switches the function of C254
Subsection 11.8.2
Page 145
FX3G Series Programmable Controllers
11 Use of High-speed Counters
User's Manual - Hardware Edition
11.8 Related Devices and Function Switching Procedures
11
When the counters C248, C253 and C254 are combined with the following special auxiliary relays, the allocation of the input terminals and functions are changed. Program the special auxiliary relays just before the counters. Counter No.
Function switching method
Details of change
M8392 •
Reset input is not given.
C248 K
13 Wiring for Various Uses
M8388 M8392 C253(OP)
•
Reset input is not given.
C253 K
M8395
14 •
C254(OP)
C254 K
• •
Test Run, Maintenance, Troubleshooting
M8388
12 Output Wiring
M8388 C248(OP)
High-Speed Counters
11.8.2 [Function switching] switching of allocation and functions of input terminals
The input count (2-phase 2-count) changes as follows Phase A : Changes from X000 to X006. Phase B : Changes from X001 to X007. Reset input is not given. Start input is not given.
15 Input/Output Powered Extension Units
16 Input/Output Extension Blocks
17 Extension Power Supply Unit
18 Other Extension Units and Options
19 Display Module
20 Terminal Block
139