100% found this document useful (1 vote)
67 views296 pages

Introduction PLC

The document outlines a course on Programmable Logic Controllers (PLC), covering topics such as history, hardware, operation, programming software, and communication. It aims to provide students with essential knowledge and skills related to PLC applications in industry, including the ability to design control systems and work effectively in teams. Assessment methods include process and final examinations, with various resources and software tools provided for learning.

Uploaded by

supersword2510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
67 views296 pages

Introduction PLC

The document outlines a course on Programmable Logic Controllers (PLC), covering topics such as history, hardware, operation, programming software, and communication. It aims to provide students with essential knowledge and skills related to PLC applications in industry, including the ability to design control systems and work effectively in teams. Assessment methods include process and final examinations, with various resources and software tools provided for learning.

Uploaded by

supersword2510
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 296

PROGRAMMABLE LOGIC

CONTROLLER

Assoc. Prof. Truong Dinh Nhon, Ph.D


Email: [email protected]
Cellphone: 0947.03.12.79
Content

• History
• PLC Overview
• Hardware
• Inputs/Outputs
• Operation
• Programming Software
• Communication
• Specifying a PLC
• Basic instructions
• Programming methods
• Advanced instructions
Introduction
This course provides students the knowledge of Goal description
Goals ELOs
the sensors, actuators, PLC hardware, PLC (This course provides students:)
operation. In addition, students will learn the G1 Basic knowledge of PLC, applications of PLC in industry. 01 (H)
programming languages, PLC instructions, how to G2 An ability to read material in English. 02 (H)
design a flowchart for a control system. G3
An ability to work effectively as a member and leader in
05 (M)
teams.
Finally, the course provides students how to design An ability to identify and solve engineering problems and 06 (M)
the hardware and program the software for an G4 to design an industrial system using tools and methods for
solving problems related to PLC systems. 07 (H)
industrial system.

Description
CLOs Outcome
(After completing this course, students can have:)

G1.1 The ability to present the structure and operation of PLC. 01, 05

G1 G1.2 The ability to draw the wiring diagram of PLC and sensors, actuators. 01, 06

G1.3 The ability to select devices for PLC system. 01, 07

G2 G2.1 The ability to read manual of devices and lectures in English 05, 07

G3 G3.1 The ability to organize, work and present in team. 06

G4.1 The ability to present the control ideal for PLC system. 02, 07
G4
G4.2 The ability to use software to program and simulate for PLC. 07
Software
TIA portal (Siemens)

Rslogix 5000 (Allen Bradley)

FX Training (Mitsubishi)

Factory IO
https://factoryio.com/
Assessment

1. Process examination (50%)


- Homework via online submission
- Paper test in class

2. Final examination (50%)


- Project
MATERIALS
- TIA Getting start

https://drive.google.com/file/d/11GQekwCl8bUzwVoeKbLZ4BZNdNV2Kgpd/view?usp=sharing

- Configuration S7-1200

https://drive.google.com/file/d/1WwyPM0a0AKGzV5vO2SFObm4LaYX2ROEN/view?usp=sharing

- Simulink

https://drive.google.com/file/d/1XSABl1bC4YJjei_0So_LEjX-bbMySxaC/view?usp=sharing

- Simulink in Factory IO

https://drive.google.com/file/d/16qNnjfBQLAnriZDW5lHdCISWLRp7Mk6o/view?usp=sharing

- Download Template from Factory IO

https://docs.factoryio.com/tutorials/siemens/setting-up-s7-plcsim-v13/

- Factory IO software

- https://docs.google.com/document/d/1c0JUKj2qEjHBIar-

7n39u6rI7hodxiHX/edit?usp=sharing&ouid=102953919047853637934&rtpof=true&sd=true

- TIA portal software:

- https://drive.google.com/file/d/1AzmRXykJnzR17iv1iDjYRhuLMYCjP-Iq/view?usp=sharing
History of the PLC

• First Programmable Logic Controllers (PLC)


were designed and developed by Modicon as a
relay replacer for GM and Landis.
• These controllers eliminated the need for rewiring
and adding additional hardware for each new
configuration of logic.
• The new system drastically increased the
functionality of the controls while reducing the
cabinet space that housed the logic.

• The first PLC, model 084, was invented by Dick Morley in 1969.
• The first commercial successful PLC, the 184, was introduced in
1973 which was designed by Michael Greenberg.
Leading Brands of PLC
AMERICAN
1. Allen Bradley
2. Gould Modicon
3. Texas Instruments
4. General Electric
5. Westinghouse
6. Cutter Hammer
7. Square D
EUROPEAN
1. Siemens
2. Klockner & Mouller
3. Festo
4. Telemechanique

8
Leading Brands of PLC

JAPANESE
1. Toshiba
2. Omron
3. Fanuc
4. Mitsubishi

9
What is a PLC?

The Basic Block

Inputs Outputs
CPU

A PLC is a solid state control system that continuously monitors the status of
devices connected as inputs. Based upon a user written program, stored in
memory, it controls the status of devices connected as outputs.
Major Components of a Common PLC

POWER
SUPPLY

I M O M
N O U O
P D T D
U U PROCESSOR P U
T L U L
From E T E To
SENSORS OUTPUT
Pushbuttons, Solenoids,
contacts, contactors,
limit switches, alarms
etc. etc.
PROGRAMMING
DEVICE
Inside a PLC
Communications
Port

C C
I i O i
r
Central r
n u
p c Processor t c
u u p u
t i Unit u i
t (CPU) t t CR
s s

High High
Voltage Isolation Voltage
Isolation MEMORY Barrier
Barrier
program data

Low Voltage

AC Power Supply or DC Power Supply


Inside a PLC
Input/output unit
The input/output unit provides the interface between the system and the outside world
through input devices such as switches and sensors and output devices such as
motors and solenoids.
Every input/output point has a unique address which can be used by the CPU.
The input/output channels provide isolation and signal conditioning functions so that
sensors and actuators can often be directly connected to them without the need for
other circuitry.
Electrical isolation from the external world is usually by means of opto-isolators (opto-
couplers).
Input Module

IS NEEDED TO: IS NEEDED TO:


USE TO  Prevent voltage CONVERTS THE AC  Prevent voltage
DROP THE transients from INPUT TO DC AND transients from
VOLTAGE damaging the DROPS THE damaging the
TO LOGIC processor. VOLTAGE TO LOGIC processor.
LEVEL  Helps reduce LEVEL  Helps reduce
the effects of the effects of
electrical noise electrical noise

Current Buffer, Rectifier, Buffer,


FROM Limiting Filter, FROM Resistor Filter,
OPTO- TO OPTO- TO
INPUT Resistor ISOLATOR hysteresis INPUT Network ISOLATOR Hysteresis
PROCESSOR PROCESSOR
DEVICE Circuits DEVICE Circuits

DC INPUT MODULE AC INPUT MODULE


A range of inputs might be available with a larger PLC, e.g. 5 V, 24 V, 110 V and
240 V digital/discrete, i.e. on−off, signals. A small PLC is likely to have just one
form of input, e.g. 24 V.
Output Module
DC / AC OUTPUT MODULE
IS NEEDED TO:
 Prevent voltage
transients from
damaging the
processor.
 Helps reduce
the effects of
electrical noise

Amplifier
FROM RELAY
TTL OPTO- TO
PROCESSOR ISOLATOR TRIAC
Circuits OUTPUT
X’SISTO
DEVICE
R

16
Output Module

DC Output. AC Output

With a small PLC, all the outputs might be of one type, e.g. 24 V DC.
Sourcing and Sinking
The terms sourcing and sinking are used to describe the way in which DC
devices are connected to a PLC.
With sourcing, using the conventional current flow direction as from positive to
negative, an input device receives current from the input module (a).
If the current flows from the output module to an output load then the output
module is referred to as sourcing (b)
Sourcing and Sinking
With sinking, using the conventional current flow direction as from positive to
negative, an input device supplies current to the input module, i.e. the input
module is the sink for the current (a).
If the current flows to the output module from an output load then the output
module is referred to as sinking (b).
COMPACTLOGIX MODULES

1769-IQ32 Sinking/Sourcing 24V DC Input

On state:
Min voltage: 10V, I = 2mA
Max voltage: 30V, I=10mA

OFF state:
Max voltage 5V.
Max current: 1,5mA.
Time to change from ON and OFF
state is 8ms.
COMPACTLLOGIX MODULES
1769-IQ32 Sinking/Sourcing 24V DC Input
Connect sensor to input digital module

Connect sensors with PNP output to Input module


Connect sensor to input digital module

Connect sensors with NPN output to Input module


What are Inputs?

• Switches and Pushbuttons


• Sensing Devices
• Limit Switches
• Photoelectric Sensors
• Proximity Sensors
• Condition Sensors
• Pressure Switches
• Level Switches
• Temperature Switches
• Vacuum Switches
• Float Switches
• Encoders
COMPACTLLOGIX MODULES
Digital input/output module DI 16x24VDC/
DQ 16x24VDC/0.5A
1769-OW8I Output
What are Outputs?

• Valves
• Motor Starters
• Solenoids
• Actuators
• Control Relays
• Horns & Alarms
• Stack Lights
• Fans
• Counter/Totalizer
• Pumps
• Printers
PLC systems

There are two common types of mechanical design for PLC systems; a single
box, and the modular/rack types.
The single box type (or, as sometimes termed, brick) is commonly used for
small programmable controllers and is supplied as an integral compact
package complete with power supply, processor, memory, and input/output
units.
PLC systems

Typically such a PLC might have 6, 8, 12 or 24 inputs and 4, 8 or 16


outputs and a memory which can store some 300 to 1000 instructions.
Some brick systems have the capacity to be extended to cope with more
inputs and outputs by linking input/output boxes to them.
PLC systems

Systems with larger numbers of inputs and outputs are likely to be modular
and designed to fit in racks.
The modular type consists of separate modules for power supply,
processor, etc., which are often mounted on rails within a metal cabinet.
PLC systems
The rack type can be used for all sizes of programmable
controllers and has the various functional units packaged in
individual modules which can be plugged into sockets in a base
rack.
It is comparatively easy to expand the number of input/output (I/O)
connections by just adding more input/output modules or to expand
the memory by adding more memory units.
PLC systems
PLC systems S7-400
PLC systems S7-300 expansion
Allen-Bradley PLC

34
Siemens Simatic PLC
Modicon TSX PLC
Other PLC Terminology

 On-line: Refers to the program code currently in the PLC memory.


 Off-line: Refers to the copy of the program code stored on the
programming computer.
 Up-Load: Refers to the act of copying the current On-line code from
the PLC to the programming computer. (Note the previous code on the
programming computer is lost during this transfer if a copy is not made)
 Down-Load: Refers to the act of copying the code from the
programming computer into the PLC’s memory. (note the previous PLC
code is lost during this transfer).
Other PLC Terminology

Run Mode: The PLC actively scanning the


code and driving outputs.

Program Mode: The PLC is not being


scanned (All outputs disabled)

Remote Mode: programming computer can


change the PLC between Run and Program.

38
Programming Device

 Industrial Terminal (Allen Bradley)

 Program Development Terminal (General Electric)

 Programming Panel (Gould Modicon)

 Programmer (Square D)

 Program Loader (Idec-Izumi)

 Programming Console (Keyence / Omron)

39
Programming Device

 Hand held unit with LED / LCD display


Hand-held programming devices will normally contain enough memory to allow the unit to retain
programs while being carried from one place to another.

 Desktop type with a CRT display


Desktop consoles are likely to have a visual display unit with a full keyboard and screen display.

 Compatible computer terminal


Personal computers are widely configured as program development work-stations.

40
Different types of I/O circuits

1. Pilot Duty Outputs

Outputs of this type typically are used to drive high-current electromagnetic loads
such as solenoids, relays, valves, and motor starters.

These loads are highly inductive and exhibit a large inrush current.

Pilot duty outputs should be capable of


withstanding an inrush current of 10 times the
rated load for a short period of time without failure.
Different types of I/O circuits

2. General - Purpose Outputs


These are usually low-voltage and low-current and are used to drive indicating
lights and other non-inductive loads. Noise suppression may or may not be
included on this types of modules.

3. Discrete Inputs
Circuits of this type are used to sense the status of limit switches, push buttons,
and other discrete sensors. Noise suppression is of great importance in preventing
false indication of inputs turning on or off because of noise.
Different types of I/O circuits

4. Analog I/O
Analog inputs come from devices, such as thermocouples, strain gages,
or pressure sensors, that provide a signal voltage or current that is
derived from the process variable.
Standard Analog Input signals: 4-20mA; 0-10V
Analog outputs can be used to drive devices such as voltmeters, X-Y
recorders, servomotor drives, and valves through the use of transducers.
Standard Analog Output signals: 4-20mA; 0-5V; 0-10V
Different types of I/O circuits
5. Special - Purpose I/O

Circuits of this type are used to interface PLCs to very specific types
of circuits such as servomotors, stepping motors, PID (proportional
integral derivative) loops, high-speed pulse counting, resolver and
decoder inputs, multiplexed displays, and keyboards.

This module allows for


limited access to timer and
counter presets and other
PLC variables without
requiring a program loader.

Temperature Control RTD Input Module


I/O Circuits

OUTPUTS

INPUTS MOTOR

CONTACTOR
LAMP

PUSHBUTTONS
PLC
I/O Circuits

Allen-Bradley 1746-1A16

L1 L2 I= Input
Module
I:2 slot # in rack

P. B SWITCH 0 Module
Terminal #
Address I:2.0/0

LADDER PROGRAM
INPUT
MODULE
WIRING DIAGRAM
I/O Circuits

CONTACTOR
L2 L1 N.
O

MOTOR
L2
C •SOLENOID
L1
•VALVES
FIELD •LAMP
WIRING •BUZZER

OUTPUT MODULE
WIRING
L1 O:4 L2
LADDER PROGRAM

CONTACTOR 0
Discrete Input

A discrete input also referred as digital input is an input that is either ON


or OFF are connected to the PLC digital input. In the ON condition it is
referred to as logic 1 or a logic high and in the OFF condition maybe
referred to as logic 0 or logic low.

Normally Open Pushbutton

Normally Closed Pushbutton

Normally Open switch

Normally Closed switch

Normally Open contact

Normally closed contact


48
Discrete Input

IN

OFF PLC
Logic 0
Input
Module
24 V dc

IN

OFF PLC
Logic 1
Input
Module
24 V dc
Analog Input

An analog input is an input signal that has a continuous signal.


Typical inputs may vary from 0 to 20mA, 4 to 20mA or 0 to10V.

Ex: A level transmitter monitors the level of liquid in the tank.

Level Transmitter IN

PLC
Analog
Tank Input
Module
Digital Output

A discrete output is either in an ON or OFF condition. Solenoids, contactors coils,


lamps are example of devices connected to the Discrete or digital outputs.

Ex: The lamp can be turned ON or OFF by the PLC output it is connected to.

OUT

PLC
Lamp
Digital
Output
Module
Analog Output

An analog output is an output signal that has a continuous signal.


Typical outputs may vary from 0 to 20mA, 4 to 20mA or 0 to 10V.

Electric to pneumatic transducer

OUT
E Supply air
PLC 0 to 10V P

Analog
Output
Module
Pneumatic control valve
Memory Operation
While the PLC is running, the scanning process includes the following four
phases, which are repeated continuously as individual cycles of operation:
PHASE 1 – Input Status scan
A PLC scan cycle begins with the CPU reading the status of its inputs.
PHASE 1
Read Inputs PHASE 2– Logic Solve/Program Execution
Scan The application program is executed using the status of the inputs
PHASE 2 PHASE 3– Diagnostics/ Communication
Program
Once the program is executed, the CPU performs diagnostics and
Execution communication tasks
PHASE 3 PHASE 4 - Output Status Scan
Diagnostics/
An output status scan is then performed, whereby the stored output
Comm
values are sent to actuators and other field output devices. The cycle
PHASE 4 ends by updating the outputs.
Output
As soon as Phase 4 are completed, the entire cycle begins again with
Scan Phase 1 input scan.
Memory Operation

Rung Scanning
Example

54
Memory Operation

The time it takes to implement a scan cycle is called SCAN TIME.

The scan time composed of the program scan time, which is the time required for
solving the control program, and the I/O update time, or time required to read inputs
and update outputs.

The program scan time generally depends on the amount of memory taken by the
control program and type of instructions used in the program.

The time to make a single scan can vary from 1 ms to 100 ms.
PLC Communications

Serial Communications: PLC communications facilities normally provides serial


transmission of information.

Common Uses of PLC Communications Ports

Changing resident PLC programs - uploading/downloading from a supervisory


controller (Laptop or desktop computer).

 Forcing I/O points and memory elements from a remote terminal.

Linking a PLC into a control hierarchy containing several sizes of PLC and
computer.

 Monitoring data and alarms, etc. via printers or Operator Interface Units (OIUs).
PLC Communications

• Common networks included in the devicebus and fieldbus classes include


CANOpen, DeviceNet, FOUNDATION Fieldbus, Interbus-S, LonWorks,
Profibus-DP...
PLC Communications

LANs are commonly used in business applications to allow several users to share
costly software packages and peripheral equipment such as printers and hard disk
storage.

RS 422 / RS 485

Used for longer-distance links, often between several PCs in a distributed system.
RS 485 can have a maximum distance of about 1000 meters.
Communication Basics

• Protocols
• A set of rules for data exchange (format and timing of data) in a communications system
• Stack / profile = selected set of protocols for a communication application

• Communication Relationships
• Master / Slave - request / response & response only
• Peer-to-Peer - client / server, publisher / subscriber

• Communication Architectures
• Star (point-to-point)
• Bus, Ring, LAN (multidrop)
Communication Basics

• Ethernet • CAN-Open
• Modbus Plus • ASi
• Modbus • Seriplex
• S908 • FIPIO/FIPway
• LonWorks • RIO
• Interbus • HART
• Profi-bus • DIO
• DeviceNet • ControlNet
• Uni-Telway • ASCII

Devices must support the same protocol to understand each other


Selecting a PLC

Criteria

• Number of logical inputs and outputs.


• Number of special I/O modules
• Scan Time
• Memory
• Communications
• Software
Selecting a PLC

Choosing a PLC for Parking control system


Detailed Design Process

1. Understand the process

2. Hardware/software selection

3. Develop ladder logic

4. Determine scan times and memory


requirements

5. Simulate/Run the program in PLC


PLC Status Indicators

• Power On
• Run Mode
• Programming Mode
• Fault
Troubleshooting

1. Look at the process


2. PLC status lights
HALT - something has stopped the CPU
RUN - the PLC thinks it is OK (and probably is)
ERROR - a physical problem has occurred with the PLC

3. Indicator lights on I/O cards and sensors


4. Consult the manuals, or use software if available
5. Use programming terminal / laptop
List of items required when working with PLCs:

1. Programming Terminal: laptop or desktop PC.


2. PLC Software: PLC manufacturers have their own specific software and license
key.
3. Communication cable for connection from Laptop to PLC.
4. Backup copy of the ladder program (on diskette, CDROM, hard disk, flash
memory). If none, upload it from the PLC.
5. Documentation (PLC manual, Software manual, drawings, ladder program
printout, and Seq. of Operations manual.)
Examples of PLC Programming Software:

1. Allen-Bradley – Rockwell Software RSLogix/Studio5000


2. Modicon - Modsoft
3. Omron - Syswin
4. GE-Fanuc Series 6 – LogicMaster6
5. Square D- PowerLogic
6. Texas Instruments – Simatic
7. Telemecanique – Modicon TSX Micro
8. Siemens - Simatic/TIA Portal
Programming the PLC

Types of Programming Software Languages


 Ladder Logic (LL)
 IEC Format
 Function Block Diagram (FBD)
 Structured Text (ST)
 Instruction List (IL)
 Ladder Diagram (LD)
 Sequential Function Chart (SFC) - also known as “Grafcet”
Ladder Logic

Inputs Outputs

Read / Conditional Write / Control


Instructions Instructions
Start (Rung #1) || ()

|| || |/| ()

|| |/| ()

End (Rung #4) || |/| ()


||
IEC - Function Block Diagram (FBD)
IEC - Structured Text (ST)
IEC - Instruction List (IL)
IEC - Ladder Diagram (LD)
IEC - Sequential Function Chart (SFC)
Program and routine in Rslogix

RSlogix programs
 Have one main routine and many subroutines
 Have 32 programs in a task
 Main routine is executed from program, sub must be
called to run
Subroutine
A Subroutine is called by another routine
Nested Subroutine
Programming language

SFC, Structure Text, Ladder and FB

SFC Structure Text

Ladder Diagram

FB
What you need to know when specifying a PLC

• Quantity, Type and Location of I/O


• Number of Inputs and output points
• AC or DC voltage
• Analog or Discrete
• Concentrated or spread out (distributed)

• Communication Requirements
• Protocol/Network used
• Devices to communicate with (HMI, other PLCs, etc)

• Speed of Application
• Response time required (throughput) of the system
• How fast does the process change
What you need to know when specifying a PLC

• Control Architecture Philosophy


• Centralized Control, Distributed Control or combination
• Redundancy - CPUs, Power Supplies, etc

• Programming Software
• IEC vs. 984
• Installed base / what is currently being used

• User Logic
• Size and complexity of Program
• Feedback control used
• etc.
Basic addressing

• For the Allen-Bradley PLCs and the simulator used, the input and
output image areas (in addition to other data) are held in “data files”
• Each “data file” holds information such as
• – Discrete input values
• – Discrete output values
• – Values associated with timers
• – Values associated with counters – Status information
• – etc.
Basic addressing

Basic AB PLC addressing

I/O located on the controller (embedded I/O) is slot 0. I/O added


to the controller (expansion I/O) begins with slot 1.
Example addressing
Basic addressing

Basic AB PLC addressing


Basic addressing

Basic Siemens PLC addressing


•Process Image
• The only way to access I/O bits
• Values are "buffered" in between scans
• Limited address space for some CPU
models
• Notation:
• Bool "I 0.0", "Q 0.0"
• Byte "IB 10", "QB 10"
• Word "IW 16", "QW 16"
• Double Word "ID 24", "QD 24"
Basic addressing

Basic Siemens PLC addressing


•Peripheral Address
• All addresses outside of the process
image
• Cannot access I/O bits this way
• The actual values are immediately read
and written to physical I/O from user
program
• Notation:
• Byte "PIB 10", "PQB 10"
• Word "PIW 16", "PQW 16"
• Double Word "PID 24", "PQD 24"
Basic addressing

Basic Siemens PLC addressing


Basic instructions

• Examine If Closed (XIC)

• Examine If Open (XIO)

• Output Energize (OTE)

• Output Latch (OTL)

• Output Unlatch (OTU)

• One-shot Rising (OSR)


Examine if closed (XIC)

• Alternate name: Normally open contact


• Use the XIC instruction in your ladder program to determine if a bit is on.
– When the instruction is executed, if the bit addressed is on (1), then the instruction is
evaluated as TRUE.
– When the instruction is executed, if the bit addressed is off (0), then the instruction is
evaluated as FALSE.
Examine if open (XIO)

• Alternate name: Normally closed contact


• Use the XIO instruction in your ladder program to determine if a bit is off.
– When the instruction is executed, if the bit addressed is on (1), then the instruction is
evaluated as FALSE.
– When the instruction is executed, if the bit addressed is off (0), then the instruction is
evaluated as TRUE.
Output energize (OTE)

• Alternate name: coil


• This instruction is usually used in conjunction with
XIC or XIO or any other input instruction.
• If the logic preceding the OTE instruction is true (1),
the OTE instruction will be energized
Example 1
What is an Industrial Network?

“ An industrial network requires geographical distribution of the physical


measurement I/O and sensors or functional distribution of applications.


Most industrial networks transfer bits of information serially.

93
Output latch (OTL)

• The OTL instruction is used only to turn a bit on and latch it on


Output unlatch (OTU)

• The OTU instruction is used only to turn a bit off and latch it off

• OTL and OTU are generally used in pairs


One-shot rising (OSR)

• When the rung conditions preceding the OSR go from false-to-true,


the OSR instruction goes true also but for only one scan
Example 1

On/Off
Branches

Branches can be inserted in ladder logic programs to create parallel


combinations of various ladder logic elements
Multiple Series/Parallel Branches

Multiple series/parallel branches can be utilized with multiple inputs and


also affecting multiple outputs in parallel
Batch simulator showing example I/O
Boolean statements and ladder logic equivalents

– Logical AND
– Logical OR
– Logical NOT
• Commonly used ladder logic sequences
Start-stop-seal circuits
– Basic interlocks
• Properly formatted outputs
Boolean logic control programs

Boolean logic control programs examine and control on and off states
– Boolean here is used interchangeably with the word “discrete”

Each control program (ladder diagram sequence) can contain one or


more conditionals
Conveyor motor control system

Example
– If (a part is on the conveyor)
AND (there is not a box in the
chute) THEN (turn the conveyor
motor on).

In terms of sensors and


actuators this becomes
– If (sensor_A is ON) AND
(sensor_B is NOT ON) THEN
(turn actuator_C ON)
Logical AND ladder diagram

The logical AND function is constructed by series combinations of


digital (discrete) inputs

Two (or more) series components


Logical OR ladder diagram

The logical OR function is constructed by parallel combinations of digital


(discrete) inputs

Two (or more) parallel components


Logical NOT

The logical NOT function is constructed by referencing the input signal


with a normally closed contact (XIO instruction)
Complex Boolean expressions

More complex Boolean expressions can be formulated with various serial-


parallel combinations of XIC and XIO instructions

NAND, NOR, XOR, XNOR


Start-stop-seal circuits

For PLC systems without latch and


unlatch instructions, a circuit is
needed that will allow a process to
start, continue to run after a start
button is released, and stop under
control of another button

– A circuit that implements this


functionality is commonly referred to
as a start-stop-seal circuit .

A feedback path (i.e. a contact) that


references the output is normally
used to seal around the start contact.
Start-stop-seal variations

In practice several start and/or several


stop buttons can be used in a process

Start buttons (with XIC instructions)


can be used
– In series if it is required that ALL be pressed
before a process starts

– In parallel if pressing ANY start button is to start a


process

Stop buttons (with XIO instructions)


are normally used in series if pressing
ANY stop button is to stop a process.
Interlock circuits

• Interlocks can prohibit output(s) from energizing under a certain condition


• Example: O:2/0 should not energize if O:2/1 is energized (and vice versa)
Formatting considerations

Ladder logic rungs should be formatted so the reader can easily infer the
meaning of the intended logic
One mechanism to help this is the grouping of related signals within an area
on a given rung of logic

For example:
– Group signals together that have some common intent
• Start signals
• Stop signals
• Emergency stop signals (E-stop)
• Interlocks
– Controls that might have greater importance (i.e. E-stop) might be located
on the left hand side of the rung if possible
Formatting considerations
Properly formatted outputs

• An output energize instruction (OTE) referencing a specific output bit


should appear only once in a ladder logic program

• Only one output energize instruction (OTE) should appear in a rung of


ladder logic
Properly formatted outputs

• If more than one output is to be controlled by a certain rung of ladder


logic, the output energize (OTE) instructions can be placed in parallel.
Programming methods

• Boolean logic design


• Karnaugh maps
• Structured logic design
• Flowchart based design
• State based design
Boolean logic design

Boolean equations consist of


variables and operations and look
very similar to normal algebraic
equations.
The three basic operators are
AND, OR and NOT; more complex
operators include exclusive or
(EOR), not and (NAND), not or
(NOR).
Truth tables are a simple (but
bulky) method for showing all of
the possible combinations that will
turn an output on or off.
Boolean logic design

The basic axioms of Boolean


Boolean logic design

The basic axioms of Boolean


Boolean logic design

Simplification of a Boolean Equation


Boolean logic design

LOGIC DESIGN
Design ideas can be converted to Boolean equations directly, or with other
techniques discussed later.
The Boolean equation form can then be simplified or rearranges, and then
converted into ladder logic, or a circuit.

Process Description:
A heating oven with two bays can heat one
ingot in each bay. When the heater is on it
provides enough heat for two ingots. But, if
only one ingot is present the oven may
become too hot, so a fan is used to cool the
oven when it passes a set temperature.
Boolean logic design

Control Description:
If the temperature is too high and there is an ingot in only one
bay then turn on fan.
Define Inputs and Outputs:
B1 = bay 1 ingot present
B2 = bay 2 ingot present
F = fan
T = temperature overheat sensor
Boolean logic design

Boolean Equation:
Boolean logic design

Boolean Equation:
Boolean logic design

Boolean Equation:
Boolean logic design

Simplify the logic circuit


Boolean logic design

Simplify the logic circuit


Boolean logic design

Simplify the logic circuit

This simplified equation is converted back into a circuit and equivalent


ladder logic
Boolean logic design

A Burglar Alarm
When activated an alarm and lights will be activated to
encourage the unwanted guest to leave.
This alarm be activated if an unauthorized intruder is
detected by window sensor and a motion detector.
The window sensor is effectively a loop of wire that is a
piece of thin metal foil that encircles the window. If the
window is broken, the foil breaks breaking the conductor.
This behaves like a normally closed switch.
The motion sensor is designed so that when a person is
detected the output will go on. As with any alarm an
activate/deactivate switch is also needed.
Boolean logic design

A Burglar Alarm
The inputs and outputs are chosen to be;
A = Alarm and lights (1 = on)
W = Window/Door sensor (1 = OK)
M = Motion Sensor (0 = OK)
S = Alarm Active switch (1 = on)

The basic operation of the alarm can be described with rules.


1. If alarm is on, check sensors.
2. If window/door sensor is broken (turns off), sound alarm and turn
on lights
Boolean logic design

A Burglar Alarm
Truth Table for the Alarm
Boolean logic design

A Burglar Alarm
Boolean logic design

Problem:

Design an automatic gate controller.


Boolean logic design
Karnaugh maps

Karnaugh maps allow us to convert a truth table to a simplified Boolean


expression without using Boolean Algebra.

Instead of converting this directly to a Boolean equation, it is put into a tabular


form.

The rows and columns are chosen from the input variables.

The decision of which variables to use for rows or columns can be arbitrary - the
table will look different, but you will still get a similar solution.

For both the rows and columns the variables are ordered to show the values of
the bits using NOTs.
Karnaugh maps

The sequence is not binary, but it is organized so that only one of the bits changes at
a time, so the sequence of bits is 00, 01, 11, 10 - this step is very important.

Next the values from the truth table that are true are entered into the Karnaugh map.

Zeros can also be entered, but are not necessary.


Karnaugh maps
Step 1: Draw the truth table
A burglar alarm example

Given
A = Alarm and lights switch (1 = on)
W = Window/Door sensor (1 = OK)
M = Motion Sensor (0 = OK)
S = Alarm Active switch (1 = on)
Q = Alarm Quiet (0 = quiet)
Karnaugh maps

Step 2: Divide the input variables up.

Example choosing SQ and MW as input variables

Step 3: Draw a Karnaugh map based on the input variables


Karnaugh maps
Step 4: Look for patterns in the map

Step 5: Write the equation using the patterns

Step 6: Convert the equation into ladder logic


Karnaugh maps

Convert the following ladder logic to a Karnaugh map


Structured logic design
Structured logic design

Traditionally ladder logic programs have been written by


thinking about the process and then beginning to write the
program.
This always leads to programs that require debugging. And,
the final program is always the subject of some doubt.
Structured design techniques, such as Boolean algebra, lead
to programs that are predictable and reliable.
The structured design techniques in this and the following
chapters are provided to make ladder logic design routine
and predictable for simple sequential systems.
Structured logic design

Most control systems are sequential in nature.


Sequential systems are often described with words such as
mode and behavior.
During normal operation these systems will have multiple
steps or states of operation. In each operational state the
system will behave differently.
Typical states include start-up, shut-down, and normal
operation.
Structured logic design

Consider a set of traffic lights - each light pattern constitutes


a state.
Lights may be green or yellow in one direction and red in the
other. The lights change in a predictable sequence.
Sometimes traffic lights are equipped with special features
such as cross walk buttons that alter the behavior of the
lights to give pedestrians time to cross busy roads.
Process sequence bits

A typical machine will use a sequence of repetitive steps that


can be clearly identified. Ladder logic can be written that
follows this sequence with the steps as follows:
1. Understand the process.
2. Write the steps of operation in sequence and give each step a
number.
3. For each step assign a bit.
4. Write the ladder logic to turn the bits on/off as the process moves
through its states.
5. Write the ladder logic to perform machine functions for each step.
6. If the process is repetitive, have the last step go back to the first.
Process sequence bits

A flag raiser that will go up when an up button is pushed, and


down when a down button is pushed, both push buttons are
momentary.
There are limit switches at the top and bottom to stop the flag
pole. When turned on at first the flag should be lowered until
it is at the bottom of the pole.
Steps:
1. The flag is moving down the pole waiting for the bottom limit switch.
2. The flag is idle at the bottom of the pole waiting for the up button.
3. The flag moves up, waiting for the top limit switch.
4. The flag is idle at the top of the pole waiting for the down button.
Process sequence bits
Process sequence bits
Process sequence bits
Boolean logic design

Problem:

Design an automatic gate controller.


Process sequence bits

A more common method of implementation, without latches


Process sequence bits

A more common method of implementation, without latches


Process sequence bits
Process sequence bits

Steps:
1. The barrier is closed waiting for the closed limit switch.
2. The barrier is idle at the bottom waiting for loop detector.
3. The barrier is open, waiting for the open limit switch.
4. The barrier is idle at the top waiting for the IR signal.
Timer

Objectives
Describe PLC retentive and delay timer functions.

List and describe major timing functions that are commonly


used in circuits and processes.

Apply PLC functions and PLC circuitry to process control for


timing functions.

Apply PLC timers in multiple timing problems that combine


two or more of the basic timing functions.

Apply PLC timers for the control of processes.


Timer

The most commonly used process control device after coils


and contacts is the timer.

The most common timing function is TIME DELAY-ON, which


is the basic function.

There are also many other timing configurations, all of which


can be derived from one or more of the basic TIME DELAY-
ON functions.

PLCs have the one basic function timer capability in


multiples.
Timer

The timing block functions are used with various contact


arrangements and in multiples to accomplish various timing
tasks.

Typical industrial timing tasks include timing of the intervals


for welding, painting, and heat treating.

Timers can also predetermine the interval between two


operations.

With a PLC you can utilize as many timer blocks as you


need, within the PLC memory limitations.
Timer

Basic Timing and Derived Functions

• Here we illustrate the basic PLC TIME DELAY- ON function


and some other derived timing functions.
• Typical of the derived functions are
– TIME DELAY-OFF,
– interval pulse timing,
– and multiple pulse timing of more than one process
operation.
Timer

Timer Variables

One major advantage of the PLC timer is that its time may be
a programmable variable time as well as a fixed time.

The variable time interval may be in accordance with a


changing register value.

Another advantage of the PLC timer is that its timer


accuracy, repeatability, and reliability are extremely high
because it is based on solid-state technology.
Timer

Non-retentive Timers
• A single-input timer called a non-retentive timer is used in
some PLCs.
– Energizing I:1/0 causes the timer to run for 4 seconds.
– At the end of 4 seconds the output (DN) goes on. When
the input is de-energized, the output goes off and the timer
resets to 0.
– If the input I:1/0 is turned off during the timing interval (for
example, after 2.7 seconds), the timer resets to 0.
– TON is the basic non-retentive timer in Allen-Bradley PLCs
Timer

Non-retentive Timers
Timer

Timer Information
• The timer table contains all information for that timer

– /EN: Timer is enabled (i.e. the input rung is energized)


– /TT: Timer is timing
– /DN: Timer is done
– .PRE: Timer preset value (point at which the timer stops timing)
– .ACC: Timer accumulator (accumulated time value)
Timer

Timer Delay Off (TOF)


• The TOF timer functions are the opposite of the TON timer.
– De-Energizing I:1/0 causes the timer to run for 4.5
seconds. The DN bit is initially set.
– At the end of 4.5 seconds the output (DN) goes off. When
the input is energized the timer resets to 0.
– If the input I:1/0 is turned on during the timing interval (for
example, after 2.7 seconds), the timer resets to 0.
Timer

Timer Delay Off (TOF)


Timer

Retentive Timers (RTO)


• Functions exactly like TON except the accumulated time
value is retained even if the input rung is de- energized.
Timer

Timer Reset Coils (RES)


• A reset coil (RES) can be associated with a timer to provide
a means of resetting the accumulated time value (and status
bits) at any given time
Timer

Function Applications

• On delay
– Output B comes on at a specific set time after output A is
turned on. When A is turned off, B also goes off.

• Limited on time
– A and B go on at the same time. B goes off after specific
set time period, but A remains on.
Timer

Function Applications

• One-shot operation
– Output B goes on for a specified time after output A is
turned on. Output B will run for its specified time interval
even if A is turned off during the B timing interval.

• Interval time within a cycle


– We may require that an output come on 7.5 seconds after
system startup, remain on for 4.5 seconds, and then go off
and stay off. The interval would repeat only after the system
is shut off and then turned back on.
Timer

On Delay Timer Function


• The first example is the simplest form of time delay.
– When the circuit is turned on, one action takes place.
– A specified time later, another action occurs.
– O:2/1 energizes exactly 8 seconds after O:2/0 energizes,
provided I:1/0 remains energized
Timer
Timer

One-shot Operation Timer Function


Timer

Interval Time Within a Cycle

• This example is for a timed interval of a number of seconds


after the start of a process operation.
– This time interval is sometimes called an embedded time
interval.
– A fan is to come on 8.7 seconds after a system is turned
on.
– It is then to run until 16 seconds after the system is turned
on, which is a net time of 7.3 seconds.
Interval Timer Example
Example
Example
Timing diagrams
Timing diagrams

Timing diagrams can be valuable when designing ladder


logic for processes that are only dependent on time. The
timing diagram is drawn with clear start and stop times.
Ladder logic is constructed with timers that are used to turn
outputs on and off at appropriate times. The basic method is;

1. Understand the process.


2. Identify the outputs that are time dependent.
3. Draw a timing diagram for the outputs.
4. Assign a timer for each time when an output turns on or off.
5. Write the ladder logic to examine the timer values and turn outputs on or off.
Timing diagrams

Consider the handicap door opener design in Figure 10.5


that begins with a verbal description.
The verbal description is converted to a timing diagram, with
t=0 being when the door open button is pushed. On the
timing diagram the critical times are 2s, 10s, 14s.
Timing diagrams

The first item is the latch


to seal-in the open
button, but shut off after
the last door closes.
auto is used to turn on
the three timers for the
critical times.
The logic for opening the
doors is then written to
use the timers.
Timing diagrams
Timing diagrams

Write ladder logic that will give the following timing diagram
for B after input A is pushed.
After A is pushed any changes in the state of A will be
ignored.
Timing diagrams
Advanced functions
Timing diagrams

Red : 20s
Green : 15s
Yellow : 5s

0 20 35 40

https://drive.google.com/file/d/1E5HaR77o00fGhUbMof
w8hMHjGWZ6tCXh/view?usp=sharing
Flowchart-based design
Flowchart-based design

A flowchart is ideal for a


process that has sequential
process steps. The steps will be
executed in a simple order that
may change as the result of
some simple decisions.
The symbols are used for
flowcharts. These blocks are
connected using arrows to
indicate the sequence of the
steps.
Example 1
Flowchart based design

The different blocks imply different types of program actions.


Programs always need a start block, but PLC programs rarely stop
so the stop block is rarely used.
Other important blocks include operations and decisions. The
other functions may be used but are not necessary for most PLC
applications.
Flowchart based design

A flowchart for a control


system for a large water
tank is shown.

When a start button is


pushed the tank will start to
fill, and the flow out will be
stopped.
Flowchart based design

When full, or the stop button


is pushed the outlet will
open up, and the flow in will
be stopped. In the flowchart
the general flow of
execution starts at the top.

The first operation is to


open the outlet valve and
close the inlet valve. Next, a
single decision block is
used to wait for a button to
be pushed.
Flowchart based design

When the button is pushed


the yes branch is followed
and the inlet valve is
opened, and the outlet
valve is closed.

Then the flow chart goes


into a loop that uses two
decision blocks to wait until
the tank is full, or the stop
button is pushed.
Flowchart based design

If either case occurs the


inlet valve is closed and the
outlet valve is opened. The
system then goes back to
wait for the start button to
be pushed again.

When the controller is on


the program should always
be running, so only a start
block is needed. Many
beginners will neglect to put
in checks for stop buttons.
Flowchart based design

The general method for constructing flowcharts is:


1. Understand the process.
2. Determine the major actions, these are drawn as blocks.
3. Determine the sequences of operations, these are drawn
with arrows.
Note

Define a First scan bit in TIA Portal

https://www.youtube.com/watch?
v=S-JPz8bMFow
Block logic
Block logic

The first step is to name each block in the flowchart. Each of the
numbered steps will then be converted to ladder logic.
To do this we will use the MCR (Master Control Relay) instruction
(it will be discussed in more detail later.)
If the first MCR line is true then the ladder logic on the following
lines will be scanned as normal to the second MCR.
If the first line is false the lines to the next MCR block will all be
forced off. If a normal output is used inside an MCR block, it may
be forced off. Therefore latches will be used in this method.
Block logic

The first part of the ladder logic required will reset the logic
to an initial condition, as shown
Block logic

The line will only be true for the first scan of the PLC, and at
that time it will turn on the flowchart block F1 which is the
reset all values off operation. All other operations will be
turned off.
Block logic

STEP 1: Add labels to each block in the


flowchart
Block logic

STEP 2: Write ladder logic to force the PLC into the first state

When F1 is true the logic


between the MCR lines
will be scanned, if F1 is
false the logic will be
ignored.

This logic turns on the


outlet valve and turns off
the inlet valve. It then
turns off operation F1,
and turns on the next
operation F2.
Block logic

STEP 3: Write ladder logic for each function in the flowchart

The ladder logic for


operation F2 is simple,
and when the start button
is pushed, it will turn off
F2 and turn on F3.

The ladder logic for


operation F3 opens the
inlet valve and moves to
operation F4.
Block logic

The ladder logic for operation F4


turns off F4, and if the tank is full
it turns on F6, otherwise F5 is
turned on.

The ladder logic for operation F5


is very similar.
Block logic

The ladder logic for operation F6


turns the outlet valve on and
turns off the inlet valve.

It then ends operation F6 and


returns to operation F2.
Block logic

The ladder logic for operation F6 turns the outlet valve on and turns off the inlet
valve.

It then ends operation F6 and returns to operation F2.


Block logic

Design a garage door controller using a flowchart. The behavior of


the garage door controller is as follows,
- there is a single button in the garage, and a single button remote
control.
- when the button is pushed the door will move up or down.
- if the button is pushed once while moving, the door will stop, a
second push will start motion again in the opposite direction.
- there are top/bottom limit switches to stop the motion of the door.
- there is a light beam across the bottom of the door. If the beam is
cut while the door is closing the door will stop and reverse.
- there is a garage light that will be on for 5 minutes after the door
opens or closes
Block logic
Sequence bits
Sequence bits

In general there is a preference for methods that do not use


MCR statements or latches.
The flowchart used in the previous example can be
implemented without these instructions using the following
method.
The first step to this process is shown in Figure 11.10. As
before each of the blocks in the flowchart are labelled, but
now the connecting arrows (transitions) in the diagram must
also be labelled.
These transitions indicate when another function block will be
activated.
Sequence bits
Sequence bits

The first section of ladder logic is shown


in Figure 11.11.

This indicates when the transitions


between functions should occur.

All of the logic for the transitions should


be kept together, and appear before the
state logic that follows in Figure 11.12.
Sequence bits
Sequence bits

Consider the first ladder rung for


F1, it will be turned on by transition
T1 and once function F1 is on it will
keep itself on, unless T2 occurs
shutting it off.

If T2 has occurred the next line of


ladder logic will turn on F2.

The function logic is followed by


output logic that relates output
values to the active functions.
Sequence bits
Sequence bits
Sequence bits
Sequence bits
Sequence bits
Sequence bits

Design a garage door controller using a flowchart. The behavior of


the garage door controller is as follows,
- there is a single button in the garage, and a single button remote
control.
- when the button is pushed the door will move up or down.
- if the button is pushed once while moving, the door will stop, a
second push will start motion again in the opposite direction.
- there are top/bottom limit switches to stop the motion of the door.
- there is a light beam across the bottom of the door. If the beam is
cut while the door is closing the door will stop and reverse.
- there is a garage light that will be on for 5 minutes after the door
opens or closes
Sequence bits
Parking gate controller
- The gate will be raised by one output
and lowered by another. If the gate gets
stuck an over current detector will make
a PLC input true. If this is the case the
gate should reverse and the light should
be turned on indefinitely.
- If a valid keycard is entered a PLC
input will be true. The gate is to rise and
stay open for 10 seconds.
- When a car is over the car detector a
PLC input will go true. The gate is to
open while this detector is active. If it is
active for more that 30 seconds the light
should also turn on until the gate
closes.
State-based design
State based design
A system state is a mode of operation. Consider a bank machine that will
go through very carefully selected states.

The general sequence of states might be idle, scan card, get secret
number, select transaction type, ask for amount of cash, count cash,
deliver cash/return card, then idle.

A state based system can be described with system states, and the
transitions between those states.
State based design

The diagram has two states, State 1 and State 2.

If the system is in state 1 and A happens the system will then go into
state 2, otherwise it will remain in State 1.

Likewise if the system is in state 2, and B happens the system will return
to state 1.
State based design
An automatic light controller

When the power is turned on the system will go into the lights off state. If
motion is detected or an on push button is pushed the system will go to
the lights on state. If the system is in the lights on state and 1 hour has
passed, or an off pushbutton is pushed then the system will go to the
lights off state.
The else statements are omitted on the second diagram, but they are
implied.
State based design

Consider the design of a coffee vending machine.


State based design

Priority Problems
State based design
State based design

Ladder logic program


State based design

Ladder logic program


State based design

State Equations

State diagrams can be converted to Boolean equations and then to Ladder Logic.

The first technique that will be described is state equations. These equations
contain three main parts. To describe them simply - a state will be on if it is
already on, or if it has been turned on by a transition from another state, but it will
be turned off if there was a transition to another state.

An equation is required for each state in the state diagram.

Informally,
State X = (State X + just arrived from another state) and has not left for another state
State based design

State Equations
State based design

State Equations
State based design

State Equations
State based design

Water level control using State-based Design method

On_PB => Motor runs

Off_PB or Full tank => Motor stops

Draw state-based

Equations

Program

Simulate
State based design

Water level control using State-based Design method


State based design

State-Transition Equations
A state diagram may be converted to equations by writing an equation for
each state and each transition.

Each state and transition needs to be assigned a unique variable name.

These are then used to write the equations for the diagram. The transition
equations are written by looking at the each state, and then determining
which transitions will end that state.
State based design

State-Transition Equations
State based design

State-Transition Equations
State based design

State-Transition Equations
State based design

State-Transition Equations
State based design

State-Transition Equations
State based design

State-Transition Equations

• State diagrams are suited to processes with a single flow of execution.


• State diagrams are suited to problems that has clearly defines modes of
execution.
• Controller diagrams can be converted to ladder logic using MCR blocks.
• State diagrams can also be converted to ladder logic using equations.
• The sequence of operations is important when converting state diagrams
to ladder logic.
State based design

1. Draw a state diagram for a microwave oven.


State based design

2. Convert the following state diagram to equations


State based design

2. Convert the following state diagram to equations


State based design

3. Given the following state diagram, use equations to implement ladder logic.
State based design

3. Given the following state diagram, use equations to implement ladder logic.
State based design

3. Given the following state diagram, use equations to implement ladder logic.
State based design

Button A is located inside and button B is located outside. When either button is
pushed the motor will be turned on to open the door. The motor is to be kept on for a
total of 15 seconds to allow the person to enter. After the motor is turned off the door
will fall closed. In the event that somebody gets caught in the door the thermal relay
will go off, and the motor should be turned off. After 20,000 cycles the door should
stop working and the light should go on to indicate that maintenance is required.
State based design

a) Develop a state diagram for the control of the door.


b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
c) Convert the state diagram to Boolean equations.
State based design

a) Develop a state diagram for the control of the door.


State based design

b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design

b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design

b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design

b) Convert the state diagram to ladder logic. (list the input and the output
addresses first)
State based design

c) Convert the state diagram to Boolean equations.


Timing diagrams

15(s) (MD20) and 5(s) (MD30)


are set by user
MD40 = MD20+MD30
Green : T2(s)
Yellow : T3(s)
Red : T1=T2+T3(s)

0 T#20s T#35s T#40s

https://drive.google.com/file/d/1kluzvfH8_fnYAdc9WNJn7j
QoPvEk9qPS/view?usp=sharing
Subroutine

0 T1 T2 T3

https://drive.google.com/file/d/12cU0hMS_Etnbb_GHC-
f_Z4VHDe-d3uzz/view?usp=sharing
1769-IF4 Analog Input
Configure range of voltage input
-10V…10V DC
0…10V DC
0 …5V DC
1…5V DC
Configure range of current input
0…20mA
4…20mA
Connecting voltage and current Sensors
Analog Input Module, connecting voltage sensors
Configure range of voltage input
-10V…10V DC
0…10V DC
0 …5V DC
1…5V DC
Analog Input Module, connecting current sensors

Configure range of current input.


0…20mA or 4…20mA.
Valid Input Data
Valid Input Data
Valid Input Data
1769-OF2 Analog Output

Configure range of voltage output


-10V…10V DC
0…10V DC
0…5V DC
1…5V DC.
Configure range of current output
0…20mA
4…20mA
Analog

https://drive.google.com/file/d/1JVRBTS7DAUuJ6MLH4H_x9taN9dTc4WSv/view
Analog
ENHANCE INSTRUCTIONS

Each device has a EDS (Electronic Data Sheet) file. EDS files
include Class, Instance and Attributes

Class : File
Instance : Structure
Attributes : Element
Software uses EDS information to access data from devices
ENHANCE INSTRUCTIONS

I/O Instructions: Message Control (MSG), Get System


Value(GSV), Set system Value(SSV)
 Read or write data to or from the controller or a block of
data to or from another module on another network.
ENHANCE INSTRUCTIONS

Message Control (MSG), Get System Value (GSV)


Read or write system data to or from the controller
ENHANCE INSTRUCTIONS

Read Realtime in PLC


Create a tag, named READ_REALTIME with array DINT(7) type.
ENHANCE INSTRUCTIONS

Use GSV instruction to read and store Realtime in plc


Depend on your applications, which data in array is used
ENHANCE INSTRUCTIONS

Message Control (MSG)


Read or write data to or from the controller or a block of
data to or from another module on another network.
ENHANCE INSTRUCTIONS

Message Control (MSG) Message configuration


ENHANCE INSTRUCTIONS

Message Control (MSG): Message configuration


ENHANCE INSTRUCTIONS

Message Control (MSG): Message configuration


ENHANCE INSTRUCTIONS
Message Control (MSG): Message configuration
ENHANCE INSTRUCTIONS

Message Control (MSG): Message configuration


Shift Registers
Stacks

 Stacks store integer words in a two ended buffer.


 There are two basic types of stacks; first-in-first-out (FIFO)
and last-in-first-out (LIFO).
 As words are pushed on the stack it gets larger, when
words are pulled off it gets smaller.
 When you retrieve a word from a LIFO stack you get the
word that is the entry end of the stack. But, when you get
a word from a FIFO stack you get the word from the exit
end of the stack (it has also been there the longest).
Stacks

The ladder logic functions are FFL to load the stack, and
FFU to unload it.
Stacks

The first time this FFL is activated (edge triggered) 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.
Stacks

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, an a load or unload occurs the error bit will be set R6:0/ER.
Stacks

The LIFO stack commands are shown above. As values are loaded on
the stack the 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
Stacks

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, an a load or unload occurs the error bit will be set R6:0/ER.
Add-ins Instructions
High-speed counter
Applications

You might also like