ladder programming language by dr. amin danial asham

22
LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Upload: sharyl-holt

Post on 17-Jan-2016

239 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

LADDER PROGRAMMING LANGUAGE

by

Dr. Amin Danial Asham

Page 2: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

References

Programmable Controllers-Theory and Implementation, 2nd Edition, L.A. Bryan and E.A. Bryan

Page 3: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

The ladder languages available in PLCs can be divided into two groups:o basic ladder language.o enhanced ladder language.

Each of these groups consists of many PLC instructions that form the language.

Sometimes, basic ladder instructions are referred to as low-level language, while enhanced ladder functions are referred to as high-level language

Page 4: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

New functions have been added to the basic relay, timing, and counting operations.

The term function is used to describe instructions that, as the name implies, perform a function on data that is, handle and transfer data within the programmable controller.

The basic ladder logic also include function blocks, which use a set of instructions to operate on a block of data.

The use of function blocks increases the power of the basic ladder language, forming what is known as enhanced ladder language.

Page 5: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

In general, a network (rung) consists of a set of input conditions (represented by contact instructions) and an output instruction at the end of the rung (represented by a coil symbol).

The contact instructions for a rung may be referred to as input conditions, rung conditions, or the control logic

Page 6: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

When a ladder diagram contains a functional block, contact instructions are used to represent the input conditions that drive (or enable) the block’s logic.

A functional block can have one or more enable inputs that control its operation. In addition, it can have one or more output coils, which signify the status of the function being performed such as the function is performed successfully.

o For example, the block has an enable block line, which when energized will activate the block to perform the instruction.

o Thus, this instruction says: IF the enable is ON because the desired logic has continuity, THEN execute the block instruction.

o Depending on the instruction, other enable lines may drive the block using reset or other control functions

Page 7: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

To make a block active at all times without any driving logic, the user can omit all contact logic and place a continuity line in the block during programming

Page 8: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

The ladder rung matrix determines the maximum number of ladder contact elements that can be used to program a rung.

The size of this matrix differs among both PLC manufacturers and the programming devices used.

Page 9: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Reverse Power Flow One rule, which is present in almost all PLCs, prevents reverse (i.e.,

right-to-left) power flow in a ladder rung. If a PLC’s logic requires reverse power flow, the user must

reprogram the rung with forward power flow to all contact elements.

Page 10: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Example: Solve the logic rung shown so that no reverse power flow condition exists. The reverse condition is not part of the required logic for the output to be energized.

Solution

Page 11: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Example: Solve the ladder logic shown in the following so that no reverse power flow exists. Assume that the reverse path logic through contact D and then forward through contacts B and C is required in the PLC logic solution to energize the output.

Solution

Page 12: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

NOT OUTPUT COIL A NOT output coil instruction (recall the NOT logic

function) is essentially the opposite of an output coil instruction.

If continuity is not present in the rung, this instruction turns the referenced output bit ON. If continuity is present, it turns the output OFF

Also, when a NOT output coil is ON, its reference contacts change state (normally open contacts close, normally closed ones open)

If a NOT output coil is OFF, then the opposite occurs the normally open reference contacts stay open and the normally closed ones remain closed

Page 13: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Example: Implement the equivalent ladder rung logic shown in the following Figure using

a. NOT output coil instruction, and b. implement the NOT Y logic without using a NOT coil.

Solution

Implementation of Y using NOT Coil

Page 14: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

LATCH OUTPUT COIL A latch coil instruction causes an output to remain energized even if the status of

the contacts that caused the output to energize changes. If any rung path has logic continuity, this instruction turns the output ON and

keeps it ON, even if logic continuity or system power is lost. The latched output will remain ON until it is unlatched by an unlatch output

instruction

UNLATCH OUTPUT COIL An unlatch coil instruction resets a latched output with the same reference

address. When any rung path has logic continuity, this instruction turns OFF the latched

reference address coil, or rather unlatches it to an OFF condition.

Page 15: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Latch-Unlatch Block Latch and unlatch instructions may occur in block form. The only difference between the ladder and block forms is that, in

block form, latching and unlatching are performed in the same instruction

The latch and unlatch ladder outputs can have ladder logic rungs in between them, while the Block form cannot. A latch/unlatch block may also be called a set/reset block.

Page 16: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

ONE-SHOT OUTPUT If the ladder rung has continuity, the one-shot output will be

energized (ON). However, the length of time that a one-shot output is ON is one scan .

A leading-edge trigger turns the one-shot output ON for one scan after the OFF-to-ON transition of the input.

A trailing-edge trigger turns the output ON for one scan after the ON-to-OFF transition of the input.

Page 17: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

TRANSITIONAL CONTACT A transitional contact instruction provides a one-shot pulse when its referenced

trigger signal makes either an OFF-to-ON (leading-edge) transition or an ON-to-OFF (trailing-edge) transition.

In a leading-edge transitional instruction, the contact will close for exactly one program scan whenever the trigger signal goes from OFF to ON. The contact will allow logic continuity for that one scan and then open again, even though the triggering signal may stay ON. The triggering signal must turn OFF and ON again for the transitional contact to reclose

Conversely, in a trailing-edge transitional instruction, an ON-to-OFF transition of the trigger signal turns the contact ON for one scan. The contact address (trigger) may be an external input/ output or an internal output.

Page 18: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

LADDER SCAN EVALUATIONThe processor starts solving a ladder program after it has

read the status of all inputs and stored this information in the input table.

The solution starts at the top of the ladder program, beginning with the first rung and proceeding one rung at a time.

As the processor solves the control program, it examines the reference address of each programmed instruction, so that it can assess logic continuity for the rung being solved.

Even if the output conditions in the rung being solved affect previous rungs, the processor will not return to the previous rung to resolve it.

Page 19: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

LADDER SCAN EVALUATION (continue) The normally open contact 10, which we will assume corresponds to

a push button, activates the first rung. If contact 10 turns ON, it will turn output 100 ON.

In the next rungs, contact 100 will turn output 101 ON, contact 101 will turn output 102 ON, and contact 102 will turn output 103 ON. Even though they are

connected to different rungs, all of these outputs turn ON in the same scan, Ladder rung where all outputs turn ON in

the same scan.

Because the processor updates the real output devices connected to the modules when it finishes the program scan. In this case, if outputs 100, 101, 102, and 103 were connected to pilot lights, they would all turn ON at the same time.

Page 20: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

LADDER SCAN EVALUATION (continue)In the first scan : When input 10 is pushed:

1. the processor examines reference 102 and finds it OFF (logic 0);therefore, output 103 stays OFF.

2. In the second rung, contact 101 is OFF; therefore, output 102 remains OFF. 3. In the third rung, contact 100 is OFF, so output 101 remains OFF. 4. In the fourth rung, contact 10 is ON because the push button is pushed, so

output 100 turns ON.

Ladder rung where the outputs turn ON in different scans

In the next scan (second), if the push button remains ON, output 101 will turn ON because, at the end of the first scan, the reference address 100 was set to logic 1.

This logic will continue until the fourth scan, when all four outputs will be ON.

Page 21: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Important Notes The important thing to remember about a ladder program is that for an output to

have an effect on another rung in the same scan, it must be programmed before that rung. If it is not, order of execution problems can arise, especially when using transitional contacts and one-shot outputs to reset and unlatch other rungs.

Once contact 10 closes, latching output 100, only the closing of contact 11 will unlatch the output.

When contact 12 closes, it triggers the one-shot output 11 (or the transitional contact 12) for one scan. However, at the end of the scan, the one-shot output turns OFF, so it is not able to unlatch coil 100 in the next scan.

Page 22: LADDER PROGRAMMING LANGUAGE by Dr. Amin Danial Asham

Thanks