Professional Documents
Culture Documents
PLC
1. PLC hardware
• Svaki kontakt i izlazni simbol ima broj upisan odmah ispod (ili iznad) njega.
Ovaj broj identifikuje lokaciju u procesorskoj memoriji (RAM), gde se čuva vrednost
(podatak) sa tog kontakta ili izlaza.
PLC programiranje i funkcionisanje - Ladder Diagram
Upravljanje pneumatskim cilindrom
PLC programiranje i funkcionisanje - Ladder Diagram
Upravljanje pneumatskim cilindrom
PLC programiranje i funkcionisanje - Ladder Diagram
Upravljanje pneumatskim cilindrom
PLC programiranje i funkcionisanje - Ladder Diagram
Upravljanje pneumatskim cilindrom
Slika na prethodnom slajdu prikazuje ulazne, procesorsku i izlazne jedinice PLC-a korištene
za upravljanje pneumatskim cilindrom.
Kvadrati (1,2, 3 i 4) u ulaznom modulu IM:1 sadrže konvertore koji konvertuju prekidačke
ulaze u logičke naponske nivoe.
Četiri linije povezuju ulazne “kvadratiće” sa memorijskim ćelijama (lokacijama) koje čuvaju
informacije o statusu odgovoarajućih ulaza.
Gornja desna ćelija ulaznog dela memorije je povezana sa ulazom 1, ulaznog modula IM-1,
tak oda nosi oznaku IM: 1-1.
Krećući se nalevo kroz memorijske ćelije njihove oznake su IM:1-2, IM:1-3, IM:1-4. Vrednost 0
u memorijskoj ćeliji IM:1-1 znači da je taster START povezan sa ulazom 1 otvoren, što i jeste.
Jedinica u memorijskim ćelijama IM:1-2 and IM:1-3 označava da su prekidači STOP i LS1
zatvoreni, što i jeste.
Nula u ćeliji IM:1-4 pokazuje da je SW1 otvoren.
ZAPAMTITE! Ulazni podaci na lokacijama IM:1-2 i IM:1-3 daju informaciju da su kontakti
priključeni na odgovarajuće ulaze zatvoreni. Nemamo informaciju da li su to neaktivirani NC ili
aktivirani NO kontakti.
PLC programiranje i funkcionisanje - Ladder Diagram
Upravljanje pneumatskim cilindrom
Kvadratići(1, 2, 3 i 4) izlaznog modula OM:1 sadrže prekidačka kola koji koriste logičke
naponske nivoe (vrednosti izlaznih memorijskih ćelija) kako bi aktivirali ili deaktivirali izlazne
uređaje (stanja ON ili OFF).
Linija povezuje izlazni kvadratić 1 sa gornjom desnom izlaznom memorijskom ćelijom, tako da
je njena adresa OM:1-1.
Krećući se nalevo od ćelije OM:1-1 su ćelije OM:1-2, OM:1-3, and OM:1-4.
Nule u memorijskim ćelijama OM:1-1 i OM:1-2 znači da su solneoid i sijalica isključeni (stanje
OFF).
PLC programiranje i funkcionisanje - Ladder Diagram
Upravljanje pneumatskim cilindrom
4. Broj kontakata povezanih na red je maksimalno 11 (ili neki drugi broj postavljen od
strane proizvođača).
5. Broj paralelnih kontakata je maksimalno 7 (ili neki drugi broj postavljen od strane
proizvođača).
When a PLC is in the RUN mode, the processor repeats the following four-step cycle:
3. Output scan. Transfer the new image of output conditions to output devices.
Cycle 1. start and SW1 are open, stop and LS1 are closed.
Input scan. New input image is IM:1-1 = 0, IM:1-2 = 1, IM:1-3 = 1, IM:1-4 = 0.
Program scan. Rung 1: IM:1-1 = FALSE, OM:1-1 = FALSE, IM:1-2 = TRUE, IM:1-3 =
TRUE, path is FALSE, so 0 is stored in cell OM:1-1. Rung 2: IM:1-4 = FALSE so 0 is
stored in cell OM:1-2.
Output scan. Both solenoid a and the light are off.
PLC programming and operation - Ladder Diagram Programming
Control circuit for a pneumatic cylinder
Cycle 3. START is open, SW1, STOP and LS1 are all closed.
Input scan. New input image: IM:1-1 = 0, IM:1-2 = 1, IM:1-3 = 1, IM:1-4 = 1.
Program scan. Rung 1: IM:1-1 = FALSE, OM:1-1 = TRUE, IM:1-2 = TRUE, IM:1-3 = TRUE,
path is TRUE, so 1 is stored in cell OM:1-1. Rung 2: IM:1-4 = TRUE so 1 is stored in cell
OM:1-2.
Output scan. Both solenoid a and the light are ON.
PLC programming and operation - Ladder Diagram Programming
Control circuit for a pneumatic cylinder
Cycle 4. START and LSI are open, STOP and SW1 are closed.
Input scan. New input image: IM:1-1 = 0, IM:1-2 = 1, IM:1-3 = 0, IM:1-4 = 1.
Program scan. Rung 1: IM:1-1 = FALSE, OM:1-1 = TRUE, IM:1-2 = TRUE, IM:1-3= FALSE,
path is FALSE, so 0 is stored in cell OM:1-1. Rung 2: IM:1-4 = TRUE so 1 is stored in cell
OM:1-2.
Output scan. Solenoid a is OFF, the light is ON.
PLC programming functions – Timer function
• The Timer is the most frequently used PLC function, and Time Delay On is the most
common timing function.
• Both Time Delay On and Time Delay Off are used in PLCs.
• The nonretentive timer has one input, one output, and a preset delay time.
• The retentive timer has two inputs, one output, and two status bits that can be used as
internal outputs. The inputs are the Enable/Reset line and the Run line. The output is the
Done.
PLC programming functions – Timer function
T4 T4
I 0.7 S_ODT Q8.5 S_EVERZ A I 0.7
S Q I 0.7 S BI MW0 L S5T#35s
S5T#35s TV BI MW0 S5T#35s QW12
SD T4
TV BCD
I 0.5 Q8.5 A I 0.5
R BCD QW12 I 0.5 R Q = R T4
L T4
T MW0
RLO at S
LC T4
RLO at R T QW12
A T4
Time = Q8.5
operation
Example
• The PLC counter keeps track of the number of times a contact opens and ignores the
times the contact closes between each pair of openings.
• In this way, the counter is "counting" the event that causes the contact to open.
• The event might be an item that is conveyed past a photo detector. It might be a vehicle
that is driven over a pneumatic pressure detector. It might be a metal object on a shaft
that rotates past a magnetic detector. Industry has many events to count.
• Some PLC counters count from 0 up to a preset value; others count from the preset value
down to 0. Most PLCs include both up and down counters.
PLC programming functions – Counter function
A generic, two-input counter. The
counter is shown with the output
address C:7, the preset value 120, and
the counter register address RA:0027.
When the Enable/Reset line is OFF, the
counter ignores changes on the count
input line, output (C:7) is OFF, and the
count register (RA:0027) is reset to 0.
When the Enable/Reset line is ON, the
counter increments the count by 1 each
time the count input line goes from OFF
to ON. The counter output (C:7) is OFF
until the count in RA:0027 reaches the
preset value (120). At that time, C:7 is
turned ON and remains ON until
Enable/Reset is turned OFF. The
counter continues to increment the
count register beyond the preset value,
even though the output is ON, indicating
it is done.
Traditional Counter Functions
LAD FBD STL
A I 0.4
C5 C5
CU C5
S_CUD S_CUD A I 0.5
I 0.4 Q 8.3
CU Q
Q I 0.4 CU CD C5
A I 0.3
I 0.5
L C#5
CD CV MW 4 I 0.5 CD
S C5
I 0.3 A I 0.7
S CV_BCD QW 12 I 0.3 S CV MW 4 R C5
L C5
C#5 PV C#5 PV CV_BCD QW 12 T MW4
Q 8.3 LC C5
I 0.7
R I 0.7 R Q
Q = T QW12
A C5
= Q8.3
Counters: Function Diagram
CU
CD
5
4
3
Count
2
1
0
Q
PLC programming functions – Counter function
• The specified output pattern for each step is stored in one word of memory, and patterns
for successive steps are stored in successive memory cells.
• Each bit in the word is matched with one output (bit 0 is matched with output No.1, bit 1 is
matched with output No.2, . . . , bit 7 is matched with output No.8).
• If a bit holds a logical 1, the sequencer turns the matching output ON (or leaves it ON).
• If a bit holds a logical 0, the sequencer turns the matching output OFF (or leaves it OFF).
• The number of outputs that a sequencer can control depends on the word size of the
PLC. An 8-bit PLC can control up to 8 outputs, and a 16-bit PLC can control up to 16
outputs.
• Additional sequencer functions can be used to control additional outputs. For example,
two 16-bit sequencers can control up to 32 outputs.
PLC programming functions – Sequencer Function
• A generic sequencer with timed
steps.
T4
I 0.7 S_ODT
Q8.5
S Q
S5T#35s TV BI MW0
I 0.5
R BCD QW12
Binary Logic Operations: AND, OR
S1 (I 0.0)
I 0.0 I 0.1 Q 8.0 I 0.0 & Q 8.0 A I 0.0
= A I 0.1
AND S2 (I 0.1) I 0.1
= Q 8.0
Q 8.1 Q 8.1 = Q 8.1
=
L1 L2
(Q 8.0) (Q 8.1)
S3
(I 0.2) I 0.2 Q 8.2
Q 8.2 O I 0.2
S4 I 0.2 >=1
OR = O I 0.3
(I 0.3) I 0.3 = Q 8.2
I 0.3
L3 (Q 8.2)
Binary Logic Operations: Exclusive OR (XOR)
I 1.2 I 1.3
Q 8.1 I 1.2 A I 1.2
& Q 8.1
Set (S) A I 1.3
I 1.3 S S Q 8.1
I 1.4 Q 8.1
(R) I 1.4 O I 1.4
>=1 Q 8.1 O I 1.5
Reset I 1.5 R R Q 8.1
I 1.5
RLO – Edge Detection
LAD FBD STL
A I 1.0
I 1.0 I 1.1 M1.0 M8.0 I 1.0 &
M1.0 M8.0 A I 1.1
P FP M1.0
I 1.1 P = = M8.0
OB1 Cycle
I 1.0
I 1.1
RLO
Example
M1.0
M1.1
M8.0
M8.1
Digital Operations
T4
I 0.7 S_ODT
Q8.5
S Q
S5T#35s BI MW0
TV
I 0.5
R BCD QW12
Integer (INT, 16-Bit Integer) Data Type
Value range -32768 to +32767 Arithmetic
(without sign: 0 to 65535) operations: such as + I, * I, <I, ==I
Display Formats:
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Display Formats:
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Sign
positive
numbers
HEX: DW#16# 0 0 0 8 4 0 8 9
(without sign)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
Sign
negative
numbers
Example: 0.75
Sign of
Real no. e = Exponent (8 Bit) f = Mantissa (23 Bit)
31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
0 0 1 1 1 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
27 26 25 24 23 22 21 20 2-1 2-2 2-3 2-4 ..... 2-23
0 2 9 6
Sign (+) 2 9 6
Sign (+) 0 0 0 0 2 9 6
Number Conversion
Entered in BCD 0 81 5 BCD->Integer
User program
Task
with Integer
math operations
Number Conversion
displayed 0 2 4 8 BCD<-Integer
in BCD
Function
OB1
FC10
Global (shared)
data
Function DB20
FC20
...
A #On_1
A #On_2 ...
= #Off A #Start
... AN #Stop
= #Motor_on
...
Exercise X of day 7
Summary of day 7