You are on page 1of 30

BASIC PLC PROGRAMMING

Q. What are ladder diagrams and sequence listing?

Ladder diagram:

Ladder diagrams are the most commonly used diagrams for nonelectronic control
circuits. They are sometimes called elementary diagrams or line diagrams. Two types
of ladder diagrams are used in control system: the control ladder diagram and the
power ladder diagram. The control ladder diagram has two active functional lines.
Some of the common practices for the format of control ladder diagram are
illustrated by this figure. Those practices are as follows: refer fig 4.1

Fig. 4.1

All coils, pilot lights and other outputs are on the right.

An input line can feed more than one output. If it does the output are
connected in parallel.

Switches, contacts and other devices are inserted in the ladder line starting
on the left.

Switches, contacts and other devices may be multiple contacts in series,


parallel or series-parallel.

Lines are numbered consecutively downward on the left.

Every connection node is given a unique identification number.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 1


BASIC PLC PROGRAMMING

Sequence listing:

The control ladder diagram in fig 4.1 has an operating sequence as follows:

All switches are open to start, both coils are off.

Close SW1, SW2 or both, CR7 is energized.

On line 3 CR7-1 closes, enabling line 3 (CR8 is still off).

Closing SW3 energizes CR8 and pilot light PL1

Opening both SW1 & SW2 turns everything OFF.

Q. Write the steps in planning a program for a large process?

OR

Q. write short note on large process ladder diagram construction.

1. Define the process to be controlled.

2. Make a sketch of the process operation

3. Create a written step sequence listing for the process.

4. Add sensor on the sketch as needed to carry out the control sequence.

5. Add manual controls as needed for process setup or operational checking.

6. Consider the safety of the operating personnel and make additions and
adjustments as needed.

7. Add master stop switches as required for safe shut down.

8. Create the ladder logic diagram that will be used as a basis for the PLC
program.

9. Consider the what ifs where the process sequence may go astray.

Q. Explain the importance of flowcharting in ladder programming.

1. One major step in planning a large process ladder diagram is to create a


written step-sequence listing for the process. Prior to doing so, however, it is
beneficial to develop a flowchart (flow diagram) which is a pictorial
representation of program logic.

2. Such a flowchart can make application program development much easier.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 2


BASIC PLC PROGRAMMING

3. The flowchart shows the points of decision, relevant operations, and the
sequence in which they should take place to solve the problem.

4. Such a chart allows us to think in a graphic manner.

5. Most flowcharts use four basic symbols: oval, diamond, rectangle, and
parallelogram. In addition, connection arrows are used to connect the various
symbols.

a. The oval symbol indicates either the beginning or end of the program.

b. The diamond indicates a point of decision. With it, we ask a question,


one that can be answered by yes or no.

c. The rectangle is the process block, some type of computational


processing or operation is taking place.

d. The parallelogram indicates input/output. It is used to input


information into the system or to take it out.

Q. List the five major type of registers. Use a block diagram to show where
each type fits into the PLC scheme of operation.

Major types of registers used in PLC.

Holding registers
Input registers
Input Group registers
Output registers
Output Group registers

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 3


BASIC PLC PROGRAMMING

Q. List three common types of timer functions available in PLCs.

Though there are many types of timer functions available in PLCs, the following
three are most commonly found:

Timer On Delay (TON)


Timer Off Delay (TOF)
Retentive timer (RTO)

Q. Explain Timer On Delay (TON) function.

The Timer On Delay instruction begins to count time base intervals when rung
conditions become true.
As long as rung conditions remain true, the timer increments its accumulated
value (ACC) according to time base interval until the accumulated value
reaches the preset value (PRE).
The accumulated value is reset when rung conditions go false, regardless of
whether the timer has timed out.
The Timer On Delay has three control bits.
o Done (DN): This bit is on when the Accumulated value = Preset Value
o Timer Timing (TT): This bit is on when the timer is timing.
(Accumulated value < Preset Value)
o Enabled (EN): This bit is on when the timer is energized.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 4


BASIC PLC PROGRAMMING

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 5


BASIC PLC PROGRAMMING

Q. Give an industrial application of Timer On Delay.

For a grinding operation on a metal part, the coolant flow on the part must be
on for an interval before the grinding process starts.
When the process circuit is turned on, the coolant motor (CM) is turned ON.
Eight seconds later the grinding process (GM) starts.

Q. Explain Timer Off Delay (TOF) function.

The Timer Off Delay instruction begins to count time base intervals when the
rung makes a true to false transition.
As long as rung conditions remain false, the timer increments its accumulated
value (ACC) until it reaches the preset value (PRE).
The accumulated value is reset when rung conditions go true regardless of
whether the timer has timed out.
Similar to TON, The Timer Off Delay has three control bits.
o Done (DN): This bit is on when the Accumulated value = Preset Value
o Timer Timing (TT): This bit is on when the timer is timing.
(Accumulated value < Preset Value)
o Enabled (EN): This bit is on when the timer is energized.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 6


BASIC PLC PROGRAMMING

Q. Give an industrial application of Timer Off Delay.

A motor and its lubrication pump motor are both running when the switch is
turned ON. Lubrication for the main motor bearings is required during motor
coast-down.
After the main motor is shut OFF, the lubricating pump remains ON for a time
corresponding to coast-down time. In this example, the lubricating pump
remains ON for 15 seconds after main switch is shut down.

Rung 1: When start button is pressed main motor output O: 0/0 is ON.

Rung 2: When output O: 0/0 is ON, its auxiliary contact with same address gets
closed which starts the Off Delay Timer T4:0.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 7


BASIC PLC PROGRAMMING

Rung 3: When OFF delay timer gets supply its DN bit is set which turn ON the
output O: 0/1 i.e. lubrication motor.

When stop button is pressed then main motor will shut down immediately i.e.
output O:0/0 turn OFF and its contact gets open. Now supply to Off Delay Timer
goes OFF but its DN bit gets open after 15 seconds so lubrication motor remains
ON for 15 seconds when main motor is OFF during coast down time.

Q. Explain Retentive Timer On (RTO) instruction.

A retentive timer accumulates time whenever rung condition becomes true,


and it maintains the current time when the rung condition goes false or when
power is removed.
Once the device accumulates time equal to its Preset value, the contacts
of the device change state. Loss of power to the device after reaching its
preset value does not affect the state of the contacts.
The retentive timer must be intentionally reset with a separate signal for the
accumulated time to be reset.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 8


BASIC PLC PROGRAMMING

Q. Explain what you mean by PLC counter.

Counters are provided as built-in elements in PLCs and allow the number of
occurrences of input signals to be counted. Some uses might include where
items have to be counted as they pass along a conveyor belt, the number of
revolutions of a shaft, or perhaps the number of people passing through a
door.
A counter is set to some preset number value and, when this value of input
pulses has been received, it will operate its contacts. Normally open contacts
would be closed, normally closed contacts get opened.
There are two basic types of counter: down-counters and up-counters. Down-
counters count down from the preset value to zero, that is, events are
subtracted from the set value. When the counter reaches the zero value, its
contacts change state. Most PLCs offer down-counting.
Up-counters count from zero up to the preset value, that is, events are added
until the number reaches the preset value. When the counter reaches the set
value, its contacts change state.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 9


BASIC PLC PROGRAMMING

Q. State important information usually associated with programming of


PLC counter instruction.

Counter Number: For the example shown, the counter number is C5: 0
which represents counter file 5, counter 0 in that file. Subsequent counters
will be numbered as C5:1, C5:2, etc.

Preset Value: The preset value can range from -32768 to + 32767. In the
example shown the preset value is 10.

Accumulated Value: The accumulated value can also range from 32768
through +32767. Regardless of what value is entered, the reset instruction
will reset the accumulated value to 0.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 10


BASIC PLC PROGRAMMING

Q. Give an industrial application of PLC counter instruction.

As an illustration of the application of a counter, consider the problem of


items passing along a conveyor belt.
The passage of an item past a particular point is registered by the interruption
of a light beam to a photoelectric cell, and after a set number (e.g. 50) there
is to be a signal sent informing that the set count has been reached and the
conveyor stopped.
When the count reaches the preset value, the done bit is set to 1, and so
O:013/01 occurs, the corresponding contacts are opened, and the conveyor is
stopped.

Q. Describe the Arithmetic functions available in PLC.

Arithmetic instructions:

PLC can perform different arithmetic operations like addition, subtraction,


multiplication etc. to perform these operations there are different arithmetic
instruction in PLC. An arithmetic instruction will retrieve one or more values, perform
an operation and store the result in destination memory location.

1. Addition (ADD):

ADD instruction will retrieve values from source A and source B convert both
values to the type of destination address, then value of source A is added to
the value of source B and store the result in destination address.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 11


BASIC PLC PROGRAMMING

In fig. Source A is an integer value, source B is floating point number and


type of destination address is also floating point number.

Therefore, ADD instruction first convert values of both the sources to floating
point number.

Then add both the values and result is floating point number which stored in
the destination address.

For example, if value of source A is 10 i.e. N7:01=10 and value of source B is


25.5 i.e. F8:30=25.5 then result is, F8:31=35.5

2. Subtraction (SUB):

Instruction retrieve values from source A and source B, convert both values to
the type of destination address, then value at source B is subtracted from the
value of source A and then store the result in the destination.

The shortened notation for this instruction is SUB (value, value, destination)

3. Multiply (MUL):

Instruction convert both the values to the type of destination address and
then value of source A is multiplied by the value of source B and store the
result in destination address.

The shortened notation for this instruction is MUL (value, value, destination)

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 12


BASIC PLC PROGRAMMING

4. Divide (DIV):

Instruction convert both the values of source A and source B to the type of
destination address and then value of source A is divided by the value of
source B and store the result in destination address.

The shortened notation for this instruction is DIV (value, value, destination)

5. Negate (NEG):

This instruction is unary, so there is only one source.

The value of source is subtracted from zero and then result is stored in
destination address.

It reverses sign from positive/negative.

The shortened notation for this instruction is NEG (value, destination)

Q. Give an example of arithmetic function.

The first SUB function retrieve the values from N7:0 and N7:1 then subtract
value of N7:1 from value of N7:0 and store the result in N7:2

The second NEG function change the sign of result of first function in N7:2
and store the result in N7:3

The third MUL function multiply the value of N7:0 by the value of N7:1 and
store the result in N7:4

Next DIV instruction divide the integer value in N7:1 by the integer value in
N7:0, the result is rounded to the nearest integer and store in N7:5

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 13


BASIC PLC PROGRAMMING

For example if the values of N7:0=5 and N7:1=25 then results are,
N7:2=-20, N7:3=20, N7:4=125 and N7:5=5.

Compute (CPT) is another useful function. CPT is used to evaluate


complicated mathematical expression. Suppose the mathematical equation is

A= Log B + Sin C.

Assign A= F8:0, B=F8:1 and C=F8:2. This equation can be expressed by CPT
function as shown in figure.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 14


BASIC PLC PROGRAMMING

Q. Describe PLC number comparison functions.

Many PLCs have only two COMPARE functions: equal (EQ) and greater than
or equal to (GE). To perform any one of the other four functions (not equal,
less than, greater than, and less than or equal to), combinations of the basic
two are used.
Sr. No. Function Equation Symbol

1 Equal A=B EQ

2 Not equal AB NEQ

Greater than or
3 AB GE
equal to

4 Less than A<B LES

5 Greater than A>B GRT

Less than or
6 AB LEQ
equal to

The table showing comparison functions is given above.


Lets take an example of each COMPARE function. Assume that A, the
standard for comparison, is placed in operand 2. A is set at 182. Then B, the
number to be compared to A, will be placed in operand 1. We are therefore
comparing the value of B to the value of A, 182.
1. Equal (EQ) is true only if B is exactly 182 also.
2. Not equal (NEQ) is true if B is 181 or less, or if B is 183 or more.
3. Greater than or equal to (GE) is true only when B is 182 or less.
4. Less than (LES) is true only when B is 183 or more.
5. Greater than (GRT) is true only when B is 181 or less.
6. Less than or equal to (LEQ) is true only when B is 182 or more.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 15


BASIC PLC PROGRAMMING

Q. Give industrial applications of any two PLC basic number comparison


function.

Equal to COMPARE Function

We are banding dowel pins into bundles of 40. A counter function (not
shown) keeps track of the count of the number of dowel pins in the bundle
as they are added.
The dowel pin counters count number is kept in HR0005.
The running count is compared to 40, as shown in figure. When the count
reaches 40, the comparison is true, and the output, CR0019, goes on.
Output CR0019 is connected to a bander that operates when 40 is reached.

Greater than or equal to COMPARE Function

In an automatic pill-bottle-filling operation each bottle is to be filled to a


count of 225 or more. This example uses a greater-than-or-equal-to
COMPARE function.
Figure shows the PLC function to control the pill counts. The pill count
(counter not shown) is fed from an input to IR0142 as the bottle is filled.
The appropriate minimum number of pills for proper filling, 225, is inserted
into HR0028.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 16


BASIC PLC PROGRAMMING

As the bottle starts filling, as long as the pill count is less than 225, the
comparison is untrue and output CR0030 is OFF.
Once the pill count reaches 225, CR0030 goes ON. Output CR0030 is
connected to a cap-and-remove operation. The bottle is capped and
removed, and the process is reset and can be repeated.
Why not use an equal-to function for this example? EQ would probably work,
but what if the process overshoots? Suppose the count somehow got to 226.
The fill would go on unabated. However if we use the GE function, the fill
process would not erroneously continue even if the count got to 226.

Q. Describe SKIP function of PLC.

The SKIP (SK) function allows a portion of a PLC program to be bypassed


when its coil is enabled. This function is used when the skip of one or more
subsequent lines is desired.
Figure shows a basic application of the SKIP function in a program. The eight
line program used for illustration has seven lines with output functions. A
SKIP function is included on the third line of the eight-line program. When the
SK function is off, the other seven functions operate in normal manner. When
the seven lines corresponding to inputs are on, their outputs are on, and
when the inputs are off, the outputs are off. For this illustration, the value of
lines to be skipped will be set at 3.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 17


BASIC PLC PROGRAMMING

When the SKIP function (set at 3) is turned on, the first two lines will function
as usual. However, the next three lines, 4 through 6, will stay on or off in
their previous state. With SKIP on, changing the input on-off status feeding
the coils on lines on lines 4 through 6 will have no effect on output coils 4
through 6. Coils on lines 4 through 6 will retain their previous states.
Lines 7 and 8 could also be skipped if we had inserted a 5 in place of 3 as the
number of lines to be skipped by the function. When SKIP is turned off, the
ladder will operate normally.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 18


BASIC PLC PROGRAMMING

Q. Describe the Master Control Relay (MCR) function.

The MASTER CONTROL RELAY (MCR) function operation is similar to the SK


function. Figure shows typical MCR function. When its enable line is
energized, it turns on.
When MCR is off, the number of following ladder diagram lines specified are
turned off. In contrast to the SK operation, where lines were skipped, the
MCR turns the following specified number of lines to the off state.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 19


BASIC PLC PROGRAMMING

Figure shows how the MCR function operates in a program. There are eight
lines. The third line is the MCR function. The other seven lines are contact-coil
functions.
When MCR is on, the other seven lines operate normally. When MCR is off,
the next three lines, 4 through 6, are turned off. Lines 1, 2, 7 and 8 are
unaffected.
With MCR off, there is no way to turn on coils 4 through 6 by energizing their
enable lines. When MCR is turned on, the ladder operates in the normal
manner.

Q. What is jump programming instruction in PLC? What are two types


jump instructions?

The jump instruction is a command in a computer program that causes the


sequence to go to, or branch to, a specific point other than the next line in
the program sequence.
There are two types of jump instructions:
o Jump with nonreturn
o Jump with return
The jump with nonreturn is similar to the skip function in that it leaps over a
certain portion of the main program when called upon to do so.
The jump with return instruction, on the other hand, leaps to a subroutine
when activated. It then returns from the subroutine to the main program.
Jump instructions reduce scanning time, programming effort, and memory
space.

Q. Explain Jump with nonreturn function.

A jump with nonreturn instruction allows us to skip, or branch, to a


different portion of the program, usually further down. Thus the scan leaps
over a portion of the main program. All outputs in the skipped portion are
frozen in their last state. This is because their inputs are not being scanned,
theyre being skipped.
The basic jump operation is illustrated in figure. Program scanning takes
place from top to bottom, as usual. When a jump instruction is
encountered, the scan leaps to the jump destination. Main program
scanning continues from here.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 20


BASIC PLC PROGRAMMING

For a jump to take place there must be a place to jump from and a
place to jump to. For this, the jump (JMP) and label (LBL) instructions
go together. The JMP is placed in the rung where the leap is to occur;
while LBL is the target of the leap. Thus a jump jumps to a label. Both
the jump and label must have the same address.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 21


BASIC PLC PROGRAMMING

Figure shows the nonreturn JUMP function. If input 121 (line 17) is on
(true), the program will jump to the next line where an LBL is found (line
22). Since lines 18 through 21 are not scanned by the processor, input
conditions are not examined and outputs controlled by these rungs remain
in their last state. If input 121 is off (false), the program continues directly
to line 18.
It is possible to jump to the same label from multiple jump locations.

Q. Explain Jump with return (Jump to subroutine) instruction.


Often, with PLC control, a machine or process goes through many repetitive
sub processes.
For example, various specific time delays may be needed as parts are
manufactured and assembled. Suppose that process requires five 4-second
delays in the assembly of an item. To write, at various points in the main
program, five identical time delays would be a waste of time, effort and PLC
memory.
It is then better to write code for the time delay once and then call the
code up every time it is needed. In our example, that would be five times.
Such programming is easily accomplished with the use of subroutines.
A subroutine is a group of instructions written separately from the main
program to perform a function that occurs repeatedly in the main program.
Thus, the subroutine code is outside the main program, residing elsewhere
in the memory.

Note that a jump-to-subroutine consists of a call operation and a return


operation. When the rung containing the jump-to-subroutine instruction (JSR)

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 22


BASIC PLC PROGRAMMING

is true, the subroutine is called. Where is the subroutine? At the label (LBL) in
the subroutine area.
Note that JSR and LBL addresses are the same. When the subroutine is
completed, an unconditional return to the main program must take place. The
return is always to the rung following the JSR in the main program.

As shown in figure, lines 21 through 23 are part of the main program. When
input 121 is true, a jump to a subroutine at LBL, on line 107, takes place.
Lines 107 through 110 contain the subroutine. When the return command
(RET) is encountered, the subroutine returns to line 23 in the main program.

Q. What are the different PLC Data Transfer functions?

PLC Data Transfer functions are as follows:

MOVE function
BLOCK TRANSFER function or TABLE-TO-TABLE function
TABLE-TO-REGISTER (TR) function
REGISTER-TO-TABLE (RT) function

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 23


BASIC PLC PROGRAMMING

Q. Explain PLC MOVE function.

MOVE function is used to copy the contents of one register to another


register. Figure shows the elements of a MOVE function.
When the function is turned on through the enable circuit, the bit pattern
from the specified source register is duplicated in the specified destination
register.
The source register is unchanged. The destination register pattern is replaced
and lost when new value is brought in.
This function might be used in following cases
o To move preset value to timer or counter
o To move timer or counter value to some register for storage
o To move data from input to register or from register to output

Q. Explain BLOCK TRANSFER (TABLE-TO-TABLE) function.

It is sometimes necessary to move more data than the quantity that will fit
into one address. One option is to use a number of individuals MOVE
functions.
But instead of that we can use a single BLOCK TRANSFER function that will
move many consecutive registers data at once.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 24


BASIC PLC PROGRAMMING

Suppose we need to move 147 bits from one location to another but we only
have 16-bit registers available. We would need to use nine full 16-bit registers
(16x9=144 bits) plus part of another register (3 bits). In this case, one BLOCK
TRANSFER function does the work of ten MOVE functions.
Figure illustrates the BLOCK TRANSFER function. In the functional block
following things are specified.
o Number of registers to be moved
o Source end register
o Destination end register

Q. Explain TABLE-TO-REGISTER (TR) function.

The TABLE-TO-REGISTER (TR) function moves data sequentially from a


specified portion of a large listing of data to a single register.
Figure shows in block diagram form how the TR function moves data. In a
typical application, the receiving register operates a number of machines by
bit picking. As different table register patterns are moved into the receiving
register, the machines on-off patterns will change.
A typical PLC function used to accomplish TR moves is shown in figure. It
operates similarly to other MOVE functions. In the TR functional block
following things are programmed.
o Table length i.e. the number of registers to be sequentially inputted.
o End register
o Destination register

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 25


BASIC PLC PROGRAMMING

The function is enabled when the lower input line is on. When the middle line,
Reset is turned off, the function is reset to first register. When the reset is on,
the function is operational and can be stepped. The top line is step line.
Whenever step line is turned on, the function transfers data and moves down
one register.

Q. Explain REGISTER-TO-TABLE (RT) function.

The REGISTER-TO-TABLE (RT) function is similar to the TR function. It


moves data from a single register sequentially into a specified number of
consecutive registers. A block diagram of an RT move is shown in figure.
Programming RT moves is similar to programming TR moves. In the RT
functional block following things are programmed.
o Table length i.e. the number of registers to be sequentially outputted
o End register
o Source register

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 26


BASIC PLC PROGRAMMING

The function is enabled when the lower input line is on. When the middle
line, Reset is turned off, the function is reset to first register. When the
reset is on, the function is operational and can be stepped. The top line is
step line. Whenever step line is turned on, the function transfers data and
moves down one register.

Q. Give an application of REGISTER-TO-TABLE function.

An RT function might be used for periodic recording of data.


A single register could be programmed to indicate the value of a varying
process parameter. The single registers value is constantly changing as the
process changes. This register is used as the source.
To record its value every 10 seconds for 5 minutes, we need 6 times 5 i.e.
30 registers to record the required sequential readings.
The functions step line is pulsed every 10 seconds. The table destination
length needs to be 30 registers.
The 10-second interval results are then recorded in order. The 30 sequential
values appear in order in the specified series of 30 destination registers.

Q. List commonly used PLC stacking systems.

Commonly used PLC stacking systems are

FIFO (first in first out) function


LIFO (last in last out) function

Q. Describe PLC FIFO function.

The FIFO function retrieves the data in the order in which it was stored.
The FIFO function consists of two subfunctions. To put data into a stack, a
function denoted FIFO Load (FFL) is used. To take data out of the stack, a
function denoted FIFO Unload (FFU) is used.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 27


BASIC PLC PROGRAMMING

Figure shows the FIFO programming formats. Information to be programmed


into the function includes:
o Source of data to be inserted in the stack
o Destination of data to be removed from stack
o Length of stack
o Other special instructions, such as control word

Both FFL and FFU functions are used in combination to accomplish FIFO.
The first time FFL is activated, it will grab the word (16 bits) from the input
card I:001 and store them on the stack, at N7:0. The next value would be
stored at N7:1, and so on until the stack length is reached at N7:4.
When the FFU is activated the word at N7:0 will be moved to the output card
O:003. The values on the stack will be shifted up so that the value previously
in N7:1 moves to N7:0, N7:2 moves to N7:1, etc.
If the stack is full or empty, and a load or unload occurs the error bit will be
set R6:0/ER.

Q. Describe PLC LIFO function.

The LIFO function retrieves the data in the reverse order in which it was
stored.
The LIFO function consists of two subfunctions. To put data into a stack, a
function denoted LIFO Load (LFL) is used. To take data out of the stack, a
function denoted LIFO Unload (LFU) is used.
Both LFL and LFU functions are used in combination to accomplish LIFO.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 28


BASIC PLC PROGRAMMING

As values are loaded on the stack, they will be added sequentially N7:0, N7:1,
N7:2, N7:3 then N7:4. When values are unloaded they will be taken from the
last loaded position, so if the stack is full the value of N7:4 will be removed
first.

Q. Explain FAL function in PLCs.

The FILE ARITHMETIC AND LOGIC (FAL) function is useful when a complex
computation is performed on a series of data values.
Instead of programming a COMPUTE (CPT) function repetitively for each
group of data, we program only once for FAL function.
Then, for FAL, we specify the number of times the calculation should run
(length) and where the calculation process should start in a stack of data
values.
The FAL function is essentially a multiple, sequential CPT function which saves
programming time and program space.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 29


BASIC PLC PROGRAMMING

Figure shows an example of FAL function.


This example would perform all of the calculations in a single scan (since
mode is ALL). These calculations would be

N7:10=N7:0 - N7:21,

N7:11=N7:1 - N7:21,

N7:19=N7:9 - N7:21.

In the above example, if mode is SINGLE then one scan will perform one
calculation.

Rohan Desai- Automobile Dept- New Polytechnic, Kolhapur Page 30

You might also like