Basics ofPLC
Programming
MC.ANTONIOSANDOVALCHIGUIL
29/10/2015
MC.ANTONIOSANDOVALCHIGUIL
Processor
Memory
Organization
29/10/2015
MC.ANTONIOSANDOVALCHIGUIL
Processor
Memory
Organization
29/10/2015
Program Files.
Program fi les are the areas of processor memory where ladder
logic programming is stored. They may include:
MC.ANTONIOSANDOVALCHIGUIL
Processor
Memory
Organization
29/10/2015
System functions (file 0) This file is always included and
contains various systemrelated information and user
programmed information such as processor type, I/O
configuration, processor file name, and password.
MC.ANTONIOSANDOVALCHIGUIL
Processor
Memory
Organization
29/10/2015
Reserved (file 1) This file is reserved by the processor and is
not accessible to the user.
MC.ANTONIOSANDOVALCHIGUIL
Processor
Memory
Organization
29/10/2015
Main ladder program (file 2) This fi le is always included and
contains userprogrammed instructions that define how the
controller is to operate.
MC.ANTONIOSANDOVALCHIGUIL
Processor
Memory
Organization
29/10/2015
Subroutine ladder program (files 3255) These files are user
created and are activated according to subroutine instructions
residing in the main ladder program file.
MC.ANTONIOSANDOVALCHIGUIL
Processor
Memory
Organization
29/10/2015
Data Files.
The data file portion of the processors 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:
MC.ANTONIOSANDOVALCHIGUIL
Output (file 0) This file stores the state of the output
terminals for the controller.
Processor
Memory
Organization
Input (file 1) This fi le stores the status of the input terminals
for the controller.
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.
29/10/2015
MC.ANTONIOSANDOVALCHIGUIL
Counter (file 5) This file stores the counter accumulated and
preset values and status bits.
Control (file 6) This file stores the length, pointer position,
and status bit for specific instructions such as shift registers and
sequencers.
Processor
Memory
Organization
Integer (file 7) This file is used to store numerical values or bit
information.
Reserved (file 8) This fi le is not accessible to the user.
Network communications (file 9) This file is
used for network communications if installed or used like files
10255.
Userdefined (files 10255) These files are userdefined as bit,
timer, counter, control, and/or integer data storage.
29/10/2015
MC.ANTONIOSANDOVALCHIGUIL
10
Processor
Memory
Organization
TheI/Oaddressformatfor
theSLCfamilyofPLCsis
showninFigure.
29/10/2015
MC.ANTONIOSANDOVALCHIGUIL
11
Processor
Memory
Organization
29/10/2015
The timer file stores the timer status and timer data. A timer
element consists of three words: the control word, preset
word, and accumulated word. The addressing of the timer
control word is the assigned timer number. Timers in fi le 4 are
numbered starting with T4:0 and running through T4:999. The
addresses for the three timer words in timer T4:0 are:
MC.ANTONIOSANDOVALCHIGUIL
12
Processor
Memory
Organization
29/10/2015
The counter file stores the counter status and counter data. A
counter element consists of three words: the control word,
preset word, and accumulated word. The addressing of the
counter control is the assigned counter number. Counters in file
5 are numbered beginning with C5:0 and running through
C5:999. The addresses for the three counter words in counter
C5:0 are:
MC.ANTONIOSANDOVALCHIGUIL
13
Processor
Memory
Organization
29/10/2015
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 defining the
following five standard languages:
MC.ANTONIOSANDOVALCHIGUIL
14
Processor
Memory
Organization
29/10/2015
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.
MC.ANTONIOSANDOVALCHIGUIL
15
Processor
Memory
Organization
29/10/2015
Function Block Diagram (FBD) a graphical depiction of
process flow using simple and complex interconnecting blocks.
MC.ANTONIOSANDOVALCHIGUIL
16
Processor
Memory
Organization
29/10/2015
Sequential Function Chart
(SFC) a graphical depiction
of interconnecting steps,
actions, and transitions.
MC.ANTONIOSANDOVALCHIGUIL
17
Processor
Memory
Organization
Instruction List (IL) a lowlevel, textbased language that
uses mnemonic instructions.
29/10/2015
MC.ANTONIOSANDOVALCHIGUIL
18
Processor
Memory
Organization
29/10/2015
Structured Text (ST) a
highlevel,
textbased
language such as BASIC, C,
or PASCAL specifi cally
developed for industrial
control applications.
MC.ANTONIOSANDOVALCHIGUIL
19
RelayType Instructions.
Processor
Memory
Organization
29/10/2015
The ladder diagram language is basically a symbolic set of
instructions used to create the controller program. These
ladder instruction symbols are arranged to obtain the desired
control logic that is to be entered into the memory of the PLC.
Because the instruction set is composed of contact symbols,
ladder diagram language is also referred to as contact
symbology.
MC.ANTONIOSANDOVALCHIGUIL
20
Processor
Memory
Organization
29/10/2015
RelayType Instructions.
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).
MC.ANTONIOSANDOVALCHIGUIL
21
Processor
Memory
Organization
29/10/2015
Examine If Closed (XIC)
instruction.
MC.ANTONIOSANDOVALCHIGUIL
22
Processor
Memory
Organization
29/10/2015
Examine If
instruction.
Open
MC.ANTONIOSANDOVALCHIGUIL
(XIO)
23
Processor
Memory
Organization
29/10/2015
Output Energize
instruction.
MC.ANTONIOSANDOVALCHIGUIL
(OTE)
24