Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

PLC Programming

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 34

PLC

Programming Concepts

BY
HAFIZ RAHIM
2011608005
PLC Operation

rite the program


rn on the PLC
nd the Data to PLC Memory through data ca
xecute the program

PLC SCAN
Field Input Output Devices
Devices
Selector Switch Alarms
Pushbuttons Control Relays
Limit Switches Fans
Circuit Breakers Hooters (horn)
Proximity Switches Valves
Motor Starter Contacts Motor Starters
Relay Contacts Solenoids

Input Interfaces Output Interfaces

4- 20 mA 12-48 Volts AC/DC


0 to +5 Volts DC 115 Volts AC/DC
0 to +10 Volts DC 230 Volts AC/DC
+5 to –5 Volts DC 5-50 Volts DC (Sink/Source)
+10 to –10 Volts DC
OUTPUTS

INPUTS CONTACTOR
MOTOR

LAMP

PLC
Push Button Relays
evel Detection

1. Motor Starter Con


2. Selector Switch
3. Limit Switchs

?
???
? ? ? ??

4- 20 ??
??
? ?

mA
PLC -------- > SIEMENS
S7-300

S5-100
Configuration of PLC :
Siemens

CPU

LED

External Power I/O Modules


Supply

Communication Analog Modules


Siemens - PLC
Architecture
Internal program
Memory
Memory
Sub module
(RAM)
Program memory

Timer

Processor Counters
ALU
Flags

I/O
Inputs Outputs

I/O bus
External
Counters
S5 - 100U PC

 The
program can be loading in two
ways :
1. Online ( Direct to internal RAM
)
2. Off-line ( EEPROM or
EPROM )

Let see the specification of S5 –


Siemens - S5-100U Specification
CPU 100 U
Function range Boolean logic, bracketed operation, counter and
timer functions, load, transfer, comparison and
jump operation, arithmetic.

Programming language STEP 5


Methods of representation STL-(statement), FBD-(functional Block), LAD.

Execution time 70 msec.


Program memory ( Internal RAM ) 1K

Flags 1024, ½ of them are retentive (can remember).

Digital Inputs 128 ( Max.)


Digital Outputs
Analog Inputs 8 ( Max.)
Analog Outputs
Software : Micro/WIN32
Programming Basics
A Program can be write in
many Ways….

Ladder logic
Statements ( lists form)

function block diagrams


Ladder logic

 I/O Numbering
I designate a discrete input
Q designates a discrete
output
I0.0 = Byte 0, Bit 0
I0.1 = Byte 0, Bit 1
I1.0 = Byte 1, Bit 0
I1.1 = Byte 1, Bit 1

 Input devices ( switches, pushbuttons, sensor) are


connected to the terminal strip under the bottom cover of
the PLC.
 Switches are wired between the 24 VDC power supply (L+)
and the inputs
 For example, the switch is wired between input (0.0) and
L+. When the switch is closed, 24 VDC is applied to the
input. This is referred to as a logic 1
 Output devices( relays) are connected to top cover of the
PLC.
 When testing a program, it is not necessary to connect
output devices. The LED status indicators signal if an output
is active.
Instructions

 – 3 Types

1. Standard Instructions
( timer, counter, math, logical ( increment/decrement/invert), move,
and block instructions )

2. Special Instructions
(used to manipulate data, table, find, conversion, for/next, and real-
time instructions )

3. High-Speed Instructions
( events , interrupts which occur independent of the PLC scan
time.
They are high-speed counters, interrupts, output, and
transmit instructions)
Symbols

 Contacts

 Coils

 Boxes

Function Block Diagram Representative


Network: 1

IO.O
QO.O
AND
IO.1
th e
s ee
et n g
L k i
Analog Inputs and
Outputs
 Typical analog signals are 0 - 10 VDC or 4 - 20 mA

 Analog signals - changes w r t time ( speed,


temperature, weight, and level) . We cannot
process these signals in an analog form. So, PLC
must convert the analog signal into a digital
representation.

 Analog module
Timers
 Three types
1. On- Delay (TON)
2. Retentive On-Delay (TONR)
3. Off-Delay (TOF).

see
t’ s
Le a
mo
e
On-Delay (TON):

 Run for a predetermined amount of time (preset


time – PT)
 Each timer has a time base. eg: 100 ms
 If PT = 150. --- 15 seconds
 If the switch were opened before 15 seconds, then
s
closed, the timer would again begin timing att’0.
Le e
Se rking
wo
th e
Retentive On-Delay (TONR)

 Similar manner to the On-Delay timer (TON).

 A RESET (R) instruction is connected to input I0.2


(reset to o)

 Does not reset when the input goes off


Off-Delay (TOF)

 used to delay an output off/on for a fixed period of


time after the input turns off

Programs

Programming Steps
1. 1st Pump On for L1
level
2. 2nd Pump On for L2
level
Let 3. Mixer runs for T1
’s s seconds
wo ee th 4. 3rd pump on till L0
& P rkin e level
rog g 5. Open drain valve till
ram L0 level
Counters

 Count to a preset value and cause an


event to occur
 three types of counters: up counter
(CTU), down counter (CTD), and
up/down counter (CTUD).
Up Counter

 counts up from a current value to a


preset value (PV).
 Each time CU transitions from a logic
0 to a logic 1 the counter increments
by a count of 1. Input R is the reset.
A preset count value is stored in PV
input. If the current count is equal to
or greater than the preset value
t ’ s
e the output bit (Q) turns
stored in LPV,
s e e ng
on rki
w o
th e
Down Counter:

 counts down from the preset value


(PV) each time CD transitions from a
logic 0 to a logic 1. When the current
value is equal to zero the counter
output bit (Q) turns on
 The counter resets and loads the
current value with the preset value
(PV) when the load input (LD) is
enabled.
Up/Down Counter:

 counts up or down from the preset value each time


either CD or CU transitions from a logic 0 to a logic
1
 When the current value is equal to the preset
value, the output QU turns on. When the current
value (CV) is equal to zero, the output QD turns on.
 The counter loads the current value (CV) with the
preset value (PV) when the load input (LD) is
enabled. Similarly, the counter resets and loads the
current value (CV) with zero when the reset (R) is
enabled. The counter stops counting when it
reaches preset or zero.
Programs

Programming Steps

1. Count up- vehicle comes for parking


2. Count down -vehicle leaves form
parking
3. Maximum capacity – 100 vehicles
4. Show status -> available = Green, Not
available = Red
5. Emergency stop
High-Speed Instructions

 Include high-speed counters, interrupts, output,


& transmit instructions.
 The scan time depends on
the size of the program
the number of I/Os
the amount of communication
required
Events may occur in an application that require a
response from the PLC before the scan cycle is
complete

High-Speed Counters
 Each counter has dedicated inputs
for clocks, direction control, reset,
Positioning
 Eg : Motor – encoder positioning system

 AIM: move an object from position 1 to 6.


 The encoder emits a series of pulses as the motor
turns.
- if the encoder generates 600 pulses per revolutio
& takes 1000 motor revolutions to move the obje
from one position to another.
Ie, 5 positions -> 5000 motor revolutions.
counter ->count up 30,000 counts & stop the
motor.
Interrupts

 Priority order
1. Communications
2. I/O Interrupts
3. Time-Based Interrupts

 Pulse Train Output (PTO): provide a series of


pulses to an output device ( stepper motor
driver)
 Pulse: square wave which has specified
number of pulses and cycle time.
- The number of pulses - 1 to 4,294,967,295
pulses.
- P TOs have a 50% duty cycle.
PWM
 PWM used to adjustable control of machine timing.

 PWM provides a fixed cycle time with a variable duty cycle ti

When pulse width = the cycle time


-> the duty cycle is 100% & the output is turned on
continuously.

Eg : if the output has a 10% duty cycle (on 10% & off 90% ).

After an interrupt the cycle switches to a 50% duty cycle (on 5


off 50%).
Connecting External
Devices
 HMI
 Freeport Mode
Thank You

for
Listening

You might also like