The text of a manual · part 27 of 37
Sharp Programmable Controller New Satellite JW10 User's Manual: Chapter 12 How to Use the High-Speed Counter
Pages 204 to 216 of 307, from Sharp Programmable Controller New Satellite JW10 User's Manual
The original document is the PDF (5.0 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 Sharp jW-10CM
Page 204
Chapter 12. How to Use the High-Speed Counter 12-1 High-speed counter • The JW10 high-speed counter has two modes for different methods of counting signals. Mode
Function
Mode 1
Single-phase rising pulse signal: 2 points Maximum frequency: 10 kHz Counter range: 0 to 65535 (16-bit binary counter) If the count value becomes equal to the comparison value, the interrupt program (LB170/LB171) will be executed.
Mode 2
90-degree phase difference two-phase signal: 1 point Maximum frequency: 10 kHz Counter range: 0 to 65535 (16-bit binary counter) If the count value becomes equal to the comparison value, the interrupt program (LB172) will be performed.
• The mode is selected by the value stored in system memory #203. Value of #203
Contents
00(H)
High-speed counter is not used (00000 to 00003 are normal input)
01(H)
Mode 1 (Single-phase rising pulse signal: 2 points)
02(H)
Mode 2 (90-degree phase difference two-phase signal: 1 point)
• When the high-speed counter is enabled, use input terminals 0 - 3 for the high-speed counter. Mode
Signal name CH1
Mode 1 CH2
Mode 2
Input terminal
Input pulse signal
0
Preset signal
1
Input pulse signal
2
Preset signal
3
Phase B input pulse signal
0
Phase A input pulse signal
1
Phase Z (marker) signal
2
HLS (home position limit switch) signal
3
• When the high-speed counter is enabled, use the following special relays, special registers and labels. Mode 1 CH1
CH2
Mode 2
Lower bits
コ0740
コ0750
コ0760
Upper bits
コ0741
コ0751
コ0761
Count comparison value (16 bits binary)
Lower bits
コ0742
コ0752
コ0762
Upper bits
コ0743
コ0753
コ0763
Preset value (16 bits binary)
Lower bits
コ0744
コ0754
コ0764
Upper bits
コ0745
コ0755
コ0765
Count enable relay
07320
07324
07364
Preset relay
07321
07325
07365
Preset release relay
07322
07326
07366
Preset status relay
07323
07327
07367
Interrupt label
LB170
LB171
LB172
Current count value (16 bits binary)
12・1
12
Page 205
12-2 Mode 1 (single-phase rising pulse input) • Mode 1 counts single-phase rising pulses and it has two channel counters (CH1, CH2). • The maximum frequency is 10 kHz, and the counter range is 0 to 65535 (16-bit binary counter). • Select mode 1 by setting system memory address #203 to 01(H).
[1] CH1 operation • Input the pulse signal to input terminal 0. • Counting continues while the count enable relay (07320) is ON. • The count value is stored in the current count value register (コ0740, コ0741). • When the count value becomes equal to the comparison value (コ0742, コ0743), subroutine LB170 will be executed. • The counter can be preset by an external signal or an internal relay.
12
① Preset by an external signal (preset signal) • The preset signal is detected at High-speed counter input terminal 1. processing section • When the preset status relay (07323) is OFF, and if the preset Comparison register signal turns ON from OFF, the Interrupt current count value will be set to the preset value (コ0744, コ0745). Input • When preset is executed, the Pulse signal (0) Counter preset status relay (07323) will turn ON. When the preset release Count enable Preset relay (07322) is turned ON, the preset status relay (07323) will turn OFF. ② Preset by an internal relay (preset relay: 07321) H Q D • When the preset relay (07321) F/F CK Preset signal (1) turns ON from OFF, the current R count value will be set to the preset value (コ0744, コ0745).
Comparison value (コ0742、コ0743) Interrupt label (LB170) Curent value (コ0740、コ0741) Preset value (コ0744、コ0745) Count enable relay (07320)
Preset relay(07321)
Preset status relay (07323)
Preset release relay (07322)
• Every time a scan cycle is executed, the count enable relay (07320), preset relay (07321), preset release relay (07322), preset status relay (07323), current value (コ0740, コ0741), comparison value (コ0742, コ0743), and preset value (コ0744, コ0745) will be refreshed before the next round of input/output processing.
〜 〜
〜 〜
Preset signal (Input terminal 1)
11
12
13
4999 5000
101
102
103
104
〜 〜 〜 〜
10
〜 〜〜 〜
Current count value (コ0740, コ0741)
〜 〜
〜 〜
Input pulse (Input terminal 0)
65534 65535
0
1
Preset value (コ0744, コ0745) = 100
Count value
Preset (when 07323 = OFF) 65535
〜 〜
Count comparison value (コ0742, コ0743) Preset value (コ0744, コ0745)
〜 〜
0 Execution of LB170 subroutine
12・2
0, when 1 is added to 65535.
Page 206
[2] CH2 operation • The pulse signal is detected on input terminal 2. • Counting continues while the count enable relay (07324) is ON. • The count value is stored in the current count value register (コ0750, コ0751). • When the count value becomes equal to the comparison value (コ0752, コ0753), subroutine LB171 will be executed. • The counter can be preset by an external signal or an internal relay. ① Preset by an external signal (preset signal) • The preset signal is detected at input terminal 3. • When the preset status relay (07327) is OFF, and if the preset High-speed counter processing section signal turns ON from OFF, the current count value will be set to the Comparison Comparison value register preset value (コ0754, コ0755). (コ0752, コ0753) Interrupt • When preset is executed, the preset Interrupt label (LB171) status relay (07327) will turn ON. Current value When the preset release relay (コ0750, コ0751) Input Pulse signal (2) (07326) is turned ON, the preset Preset value Counter (コ0754, コ0755) status relay (07327) will turn OFF. Count enable Count enable preset ② Preset by an internal relay (preset (07324) Preset relay: 07325) • When the preset relay (07325) turns Preset relay ON from OFF, the current count (07325) value will be set to the preset value (コ0754, コ0755). H CK
Preset sinal (3)
Preset status relay (07327)
Q
D
F/F
• Every time a scan cycle is executed, R Preset release relay the count enable relay (07324), (07326) preset relay (07325), preset release relay (07326), preset status relay (07327), current value (コ0750, コ0751), comparison value (コ 0752, コ0753), and preset value (コ0754, コ0755) will be refreshed before the next round of input/ output processing.
〜 〜
〜 〜
Preset signal (Input terminal 3)
11
12
13
4999 5000
101
102
103
104
〜 〜 〜 〜
10
〜 〜〜 〜
Current count value (コ0750, コ0751)
〜 〜
〜 〜
Input pulse (Input terminal 2)
65534 65535
0
1
Preset value (コ0754, コ0755) = 100
Count value
Preset (when 07327 = OFF) 65535
〜 〜
Count comparison value (コ0752, コ0753) Preset value (コ0754, コ0755)
〜 〜
0 Execution of LB171 subroutine
12・3
0, when 1 is added to 66535.
12
Page 207
12-3 Mode 2 (90-degree phase difference two-phase signal input) • Mode 2 counts 90-degree phase difference two-phase signals and it has one channel. • The maximum frequency is 10 kHz, and the counter range is 0 to 65535 (16-bit binary counter). • Select mode 2 setting system memory address #203 to 02(H). • Input phase A, phase B, phase Z, HLS (home position limit switch) on input terminal 1, input terminal 0, input terminal 2, and input terminal 3, respectively. • Counting continues while the count enable relay (07330) is ON. • The count value is stored in the current count value register (コ0760, コ0761). • When the count value becomes equal to the comparison value (コ0762, コ0763), subroutine LB172 will be executed. • The counter can be preset by an external signal or an internal relay.
12
① Preset by an external signal (Zphase signal or HLS signal) • When the preset status relay (07333) is OFF and the HLS signal is ON, if the Z-phase signal turns ON from OFF, the current count value will be set to the preset value (コ 0764, コ0765). • When preset is executed, the preset status relay (07333) will turn ON. When the preset release relay (07332) is turned ON, the preset status relay (07333) will turn OFF. ② Preset by an internal relay (preset relay: 07331) • When the preset relay (07331) turns ON from OFF, the current count value will be set to the preset value (コ0764, コ0765).
High-speed counter processing section Comparison register Interrupt
Comparison value (コ0762, コ0763) Interrupt label (LB172) Current value (コ0760, コ0761)
Phase A (1)
Input
Phase B (0)
Input
Counter
Preset value (コ0764, コ0765)
Count enable
Count enable relay (07330)
Preset
Preset relay (07331)
H Phase Z (2) HLS (3)
Q
D CK
F/F
Preset status relay (07333)
R Preset release relay (07332)
• Every time a scan cycle is executed, the count enable relay (07330), preset relay (07331), preset release relay (07332), preset status relay (07333), current value (コ0760, コ0761), comparison value (コ0762, コ0763), and preset value (コ0764, コ0765) will be refreshed before the next round of input/output processing.
12・4
Page 208
Counting up
〜 〜
〜 〜
Phase Z (Input terminal 2)
〜 〜
〜 〜
HLS (Input terminal 3)
11
12
13
4999
5000
100
101
〜 〜 〜 〜
10
〜 〜〜 〜
Current count value (コ0760, コ0761)
〜 〜
〜 〜
Phase B (Input terminal 0)
〜 〜
〜 〜
Phase A (Input terminal 1)
65535
0
Preset value (コ0764, コ0765) = 100
Count value
Preset (when 07333 = OFF)
〜
65535
Count comparison value (コ0762, コ0763)
〜 〜 〜
Preset value (コ0764, コ0765) 0 Execution of LB172 subroutine
Counting down
〜 〜
〜 〜
HLS (Input terminal 3)
〜 〜
〜 〜
Phase Z (Input terminal 2)
5011
5010
2001
2000
9999
9998
〜 〜 〜 〜
5012
〜 〜 〜〜
5013
12
〜 〜
〜 〜
Phase B (Input terminal 0)
Current count value (コ0760, コ0761)
〜 〜
〜 〜
Phase A (Input terminal 1)
0
65535
Preset value (コ0764, コ0765) = 100
Count value
Preset (when 07333 = OFF) 65535 Preset value (コ0764, コ0765)
〜
Count comparison value (コ0762, コ0763)
〜〜 〜
0 Execution of LB172 subroutine
12・5
Page 209
■ Encoder connection examples • The high-speed counter can be connected to open-collector outputs or voltage-output encoders. • The high-speed counter cannot be connected to differential output encoders. Example 1: An open collector type encoder 12/24V power 0V
Phase B
0
Phase A
1
Phase Z
2
Internal circuit
0V
Photo coupler
Shielded twisted pair cable COM.A Encoder
JW10 basic module
Example 2: A voltage output type encoder (load sinking)
12
12/24V power 0V
Phase B
0
Phase A
1
Phase Z
2
Internal circuit
0V
Photo coupler
Shielded twisted pair cable COM.A Encoder
JW10 basic module
Example 3: A voltage output type encoder (load sourcing) 12/24V power 0V
Phase B
0
Phase A
1
Phase Z
2
Internal circuit
0V
Photo coupler
Shielded twisted pair cable COM.A Encoder
JW10 basic module
12・6
Page 210
Note
★ If noise interferes with the encoder signals, miscounts are likely and the current counter value may be wrong. Pay special attention when wiring. • Never run the motor output cable and the encoder cable in the same conduit.
Keep separate
Encoder
Motor
Encoder
Motor
Never in the same conduit
• Use separate conduits to run the motor output and encoder cables from the connection box in the machine to the encoder. Never bundle them. • Do not run the motor output cable and the encoder cable in parallel, even inside the control panel. They must never be in the same conduit. • Do not run the encoder cable near device that generates noise. Never run the encoder cable in parallel with the wires of such device. • Connect the encoder cable directly to the terminal block in the main module’s control panel. If at all possible, do not connect it to the terminal strip in the control panel. If it must be connected to a terminal connection strip, keep the length of the exposed, unshielded wires as short as possible. Be sure to connect the shield from the cables on both sides. Keep this connection terminal away from any other connection terminals that generate noise. Other I/O cable Separate by at least 15 cm. To the encoder
To the basic module
Encoder signal cable
Connect the cable shileds Less than 15 cm
• Do not use the encoder’s DC power supply for any other device (excepting HLS). Do not connect the encoder’s DC power supply GND to the GND of any other DC power supply. • Connect the encoder cable shield to the FG terminals in the basic module or to the ground terminals in the control panel.
12・7
12
Page 211
Note
★ Do not make the wires leading to the HLS (home limit switch) unnecessarily long. If they become too long, use relays. • In order to improve resistance to noise, use shielded twisted pair cables. • Even when shielded twisted pair cables are used, do not run them in the same conduit as the motor output cable or any other PC control cables. Do not run them in parallel with other wiring. Terminal block in the control panel
Basic module
HLS COM.A HLS(3) 12/24V GND FG Power supply exclusively for the encoder and HLS AC input FG
(
FG
• If an external power is used for the HLS input, install a connection terminal block in the control panel. Keep the connection terminal block away from the connection terminal block for PC I/O control wires. • Install a surge absorber for the HLS contacts in parallel. Since the origin signal (HLS) is installed on the machine side, the wiring may be quite long. In addition to that, the contacts of the origin signal are open when the encoder is not at the origin, so that the cable may function as an antenna and it may easily pick up electrical noise.
)
12 HLS
R
Basic module
C
Since the HLS response time will be lengthened due to the capacitor and resistor in the surge absorber, pay attention to the mechanical and positional relationship between the HLS and phase Z.
• Connect the HLS signal cable shield to the basic module’s FG terminals or to the control panel’s ground terminals.
12・8
Page 212
12-4 Application examples [1] An example of use on a wire cutter (1) System configuration
Feed rollers
Cutter
Wire feed drum
Encoder EC Motor
M
0 JW10 400
401
Motor controller
• The amount of wire unwound is determined by the pulses from the encoder installed on the feed roller, which are captured by the JW10 high-speed counter. • When the JW10 determines that the number of pulses counted equal the preset length, it sends instructions to cut to the cutter.
(2) System memory setting #203 = 01(H) ... Mode 1 (single-phase rising pulse input) (3) Operation flow
Preparation
• Set number of pulses for cut wire length • Count enable
Wire feed
• Set preset value • Motor start • Motor stop
Wire cutting
• Start wire cutting • Stop wire cutting
12・9
12
Page 213
(4) Program
F-44
F-07w DCML
Preparation
F-32 SET
10000 コ0742
07320
• Set number of pulses for cut wire length (Set 10000 to the counter comparison register.) • Count enable
00400
F-44
• Motor start Wire feed
Error
00400
F-07w DCML
コ0744
0
07321
• Preset the counter to 0
00401
F-44
• Wire cutting Wire cutting 00401
Error
Stop cutting
00400
12
F-140 LB170 LABL
• Mode 1 (CH1) interrupt label
F-33 RST
00400
• Motor stop
F-81 IORF
0
コ0040
• Refresh 00400. (Motor stop)
F-143 RET
Note: The use of an interrupt program allows the motor to be stopped more quickly.
12・10
Interrupt program
F-40 END
(note)
Page 214
[2] An example of 2-point positioning of a single-axis table (1) System configuration Phase Phase Phase A Z B
HLS
1 2 3 JW10 400 401 402 0
Low/high speed Control circuit command Reverse rotation start
Driver
Forward rotation start Motor Point B Point C
Encoder
Point A
Table
Overrun LS HLS
Overrun LS
V • Position on points A and B. • The table moves to point A at low speed. When it moves to point B, it first moves to point C at high speed and then on to point B at low speed. • The table moves to the home position in reverse at low speed.
High speed Low speed 200 Origin
1000 Point A
5000 6000 Point C Point B
(2) System memory setting #203 = 02(H) ... Mode 2 (90-degree phase difference two-phase signal input) (3) Operation flow • Preset status relay OFF • Count enable
Preparation
Return to origin (low speed)
• Origin preset value (200) setting • Origin comparison value (200) setting • Reverse rotation start (low speed) • Stop at origin
Positioning to point A (low speed)
• Point A comparison value (1000) setting • Forward or reverse rotation start (low speed) • Stop at point A
Positioning to point C (high speed)
• Point C comparison value (5000) setting • Forward rotation start (high speed)
Positioning to point B (low speed)
• Point B comparison value (6000) setting • Forward rotation start (low speed) • Stop at point B 12・11
12
Page 215
(4) Program
F-44
F-32 SET
Preparation
• Count enable
07330 07332
• Preset status relay (07333) OFF Preset cancel F-44 Return to origin 04000
04000
07333 Preset Error status
• Auxiliary relay for starting reverse rotation to the origin F-07w DCML F-07w DCML F-12w CMP
Positioning
200
コ0764
• Origin preset value setting
200
コ0762
• Origin comparison value setting
コ0760
1750
• Direction check of point A [1750(8) = 1000(D)] (A < 1000 or A ≧ 1000)
to point A 07356
F-44
<
Preset Error status
04001
07354
12
F-44
≧
F-44 Positioning to point B 04003
• Auxiliary relay for starting forward rotation to point A F-07w 1000 DCML
07333 Preset Error status
04002
04001
07333
F-07w 1000 DCML
• Point A comparison value setting
04002
• Auxiliary relay for starting reverse rotation to point A
コ0762
• Point A comparison value setting
04003
07333 Preset Error status
コ0762
• Auxiliary relay for starting forward rotation to point B F-07w 5000 DCML
コ0762
• Point C comparison value setting
00400
04001
• Forward rotation start 04003
00401
04000
• Reverse roation start 04002
04003
F-44
00402
• High speed command 00402
12・12
Page 216
F-40 END
00402 Low speed
04003
00402 High speed
07366
• Reverse rotation stop
F-33 RST
04000
• Start reverse rotation to the origin
F-33 RST
00400
• Forward rotation stop
F-33 RST
04001
• Reset auxiliary relay for starting forward rotation to point A
F-33 RST
00401
• Reverse rotation stop
F-33 RST
04002
• Reset auxiliary relay for starting reverse roation to point A
F-33 RST
00400
• Forward rotation stop
F-33 RST
04003
• Reset auxiliary relay for starting reverse rotation to point B
F-33 RST
00402
• Low speed command
07333 Preset status
04003
00401
07333 Preset status
04002
F-33 RST
07333 Preset status
04001
• Mode 2 interrupt label
07333 Preset status
07333 Preset status
Interrupt program
04000
F-140 LB172 LABL
12 F-07w 6000 DCML
コ0762
F-80 コ0040 IORF F-143 RET
12・13
• Point B comparison value setting • I/O refresh