Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeContact

The text of a manual · part 22 of 36

DL305 User Manual, pages 207 to 216

Pages 207 to 216 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 207

RLL PLUS Programming Basics

A Few Simple Rules for Execution

10–7

Since the CPU will only examine the logic in those stages that are active, it is important you understand how stages can be turned on and off. There are a few simple rules that dictate how this works. This may seem like quite a few things to remember, but it’s really pretty simple. We’ll show examples in the following pages that show how each of these rules apply to the program execution. 1. Only active stages are executed. If a stage is inactive, the CPU skips the logic between that stage and the next active stage. 2. You can turn stages on by the following methods. 2.a Initial Stages are automatically turned on when the CPU transitions from Program Mode to Run Mode. 2.b A stage can be turned on when the program “jumps” from stage to stage with the Jump (JMP) instruction. 2.c You can use the SET instruction to set a stage status bit just like you would SET an output. 2.d A stage can be turned on when the program has power flow between two stages that are tied together by a single transition element. 3. You can turn stages off by the following methods. 3.a An active stage is automatically turned off if the program jumps from the active stage to another stage. 3.b You can use the Reset (RST) instruction to turn off a stage just like you use Reset to turn off an output point. 3.c The current stage is automatically turned off if the program has power flow between the current stage and the next stage.

RLLPLUS Programming Basics

Page 208

10–8

RLL PLUS Programming Basics

Activating Stages Using Initial Stages

Any initial stages (ISG instructions) are automatically turned on when the CPU goes from Program Mode to Run Mode. For example, when the CPU executing our example program enters Run Mode, the Initial Stage (ISG 000) will be turned on automatically. The other stages are off, so the CPU only scans the portion of the program associated with ISG 000. Since there’s only one rung in Stage 0, the CPU continually monitors the start switch. Nothing else will happen until the start switch is pressed.

Only executes logic in stages that are active ISG

Wait for start

S000 Start

S1 JMP

000 SG

Check for a part

S001

Part Present

S2 JMP

001 Part Present

S5 JMP

001

RLLPLUS Programming Basics

Although it is unusual, there may be times when you need more than one initial stage. There is nothing at all wrong with this. If your application has a need for more than one starting point, you can use more than one initial stage. For example, if you had three initial stages, then those three stages would all be active when the CPU entered the Run Mode.

Page 209

RLL PLUS Programming Basics

Using Jump Instructions

When the operator presses the start switch input 000 comes on. When 000 comes on the CPU executes the Jump instruction and “jumps” to Stage 1. Now the CPU only scans Stage 1. Stage 0 is no longer scanned after the program jumped to stage 1. This means the Jump instruction did two things. S It activated the destination stage. In this case, it activated stage 1. S It deactivated the stage it came from, which was stage 0 in this case. So, you can jump to a stage to turn it on, and when you jump from a stage it turns off.

10–9

Only executes logic in stages that are active ISG

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

S002

Part Locked

Clamp SET 020 S3 JMP

002

This example only shows an action that initiates a jump to one destination. You can use several jumps ORed together if necessary. Examples of this will be shown later. Only executes logic in stages that are active There’s also another type of Jump instruction called a Not Jump. This ISG Wait for start S000 instruction only works if the input conditions are not true, whereas the Start S1 JMP regular JMP instruction only works if the 000 input conditions are true. SG Check for a part S001 In the previous example we examined a Part single contact to determine which part of S2 Present JMP the program to jump to next. If the part is 001 present (001 closed), the program jumps S5 NJMP to Stage 2. If a part is not present (001 open), the program jumped to Stage 5. SG We could have used a single contact and Lock the clamp S002 the NJMP instruction. Clamp The program example to the right shows SET 020 Part how the NJMP instruction would be used Locked S3 JMP in this situation. Notice there is one less 002 instruction required in this example compared to the previous one. RLLPLUS Programming Basics

NOTE: We strongly recommend you avoid using the NJMP instruction. This is because program debugging can become more difficult, especially for those who are not so familiar with structured programming concepts.

Page 210

10–10

RLL PLUS Programming Basics

Using Set Instructions with Stages

When you examine the instruction set more carefully you’ll notice the DL330P CPU offers a Set (SET) instruction that works similarly to a latching operation. For example, you could use a SET instruction to latch an output point. The output point can then be unlatched with the Reset (RST) instruction. You can also use a SET instruction to turn on a stage. To show how this works, we’re going to add a stage to the program. You may have noticed the original flowchart did not contain a stop switch. Well, we don’t want to make these little widgets forever, so we’re adding Stage 150, which monitors for a stop switch. (This is also a good example of how you can skip stage numbers.) Notice we added a SET instruction in the first stage. Now when the start switch is pressed, two stages will be activated. The CPU examines Stage 1, which monitors for a part, and it also examines Stage 150, which monitors the stop switch.

Only executes logic in stages that are active ISG

Wait for start

S000 Start

S0 JMP

000 S150 SET SG

Check for a part

S001

Part Present

S2 JMP

001 Part Present

S5 JMP

001 SG

Lock the clamp

S002

Part Locked

Clamp SET 020 S3 JMP

002

SG

Monitor for stop

S150 Stop

020 – 022 RST

010 S0 – S6 RST

RLLPLUS Programming Basics

S0 JMP

We did not absolutely have to use a SET instruction in the example. We could have used a Jump, since you can jump to more than one stage. We just used a SET to show how it works. If you examine Stage 150, you’ll notice we do three things when the stop switch is pressed. S The RST 020 – 022 instruction makes sure all the outputs are turned off. (We’ll discuss this in more detail in the next section.) S The RST S0–S6 instruction resets (turns off) stages 0 through 6. We reset the entire range so that we guarantee we can stop the press no matter which stage is currently executing. Notice we reset stages that were not necessarily turned on with the SET instruction. The Reset (RST) instruction can be used to turn off stages, no matter how they were turned on. This is especially handy in larger, more complex programs. S The program jumps back to Stage 0 and starts over again. Note, just because Stage 0 is an initial stage does not mean it can only be active at a transition to Run Mode. You can return to an Initial Stage at any time. It’s just the CPU automatically activates Initial Stages at the Run Mode transition.

Page 211

RLL PLUS Programming Basics

Power Flow Transitions

You do not always have to use a Jump instruction to move from stage to stage. If you only move to one stage, instead of multiple stages, you can use what it is called a power flow transition. For example, we used Jump instructions in our sample program. For those stages that did not have multiple transition possibilities, we could have just used power flow transitions. Look at Stage 2. Notice how the transition contact, 002 now is directly connected to the next stage, Stage 3. You can only do this if you are moving from one stage to one other stage. If you examine Stage 1, you’ll notice we have to use the Jump instructions because the program can transition to more than one stage. NOTE: We suggest you use Jump Instructions instead of power flow transitions. This is because we’ve seen many cases where we had to come back and add things to the program. If you used Jumps from the beginning, you only have to add another Jump instruction. If you used power flow transitions, the program edits can take a little longer.

10–11

Only executes logic in stages that are active ISG

Wait for start

S000 Start

S1 JMP

000 S150 SET SG

Check for a part

S001

Part Present

S2 JMP

001 Part Present

S5 JMP

001 SG

Lock the clamp

S002

Part Locked

Clamp SET 020

002

SG

Press the part

S003

Press Down 021 Lower Limit 004

RLLPLUS Programming Basics

Page 212

10–12

RLL PLUS Programming Basics

Using Outputs in Stages

Setting Outputs with the SET Instruction

Since the CPU only examines the logic in stages that are on, you have a lot more flexibility in how you use outputs with the RLL PLUS instructions. Also, you don’t have to worry about adding several permissive contacts to keep the output from coming on at an inappropriate time. (If the stage is not on,the CPU doesn’t even scan the stage, so the output can’t possibly be turned on by the logic in that stage.) If you examine Stage 2, you’ll notice we use a SET instruction to clamp the part in ISG Wait for start S000 place. Why a set? Simple. If we used a regular output the clamp will be Start S1 JMP deactivated when the program 000 S150 transitions to Stage 3. Remember, when SET you leave a stage the CPU no longer SG Check for a part S001 scans that stage until it is turned on Part again. So if we had used a regular OUT S2 Present JMP instruction, the CPU would have 001 automatically turned off the output, which Part Present S5 would have unclamped the part. JMP 001 The first example shows the program SG execution in Stage 2. The second Lock the clamp S002 example shows what happens on the Clamp next scan after the part is locked. Notice SET 020 the clamp output is still on even though Part Locked S3 the CPU is not scanning this portion of JMP 002 the program. This is why we use the SET instruction in this case. We want the clamp to stay on while the press completes the cycle. Next Scan after part is locked The clamp will stay on until the program SG enters Stage 4. Stage 4 unlocks the part Lock the clamp S002 by resetting output 020 when the press Clamp returns to the top limit. SET Part Locked

020 S3 JMP

002 SG

Press the part

S003

Press Down 021

RLLPLUS Programming Basics

Lower Limit

S4 JMP

004 SG

Unlock the clamp

S004 Top Limit 005

Part Unlocked 003

Clamp RST 020 S5 JMP

Page 213

RLL PLUS Programming Basics

Using the OUT Instruction

One other benefit with RLL PLUS is the ability to use the same output in multiple places. Instead of using the SET instruction in Stage 2, we could have just put the clamp output, 020, in all the stages where we wanted the part to remain clamped. If you examine Stage 2 you’ll notice output 020 is on because the stage is active. The next example shows what happens after the part is locked in place. The program moves to Stage 3 from Stage 2. Notice output 020 is now off in Stage 2. However, since we included the same clamp output in Stage 3, the part remains clamped in place. The clamp will automatically turn off when the program enters Stage 4. Notice Stage 4 does not have to have any kind of Reset instruction, since the output is automatically turned off when the program exits Stage 3. The concept of automatically turning off the outputs sometimes confuses many people. However, the CPU just uses a very simple algorithm to determine if the output should be turned off. The following diagram shows how this algorithm works.

ISG

10–13

Wait for start

S000 Start

S1 JMP

000 S150 SET SG

Check for a part

S001

Part Present

S2 JMP

001 Part Present

S5 JMP

001 SG

Lock the clamp

S002

Clamp OUT 020 S3 JMP

Part Locked 002

Next Scan after part is locked SG

Lock the clamp

S002

Clamp OUT 020 S3 JMP

Part Locked 002 SG

Press the part

S003

Press Down 021 Clamp OUT 020 Lower Limit

Stage=On

No

S4 JMP

004 SG

Unlock the clamp

S004

Yes Any outputs on last scan?

No

Top Limit

Part Unlocked

005

003

S5 JMP

Yes

Examine Logic, AND results with 0

Skip to next active stage

RLLPLUS Programming Basics

Execute Logic

Page 214

10–14

RLL PLUS Programming Basics

Latching Outputs with Stages

There’s one more way to control outputs with the Stage instructions. You may recall once a stage is turned on, you can only turn it off by resetting it, or by having a transition from it, either by a Jump or a power flow. What happens if you have a stage that does not have any kind of transition? What if it doesn’t have a Jump instruction or any other kind of transition contact leading to another stage? Simple. The stage will stay on until it is reset by some other part of the program that uses a Reset instruction. This makes it easy to use a stage without a transition to latch an output. For example, if you examine Stage 2 you’ll notice we’ve now changed this part of the program again. Now this stage sets Stage 140,which will be used to control the clamp. Notice Stage 140 does not have any type of transition. The only way to turn off the clamp is to Reset Stage 140. This instruction has now been included in Stage 4. So, after the program transitions to Stage 4, the Reset instruction will turn off Stage 140.

ISG

Wait for start

S000 Start

S1 JMP

000 S150 SET SG

Check for a part

S001

Part Present

S2 JMP

001 Part Present

S5 JMP

001 SG

Lock the Clamp

S002

Part Locked

SET S140 S3 JMP

002

Next Scan after part is locked SG

Lock the clamp

S002

Part Locked

SET S140 S3 JMP

002 SG

Press the part

S003

Press Down 021

Lower Limit

S4 JMP

004 SG

Unlock the clamp

S004 Top Limit

Clamp RST S140

005 Part Unlocked

S5 JMP

003 SG

RLLPLUS Programming Basics

S140

Clamp Clamp 020

Page 215

RLL PLUS Programming Basics

10–15

Using Timers and Counters in Stages Time Based Transitions

Up to this point we’ve been using certain events that triggered the transition from stage to stage. There will probably be many cases where the transition should be related to a timer value. For example, if you know the speed of the conveyor you could use a timer to control the conveyor movement. If we used this approach we would modify Stage 5 as shown. Notice the timer does not have a preset value. The timer begins incrementing as soon as it becomes active. Since the timer does not have a preset value, you do not have a timer contact, so you have to use a comparative instruction. In the example shown, the conveyor will be turned on for 5 seconds and then the program will jump to the next stage.

Only executes logic in stages that are active

SG

Unlock the clamp

S004 Top Limit

Clamp RST 020

005 Part Unlocked

S5 JMP

003 SG

Index the conveyor

S005

Move Conveyor 022

TMR

T600 50

SG

T600

S6 JMP

One cycle or automatic?

S006

One Cycle

S0 JMP

007 One Cycle

S1 JMP

007

RLLPLUS Programming Basics

Page 216

10–16

RLL PLUS Programming Basics

RLLPLUS Programming Basics

Using Counters

There will also be times when you need to count things that happen throughout the process. For example, you may want to know the number of parts produced during any given shift, or you may know the presses generally require some type of maintenance after a certain number of cycles. If we wanted to count the number of widgets made on our simple press, we could just add a counter to Stage 4 to monitor how many times the press is used. We’re also going to use the counter as an automatic shutdown when the press has made 5000 parts so we’ve added a new rung in Stage 150 to perform the shutdown operation. Notice the counter does not have a reset leg. This is true only when you use a counter with the DL330P. (The other CPUs have counters with reset legs.) Even though this counter does not have a reset leg, it can be reset with a Reset instruction. This works just like an output reset, so you could place this reset wherever it is appropriate. We’ve placed it in Stage 150 for this example. When the parts count reaches 5000, the program will finish the current cycle, reset the part counter, and jump to Stage 0 to wait for another start cycle. You may notice we added an additional input, 006. This is what allows the program to finish the current cycle. (You may recall 006 only came on after the part was unlocked and the conveyor was indexed.)

SG

Lock the clamp

S002

SET S150 S3 JMP

Part Locked 002 SG

Press the part

S003

Press Down 021

Lower Limit

CNT

C600

004 S4 JMP

SG

Monitor for stop

S150 Stop

020 – 022 RST

010 S0 – S6 RST S0 JMP

Parts Count C600 K5000

Index Conveyor

C600 RST

006 S0 – S6 RST S0 JMP