You are on page 1of 35

3/20/14

Basic PLC

PLCs and Ladder Logic

An Introduction
By Thomas Smith

3/20/14

Basic PLC

This is a basic introduction on how to create an automation program for a ControlLogix or CompactLogix processor using the RSLogix 5000 programming environment from Rockwell Automation. Also this is to teach the fundamentals and basics of PLCs in general. This presentation explains how to write the automation program including the ladder logic for a garage door opener. I chose a door opener because its quite simple, and its something that everyone is familiar with.

3/20/14

Basic PLC

What will be covered


PLC history Ladder logic basics From electrical drawing to ladder logic Creating a new project Adding I/O cards Program structure / Building a program Create fault logic

3/20/14

History of a PLC

Basic PLC

Historical Background
The Hydramatic Division of the General Motors Corporation specified the design criteria for the first programmable controller in 1968 What was their primary goal? To eliminate the high costs associated with inflexible, relay-controlled systems.

3/20/14

Basic PLC

Programmable Logic Controllers


( Definition according to NEMA standard ICS3-1978) A digitally operating electronic apparatus which uses a programming memory for the internal storage of instructions for implementing specific functions such as logic, sequencing, timing, counting and arithmetic to control through digital or analog modules, various types of machines or process.

3/20/14

Basic PLC

Major Components of a Common PLC

POWER SUPPLY

From SENSORS
Pushbuttons, contacts, limit switches, etc.

I M N O P D U U T L E

PROCESSOR

O U T P U T

M O D U L E

To OUTPUT
Solenoids, contactors, alarms etc.

PROGRAMMING DEVICE

3/20/14

Basic PLC

PLC Operation
Basic Function of a Typical PLC

Read all field input devices via the input interfaces, execute the user program stored in application memory, then, based on whatever control scheme has been programmed by the user, turn the field output devices on or off, or perform whatever control is necessary for the process application.
This process of sequentially reading the inputs, executing the program in memory, and updating the outputs is known as scanning.

3/20/14

Basic PLC

While the PLC is running, the scanning process includes the following four phases, which are repeated continuously as individual cycles of operation:
PHASE 1

Read Inputs
PHASE 2

Program Execution
PHASE 3

Diagnostics/ Communication
PHASE 4

Update Outputs

2/20/14

Basic PLC

Ladder logic is the main programming method used for PLCs. Ladder logic has been developed to mimic relay logic. By selecting ladder logic as the main programming method, the amount of retraining needed for engineers and trades people was greatly reduced. Modern control systems still include relays, but these are rarely used for logic. A relay is a simple device that uses a magnetic field to control a switch.

3/20/14

Basic PLC

10

A PLC Illustrated With Relays

3/20/14

Basic PLC

11

Discrete Input
A discrete input also referred as digital input is an input that is either ON or OFF and is connected to the PLCs digital input. In the ON condition it is referred to as logic 1 or a logic high and in the OFF condition it is referred to as logic o or logic low.

Normally Open Pushbutton Normally Closed Pushbutton Normally Open switch Normally Closed switch Normally Open contact Normally closed contact

3/20/14

Basic PLC

12

Analog Input
An analog input is an input signal that has a continuous signal. Typical inputs are eather 4 to 20mA or 0 to10V. Below, a level transmitter monitors the level of liquid in the tank. Depending on the level Tx, the signal to the PLC can either increase or decrease as the level increases or decreases.

Level Transmitter

INPUT

Tank

PLC Analog Input Module

3/20/14

Basic PLC

13

PROGRAMMING INPUTS
Normally Open (NO)
Normally Closed (NC)

Power flows through these contacts when they are closed. The normally open (NO) is true when the input or output status bit controlling the contact is 1 or on. The normally closed (NC) is true when the input or output status bit controlling the contact is 0 or off.

3/20/14

Basic PLC

14

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. Below, the lamp can be turned ON or OFF by the PLC output it is connected to.

OUT

PLC

Lamp
Digital Output Module

3/20/14

Basic PLC

15

Analog Output
An analog output is an output signal that has a continuous signal. Typical outputs are 4 to 20mA or 0 to10V.
Electric to pneumatic transducer
OUT

PLC Analog Output Module

0 to 10V

Supply air

Pneumatic control valve

3/20/14

Basic PLC

16

Outputs or Coils

Coils represent relays that are energized when power flows to them. When a coil is energized it causes a corresponding output to turn on by changing the state of the status bit controlling the output to a logic 1. That same output status bit maybe used to control normally open or normally closed contact anywhere in the program.

3/20/14

Basic PLC

17

A
Rung

Each rung or network on a ladder program represents a logic operation. In the rung above, both inputs A and B must be true (1) in order for the output C to be true (1).

3/20/14

Basic PLC

18

A Relay logic Seal-in Circuit

3/20/14

Basic PLC

19

A Simple Relay Logic Diagram

3/20/14

Basic PLC

20

3/20/14

Basic PLC

21

Output Connections

3/20/14

Basic PLC

22

L1

L2

I= Input I:2
Module slot # in rack

P. B SWITCH

Module Terminal #

Last digit Is the Bit #

Address I:2.0/0

INPUT MODULE WIRING DIAGRAM

Allen Bradley LADDER PROGRAM

3/20/14
CONTACTOR

Basic PLC
MOTOR
SOLENOID VALVES LAMP BUZZER

23

L2

L1

N.O

L2 L1

OUTPUT MODULE WIRING L1

O:4

L2

O:4.0/0
CONTACTOR

LADDER PROGRAM

3/20/14

Allen-Bradley Abbreviations

Basic PLC

24

Circuit elements
I Input contact closures Q Output contact closures (drives coil) T Timer device C Counter device M Auxillary relay (or internal relay bits) H Time of day A Analog input D Display on screen R,S Expansion devices

3/20/14

Basic PLC

25

Other instructions
Boxes

Boxes represent various instructions or functions that are Executed when power flows to the box. Some of these Functions are timers, counters and math operations.

3/20/14

Basic PLC

26

I have a 700 page PDF file with all the RSLogix 5000 special function blocks. I am not going to go through them all. I am going to touch base on just a couple. This PDF can also be found on the Rockwell Automation website.

http://www.rockwellautomation.com/literature/

3/20/14

Timers and Counters

Basic PLC

27

The special instructions I am going to discuss are timers and counters. Timers and counters control operations based on time or the number of events. The time base for all timers is 1 ms.
Counters count the number of events.

3/20/14

Basic PLC

28

If you want to Time how long a timer is enabled Time how long a timer is disabled Accumulate time Time how long a timer is enabled with built-in reset in a function block Time how long a timer is disabled with built-in reset in a function block

Use this instruction TON (delay on timer) TOF (delay off timer) RTO (Retentive Timer On) TONR (Timer On Delay with Reset) TOFR (Timer Off Delay with Reset)

Accumulate time with built-in reset in function block


Count up Count down Count up and count down in function block Reset a timer or counter

RTOR (Retentive Timer On with reset)


CTU (count up counter) CTD (count down counter) CTUD (count up/down counter) RES (reset)

3/20/14

Timer On Delay

Basic PLC

29

The Timer On Delay or TON The TON instruction is a non-retentive timer that accumulates time when the instruction is enabled (rung-condition-in is true).

Timer Tag or name Preset how long to delay (accumulated time) Accum -- Total milliseconds the timer has counted Initial value is typically 0

3/20/14

Timer On Delay

Basic PLC

30

EN indicates that the TON bit is enabled DN the done bit is set when the ACCUM is bigger then the PRESET value The TON instruction accumulates time until the following occurs: The TON instruction is disabled The ACCUM PRESET The time base is always 1 ms. For example, for a two-second timer, enter 2000 for the PRESET value.

3/20/14

Timer Off Delay

Basic PLC

31

The Timer Off Delay or TOF The TOF instruction is a non-retentive timer that accumulates time when the instruction is disabled (rung-condition-in is false).

Timer Tag or name Preset how long to delay (accumulated time) Accum -- Total milliseconds the timer has counted Initial value is typically 0

3/20/14

Timer Off Delay

Basic PLC

32

EN indicates that the TOF bit is enabled DN the done bit is set when the ACCUM is bigger then the PRESET value The TOF instruction accumulates time until the following occurs: The TOF instruction is enabled The ACCUM PRESET The time base is always 1 ms. For example, for a two-second timer, enter 2000 for the PRESET value.

3/20/14

Count Up

Basic PLC

33

The Count Up or CTU The CTU instruction counts upward.

Counter Tag or name Preset how high to count Accum The number of times the counter has counted Initial value is typically 0

4/24/05

Count Up

34 BAE 3023

CU indicates the CTU instruction is enabled DN indicates the done bit is set and the ACCUM is greater than or equal to the PRESET When enabled and the CU bit is set, the CTU instruction increments the counter by one. And when disabled, the CU bit is cleared, the CTU instruction retains its ACCUM value. The accumulated value continues incrementing, even after the DN bit is set. To clear the accumulated value, use a RES instruction that references this counter.

4/24/05

Count Down

35 BAE 3023

The Count Down or CTD Same as the count up counter but it counts down from a preset value