The text of a manual · part 67 of 70
SLC 500 Instruction Set Reference Manual, pages 661 to 670
Pages 661 to 670 of 694
The original document is the PDF (7.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 Allen-Bradley 1747-L514
Page 661
Application Example Programs
G-7
The following rung will keep track of the hole number that is being drilled and loads the next correct DII preset based on the hole count. This rung is only active when the "HOLE SELECTOR" switch is in the "3-HOLE" position. The sequencer uses step 0 a s a null step upon reset. It uses the last step as a "go forever" in anticipation o f the "end of manual". Movin g a 0 i n to S :4 9 t e lls th e D II to trigger an interrupt when the trailing edge of the current book is detected.
I:1
I:1
9 1746-IA16
10 1746-IA16
SQO Sequencer File Mask Dest Control Length Position
0002
Output #N10:0 0FFFFh S:50 R6:4 4< 0<
EN DN
R6:4 U EN
EQU Equal Source A Source B
The following rung is identical to the previous switch is in the "5-HOLE" position.
I:1
I:1
9 1746-IA16
10 1746-IA16
R6:4.POS 0< 4 4<
Discrete Input InterruptCompare Value MOV Move Source Dest rung except that it is only active when the "HOLE
SQO Sequencer File Mask Dest Control Length Position
0003
Output #N10:5 0FFFFh S:50 R6:5 6< 0<
0 0< S:49 0<
SELECTOR"
EN DN
R6:5 U EN
EQU Equal Source A Source B
R6:5.POS 0< 6 6<
Discrete Input InterruptCompare Value MOV Move Source Dest
0 0< S:49 0<
Publication 1747-RM001G-EN-P - November 2008
Page 662
G-8
Application Example Programs
The following rung is identical to the previous two rungs except that it is only active when the "HOLE SELECTOR" switch is in the "7-HOLE" position.
I:1
I:1
9 1746-IA16
10
SQO Sequencer Output File #N10:12 Mask 0FFFFh Dest S:50 Control R6:6 Length 8< Position 0<
0004
1746-IA16
EN DN
R6:6 U EN Discrete Input InterruptCompare Value MOV Move Source
EQU Equal Source A R6:6.POS 0< 8 8<
Source B
Dest
0 0< S:49 0<
If the processor is in this subroutine either for initialization or due to sensing the trailing edge of a manual, just return and skip the logic that stops the conveyor and starts the drill sequence.
First Pass S:1
B3:0
15
2
0005
I:1
I:1
9 1746-IA16
10 1746-IA16
Source B
I:1
I:1
9 1746-IA16
10 1746-IA16
I:1
9 1746-IA16
10 1746-IA16
0< 1 1<
EQU Equal Source A R6:6.POS Source B
Publication 1747-RM001G-EN-P - November 2008
0< 1 1<
EQU Equal Source A R6:5.POS Source B
I:1
RET Return
EQU Equal Source A R6:4.POS
0< 1 1<
Page 663
Application Example Programs
G-9
The following rung stops the conveyor and signals the main program (file 2) to initialize a drilling sequence. The DRILL SEQUENCE subroutine (program file 6) resets the drill sequence start bit and sets the conveyor drive bit (O:3/0) upon completion of the drilling sequence.
0006
Drill Sequence Start B3:2 L 0
Conveyor Start/Stop O:3 U 0 1746-OA16
0007
END
Publication 1747-RM001G-EN-P - November 2008
Page 664
G-10
Application Example Programs
Drill Calculation and Warning The program tracks the number of holes drilled and the number of inches of material that have been drilled through using a thumbwheel. The thumbwheel is set to the thickness of the book per 1/4 inch. (If the book is 1 1/2 inches thick, the operator would set the thumbwheel to 6.) When 25,000 inches have been drilled, the Change Drill Soon pilot light turns on. When 25,500 inches have been drilled, the Change Drill Soon pilot light flashes. When 26,000 inches have been drilled, the Change Drill Now pilot light turns on and the machine turns off. The operator changes drill bits and then resets the internal drill wear counter by turning the Drill Change Reset keyswitch.
The following rung examines the number of 1/4" thousands that have accumulated over the life of the current drill bit. If the bit has drilled between 1 00,000 and 101,999 1/4" increments of paper, then the "CHANGE DRILL" light will illuminate steady. When the value is between 102,000 and 103,999, then the "CHANGE DRILL" light will flash at a 1.28 second rate. When the value reaches 105,000, then the "CHANGE DRILL" light will flash, and the "CHAGE DRILL NOW" light will illuminate.
0000
100,000 1/4" Increments Occured B3:1
GEQ Grtr Than or Eql (A>=B) Source A N7:11 0< Source B 100 100 <
0
102,000 1/4" Increments Occured B3:1
GEQ Grtr Than or Eql (A>=B) Source A N7:11 0< Source B 102 102 <
1
Change Drill Bit Now! O:3
GEQ Grtr Than or Eql (A>=B) Source A N7:11 0< Source B 105 105 <
100,000 1/4" Increments Occured B3:1
Publication 1747-RM001G-EN-P - November 2008
6 1746-OA16
102,000 1/4" Increments Occured B3:1
Change Drill Bit Soon! O:3
0
1
100,000 1/4" Increments Occured B3:1
102,000 1/4" Increments Occured B3:1
4 1746-OA16
Time Base S:4
0
1
7
Page 665
Application Example Programs
The following rung will reset the number o f 1/4" increments RESET" keyswitch is energized.
Drill Change Reset Keyswitch I:1 0001
8 1746-IA16 and the 1/4" thousands when the "DRILL
CLR Clear Dest
CLR Clear Dest
BCD thumbwheel
G-11
CHANGE
N7:11 0<
N7:10 0< input
Thumbwheel Section Comment Bit B3:1 0002 2 The following rung will move the single digit BCD thumbwheel value into an internal integer register. This is done to properly align the four BCD input signals prior to executing the BCD to integer instruction (FRD). The thumbwheel is used to allow the operator to enter the thickness of the paper that is to be drilled. The thickness is entered in 1/4" increments. This provides a range of 1/4" to 2.25"
BCD Bit 0 I:1
FRD Bit 0 N7:14
11 1746-IA16
0
0003
BCD Bit 1
I:1
FRD Bit 1 N7:14
12 1746-IA16
1
BCD Bit 2 I:1
FRD Bit 2 N7:14
13 1746-IA16
2
BCD Bit 3 I:1
Bit 3 N7:14
14 1746-IA16
3
Publication 1747-RM001G-EN-P - November 2008
Page 666
G-12
Application Example Programs
The following rung will convert the BCD thumbwheel value from BCD to integer. This is done because the processor operates upon integer values. This rung also "debounces" the thumbwheel to ensure that conversion only occurs on valid BCD values. Note that invalid BCD values can occur while the operator is changing the BCD thumbwheel. This is due to input filter p ropagation delay differences between the 4 input circuits that provide the BCD input value.
First Pass S:1 0004
15
EQU Equal Source A Source B
N7:13 0< N7:14 0<
FRD From BCD Source Dest
N7:14 0000h < N7:12 0<
Processor Arithmetic Underflow/ Overflow Flag S:0
Overflow Trap S:5 U 0
1 MOV Move Source Dest
N7:14 0< N7:13 0<
The following rung will ensure that the operator cannot select a paper thickness of 0. If this were allowed, the drill bit life calculation could be defeated resulting in poor quality holes due to a dull drill bit. Therefore the minimum paper thickness that will be used to calculate drill bit wear is ¼".
0005
EQU Equal Source A Source B
Publication 1747-RM001G-EN-P - November 2008
N7:12 0< 0 0<
MOV Move Source Dest
1 1< N7:12 0<
Page 667
Application Example Programs
G-13
The following rung will keep a running total of how many inches of paper have been drilled with the current drill bit. Every time a hole is drilled, add the thickness (in ¼"s) to the running total (kept in ¼"s). The same OSR is necessary because the ADD will execute every scan that the rung is true, and the drill body would actuate the DRILL DEPTH limit switch for more than 1 program scan. Integer N7:12 is the integer-converted value of the BCD thumbwheel on inputs I:3/11 - I:3/14.
Drill Depth Limit Switch I:1 0006
4 1746-IA16
B3:1 OSR 8
ADD Add Source A Source B Dest
N7:12 0< N7:10 0< N7:10 0<
The following rung will keep track of the number of counts that are past 1,000.
0007
GEQ Grtr Than or Eql (A>=B) Source A N7:10 0< Source B 1000 1000 <
SUB Subtract Source A Source B Dest
ADD Add Source A Source B Dest
MOV Move Source Dest
0008
N7:10 0< 1000 1000 < N7:20 0<
1 1< N7:11 0< N7:11 0<
N7:20 0< N7:10 0<
END
Publication 1747-RM001G-EN-P - November 2008
Page 668
G-14
Application Example Programs
The following application example illustrates the use of the TON and SQO instructions in a traffic signal at an intersection. The timing requirements are:
Time Driven Sequencer Application Example
• Red light - 30 seconds. • Yellow light - 15 seconds. • Green light - 60 seconds. The timer, when it reaches its preset, steps the sequencer that in turn controls which traffic signal is illuminated. For a detailed explanation of: • XIC, XIO, and TON instructions, see Chapter 2. • SQO and SQC instructions, see Chapter 7.
Time Driven Sequencer Ladder Program The function of this rung is called a regenerative timer. Every time the timer reaches its preset, the DONE bit is set for one scan - this causes this rung to become FALSE for one scan and resets the timer. On the following scan, when this rung becomes TRUE again, the timer begins timing.
Timer Enable T4:0 0000
DN
0001
TON Timer On Delay Timer
T4:0
Time Base Preset
0.01 1
Accum
0
Controls the RED, GREEN, and YELLOW lights wired to outputs O:3/0, O:3/1 and O:3/2, and controls how long the regenerative timer times between each step. When this rung goes from false-to-true (by the timer reaching reaching its preset), the first sequencer changes which traffic light is illuminated, and the second sequencer changes the preset of the timer to determine how long this next light is illuminated. RED, YELLOW AND GREEN LIGHTS T4:0 SQO EN Sequencer Output File #N7:0 DN DN Mask 0007 Dest O:3.0 Control R6:0 Length 3< Position 0<
Timer Presets for each light SQO Sequencer Output File #N7:5 Mask FFFF Dest T4:0.PRE Control R6:1 Length 3< Position 0< 0002
Publication 1747-RM001G-EN-P - November 2008
EN DN
END
Page 669
Application Example Programs
Event Driven Sequencer Application Example
G-15
The following application example illustrates how the FD (found) bit on an SQC instruction can be used to advance as SQO to the next step (position). This application program is used when a specific order of events is required to occur repeatedly. By using this combination, you can eliminate using the XIO, XIC, and other instructions. For a detailed explanation of: • XIC, XIO, and RES instructions, see Chapter 2. • SQO and SQC instructions, see Chapter 7.
Event Driven Sequencer Ladder Program Ensures that the SQO always resets to step (position) 1 each REM Run mode entry. (This rung actually resets the control register's position and EN enable bit to 0. Due to this the following rung sees a false-to-true transition and asserts step (position) 1 on the first scan.) Eliminate this rung for retentive operation.
R6:0
S:1
RES
0000
15 The SQC instruction and SQO instruction share the same Control Register. This is acceptable due to the careful planning of the rungstate condition. You could cascade (branch) many more SQO instructions below the SQO if you desired, all using the same Control Register (R6:0 in this case). Notice that we are only comparing Inputs 0 to 3 and are only asserting Outputs 0 to 3 (per Mask Value).
R6:0 0001
FD
R6:0
FD
0002
SQC Sequencer File Mask Dest Control Length Position
Compare #N7:0 000F I:1.0 R6:0 9< 2<
SQO Sequencer File Mask Dest Control Length Position
Output #N7:10 000F O:3.0 R6:0 9< 2<
EN DN
EN DN
END
The following table displays the FILE DATA for both sequencers. The SQC compare data starts at N7:9. While the SQO output data starts at N7:10 and ends at N7:19. Please note that the step 0 of the SQO is never active. The reset rung combined with the rung logic of the sequencers guarantees that the sequencers always start at step 1. Both sequencers also roll over to step 1. Roll Over to step 1 is integral to all sequencer instructions.
Publication 1747-RM001G-EN-P - November 2008
Page 670
G-16
Application Example Programs
Table G.1 SQC Compare Data Addresses
Data (Radix = Decimal)
N7:0
0
1
2
3
4
5
6
7
8
9
N7:10
0
0
1
2
3
4
5
6
7
8
If the high-speed counter reached its high preset of 350 (indicates that the holding area reached maximum capacity), it would energize O:0/0, shutting down the filling operation. Before re-starting the filler, allow the packer to empty the holding area until it is about 1/3 full. HSC Interr due to High Preset C5:0 0006 IH
On/Off Circuit Application Example
LES Less Than (A<B) Source A C5:0.ACC 0 Source B 150
HSC Interr due to High Preset
O:3 U 0 C5:0 U IH
The following application example illustrates how to use an input to toggle an output either on or off. For a detailed explanation of: • XIC, XIO, OTE, OTU, OTL, and OSR instructions, see Chapter 2. • JMP and LBL instructions, see Chapter 6.
Publication 1747-RM001G-EN-P - November 2008