The text of a manual · part 23 of 36
DL305 User Manual, pages 217 to 226
Pages 217 to 226 of 356
The original document is the PDF (3.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 GE DL330 / D3-330, Fanuc DL330 / D3-330 and GE Fanuc DL330 / D3-330
Page 217
RLL PLUS Programming Basics
10–17
Using Data Instructions in Stages Even though there are a few differences in the way some of the instructions operate between the various CPUs, there are many of the normal instructions that can be used inside an individual stage. For example, you may need to load data into the accumulator to perform some type of math, or, you may need to store values into register locations. If you examine Stage 3, you’ll notice we’ve added a couple of instructions. These instructions store the current parts count in a register. Now the CPU will take the current parts count, stored in R600, and load it into the accumulator with the DSTR instruction. Then this 4-digit BCD count will be moved to R400 with the DOUT instruction. This is just one example of how you can use the various types of data instructions. There are many other possibilities. Just remember, if the stage is active, the instructions can be executed. If the stage isn’t active, the instructions will not even be examined.
SG
Lock the clamp
S0002
SET S150 S3 JMP
Part Locked 002 SG
Press the part
S0003
Press Down 021
Lower Limit
CNT
C600
004 DSTR F50 R600 DOUT F60 R400 S4 JMP SG
Monitor for stop
S150 Stop
020 – 021 RST
010 S0 – S6 RST S0 JMP
Parts Count C600 5000
Index Conveyor
CT0 RST
006 S0 – S6 RST S0 JMP
RLLPLUS Programming Basics
Page 218
10–18
RLL PLUS Programming Basics
RLLPLUS Programming Basics
Using Comparative Contacts in Stages You may recall you had to use a comparative instruction with the timers and counters. The DL330P provides several comparative contacts that are very useful. You can use these contacts to examine the relationship between a counter or timer value and a constant or register value. For example, let’s assume the pressed widgets move off the conveyor into a holding bin. The bin can only hold 1000 widgets, so we’ll add another counter, C601, to note how many widgets are in the bin. Also, we want to use different colored lights mounted on top of the press to alert a forklift driver the bin needs to be carried to the next operation. We’ll use the following indicators. Indicator Meaning Address Stage Green OK 040 21 Yellow Soon 041 22 Red Urgent 042 23 Reset Emptied 030 Notice we’ve added a few more stages to monitor this condition. For this example, assume the press has made 750 widgets. This means the Yellow indicator (Stage 22) should be active. We also need a way to reset the bin counter whenever the forklift driver empties the bin. If you examine Stage 21 through Stage 23, you’ll notice we reset the bin counter whenever the bin reset (030) is active. This example doesn’t show it, but you would also have to make some changes to other parts of the program. For example, you’d need to modify the Stop Stage to shut off these stages when the machine was stopped.
SG
Press the part
S0003
Press Down 021 Lower Limit
CNT
C600
004 DSTR F50 R600 DOUT F60 R400 CNT
Bin counter
C601
S4 JMP SG
Monitor lights for forklift
S0020
R601 K499
S21 SET S22 RST S23 RST
R601 500
R601
K899
S22 SET S21 RST
R601 K900
S23 SET S22 RST
SG
Bin level OK
S0021
040 OUT Bin Emptied
C601 RST
030 SG
Empty bin soon
S0022
041 OUT Bin Emptied
C601 RST
030 SG
Empty bin now
S0023
042 OUT Bin Emptied 030
C601 RST
Page 219
RLL PLUS Programming Basics
10–19
Parallel Branching Concepts Branching Methods
As you examined some of the previous examples you saw we could have more than one stage being processed on any given scan. The CPU scanned the first active stage and then moved on to the next active stage, skipping any inactive stages in between. For some complex applications, you can easily have as many parallel paths as necessary. This is often called branching or divergence. There are a couple of approaches you can take when you want to turn on more than one stage. The diagrams shown don’t necessarily apply to our press example, but instead show the various approaches. Only executes logic in stages that are active In this example, you use one transition contact to activate several stages. ISG Wait for start S000 S The SET instruction sets a range of Start S20 – S30 stages. These stages would remain SET on until they were reset, or, until 000 S2 any transition instructions contained JMP within the stages were executed. S50 JMP S There are two Jump instructions, both activating different stages. In this example, notice the stage that gets activated depends on an extra condition. For example, if the machine was capable of producing three different patterns, there may be a section of program for each pattern. There are other types of contacts that can be used. For example, you may recall we used Comparative contacts in some earlier examples. Notice we had to repeat the start switch in a separate rung each time. At first glance you would think you could simply have one Start switch contact and OR the remaining switches. The DL305 CPUs do support midline outputs (which is what this is called), but only in an AND situation.
Only executes logic in stages that are active ISG
Wait for start
S000 Start
Pattern 1
000
020
Start
Pattern 2
000
021
Start
Pattern 3
000
022
ISG S0000
S100 JMP
S200 JMP
S300 JMP
Wait for start Start
Pattern 1
000
020 Pattern 2
S100 JMP
S200 JMP
021 Pattern 3
S300 JMP
022
ISG S000 S100 SET 000
001 S200 JMP 002 S300 JMP
000
023
RLLPLUS Programming Basics
You can also use midline outputs to control branching conditions. Here’s an example of branching instructions that follow the guidelines for midline outputs. (This example is not for the press program, but merely shows how the midline outputs would appear.)
Page 220
10–20
RLL PLUS Programming Basics
RLLPLUS Programming Basics
Joining Parallel Branches
There are many times you have to bring parallel branches back together at some point in the program. You may recall the stages have status bits associated with them. You can use this status bit as a contact to easily converge the parallel paths. To illustrate this method, we’re going to use a simple press with two stations. Now a widget must get pressed at each station before it is a finished product. Since there are two stations, we must make sure both operations are complete before we move the conveyor.
Page 221
RLL PLUS Programming Basics
10–21
Here’s a flowchart that describes the two-station press. Please note we’ve changed some of the stage numbers, input numbers, and output numbers, so they won’t necessarily match the previous examples. Check for Stop Stage150
Reset all stages Jump to Start
Check for Parts in A&B Stage 10
Lock the clamp
Press the Part
Unlock clamp
Wait for Station B
Move Conveyor
Check Mode
A Stage 20
Stage 21
Stage 22
Stage 23
Stage 40
Stage 50
Station A Wait for Start Stage 0
No Part in A
Station B Lock the clamp
Press the Part
Unlock clamp
Station B Finished
B Stage 30
Stage 31
Stage 32
Stage 33
Program must converge into a single path again
No Part in B
One Cycle
Continuous
You’ve already seen how the basic sequence of operations was executed. so we’re only going to show the portions of the program that describe how the branches are joined together.
RLLPLUS Programming Basics
Page 222
10–22
RLL PLUS Programming Basics
Using Stage Bits as Contacts
If you examine the flowchart you’ll notice once the part is unclamped in station B, the program transitions to Stage 33 which indicates Station B is complete. If you look at that portion of the program shown here, you’ll notice there are no other instructions or actions that take place in this stage. This is why we call it a “dummy” stage. We’re just going to use the status of the stage bit associated with this dummy stage as a contact elsewhere in the program to indicate station B is finished. You may be wondering how we can turn off this stage. Since it does not have any type of jump or power flow transition, the only other option is to Reset the stage. We’ll do this later in the program.
Station B SG
Lock the clamp
S030
Clamp SET 020 S31 JMP
Part Locked 023 SG
Press the part
S031
Press Down 021
Lower Limit
S32 JMP
024 SG
Unlock the clamp
S031 Top Limit
Clamp RST 020
025 Part Unlocked
S33 JMP
023 SG S0033
Station B Finished
Check for Stop Stage 150
Reset all stages Jump to Start
Check for Parts in A&B Stage 10
Lock the clamp
Press the Part
Unlock clamp
Wait for Station B
Move Conveyor
Check Mode
A Stage 20
Stage 21
Stage 22
Stage 23
Stage 40
Stage 50
Station A Wait for Start Stage 0
No Part in A
RLLPLUS Programming Basics
Station B Lock the clamp
Press the Part
Unlock clamp
Station B Finished
B Stage 30
Stage 31
Stage 32
Stage 33
No Part in B One Cycle
Continuous
Program must converge into a single path again
Page 223
RLL PLUS Programming Basics
Stage Contact Example
Since each stage has a status bit that is either on or off, you can use this bit as a contact in the program. If you examine Stage 23 you’ll notice we’ve used a contact labeled S33. This contact reflects the status of Stage 33, which indicated Station B was finished. When S33 is on, the contact labeled S33 is also on and the program will transition to Stage 40. In Stage 40 we use a reset instruction to reset Stage 33 before we move the conveyor.
10–23
Only executes logic in stages that are active
Station A SG
Clamp the part
S020
Part Locked
Clamp SET 020 S21 JMP
002 SG
Press the part
S021
Press Down 021 Lower Limit
S22 JMP
004 SG
Unlock the clamp
S022 Top Limit
Clamp RST 020
005 Part Unlocked
S23 JMP
003 SG
Wait for Station B to finish
S023
B Finished
S40 JMP
S33 SG
Index the conveyor
S040
B Finished RST S33 Conveyor 022
Conveyor Moved
S50 JMP
006 SG
One cycle or automatic?
S050
One Cycle
S0 JMP
007 One Cycle
S10 JMP
007
RLLPLUS Programming Basics
Page 224
10–24
RLL PLUS Programming Basics
Unusual Operations in Stages
Using the Same Output Multiple Times
Over the last few pages you’ve learned how the CPU executes the Stage instructions. However, there are a few unusual circumstances that may not work exactly as the appear. In the program shown it appears output 021 will be turned on at three separate SG times before the program jumps to the S0010 next stage. However, the only time the TMR T600 output actually comes on is when the final condition has been met. T600 K100 021 Why? Remember if you use multiple OUT outputs in a program, the last rung 021 T600 K200 T600 K500 containing the output controls the status OUT that will be written to the module. This is 021 T600 900 no different in a program that uses OUT RLL PLUS instructions. Finished S20 In this example, the last comparison rung JMP 001 says the output should be off until the timer value reaches 90 seconds.
RLLPLUS Programming Basics
In the previous example the same output was used multiple times in the same stage. The last use of the output controlled the status of the output. There may be occasions when you have the same output in different stages. Even though it’s not advisable to do this in normal RLL programs, this is perfectly acceptable with a program that uses RLL PLUS instructions. However, if both stages are active at the same time, then the logic in the last stage will control the status of the output. In the example shown, if both stages are active, then the logic in Stage 70 will control the output status.
SG S0010 021 OUT 001 S002 JMP 002
SG S070 021 OUT 010
011 S002 JMP
006
Page 225
RLL PLUS Programming Basics
Using a Set Out Reset (SET OUT RST) Instruction
Output Placement
Many normal RLL programs use one-shot instructions. In the DL305 instruction set, this instruction is called a Set Out Reset (SET OUT RST). In the program shown, input 001 will trigger the SET OUT RST 160 instruction, which will in turn activate output 021 for one scan. However, what happens if 001 stays on and Stage 10 is activated, deactivated, and then activated again? At first glance it appears the one shot only gets executed one time since 001 stayed on while Stage 10 was turning on and off. It doesn’t work this way. The logic in an inactive stage is not executed. So even though the stage became active the SET OUT RST instruction did not see an off to on transition, so the instruction is not executed. The SET OUT RST instruction will work in an active stage as long as the input transitions from off to on while the stage is active.
Scan N SG
One Shot is executed
S010 001
160 SET OUT RST
160
021 OUT
Scan N + 10 Stage off, One Shot is not executed
SG S0010 001
160 SET OUT RST
160
021 OUT
Scan N + 20 SG S0010
One shot must see off to on 001
160 SET OUT RST
160
021 OUT
Incorrect Placement SG S0010 001
CNT
C600
021 OUT
003
S11 JMP
Correct Placement SG S0010 021 OUT 001
003
CNT
C600
S11 JMP
RLLPLUS Programming Basics
As you’ve seen in some of the previous examples, we always place unconditional outputs immediately following the Stage Instructions. There’s a reason for doing this. If you look at the example stage shown here, the output is placed after a counter box. The DirectSOFT software and the Handheld Programmer will allow you to enter this as shown. However, the CPU will only turn on output 021 when the counter input 001 is turned on. This is because the CPU interprets the output as being tied to the counter input leg instead of the Stage power rail. You can easily avoid this problem by placing any unconditional actions at the very beginning of the stage. Then, the output will work the way you expect.
10–25
Page 226
10–26
RLL PLUS Programming Basics
Two Ways to View RLL PLUS Programs Throughout the example programs, we’ve consistently shown how the instructions appear in when viewed as ladder instructions. However, with DirectSOFT, you also have the capability to view the program as a flowchart. You can even view the program flowchart (in Stage View) and view the ladder program at the same time with a split screen feature. The DirectSOFT manual provides detailed information on how to view the programs in this manner. DirectSOFT Stage View ISG S0
J
J
SG
Stage
DirectSOFT Ladder View
SG S1
SG S150
Reference to a Stage
J
SG S2
S
SG S140
J
SG S6
J
SG S3
J
ISG S0
R
SG S140 Transition Logic
ISG
J
Wait for start
S000 Start
S1 JMP
000 SG
Check for a part
S001
Part Present
S2 JMP
001 Part Present
S5 JMP
001 SG
Lock the clamp
RLLPLUS Programming Basics
S002
Part Locked
Clamp SET 020 S4 JMP
002 SG
Press the part
S003
Press Down 021 Lower Limit 004
S4 JMP
Jump
S
Set Stage
R
Reset Stage