You are on page 1of 23

Mechatronics Eng.

PLC Course

ME554: Programmable Logic Control


(PLC)

Basics of PLC Programming


Prepared By: Dr. Hani Muhsen

7/24/2019 Dr. Hani Muhsen 1


Mechatronics Eng. PLC Course

Processor Memory Organization


➢While the fundamental concepts of PLC programming are common to all manufacturers,
differences in memory organization, I/O addressing, and instruction set mean that PLC
programs are never perfectly interchangeable among different makers.

➢The memory map or structure for a PLC processor consists of several areas, some of
these having specific roles.

➢Allen-Bradley PLCs have two different memory structures identified by the terms rack-
based systems and tag-based systems. The memory organization for rack-based systems
will be covered in this chapter .

7/24/2019 Dr. Hani Muhsen 2


Mechatronics Eng. PLC Course

Processor Memory Organization


➢The memory space can be divided into two broad categories: program files and
data files.

➢Individual sections, their order, and the sections’ length will vary and may be
fixed or variable, depending on the manufacturer and model.

7/24/2019 Dr. Hani Muhsen 3


Mechatronics Eng. PLC Course

1. Program Files
Program files are the areas of processor memory where ladder logic programming
is stored. They may include:

▪ System functions (file 0)—This file is always included and contains various
system-related information and user-programmed information such as
processor type, I/O configuration, processor file name, and password.

7/24/2019 Dr. Hani Muhsen 4


Mechatronics Eng. PLC Course

1. Program Files
▪ Reserved (file 1)—This file is reserved by the processor and is not accessible
to the user.

▪ Main ladder program (file 2)—This file is always included and contains user-
programmed instructions that define how the controller is to operate.

▪ Subroutine ladder program (files 3–255)—These files are user-created and


are activated according to subroutine instructions residing in the main ladder

▪ program file.

7/24/2019 Dr. Hani Muhsen 5


Mechatronics Eng. PLC Course

2. Data Files
The data file portion of the processor’s memory stores input and output status,
processor status, the status of various bits, and numerical data. All this
information is accessed via the ladder logic program. These files are organized
by the type of data they contain and may include:
▪ Output (file 0)—This file stores the state of the output terminals for the
controller.
▪ Input (file 1)—This file stores the status of the input terminals for the
controller

7/24/2019 Dr. Hani Muhsen 6


Mechatronics Eng. PLC Course

2. Data Files
▪ Status (file 2)—This file stores controller operation information and is useful
for troubleshooting controller and program operation.

▪ Bit (file 3)—This file is used for internal relay logic storage.

▪ Timer (file 4)—This file stores the timer accumulated and preset values and
status bits.

▪ Counter (file 5)—This file stores the counter accumulated and preset values
and status bits.

7/24/2019 Dr. Hani Muhsen 7


Mechatronics Eng. PLC Course

2. Data Files
▪ Control (file 6)—This file stores the length, pointer position, and status bit for
specific instructions such as shift registers and sequencers.

▪ Integer (file 7)—This file is used to store numerical values or bit information.

▪ Reserved (file 8)—This file is not accessible to the user.

▪ Network communications (file 9)—This file is used for network


communications if installed or used like files 10–255.

▪ User-defined (files 10–255)—These files are user defined as bit, timer,


counter, control, and/or integer data storage.
7/24/2019 Dr. Hani Muhsen 8
Mechatronics Eng. PLC Course

Program Files and Data Files Mapping

7/24/2019 Dr. Hani Muhsen 9


Mechatronics Eng. PLC Course

The I/O address format for the SLC family of PLCs


The format consists of the following three parts:

Part 1: I for input, and a colon to separate the module type from the slot. O for
output and a colon to separate the module type from the slot.

Part 2: The module slot number and a forward slash to separate the slot from
the terminal screw.

Part 3: The screw terminal number

7/24/2019 Dr. Hani Muhsen 10


Mechatronics Eng. PLC Course

The I/O address format for the SLC family of PLCs

7/24/2019 Dr. Hani Muhsen 11


Mechatronics Eng. PLC Course

Program Scan
When a PLC executes a program, it must know—in real time—when external
devices controlling a process are changing. During each operating cycle, the
processor reads all the inputs, takes these values, and energizes or de-energizes
the outputs according to the user program. This process is known as a program
scan cycle.

7/24/2019 Dr. Hani Muhsen 12


Mechatronics Eng. PLC Course

Program Scan

7/24/2019 Dr. Hani Muhsen 13


Mechatronics Eng. PLC Course

Program Scan
There are two basic scan patterns that different PLC manufacturers use to
accomplish the scan function ( Figure 5-11 ). Allen-Bradley PLCs use the
horizontal scan by rung method. In this system, the processor examines input
and output instructions from the first command, top left in the program,
horizontally, rung by rung.

7/24/2019 Dr. Hani Muhsen 14


Mechatronics Eng. PLC Course

Program Scan
Modicon PLCs use the vertical scan by column method. In this system, the
processor examines input and output instructions from the top left command
entered in the ladder diagram, vertically, column by column and page by page.
Pages are executed in sequence. Both methods are appropriate; however,
misunderstanding the way the PLC scans a program can cause programming
bugs.

7/24/2019 Dr. Hani Muhsen 15


Mechatronics Eng. PLC Course

Program Scan

7/24/2019 Dr. Hani Muhsen 16


Mechatronics Eng. PLC Course

PLC Programming Languages


❖ The term PLC programming language refers to the method by which the user
communicates information to the PLC.

❖The standard IEC 61131 was established to standardize the multiple languages
associated with PLC programming by defi ning the following five standard
languages:

7/24/2019 Dr. Hani Muhsen 17


Mechatronics Eng. PLC Course

PLC Programming Languages


▪ Ladder Diagram (LD)—a graphical depiction of a process with rungs of logic, similar to the
relay ladder logic schemes that were replaced by PLCs.

▪ Function Block Diagram (FBD)—a graphical depiction of process flow using simple and
complex interconnecting blocks.

▪ Sequential Function Chart (SFC)—a graphical depiction of interconnecting steps, actions, and
transitions.

▪ Instruction List (IL)—a low-level, text-based language that uses mnemonic instructions.

▪ Structured Text (ST)—a high-level, text-based language such as BASIC, C, or PASCAL


specifically developed for industrial control applications.
7/24/2019 Dr. Hani Muhsen 18
Mechatronics Eng. PLC Course

PLC Programming Languages

7/24/2019 Dr. Hani Muhsen 19


Mechatronics Eng. PLC Course

Examples: PLC Programming Languages

7/24/2019 Dr. Hani Muhsen 20


Mechatronics Eng. PLC Course

Relay-Type Instructions
➢Representations of contacts and coils are the basic symbols of the logic ladder diagram
instruction set.

➢The three fundamental symbols that are used to translate relay control logic to contact symbolic
logic are Examine If Closed (XIC), Examine If Open (XIO), and Output Energize (OTE).

➢ Each of these instructions relates to a single bit of PLC memory that is specified by the
instruction’s address.

7/24/2019 Dr. Hani Muhsen 21


Mechatronics Eng. PLC Course

Relay-Type Instructions
➢The symbol for the Examine If Closed (XIC) instruction is shown in the Figure below. The XIC
instruction, which is also called the Examine-on instruction, looks and operates like a normally
open relay contact.

Note: the highlight of the Symbol


means it has a True Value (1)

7/24/2019 Dr. Hani Muhsen 22


Mechatronics Eng. PLC Course

Relay-Type Instructions
➢The symbol for the Examine If Open (XIO) instruction is shown in the Figure below. The XIO
instruction, which is also called the Examine-off instruction, looks and operates like a normally
closed relay contact.

Note: the highlight of the Symbol


means it has a True Value (1)

7/24/2019 Dr. Hani Muhsen 23

You might also like