Post on 19-Oct-2015
description
LG PLC
http://plcforall.com
Http://plcforall.comby:pyman rasehk
2
"#$%%&'%&()*
+%,'%&
--(. /-'
$01-23&4(5267#8$(#$96'%:6
;
3
70%*'%:60,3"$9&(@,
4
5
B6m 6^,1$g6
nB1$g-2/
UPLC
8LD(Ladder Diagram) $d^IEC61131-3
\5LPLC"-( [2(
"( [2(Simens Logo"( [2(Omron Zen
"( [2(-$%U"8-G-GR&("&($&B
" *o,_3+( [2(GDisplay-$&-GR&8#PC_3+ e$gBC
DBp 39$+0
6
1- LD ( Ladder Diagram ) 2- FBD ( Function Block Diagram ) 3- SFC ( Sequential Function Chart ) 4- IL ( Instruction List ) 5- ST ( Structured Text )
6O3gPLC"
--X("(PLCO:G --("('
--("(. /
Http://plcforall.com
7
O3PLC
(3+0"q"(-
8
PLC("&6%1,-/$"$%%&HMI (Human Machine Interface)3"&
9
----------- ----------- -----------
3U[--5Q8(t A"$B
X-9U
3ZVg&U4/u9-$&
o(5QAPA3Q`G
10
I1=%IX0.0.0 Q1=%QX0.0.0 I2=%IX0.0.1 Q2=%QX0.0.1 I3=%IX0.0.2 Q3=%QX0.0.2 I4=%IX0.0.3 Q3=%QX0.0.3
'WD2(7(
A B C F 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1
F=AB+BC+AC
"#3PLC^d$IEC61131-3
;X8"#Short integer (SINT)
Http://plcforall.com
11
"#8XShort integerG58
12
;X8#Integer-#XL58
13
=4,294,967,295 DINT-2,147,483,648+2,147,483,647
0-$$gL>IDnInekDn!C
14
T-MC&$%U"3$g-(+F-4(G+F--?U6$-B
;X8#ByteE =5#XLGt A5Q8
15
-"IECC;0F3>Pulse timerCD;003,->On Delay TimerC;003]^[>Off Delay TimerC
;0F3>pulser timerCPt%0-8?
ETH8(#$9 Q5"5Q8
637%U?):/?U($%6
-30(->INC| 7q$%}}0$%| -, 0`$3",-?$%~3}#7"30?%}
'W$%}Q2~3R$| B
16
%[#R3%"RQ'W>#BC
Http://plcforall.com
17
D
;,-030>On Delay TimerC0-
18
`30-
19
'W"P?0M1-M2-M3p -8?%}p -L9-B;$O}8S10M10M@$-9L9-wO+$3L9-BD;0M2M8r*w$9L9-M1O+@$-9L9-$3L9-B;M3q!$9L9-8r*wM2$3L9-O+@$-9L9-BI; ]^[ 8r*M1>\ ]^[ C 0M2 8 $+DM - 9 ]^[ wM3]^[ 8r*
0M29]^[B
9/ 5L3F cd?D:\GMWIN 4\Source\m1m2m3
[B
Http://plcforall.com
20
'W%U&$!00s _S6600#--$9L9-p S
w$%R/-q$9w$%R
21
Http://plcforall.com
22
55-4%64&OL6
-754%6
; $%U"5Q$[5B
D; 5GL6"#X$(--(--6$9B
; $+0L65"(--(-#3"-GB
I; 24L65"G*EN-*GENOq
23
":O3g(=#$%%&U
X8UF$%U"B--("#130(8>63Q"#$8$%9XGBC
GEO[3"WNE---E =5(=?"U$%6B
4%65-4&OL65Great thanC728 IN1>IN2>IN3>IN4>IN5>IN6>IN7>IN8
GL>Great EqualC72-U( IN1>=IN2>=IN3>=IN4>=IN5>=IN6>=IN7>=IN8
LT>Less thanC86R& IN1
24
IN1
25
D;_69Q-D--I8#%*0#&9"aB
I; _#%*--$--44+0$9Nq(8Q&L"1$B
!; -(-_69(O&"$g$(#$9#q
26
--1T P8$+(--X-(-(O&$OKO&%&G--0$(#%*39
8[#%*L9#$B
--130T P8$+4-T P4%6-@,3"?-&@-0L
O& $O& #&G>- 7 6("P ?-(O& $DO&%&G & $L
---
27
/rH-Compile%68#%*-?8B
H-r8#%*
28
Http://plcforall.com
29
30
'Q?(
31
1 0 0 0 0 0 0 2 * 1 0 0 0 0 0 3 * * 1 0 0 0 0 4 * * * 1 0 0 0 5 * * * * 1 0 0 6 * * * * * 1 0 7
32
_$m O-
33
4&OL65-L65
&0-4%65S4%65$m OL65
34
$0#o$g%(g$g(>'3C
"#$39
30PLC"#$39_3+"(8-B; +,#$39(UP Counter>3"PLC$"C D; -2#$39Down Counter>3"PLC$"C ; +,#$39(-2Up/Down Counter>$W&&C I; =OQ#$39(Ring Counter
;+,#$39(>Up CounterCCU=counter up input pulse (Bool) R=Reset Input (Bool) PV=Preset value (Int) Q=Counter out put ( Bool) CV=Counter value (Int) R=1 CV=0 CV=>PV Q=1
--r* " (CU $=CV625v-- -$(r*R0 3
35
D;-2#$39Down Counter>3"PLC$"C
CD=Counter Down input pulse (Bool) LD=Load preset value (Bool) PV=Preset value (Int) Q=Counter output (Bool) CV=Counter value (Int) LD=1 CV=PV CV=UP/Down CounterC
36
------------------------------
CU=Counter up pulse Input (Bool) | R = 1 CV = 0 CD=Counter Down pulse Input (Bool) | LD =1 CV = PV R=Reset Input (Bool) | CV => PV QU = 1 LD=Load preset value (Int) | CV =< 0 QD=1 PV=Preset value (Int) ------------------------------
QU=Up Counter output (Bool) QD=Down Counter Output (Bool) CV=Counter value (Int)
I;=OQ#$39(>Ring CounterC
CU=Counter up pulse Input (Bool) PV=Preset value (Int)
Http://plcforall.com
37
R=Rest Input "#$39L#:iPV CV$"PB
'W(PV=40 1 2 3 4 ^ | | | -------------------
L65-GMWIN
38
!; @$+01
e; 4(--(@$+07q9UeMMMM$
k; 7$+0@--(!IMMM*v "&4&$(--($98
; [7O"
39
RTC>Real Time ClockC/@A (
40
"8-("_RTC_Week q%9-M
q%9
q%94RD
q%%*
q+3I
q%9!
q%6e
'W"0?("8-(
41
_RTC_Time[$g] | -----------------------------------------------------------------------------------------
-
| | | | | | | | 0 1 2 3 4 5 6 7
["8-("w[=
42
'W#$39V
0":GMWIN
F_Trig *#$-L
Http://plcforall.com
43
R_Trig#$-_
0r*$48(
N 0["r*$=
PLC?""(006r*$8]=$N OPB
T0
44
8(r*"0?GDuty cycle%0 [$99?B
" 4-digit 7 segment code: use SEG function 2) 4-digit HEX -> 4-digit 7 segment code: use SEG function 3) INT -> 4-digit BCD-type 7 segment code use INT_TO_BCD function first and SEG function
Http://plcforall.com
45
4) INT - 4-digit HEX-type 7 segment code: use INT_TO_WORD function first and SEG function 5) When 7 segment display digits are more than 4, A) in case of BCD, HEX type, use SEG function, after dividing them into 4 digits. B)INT -> 8-digit BCD-type 7 segment code Divide INT by 10,000 and convert quotient and remainder into upper/lower 4-digit 7 segment code using INT_TO_BCD and SEG function
(1) If the transition condition (%M0)01 SEG function is executed. (2) If input variable BCD_DATA (WORD) = 16#1234. The output is 2#00000110_0l011011_0l001111_01100110 which is displayed as a 7 segment code (1234) and written at SEG_PATTERN (DWORD).
46
--#X(X87Word-#X$9X8$DwordX87-$9DwordX8$Long word $9B
"-$9#&?p /XOR#-&[B
'W
47
-8@A $L$9
'Q"P@A ?AM-PM%?B
48
"(
Subroutine call Jump Return\
"(
Shift Rotate
Shift left10111001 11001000 4(,
49
":O3g(0o-(4%65(0-8
1- ADD-Time 2- Sub-Time 3- Mul-time 4- Div-Time 5- Concat-Time 6- Sub-TOD 7- Sub-date 8- Sub-DT
;ADD-Time?"8-&]3
50
D;Sub-Time0d?"88-
Http://plcforall.com
51
;Mul-Time8&T F$gG
52
I;Div-TimeU=08?$gG
Http://plcforall.com
53
!; Concat-Time?"8-&A
54
e; Sub-TOD0d88-$6:
Http://plcforall.com
55
k;Sub-Date00d?"88-
56
;Sub_DT08-8-d
Http://plcforall.com
57
--(--4PLC4%:([2$d
A/D . /' D/A . /'
DONE&rQ@&7BSTAT+[@&
58
0 10V -10 10 v 0 5V
0$_#-78#-7