introduction to plc s7

Post on 26-Oct-2014

131 Views

Category:

Documents

6 Downloads

Preview:

Click to see full reader

TRANSCRIPT

SIEMENS SIMATIC S7SIEMENS SIMATIC S7

INTRODUCTION TOINTRODUCTION TO

PROGRAMMABLEPROGRAMMABLELOGICLOGIC

CONTROLCONTROL

Revision 2

ASSESSMENTASSESSMENTASSESSMENTASSESSMENT

»Practical Test 1 – 20%

»Practical Test 2 – 20%

»Assignment – 20%»Assignment – 20%

»Final Exam – 30%

»Key Qualification – 10%

MODULE OBJECTIVESMODULE OBJECTIVESMODULE OBJECTIVESMODULE OBJECTIVES

Upon completion of this course, the participants will be able to:

» explain the basic ideas on PLC such as PLC components’

signaling, I/O addressing and program execution;

» apply PLC programming method such as LAD, FBD and STL using

Siemens STEP 7 software;

» define and explain Siemens STEP 7 PLC software such as RS,

timers, counters, load and transfer commands, comparisons and

arithmetic functions.

Topic 1Topic 1Topic 1Topic 1

Handout section 1.0

Basic Principle of Basic Principle of

Control TechnologyControl Technology

Basic Principle of Basic Principle of

Control TechnologyControl Technology

PPROGRAMMABLE ROGRAMMABLE LLOGIC OGIC CCONTROL ONTROL (PLC)(PLC)::

“ A digital electronic device that uses a

PLCPLCPLCPLC

“ A digital electronic device that uses a

programmable memory to store instructions

and to implement specific functions such as

logic, sequence, timing, counting and

arithmetic to control machines and process. “

What is CONTROL?

“ CONTROL is the process in a system in which

Definition of ControlDefinition of ControlDefinition of ControlDefinition of Control

“ CONTROL is the process in a system in which

one or several input variables influence other

variables “

DIN 19226

CC

OO

SS

YY PP

INFORMATION SENSORS

A Simple View of a Control SystemA Simple View of a Control SystemA Simple View of a Control SystemA Simple View of a Control System

OO

NN

TT

RR

OO

LL

YY

SS

TT

EE

MM

PP

LL

AA

NN

TT

COMMANDS ACTUATORS

CONTROL

SYSTEM

Types of Control SystemTypes of Control SystemTypes of Control SystemTypes of Control System

SYSTEM

OPEN-LOOP

CONTROL SYSTEM

CLOSED-LOOP

CONTROL SYSTEM

In open-loop control systems, output variables are

influenced by the input variables.

OpenOpen--loop Control Systemloop Control SystemOpenOpen--loop Control Systemloop Control System

LLLL

NN

It is characterized by continuous comparison of the

desired value (or set point) with the actual value of the

controlled variable.

ClosedClosed--loop Control Systemloop Control SystemClosedClosed--loop Control Systemloop Control System

CC

XsXsXiXi

Xi > XsXi > Xs

Xi < XsXi < Xs

LL

NN

Xi Xi -- Required valueRequired value

Xs Xs -- Actual valueActual value

The essential difference between programmable control and traditional control technology may be summed up as follows:

PLC and Conventional Control SystemPLC and Conventional Control SystemPLC and Conventional Control SystemPLC and Conventional Control System

Handout section 1.1

» The functions are no longer determined by the wiring, but

rather by the program

» Programming is simplified to enable symbols familiar to

the control engineer to be used (contacts or logic graphic

symbols)

LL

S1S1 S1S1 S2S2

24 VDC24 VDC

Hardwire and PLC Wiring DiagramsHardwire and PLC Wiring DiagramsHardwire and PLC Wiring DiagramsHardwire and PLC Wiring Diagrams

Handout section 1.3

NN

S2S2

K1K1

PLCPLC

K1K1

HardwireHardwire PLCPLC

0 V0 V

K1K1

ComparisonComparisonComparisonComparison

Hardwired control systemsHardwired control systems

» The functions are determined

by the physical wiring.

Programmable control systemProgrammable control system

» The functions are determined

by a program stored in the

memory.

» Changing the function means

changing the wiring

» Can be contact-making type

(relays, contactors) or

electronic type (logic circuits)

memory.

» The control functions can be

changed simply by changing

the program.

» Consist of a control device, to

which all the sensors and

actuators are connected.

» During the late 1960s, General Motors (USA) was interested in the

computer application to replace the hardwire systems.

» Bedford Associates (Modicon) and Allen Bradley responded to

General Motors.

HISTORY OF PLCHISTORY OF PLCHISTORY OF PLCHISTORY OF PLC

General Motors.

» The name given was “Programmable Controllers” or PC.

» Programmable Logic Controller or PLC was a registered trademark

of the Allen Bradley.

» Later, PC was used for “Personal Computer” and to avoid

confusion PLC for “Programmable Controller” and PC for a

personal computer.

» Implementing changes and correcting errors

» Pilot run - trial / test run

ADVANTAGES OF PLC COMPARED TO HARDWIREADVANTAGES OF PLC COMPARED TO HARDWIREADVANTAGES OF PLC COMPARED TO HARDWIREADVANTAGES OF PLC COMPARED TO HARDWIRE

» Visual observation - online monitoring

» Speed of operation

» Reliability

» Documentation

CONVEYOR LINE

PLC Application ExamplePLC Application ExamplePLC Application ExamplePLC Application Example

WORKSTATION #1 WS #2 WS #3

FLOW OF MATERIAL

» Input devices

◊ Sensors

◊ Switches etc.M

PLC Control SystemPLC Control SystemPLC Control SystemPLC Control System

» Output devices

◊ Relays

◊ Lamps etc

» PLC

WS #1 WS #2 WS #3

0 0 3 2PLC

Familiarization with STEP 7Familiarization with STEP 7Familiarization with STEP 7Familiarization with STEP 7

Handout section 2.0 ( Topic 2 )

POWERPOWER

SUPPLYSUPPLY

PG/PG/

PCPC

Basic Structure of a PLCBasic Structure of a PLCBasic Structure of a PLCBasic Structure of a PLC

Handout section 1.4

CENTRALCENTRAL

PROCESSINGPROCESSING

UNIT (CPU)UNIT (CPU)

INPUTINPUT

MODULESMODULESOUTPUTOUTPUT

MODULESMODULES

MEMORYMEMORY

(EPROM/RAM)(EPROM/RAM)

USERUSERPROGRAMPROGRAMUSERUSER

PROGRAMPROGRAM

PLC Inputs / Outputs (I/Os)PLC Inputs / Outputs (I/Os)PLC Inputs / Outputs (I/Os)PLC Inputs / Outputs (I/Os)

PLCPLC

PROGRAMPROGRAM

(LOGIC)(LOGIC)

PROGRAMPROGRAM

(LOGIC)(LOGIC)

InputInputDevicesDevices

OutputOutputDevicesDevices

InputInput

» Input card

» Converter

Input ConnectionsInput ConnectionsInput ConnectionsInput Connections

InputInputDevicesDevices

» Converter

◊ field voltage to 5V

acceptable by the CPU

Input Interface / ModuleInput Interface / ModuleInput Interface / ModuleInput Interface / Module

Handout section 1.4.1

From field wiring

Detection

Bridge

Signal

To CPU / Memory

Signal

Conditioning

Threshold

Decision

Logic

Logic Status

Light

Opto-Isolation

» Output card

Output ConnectionsOutput ConnectionsOutput ConnectionsOutput Connections

» Converter

◊ 5V to field voltage

to drive field devices

OutputOutputDevicesDevices

Output Interface / ModuleOutput Interface / ModuleOutput Interface / ModuleOutput Interface / Module

From CPU / Memory

Logic Status

Light

Opto-Isolation

Logic

Handout section 1.4.2

To field wiring

Switching

Circuitry

Protection

Circuitry

Opto-Isolation

IN

OUT

M

PLC

Input/output ConnectionsInput/output ConnectionsInput/output ConnectionsInput/output Connections

NPUTS

UTPUTS

WS #1 WS #2 WS #3

0 0 32 PLC

PLC

Logic

Input / Output ModulesInput / Output ModulesInput / Output ModulesInput / Output Modules

» Digital input modules adapt digital signals e.g. from proximity

sensors

» Digital output modules convert the internal signal level of PLC into

digital process signals e.g. relaysdigital process signals e.g. relays

» Analog input modules adapt analog process signals e.g. from

transducers

» Analog output modules convert internal digital values of the PLC to

analog process signals e.g. temperature controller

Central Processing Unit (CPU)Central Processing Unit (CPU)Central Processing Unit (CPU)Central Processing Unit (CPU)

What is a CPU?What is a CPU?

» The “brain” of a PLC

Handout section 1.4.3

» Controlled by a program called the executive or operating

system (OS)

» The executive is a collection of supervisory programs

permanently stored in memory

CPUCPUCPUCPU

Four basic types of CPU operations:Four basic types of CPU operations:

» Input and output operation

» Arithmetic and logic

» Reading or changing contents of memory locations

» Jump operations

CPUCPUCPUCPU

ACCUMULATOR

INTERNALPROGRAMMEMORY

(RAM)

MEMORYSUBMODULE

(EPROM/EEPROM/

RAM)

PROCESSOR

TIMERS, COUNTERS,

Memory

PII PIQ

SERIALINTERFACE

» The CPU reads in input signal states, processes the control

program and controls the outputs.

» The CPU provides internal Memory, timers and counters.

CPUCPUCPUCPU

» Restart procedure can be preset and errors can be diagnosed

using the CPU’s LEDs.

» The overall Reset on the CPU is used to delete the contents of the

RAM.

» A PG or a Memory submodule is used to transfer the control

program to the CPU.

Program MemoryProgram MemoryProgram MemoryProgram Memory

Program memory

Handout section 1.4.4

RAM (Random Access Memory)

• the memory contents can be

read and written (modified)

• memory contents will be lost

when the supply voltage fails

ROM (Read Only Memory)

• the memory contents can be

read, but cannot be modified

Types of Program MemoryTypes of Program MemoryTypes of Program MemoryTypes of Program Memory

Programmable(Read-write memory)

Program memory

Non-programmable

Alterable

UV erasableEPROM / REPROM

Semiconductor RAM

Non-alterableROM / PROM

Electrically erasableEEPROM / EAPROM

SemiconductorEEPROM / EAPROM

Memory SubmodulesMemory SubmodulesMemory SubmodulesMemory Submodules

» EPROM SUBMODULE

An ultraviolet erasing device is used to delete the contents of the

submodule

» EEPROM SUBMODULE » EEPROM SUBMODULE

EEPROM submodule can be programmed or erased using a

programmer

» RAM SUBMODULE

Can be used in addition to program storage; and used to test a

control program during system startup

» The power supply module supplies the operational voltage for the

PLC and provides backup for the RAM with a battery

» Backup battery

Power Supply ModulePower Supply ModulePower Supply ModulePower Supply Module

Handout section 1.4.5

» The backup battery maintains the program and data when the PLC

is switch off

» The backup battery has a service life of approximately 2 years

PG

Input

External power supply

Hardware SummaryHardware SummaryHardware SummaryHardware Summary

PS951CPU

Inputmodule

Outputmodule

Inputdevices

Outputdevices

How Does a Programmable Controller Work?How Does a Programmable Controller Work?How Does a Programmable Controller Work?How Does a Programmable Controller Work?

Handout section 1.5

ProgramProcessor

24 VDC

Sensors

Power

Supply

Program

MemoryProcessor

Input modules

Output modules

GND

Actuators / Annunciators

Steps of OperationSteps of OperationSteps of OperationSteps of Operation

» The sensors are connected to the INPUT MODULES

» The processor in the CPU MODULE executes the program and

scans the individual input for presence or absence of voltagescans the individual input for presence or absence of voltage

» Depending on the state of the inputs, the processor directs the

OUTPUT MODULES to switch voltages

» The ACTUATORS or ANNUNCIATORS are switched “ON” or

“OFF” according to the voltage states

Signal States and Sensor ContactsSignal States and Sensor ContactsSignal States and Sensor ContactsSignal States and Sensor Contacts

» There are only two different states:

SIGNAL STATE “0” = voltage not present = OFF

SIGNAL STATE “1” = voltage present = ON

Handout section 1.6

» The sensor is a The sensor is Voltage at input Signal state

NO contact activated present 1

NO contact not activated not present 0

NC contact activated not present 0

NC contact not activated present 1

Addressing of Inputs and OutputsAddressing of Inputs and OutputsAddressing of Inputs and OutputsAddressing of Inputs and Outputs

» The addressing of inputs and outputs are identified by an operand identifiers and the parameter

» Operand identifiers:

Handout section 1.7

» Operand identifiers:

I - Input

Q - Output

» Parameter: (consists of a byte and a bit address)

0.0 … 0.7 (where 0. is the byte; 0…7 are the bit addresses)

1.0 … 1.7

Types of AddressingTypes of AddressingTypes of AddressingTypes of Addressing

Absolute

» example:» A I 0.0

» = Q 8.0

» A I0.4

» = Q20.5

Symbolic

» example:» A “System_On”

» = “System_On”

» A “M_FORW”

» = “MOTOR_FOR”» = Q20.5

» Call FC18» = “MOTOR_FOR”

» Call “COUNT”

Symbol Address Data Type Comment

MOTOR_FOR Q20.5 BOOL Motor moves forward

COUNT FC18 FC18 Count bottles

SYSTEM_ON I0.0 BOOL Switch system ON

SYSTEM_ON Q8.0 BOOL Indicator: “System is ON”

M_FORW I0.4 BOOL Pushbutton: Motor forward

Max. 24 character Max. 80 character

Handout section 1.8.1

LAD - Ladder Diagram

( )I 0.0 I 0.1 Q 4.0

Program Representation Program Representation -- LADLADProgram Representation Program Representation -- LADLAD

» The graphical representation of a control task using symbols to

DIN 19239

» Very similar to traditional circuit diagrams, but the current paths are

arranged horizontally instead of vertically

Program Representation Program Representation -- FBDFBDProgram Representation Program Representation -- FBDFBD

FBD - Function Block Diagram

&I 0.0

I 0.1Q 4.0

Handout section 1.8.2

» The graphical representation of a control task using symbols to

DIN 40700 and DIN 19239

» Inputs are arranged on the left side while outputs on the right

I 0.1

Program Representation Program Representation -- STLSTLProgram Representation Program Representation -- STLSTL

STL - Statement List

A I 0.0

A I 0.1

= Q 4.0

Handout section 1.8.3

» The control statement describes the task with mnemonic

abbreviations of function designation (DIN 19239)

» Each method of representation has special characteristics and

specific limits

» If certain rules are followed, translation into all three methods of

representation is possible

= Q 4.0

Operation And OperandOperation And OperandOperation And OperandOperation And Operand

Handout section 1.8.4

Operation;

Describes the function to be carried out (what is to be done)

e.g Binary operations, Digital operations and Organizational operations

Operand;

START FROM HERE

FBDFBDFBDFBD

OPERAND + OPERATION

STLSTLSTLSTL

OPERATION + OPERAND

A I 0.0

Operation And OperandOperation And OperandOperation And OperandOperation And Operand

LADLADLADLAD

OPERATION + OPERAND

I 0.0 M 80.0

Handout section 1.8.4

I 0.0

OPERATION + OPERAND

= Q 4.0

A I 0.0A M 80.0

= Q 4.0( )

Q 4.0

I 0.0 M 80.0&

I 0.0

M 80.0

Program ExecutionProgram ExecutionProgram ExecutionProgram Execution

PLC Scan Function:PLC Scan Function:

» Read the status of all inputs and outputs

Handout section 1.9

» Read the status of all inputs and outputs

» Examine the application program instructions

» Execute the control program

Linear Program ScanningLinear Program ScanningLinear Program ScanningLinear Program Scanning

» Statements are scanned linearly

» At the end of the program, scanning starts again from the

beginning

Handout section 1.9.1

beginning

» This is also referred to as cyclical scanning

» Linear program scanning is used mainly for simple, small-scale control schemes

» OB = Organization Block

» Every program must have OB1

OB1OB1OB1OB1

Linear program scanning

OB1

» When the PLC is set to run, the

PLC will look for OB1 only in the

user memory and execute it

» Other blocks can be called from

OB1 with the “jump” commandCyclic program execution

A I 0.0A I 0.1= Q 4.0:::BE

» Complex tasks are subdivided

into clearly differentiated sub-

tasks

Handout section 1.9.2

Structured Program ScanningStructured Program ScanningStructured Program ScanningStructured Program Scanning

OB1

JU FC 1

FC1

A I 0.0A I 0.1= Q 4.0:::

Cyclic

pro

gra

m e

xecution

Operatingsystem

» i.e. the program is divided into

small, easy-to-follow program

blocks, organized according to

different functions

JU FC 1

JU FC 4:::BE

:BE

FC4

A Q 4.0A I 0.2= Q 5.0:::BE

Cyclic

pro

gra

m e

xecution

Structured program scanning

Linear programming

OB1

Network 1

A I 0.6

A I 0.7

= Q 4.2

Network 2

A I 0.7

Network 1

JU FC 1

OB 1

Network 1

A I 0.6

A I 0.7

= Q 4.2

Network 2

A I 0.7

A I 0.5

= Q 4.3

FC 1

Structured programming

A I 0.7

A I 0.5

= Q 4.3

Network 3

A Q 4.2

A I 0.2

= Q 5.5

BE

JU FC 1

JU FC 4

BE

= Q 4.3

BE

Network 1

A Q 4.2

A I 0.2

= Q 5.5

BE

FC 4

Program ExecutionProgram ExecutionProgram ExecutionProgram Execution

Handout section 1.9.3

A I 0.0

A I 0.1

= Q 4.0P P

24 VDC GNDInput

moduleProcess

input imageProcess

output image

Program inthe RAM

Outputmodule

I 0.1

I 0.0

Q 4.0

1

0

0

= Q 4.0

O I 0.5

O I 0.7

= Q 4.3

BE:

P

I

I

P

I

Q

Input cycle Program execution Output cycle

I 0.5

I 0.7

Q 4.3

1

1

1

» A buffer of input signals

» Update just before program

execution starts

Update PII

Execute

Program

PII PII -- Process Input ImageProcess Input ImagePII PII -- Process Input ImageProcess Input Image

» Not updated during program

execution

» Logic executed based on status in PII

» Prevent signal transition during

program cycle to affect the program

Program

Logic

Update Output

» Updated by the

program logic during

program execution

OB1

PIQ PIQ -- Process Output ImageProcess Output ImagePIQ PIQ -- Process Output ImageProcess Output Image

program execution

» The contents of PIQ

are transferred to the

output module at the

end of OB1

OB1 PIQ

Copy PIQ to Output Module

BLOCK TYPESBLOCK TYPESBLOCK TYPESBLOCK TYPES

» ORGANISATION BLOCKS (OB) – Interface between the operating system and the user program

» FUNCTIONS (FC) - Contains a partial functionality of the program

» DATA BLOCKS (DB) – Are data areas of the user program in which user data are managed in a structured manner

Handout section 1.9.4

data are managed in a structured manner

» SYSTEM FUNCTION BLOCKS (SFB), SYSTEM FUNCTIONS (SFC) -SFBs and SFCs are integrated in the S7 CPU and allow you access to some important system functions

» FUNCTION BLOCKS (FB) - FBs are blocks with a “memory” which you can program yourself

» INSTANCE DATA BLOCKS (DB) - Instance DBs are associated with the block when an FB/SFB is called. They are created automatically during compilation

FC 1

FC 4

FC 7

A I ....

..

..

Block Nesting DepthBlock Nesting DepthBlock Nesting DepthBlock Nesting Depth

JU FC 1

..

...

..

BE

OB1JU FC4

..

...

BE

JU FC 7

..

...

BE

..

..

BE

The Operand Areas (for Siemens S5The Operand Areas (for Siemens S5--95U PLC)95U PLC)The Operand Areas (for Siemens S5The Operand Areas (for Siemens S5--95U PLC)95U PLC)

» I (Input)

Interface from the process to the programmable controller

» Q (Output)

Interface from programmable controller to the process

Handout section 1.9.5

» M (Memory/Flag)

Memory for intermediate results of binary operations

» T (Timer)

Memory for implementing timers

» C (Counter)

Memory for implementing counters

The Addressing of Siemens S7The Addressing of Siemens S7The Addressing of Siemens S7The Addressing of Siemens S7

Operand Areas Addressing

Input (I) 0.0 to 0.7

1.0 to 1.7

2.0 to 2.7

Handout section 1.9.6

3.0 to 3.7

Output (Q) 4.0 to 4.7

5.0 to 5.7

8.0 to 8.7

9.0 to 9.7

Counters (C) 0 to 63

Timers (T) 0 to 127

Topic 3Topic 3Topic 3Topic 3

Handout section 3.0

Programming Basic Programming Basic

FunctionsFunctions

Programming Basic Programming Basic

FunctionsFunctions

The Stages of Project PlanningThe Stages of Project PlanningThe Stages of Project PlanningThe Stages of Project Planning

Description of the Problem

Assignment Lists

Handout section 3.1

Rough Structure of the Control System

Program Structure

Detailed Structure of the Control System

The Stages of Project PlanningThe Stages of Project PlanningThe Stages of Project PlanningThe Stages of Project Planning

Problem Description

» it consists of process schematic, a short description of the task

definition, and a list of the sensors and actuators

Assignment ListAssignment List

» the sensors and actuators are allocated to the parameters of the

programmable controller

» it contains a short functional description as well as the device

identifier

The Stages of Project PlanningThe Stages of Project PlanningThe Stages of Project PlanningThe Stages of Project Planning

Rough Structure of the Control System

» it contains all sub-functions of the process with relevant sensors,

actuators and indicators

Program StructureProgram Structure

» it determines the order in which the LAD, FBD or STL diagram to

be drafted

Detailed Structure of the Control System

» using the assignment list and the program structure, the flow chart

contained in the rough structure is refined

Programming AND OperationProgramming AND OperationProgramming AND OperationProgramming AND Operation

( )I 0.0 I 0.1 Q 4.0

LAD

Handout section 3.2

STL

A I 0.0A I 0.1= Q 4.0

&I 0.0

I 0.1

Q 4.0

FBD

OR OperationOR OperationOR OperationOR Operation

Handout section 3.3

LAD

( )I 0.0

I 0.1

Q 4.0

STL

O I 0.0O I 0. 1= Q 4.0

>= 1

FBD

I 0.0

I 0.1

Q 4.0

I 0.1

AND AND -- before before -- OR OperationOR OperationAND AND -- before before -- OR OperationOR Operation

Handout section 3.4

( )I 0.0 I 0.1

I 0.2 I 0.3

Q 4.0LAD

I 0.0 I 0.2

STLA I 0.0A I 0.1OA I 0.2A I 0.3= Q 4.0

I 0.2 I 0.3

I 0.1 I 0.3

I 0.0

I 0.1

I 0.2

I 0.3

Q 4.0

FBD

>= 1

&

&

STL

OR OR -- before before -- AND OperationAND OperationOR OR -- before before -- AND OperationAND Operation

Handout section 3.5

( )I 0.0 I 0.1

I 0.2 I 0.3

Q 4.0LAD

I 0.0 I 0.2STLA (O I 0.0O I 0.2)A (O I 0.1O I 0.3)= Q 4.0

I 0.1 I 0.3

I 0.0

I 0.1

I 0.2

I 0.3

Q 4.0

FBD

&

>= 1

>= 1

Handout section 3.6

Programming of NC Contacts and NO ContactsProgramming of NC Contacts and NO ContactsProgramming of NC Contacts and NO ContactsProgramming of NC Contacts and NO Contacts

» Physical connection PLC programming The sensor is Signal state

NO contact NO contact activated 1

NO contact NO contact not activated 0NO contact NO contact not activated 0

NO contact NC contact activated 0

NO contact NC contact not activated 1

NC contact NO contact activated 0

NC contact NO contact not activated 1

NC contact NC contact activated 1

NC contact NC contact not activated 0

Latching OutputLatching OutputLatching OutputLatching Output

Handout section 3.7

S1

S2

K1S3

S4

K2

SET Priority / Dominant SET RESET Priority / Dominant RESET

S2

K1

S4

K2

RS Memory FunctionRS Memory FunctionRS Memory FunctionRS Memory Function

Handout section 3.8

R

S2S3

S4

K2

SET Priority / Dominant SET

=S Q

S1

( )K1

S4

K2

RS Memory FunctionRS Memory FunctionRS Memory FunctionRS Memory Function

S

S3S1

S2

K1

RESET Priority / Dominant RESET

=R Q

S4

( )K2

S2

K1

Try This !Try This !Try This !Try This !

Will the output Q 4.0 be

activated when you

activate:

» I 0.0 and I 0.1 ?( )I 0.0 I 0.1 Q 4.0

LAD

» I 0.2 and I 0.3 ?

» I 0.4 and I 0.5 ?

( )I 0.2 I 0.3 Q 4.0

( )I 0.4 I 0.5 Q 4.0

The AnswerThe AnswerThe AnswerThe Answer

» I 0.0 and I 0.1 = NO!

» I 0.2 and I 0.3 = NO!» I 0.2 and I 0.3 = NO!

» I 0.4 and I 0.5 = YES …… but why ?

When I0.0 and I0.1 Are Activated...When I0.0 and I0.1 Are Activated...When I0.0 and I0.1 Are Activated...When I0.0 and I0.1 Are Activated...

» the PLC registers in the PIQ that Q 4.0 is “1”

( )I 0.0 I 0.1 Q 4.0

LAD

I 0.2 I 0.3 Q 4.0» the PLC registers in the PIQ

that Q 4.0 is “0”

» the PLC registers in the PIQ that Q 4.0 is “0”

so, Q 4.0 = “0”

( )I 0.2 I 0.3 Q 4.0

( )I 0.4 I 0.5 Q 4.0

When I0.2 and I0.3 Are Activated...When I0.2 and I0.3 Are Activated...When I0.2 and I0.3 Are Activated...When I0.2 and I0.3 Are Activated...

» the PLC registers in the PIQ that Q 4.0 is “0”

( )I 0.0 I 0.1 Q 4.0

LAD

I 0.2 I 0.3 Q 4.0» the PLC registers in the PIQ

that Q 4.0 is “1”

» the PLC registers in the PIQ that Q 4.0 is “0”

so, Q 4.0 = “0”

( )I 0.2 I 0.3 Q 4.0

( )I 0.4 I 0.5 Q 4.0

When I0.4 and I0.5 Are Activated...When I0.4 and I0.5 Are Activated...When I0.4 and I0.5 Are Activated...When I0.4 and I0.5 Are Activated...

» the PLC registers in the PIQ that Q 4.0 is “0”

( )I 0.0 I 0.1 Q 4.0

LAD

I 0.2 I 0.3 Q 4.0» the PLC registers in the PIQ

that Q 4.0 is “0”

» the PLC registers in the PIQ that Q 4.0 is “1”

this time, Q 4.0 = “1”

( )I 0.2 I 0.3 Q 4.0

( )I 0.4 I 0.5 Q 4.0

Priority and PIQPriority and PIQPriority and PIQPriority and PIQ

The Problem of Repetitive OutputsThe Problem of Repetitive OutputsThe Problem of Repetitive OutputsThe Problem of Repetitive Outputs

» Therefore, when the same output is used more than once in the

program, only the last state of the output will be valid due to the

PLC dynamically updating the PIQ (Process Output Image)

» MEMORY = Memory for intermediate results of binary » MEMORY = Memory for intermediate results of binary operations

» Memory can be treated as flags/variables

» Memory can be used to solve the problem of repetitive outputs

Using Memory…...Using Memory…...Using Memory…...Using Memory…...

( )I 0.0 I 0.1 M 100.0

( )I 0.2 I 0.3 M 100.1

I 0.4 I 0.5 M 100.2( )

I 0.4 I 0.5 M 100.2

( )M 100.0 Q 4.0

M 100.1

M 100.2

RLO STATA Q 4.0 …… ……

Result of Logic Operation (RLO)Result of Logic Operation (RLO)Result of Logic Operation (RLO)Result of Logic Operation (RLO)

Q 4.0A Q 4.0 …… ……A ( …… …… O I 0.1 …… …… O I 0.2 …… …… O I 0.3 …… …… )= Q 5.0 …… ……

>=1I 0.0

I 0.1

I 0.2

Q 5.0&

Mathematics Logic Operation

Multiplication Before Addition

4 X 8 + 3 X 2 = 38AND before OR

Parenthesized FunctionParenthesized FunctionParenthesized FunctionParenthesized Function

4 X 8 + 3 X 2 = 38

RLO STATA I 0.0 1 1A I 0.1 1 1O 1 \A I 0.2 0 0A I 0.3 0 1= Q 4.0 1 1

Addition Before Multiplication

4 X (8 + 3 ) X 2 = 88

Parenthesized FunctionParenthesized FunctionParenthesized FunctionParenthesized Function

Mathematics Logic Operation

OR before AND4 X (8 + 3 ) X 2 = 88

RLO STATA I 0.0 1 1A ( 1 \O I 0.1 1 1O I 0.2 1 0) 1 \A I 0.3 1 1= Q 4.1 1 1

Topic 4Topic 4Topic 4Topic 4

Handout section 4.0

Numerical Systems and Numerical Systems and

Data FormatsData Formats

Numerical Systems and Numerical Systems and

Data FormatsData Formats

Comparison of Number SystemsComparison of Number SystemsComparison of Number SystemsComparison of Number Systems

DecimalNumber

HexadecimalNumber

BinaryNumber

102

101

100

162

161

160

24

23

22

21

20

100 10 1 256 16 1 16 8 4 2 1

0 0 0 0 0 0 0 0 01 1 0 0 0 0 1

2 2 0 0 0 1 0

3 3 0 0 0 1 1

Handout section 4.1

3 3 0 0 0 1 1

4 4 0 0 1 0 0

5 5 0 0 1 0 1

6 6 0 0 1 1 0

7 7 0 0 1 1 1

8 8 0 1 0 0 0

9 9 0 1 0 0 1

1 0 A 0 1 0 1 0

1 1 B 0 1 0 1 1

1 2 C 0 1 1 0 0

1 3 D 0 1 1 0 1

1 4 E 0 1 1 1 0

1 5 F 0 1 1 1 1

1 6 1 0 1 0 0 0 0

1 7 1 1 1 0 0 0 1

Binary and HexadecimalBinary and HexadecimalBinary and HexadecimalBinary and Hexadecimal

Word Address

IW0

Byte Addresses

High Byte Low Byte

Bit, Byte and Word AddressesBit, Byte and Word AddressesBit, Byte and Word AddressesBit, Byte and Word Addresses

Handout section 4.2

High Byte Low Byte

IB0 IB1

215

214

213

212

211

210

29

28

27

26

25

24

23

22

21

20

Bit Addresses

I0.7

I0.6

I0.5

I0.4

I0.3

I0.2

I0.1

I0.0

I1.7

I1.6

I1.5

I1.4

I1.3

I1.2

I1.1

I1.0

Force Variable and Data FormatForce Variable and Data FormatForce Variable and Data FormatForce Variable and Data Format

Force Variable

» Display the signal status from memory (PII, PIQ and flag) of the

CPU

Handout section 4.3

CPU

» Used to access the system data area of the CPU and modify the

data

Force Variable and Data FormatForce Variable and Data FormatForce Variable and Data FormatForce Variable and Data Format

Data Format

» KM - bit pattern

» KH - hexadecimal

» KF - sign number ( - 32768 to +32767 )

» KT - time value

» KC - counter value

» KY - left hand and right hand byte (high / low byte)

» KS - alphanumeric character

Load and Transfer OperationsLoad and Transfer OperationsLoad and Transfer OperationsLoad and Transfer Operations

Characteristics:

» They are used to perform operations on a whole byte or word in

memory

» They are unconditional operations i.e. They are performed by the

processor in each cycle

Handout section 4.4

processor in each cycle

Functions:

» Exchange information between various operand areas

» Prepare times and counts for further processing

» Load constants for program processing

Load OperationLoad OperationLoad OperationLoad Operation

Byte d Byte c Byte b Byte a PII

L IB 0

L IB 1ACCUM 2 ACCUM 1

0 IB 0Byte b Byte a

0 IB 10 IB 0

IB 0

IB 1

Information from PII

Transfer OperationTransfer OperationTransfer OperationTransfer Operation

Byte d Byte c Byte b Byte a PIQ

T QB 0ACCUM 2 ACCUM 1

Byte d Byte c

Byte a QB 0

Information in the PIQ

Byte b Byte a

Arithmetic and Assignment of AccumulatorArithmetic and Assignment of AccumulatorArithmetic and Assignment of AccumulatorArithmetic and Assignment of Accumulator

Handout section 4.5

Binary Coded Decimal (BCD)Binary Coded Decimal (BCD)Binary Coded Decimal (BCD)Binary Coded Decimal (BCD)

Handout section 4.6

Topic 5Topic 5Topic 5Topic 5

Handout section 5.0

Timer OperationsTimer OperationsTimer OperationsTimer Operations

Fault Indication with Timer FunctionFault Indication with Timer FunctionFault Indication with Timer FunctionFault Indication with Timer Function

Handout section 5.0

Handout section 5.1

Inputs and Outputs of a TimerInputs and Outputs of a TimerInputs and Outputs of a TimerInputs and Outputs of a Timer

Handout section 5.2.1

Types of Timer Types of Timer -- Pulse Timer (SP)Pulse Timer (SP)Types of Timer Types of Timer -- Pulse Timer (SP)Pulse Timer (SP)

Handout section 5.2.2

Extended Pulse Timer (SE)Extended Pulse Timer (SE)Extended Pulse Timer (SE)Extended Pulse Timer (SE)

Handout section 5.2.3

On Delay Timer (SD)On Delay Timer (SD)On Delay Timer (SD)On Delay Timer (SD)

Handout section 5.2.4

Stored On Delay Timer (SS)Stored On Delay Timer (SS)Stored On Delay Timer (SS)Stored On Delay Timer (SS)

Handout section 5.2.5

Off Delay Timer (SF)Off Delay Timer (SF)Off Delay Timer (SF)Off Delay Timer (SF)

Handout section 5.3

Specifying the Time PeriodSpecifying the Time PeriodSpecifying the Time PeriodSpecifying the Time Period

Time Value and AccuracyTime Value and AccuracyTime Value and AccuracyTime Value and Accuracy

Example:

KT 500.1 500 X 0.1S 49.9s …….. 50.0s

KT 050.2 50 X 1S 49s ………... 50s

KT 005.3 5 X 10S 40s ………... 50s

Load and Transfer Timer ValueLoad and Transfer Timer ValueLoad and Transfer Timer ValueLoad and Transfer Timer Value

Return OperationsReturn OperationsReturn OperationsReturn Operations

» BE (Block End)

» the return operation is performed unconditionally

» it is always the last statement in the block

» BEU (Block End Unconditional)

Handout section 5.4

» BEU (Block End Unconditional)

» the return operation is performed unconditionally

» statements can follow BEU, but they will not be executed

» BEU is often used during commissioning so that individual parts of

the program can be tested

» BEC (Block End Conditional)

» the return is made dependent on a condition and is only performed

if the condition is satisfied

Block End Operations BEC, BEU and BEBlock End Operations BEC, BEU and BEBlock End Operations BEC, BEU and BEBlock End Operations BEC, BEU and BE

:

:JU FC1

:

:A I 0.6

:BEC

:

:BE

OB1

FC1

is always executed

is executed only

when I 0.6 = “0”

System

:A I 0.0

:JC FC 2

:

:BEU

:

:JU FC3

:BE

:BE

:

:

:BE

:

:

:BE

FC2

FC3

when I 0.6 = “0”

is executed only

when I 0.0 = “1”

is not executed

is not

executed

Topic 6Topic 6Topic 6Topic 6

Handout section 6.0

Counter OperationsCounter OperationsCounter OperationsCounter Operations

Handout section 6.0

CounterCounterCounterCounter

Counter OperationsCounter OperationsCounter OperationsCounter Operations

CU - count up

CD - count down

S - set counter to the count value (CV)

CV - the count value

R - reset the counter (count value = 0)

BI - counter output as binary number

DE - counter output as BCD number

Q - counter status

Q = 0 when count value = 0

Q = 1 when count value > 1

Handout section 6.1

Load and Transfer for CounterLoad and Transfer for CounterLoad and Transfer for CounterLoad and Transfer for Counter

Handout section 6.2

Timing DiagramTiming DiagramTiming DiagramTiming Diagram

Assign an Initial Value to a Counter (S)Assign an Initial Value to a Counter (S)Assign an Initial Value to a Counter (S)Assign an Initial Value to a Counter (S)

Assign Value (CV)

» constant KC 0 to 999

» input word IW ….....

» output word QW …...

» flag word FW …....

» data word DW …...

Counter InputCounter InputCounter InputCounter Input

Handout section 6.3

Counter OutputCounter OutputCounter OutputCounter Output

Handout section 6.4

ComparatorComparatorComparatorComparator

Types of comparison:

!=F compare for equal to

><F compare for not equal to

>F compare for greater than

>=F compare for greater than or equal to

<F compare for less than

<=F compare for less than or equal to

Comparison OperationsComparison OperationsComparison OperationsComparison Operations

» The comparison operations compare two digital values in

accumulator 1 and accumulator 2

» The result of comparison produces an RLO:» The result of comparison produces an RLO:

» Comparison satisfied RLO = “1”

» Comparison not satisfied RLO = “0”

Handout section 6.4

ComparatorComparatorComparatorComparator

THE ENDTHE ENDTHE ENDTHE END

top related