The text of a manual · part 6 of 7
Encoder/Counter Modules User Manual (Cat. Nos. 1771-IJ and 1771-IK), pages 51 to 60
Pages 51 to 60 of 68
The original document is the PDF (388 KB). 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 Allen-Bradley 1771-IK
Page 51
Block Transfer Programming
6–7
PLC-3 Family Processors Use the following ladder logic with PLC-3 or PLC-3/10 processors. This program assumes that your application requires a single BTR and BTW instruction to pass data between the processor and the module. Ladder logic alternates the execution of BTR and BTW instructions. The processor checks data validity before accepting read data, and sets one enable bit at a time. Refer to Figure 6.5 for generalized ladder logic, and to Figure 6.6 for example ladder logic with entered values. Figure 6.5 Generalized Ladder Logic for PLC-3 Block Transfer
1
PLC-3 AC Power Loss Bit
2
XOR
XOR
A = BTW cntl B = BTW cntl
A = BTR cntl B = BTR cntl
R = BTW cntl
R = BTR cntl
BTR
BTW R
DN
LE
G EQU
M
A = BTW cntl B = BTR cntl
Data
DN
Length Cntl
3
BTW DN
ER BTR
R G
LE
M Data
DN
Length Cntl
ER 15045
Publication 1771-UM006B-EN-P - June 2002
Page 52
6–8
Block Transfer Programming
Figure 6.6 Sample Ladder Logic for PLC-3 Block Transfer RUNG NUMBER RM1 S0003
1
03
XOR
XOR
A XOR B = R
A XOR B = R
A : WB001:0030
A : WB001:0020
B : WB001:0030
B : WB001:0020
R : WB001:0030
R : WB001:0020
RUNG NUMBER RM2 2
WB001:0020 15 EQU A = B A : WB001:0030 B : WB001:0020
BTW BLOCK XFER WRITE 002 RACK : 1 GROUP : 1 = HIGH MODULE : FB002:0150 DATA: 0 LENGTH = FB001:0030 CNTL:
CNTL LE 02 CNTL DN 05 CNTL ER 03
RUNG NUMBER RM3 WB001:0030 3 05
BTR BLOCK XFER READ 002 RACK : 1 GROUP : 1 = HIGH MODULE : FB002:0220 DATA: 0 LENGTH = FB001:0020 CNTL:
CNTL LE 12 CNTL DN 15 CNTL ER 13 15064
Rung Descriptions Rung 1 - Rung one is true only at power up. It uses status word 3, bit 03 (the PLC-3’s AC power loss bit) to zero the control file of both the BTR and BTW instructions. Rung 2 - The equal instruction is used at power up. At power up, the BTR and BTW control files both equal zero, so the BTW instruction is enabled. Rung 2 and 3 - During normal program execution, the BTW and BTR instructions are alternately executed. The done bit of either instruction enables the next block transfer instruction. After power up, the BTR and BTW done bits are used to alternate reads and writes.
Publication 1771-UM006B-EN-P - June 2002
Page 53
Block Transfer Programming
6–9
PLC-5 Family Processors You can use the following ladder logic with PLC-5 processors. This program assumes that your application requires a single BTR and BTW to pass data between the processor and the module. Ladder logic alternates the execution of BTR and BTW instructions. The processor checks data validity before accepting read data, and sets one enable bit at a time. Refer to Figure 6.7 for generalized ladder logic, and to Figure 6.8 for example ladder logic with entered values. Figure 6.7 Generalized Ladder Logic for PLC-5 Block Transfer 1
BTW
BTR
EN
EN
BTW
BTR
EN
EN
2
BTW Control Block xxx
Data File yyy
Continuous no
BTR Control Block zzz
Data File aaa
Continuous no 15047
Publication 1771-UM006B-EN-P - June 2002
Page 54
6–10
Block Transfer Programming
Figure 6.8 Example Ladder Logic for PLC-5 Block Transfer File 2, Rung 0
File 2, Rung 1
N10:10
N11:10
15
15
N10:10
N11:10
15
15
BTW BLOCK TRNSFR WRITE
EN
Rack
0
Group
0
Module
0
Control Block
N10:10
Data File
N10:15
Length
0
Continuous
N
DN ER
BTR BLOCK TRNSFR READ
EN
Rack
0
Group
0
Module
DN
0
Control Block
N11:10
Data File
N11:15
Length
0
Continuous
N
ER
15965
Rung Descriptions Rungs 0 and 1 - Rungs 0 and 1 execute BTW and BTR instructions alternately. When the processor completes the BTW instruction, it enables the BTR instruction immediately in the same scan. Enabling a block transfer instruction places the block transfer request in queue. There is one queue for each I/O chassis. Waiting time depends on the number of queued requests ahead of it.
Publication 1771-UM006B-EN-P - June 2002
Page 55
Chapter
7
Special Programming Extending the Count Beyond 999
The input Status word stores a maximum count of 999 (BCD). If using binary resolution, the maximum count is 1111 1111 1111 (4095 binary). To count beyond these full scale values, you may want to use either of the following ladder programs for PLC–2 or PLC–3 family processors. Both programs (Figure 7.1 and Figure 7.2) extend the count beyond 999 (4095 binary) in the same manner. Either program compares the new count value with the value in the previous scan (old value). If the difference of the new value less the old value is greater than a constant (a constant less than 999/2 or 4095/2), the count passed through zero. If the sign of the difference is negative, the up counter is incremented by one; if positive the down counter is decremented by one.
Publication 1771-UM006B-EN-P - June 2002
Page 56
7–2
Special Programming
Figure 7.1 Ladder Logic for Extending the Count Beyond 999 (PLC-2 Program) SUBTRACT PREVIOUS COUNT FROM CURRENT COUNT. STORE IN 0077.
1
CURRENT PREVIOUS SCAN IJ/IK COUNT COUNT 0113 0577 GET GET 125 168
NEW/OLD COUNT DIFF. 0077 043
IF THE DIFFERENCE IS GREATER THAN A CONSTANT (COUNT PASSED THROUGH ZERO), THEN INCREMENT THE COUNT. THE CONSTANT MUST BE LESS THAN 1/2 THE TOTAL COUNTS OF THE IJ/IK (HALF OF 999 OR 4095).
2
NEW/OLD COUNT CONSTANT DIFF. 0077 0072 < GET 043 400
PASSED THROUGH ZERO 0076 00
AFTER PASSING THROUGH 0: IF THE SIGN OF THE DIFFERENCE IS NEGATIVE THEN INCREMENT THE COUNT, IF POSITIVE THEN DECREMENT THE COUNT.
3
PASSED DIFF. THROUGH VALUE ZERO NEGATIVE 0076 0077 00
4
16
DIFF. PASSED THROUGH VALUE POSITIVE ZERO 0077 0076 00
16
MOST SIGNIF DIGITS 0052 Ctu Pre 999 Acc 002 MOST SIGNIF DIGITS 0052 Ctd Pre 999 Acc 002
DISPLAY THE TOTAL COUNT AND MOVE THE CURRENT COUNT TO THE PREVIOUS COUNT
5
MOST SIGNIF DIGITS 0052 GET 002
CURRENT IJ/IK COUNT 0113 GET 125
Publication 1771-UM006B-EN-P - June 2002
PREVIOUS SCAN COUNT 0577 Put 168
Page 57
Special Programming
7–3
Figure 7.2 Ladder Logic for Extending the Count Beyond 999 (PLC-3 Program) MVM
RUNG NUMBER RMO
MOVE WITH MASK A : WB002:0200 0110000101011100 B : WB005:0000 000011111111111111 R : WB005:0001 0000000101011100 MOV MOVE FROM A TO R A : WB005:0001 0000000101011100 R : WN005:0000 348
RUNG NUMBER RM1
SUB A - B = R A : WN005:0000 348 B : WN005:0001 348 R : WN005:0002 0
RUNG NUMBER RM2 LES
A < B
A : WN005:0002 0
WN005:0002 ] / [ 17
A > B
A : WN005:0002 0 B : WN005:0004 500
CP = 32000 CA =
B : WN005:0003 -500 GRT
CTU COUNTER UP C0100
WN005:0002 ] [ 17
CTD COUNTR DOWN C0100 CP = 32000 CA =
RUNG NUMBER RM3
4
4
C0100 ( CU ) 17 C0100 ( DN ) 15 C0100 ( CD ) 16 C0100 ( DN ) 15
MOV MOVE FROM A TO R A : WN005:0000 348 R : WN005:0001 348
Publication 1771-UM006B-EN-P - June 2002
Page 58
7–4
Special Programming
Rung Descriptions (Figure 7.2) Rung 0 – This rung strips the upper byte of the count value and stores the value. A = BTR status B = Mask R = Temporary count storage with upper byte removed A = Temporary count storage with upper byte removed R = New count value Rung 1 – This rung subtracts the old count value from the new value and stores the difference with its sign. A = New count value B = Old count value R = Difference of new count value less old value Rung 2 – This rung looks at the sign and magnitude of the difference from rung 1 and compares it with a constant (a constant less than 999/2 or 4095/2). If positive, the up counter is incremented by one; if negative, the down counter is decremented by one. Rung 3 – This rung moves the new count value (A) to the old count storage location (R). A = New count value R – Old value storage location
Publication 1771-UM006B-EN-P - June 2002
Page 59
Appendix
A
Specifications
Specifications - 1771-IJ and ĆIK Encoder Counter Modules General Input Specifications
Number of Counters
1
Counter Input (switch selectable)
Single channel (counter) Dual channel (encoder)
Input Pulse Rate
50KHz maximum
Data Transfer Modes (switch selectable)
Single transfer mode Block transfer mode
1771-IJ External supply
5V dc, +0.25V
Input Ratings
Vin = 0-5V dc Vih (min) = 2.4V dc Vil (max) = 0.6V dc Device driving input terminal must be able to sink 16A minimum.
Output Ratings
2 open-collector outputs without internal pull-up resistors Iout = 500mA maximum per output Vout = 5V dc maximum
Power Dissipation
1771-IJ - 6.7 Watts maximum
Thermal Dissipation
1771-IJ - 22.9 BTU/hr
1771-IK External Supply (Vext)
12-24V dc Input circuits require 170mA maximum Output circuits require 1.08A maximum
Input Ratings
0 < Vin < Vext For Vext = 12V dc: Vih = 7.2V dc max; Vil = 4.8V dc max Device driving input terminal must sink (or source if selected on Channel A) 10mA For Vext = 24V dc: Vih = 14.4V dc max; Vil = 9.6V dc max Device driving input terminal must sink (or source if selected on Channel A) 20mA
Output Ratings
2 open collector outputs without internal pull-up resistors. Iout = 500mA max per output Vout = Vext
Power Dissipation
1771-IK - 12.1 Watts maximum
Thermal Dissipation
1771-IK - 41.3 BTU/hr
General Specifications
Module Location
Cat. No. 1771 I/O chassis
I/O Isolation
Tested to 1500V ac for 1s
Limit Switch Input
12-48V dc
Backplane Power Supply 5V Current Requirements
1.2A typical 1.4A maximum
Current consumption from external power supply
150mA @ 12V dc 75mA @ 24V dc
Publication 1794-UM006B-EN-P - June 2002
Page 60
A–2
Specifications
Specifications - 1771-IJ and ĆIK Encoder Counter Modules Indicators
2 Channel A and B status 1 Marker 1 Limit 2 Output 1 and 2 1 Red Fault
Keying
1771-IJ 1771-IK
Left connector: Between 6 and 8; 18 and 20 Right connector: Between 4 and 6; 32 and 34 Left connector: Between 6 and 8; 20 and 22 Right connector: Between 4 and 6; 32 and 34 Note: Modules must be in a single module group (slots 0 and 1). Do not straddle 2 module groups.,
Environmental Conditions Operational Temperature
IEC 60068-2-1 (Test Ad, Operating Cold) IEC 60068-2-2 (Test Bd, Operating Dry Heat) IEC 60068-2-14 (Test Nb, Operating Thermal Shock) 32 to 140°F (0 to 60°C)
Storage Temperature
IEC 60068-2-1 (Test Ab, Unpackaged, Nonoperating Cold) IEC 60068-2-2 (Test Bb, Unpackaged, Nonoperating Dry Heat) IEC 60068-2-14 (Test Na, Unpackaged, Nonoperating Thermal Shock) -40 to 185°F (-40 to 85°C)
Relative Humidity
IEC 60068-2-30 (Test Db, Unpackaged, Nonoperating Damp Heat) 5 to 95% noncondensing
Shock Operating Nonoperating
IEC 60068-2-27 (Test Ea, Unpackaged Shock) 30g 50g
Vibration
IEC 60068-2-6 (Test Fc, Operating) 2g @ 10-500Hz
ESD Immunity
IEC 61000-4-2 4kV contact discharges
Radiated RF Immunity
IEC 61000-4-3 10V/m with 1kHz sine-wave 80% AM from 30MHz to 1000MHz 10V/m with 200Hz 50% Pulse 100% AM at 900MHz
EFT/B Immunity
IEC 61000-4-4 +1kV @ 5kHz on signal ports
Surge Transient Immunity
IEC 61000-4-5 +2kV line-earth (CM) on shielded ports
Conducted RF Immunity
IEC 61000-4-6 10V rms with 1kHz sine wave 80% AM from 150kHz to 30MHz
Emissions
CISPR 11 Group 1, Class A (with appropriate enclosure)
Enclosure Type
None (open style
Input Conductors Wire Category Length (max)
Belden 8761 (for pulse counter applications below 20KHz); Belden 9182 (for frequencies up to 50KHz) Belden 8725 (for twisted pair encoder applications below 20KHz) 21 Sensor must be within 40ft of the module
Field Wiring Arm
Cat. No. 1771-WB
Field Wiring Arm Screw Torque
7-9 pound-inches (0.6-0.7Nm)
Publication 1794-UM006B-EN-P - June 2002