0% found this document useful (0 votes)
7 views

input output modules

io modules in plc

Uploaded by

Affan Ahmmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

input output modules

io modules in plc

Uploaded by

Affan Ahmmed
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Horizontal scanning order 5.

3 PLC Programming Languages


The term PLC programming language refers to the
method by which the user communicates information to
Vertical the PLC. The standard IEC 61131 (Figure 5-12) was es-
scanning tablished to standardize the multiple languages associated
order Return
for next
with PLC programming by defining the following five
scan standard languages:
• Ladder Diagram (LD)—a graphical depiction of a
process with rungs of logic, similar to the relay lad-
End of ladder der logic schemes that were replaced by PLCs.
• Function Block Diagram (FBD)—a graphical de-
Figure 5-11 Scanning can be vertical or horizontal.
piction of process flow using simple and complex
interconnecting blocks.
the user program is also dependent on the clock frequency • Sequential Function Chart (SFC)—a graphical
of the microprocessor system. The higher the clock fre- depiction of interconnecting steps, actions, and
quency, the faster is the scan rate. transitions.
There are two basic scan patterns that different PLC • Instruction List (IL)—a low-level, text-based
manufacturers use to accomplish the scan function language that uses mnemonic instructions.
(Figure 5-11). Allen-Bradley PLCs use the horizontal
• Structured Text (ST)—a high-level, text-based lan-
scan by rung method. In this system, the processor exam-
guage such as BASIC, C, or PASCAL specifically
ines input and output instructions from the first com-
developed for industrial control applications.
mand, top left in the program, horizontally, rung by rung.
Modicon PLCs use the vertical scan by column method. Ladder diagram language is the most commonly used
In this system, the processor examines input and output PLC language and is designed to mimic relay logic. The
instructions from the top left command entered in the lad- ladder diagram is popular for those who prefer to de-
der diagram, vertically, column by column and page by fine control actions in terms of relay contacts and coils,
page. Pages are executed in sequence. Both methods are and other functions as block instructions. Figure 5-13
appropriate; however, misunderstanding the way the PLC shows a comparison of ladder diagram programming
scans a program can cause programming bugs. and instruction list programming. Figure 5-13a shows

PLC programming languages

Textural language Graphical language

Instruction Structured Ladder Functional Sequential


list text diagram block diagram function chart

Figure 5-12 Standard IEC 61131 languages associated with PLC programming.

PB1 CR 1 CR 2 SOL (PB1) (CR1) (CR2) SOL START PB 1


AND CR1
OR LS1
LS1 A B D Y
AND NOT CR2
OUT SOL
C
(LS1)
(a) Hardwired relay control circuit (b) Equivalent ladder diagram (LD) program (c) Equivalent instruction
list (IL) program

Figure 5-13 Comparison of ladder diagram and instruction list programming.

Basics of PLC Programming Chapter 5 79

pet10882_ch05_071-094.indd 79 7/23/10 9:14 PM


the original relay hardwired control circuit. Figure 5-13b Caution
shows the equivalent logic ladder diagram programmed Sensor 1 Sensor 2 PL 1

into a controller. Note how closely the ladder diagram


program closely resembles the hardwired relay circuit.
Ladder diagram
The input/output addressing is generally different for
each PLC manufacturer. Figure 5-13c show how the
original hardwired circuit could be programmed using BAND_01

the instruction list programming language. Note that BAND


the instructional list consists of a series of instructions Boolean And Caution
0
that refer to the basic AND, OR, and NOT logic gate Out PL 1
functions. 0
Sensor 1 In1
Functional block diagram programming uses instruc- 0
tions that are programmed as blocks wired together on Sensor 2 In2

screen to accomplish certain functions. Typical types of


Function block diagram
function blocks include logic, timers, and counters. Func-
tional block diagrams are similar in layout to electrical/ Figure 5-15 PLC ladder and equivalent function block
electronic block diagrams used to simplify complex sys- diagram.
tems by showing blocks of functionality. The primary
concept behind a functional block diagram is data flow.
Function blocks are linked together to complete a circuit Figure 5-15 illustrates how ladder diagram and func-
that satisfies a control requirement. Data flow on a path tional block diagram programming could be used to pro-
from inputs, through function blocks or instructions, and duce the same logical output. For this application, the
then to outputs. objective is to turn on caution pilot light PL 1 whenever
The use of function blocks for programming of pro- both sensor switch 1 and sensor switch 2 are closed. The
grammable logic controllers (PLCs) is gaining wider ladder logic consists of a single rung across the power
acceptance. Rather than the classic contact and coil repre- rails. This rung contains the two input sensor instructions
sentation of ladder diagram or relay ladder logic program- programmed in series with the pilot light output instruc-
ming, function blocks present a graphical image to the tion. The function block solution consists of a logic Bool-
programmer with underlying algorithms already defined. ean And function block with two input references tags for
The programmer simply completes needed information the sensors and a single output reference tag for the pilot
within the block to complete that phase of the program. light. Note there are no power rails in the function block
Figure 5-14 shows function block diagram equivalents to diagram.
ladder logic contacts. Sequential function chart programming language is
similar to a flowchart of your process. SFC programming
is designed to accommodate the programming of more
Functional block advanced processes. This type of program can be split
Ladder logic diagram equivalent into steps with multiple operations happening in paral-
AND_BOOL lel branches. The basic elements of a sequential function
A B
A chart program are shown in Figure 5-16.
B
Structured text is a high level text language primarily
used to implement complex procedures that cannot be
A easily expressed with graphical languages. Structured text
OR_BOOL
uses statements to define what to execute. Figure 5-17 il-
A
B lustrates how structured text and ladder diagram program-
B
ming could be used to produce the same logical output.
For this application, the objective is to energize SOL 1
A B AND_BOOL whenever either one of the two following circuit condi-
A tions exists:
B
• Sensor 1 and Sensor 2 switches are both closed.
Figure 5-14 Function block diagram equivalents to ladder • Sensor 3 and Sensor 4 switches are both closed and
logic contacts. Sensor 5 switch is open.

80 Chapter 5 Basics of PLC Programming

pet10882_ch05_071-094.indd 80 7/23/10 9:14 PM


logic to contact symbolic logic are Examine If Closed (XIC),
Initial
Examine If Open (XIO), and Output Energize (OTE). Each
Action of these instructions relates to a single bit of PLC memory
Step 1
that is specified by the instruction’s address.
Wire
loop Transition The symbol for the Examine If Closed (XIC) instruc-
Wire tion is shown in Figure 5-18. The XIC instruction, which
is also called the Examine-on instruction, looks and oper-
Step 2 Action ates like a normally open relay contact. Associated with
each XIC instruction is a memory bit linked to the status
of an input device or an internal logical condition in a
Transition rung. This instruction asks the PLC’s processor to exam-
ine if the contact is closed. It does this by examining the
bit at the memory location specified by the address in the
Step 3 Action following manner:
• The memory bit is set to 1 or 0 depending on the
Transition
status of the input (physical) device or internal
(logical) relay address associated with that bit.
Stop
• A 1 corresponds to a true status or on condition.
Figure 5-16 Major elements of a sequential function chart • A 0 corresponds to a false status or off condition.
program. • When the Examine-on instruction is associated
with a physical input, the instruction will be set to 1
when a physical input is present (voltage is applied
Sensor 1 Sensor 2 SOL 1
to the input terminal), and 0 when there is no physi-
cal input present (no voltage applied to the input
terminal).
Sensor 3 Sensor 4 Sensor 5 • When the Examine-on instruction is associated by
address with an internal relay, then the status of the
Ladder diagram (LD) program

Symbol
IF Sensor_1 AND Sensor_2 THEN Examine if closed (XIC)
SOL_1 := 1; Examine-on
ELSEIF Sensor_3 AND Sensor_4 AND NOT Sensor_5 THEN
SOL_1 := 1; Bit
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
END_IF; number
1 Status
Structured text (ST) program
Ι:1/4
Figure 5-17 PLC ladder and equivalent structured text
program.
Instruction interpreted
as true
Ι:1/4
5.4 Relay-Type Instructions
The ladder diagram language is basically a symbolic set of
instructions used to create the controller program. These 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
ladder instruction symbols are arranged to obtain the de- 0

sired control logic that is to be entered into the memory


Ι:1/4
of the PLC. Because the instruction set is composed of
contact symbols, ladder diagram language is also referred
Instruction interpreted
to as contact symbology. as false
Representations of contacts and coils are the basic sym- Ι:1/4
bols of the logic ladder diagram instruction set. The three
fundamental symbols that are used to translate relay control Figure 5-18 Examine If Closed (XIC) instruction.

Basics of PLC Programming Chapter 5 81

pet10882_ch05_071-094.indd 81 7/23/10 9:14 PM

You might also like