bÀi giẢng mÔn hỌc siemens plc s7 – 300 - .bÀi giẢng mÔn hỌc siemens plc s7 – 300

Download BÀI GIẢNG MÔN HỌC SIEMENS PLC S7 – 300 - .BÀI GIẢNG MÔN HỌC SIEMENS PLC S7 – 300

If you can't read please download the document

Post on 21-Sep-2018

217 views

Category:

Documents

2 download

Embed Size (px)

TRANSCRIPT

  • BI GING MN HCSIEMENS PLC S7 300

    Chng m u: Gii thiu dng sn phm Siemens

    Chng 1: Nhp mn PLC S7 300

    Chng 2: Cu trc PLC S7 300

    Chng 3: Hng dn s dng phn mm lp trnh PLC S7-300

    Chng 4: Ngn ng lp trnh STL

    Chng 5: K thut lp trnh

    Chng 6: Bi tp thc hnh

  • CHNG MCHNG M UU: GI: GIIITHITHIU DNG SU DNG SN PHN PHMM

    SIEMENSSIEMENS

    PLC S7 200: loi cc nh, thch hp cho nhng ng dng ring l, vi s lng I/O va phi.

    PLC S7 300: loi trung bnh, thch hp cho nhng ng dng va phi.

    PLC S7 400: tiu chun mc cao p ng c cc bi ton iu khin mc cao nht.

  • CHNGCHNG 11::NHNHP MN PLC S7P MN PLC S7 300300

    2.1. i s Boolean

    2.2. Biu din s nguyn dng

    2.3. Biu din s nguyn c du

  • 2.1.2.1. ii ss BooleanBoolean

    2.1.1. Bin v hm hai tr

    - Bin 2 tr (Bin Boolean): l loi hm s m min gitr ca n ch c hai phn t, l 0 v 1

    - Hai bin Boole c gi l c lp vi nhau nu s thay i gi tr ca bin ny khng nh hng ti gitr ca bin kia

    - Ngc li, nu gi tr ca bin ny ph thuc vo gitr ca bin kia th gi l bin ph thuc

    - Hm hai tr l m hnh ton hc m t s ph thuc ca mt bin Boole vo cc bin Boole khc

  • 2.1.1. Bin v hm hai tr (tt)

    V d minh ha:x y z

    Cng tc x, y: l bin Boole hai tr (0 v 1)

    n z: cng l bin Boole hai tr

    x v y l hai bin Boole c lp nhau

    n z l bin Boole ph thuc vo hai bin cng tc

  • 2.1.2. 2.1.2. CCcc phphpp totonn trntrn hhmm haihai trtr

    0011

    1100

    yyxx

    a. Php Not (y = Not(x))

  • b. b. PhPhpp ccngng (z = x + y)(z = x + y)

    111111

    110011

    111100

    000000

    ZZYYXX

  • c. c. PhPhpp giaogiao (z = (z = x^yx^y))

    111111

    000011

    001100

    000000

    ZZYYXX

  • 2.2.2.2. BiBiuu didinn ss nguynnguyn dngdng

    2.2.1. Trong h c s 10 (h thp phn)

    Mt s nguyn dng un bt k, trong h c s 10 bao gi cng c biu din y bng dy con s nguyn t 0 n 9

    V d: un = 515 c biu din trong c s 10

    515 = 5.102 + 1.101 + 5.100

  • 2.2.2. 2.2.2. TrongTrong hh cc ss 2 (2 (hh nhnh phnphn))

    Cch biu din un trong h c s 10 cha ph hp vi nguyn tc mch in (hay nguyn tc hm 2 tr). sdng nguyn tc hm 2 tr, ta a ra khi nim bit.

    V d: un = 205

    c biu din nh sau:

    11001101

    205 = 1.27 + 1.26 + 0.25 + 0.24 + 1.23 + 1.22 + 0.21 + 1.20

  • 2.2.3. 2.2.3. TrongTrong hh cc ss 16 (16 (hh Hexadecimal)Hexadecimal)Cng ging nh h c s 10, mt s nguyn dng bt k cng c th biu din trong h c s 16 nh sau:

    V d: 7723 trong h c s 10 c biu din thnh 1E2B trong h c s 16

    1E2B = 1.163 + 14.162 + 2.161 + 11.160

    2.2.4. M BCD trong s2.2.4. M BCD trong s nguyn dng nguyn dngS 259 trong h thp phn c biu din di dng m BCD nh sau:

    0010 0101 1001

    2 5 9

  • 2.3. Biu din s nguyn c du

    S nguyn c du uk c biu din theo quy tc b loi 2 gm cc bc sau:

    -Biu din |uk| trong h c s 2 thnh dy cc bit xk

    -o gi tr tng bit xk, thnh

    -Cng thm 1

    V d: biu din uk=-15 trong h c s 2 vi di 8 bit? Ln lt thc hin theo 3 bc trn.

  • CHNGCHNG 22: C: CUU TRTRCC PLC S7PLC S7 300300

    2.1. nh ngha

    2.2. Cc tn hiu kt ni vi PLC

    2.3. Cc module ca PLC S7-300

    2.4. Kiu d liu v phn chia b nh

    2.5. Cu trc b nh ca CPU

    2.6. Vng qut chng trnh

    2.7. Cu trc chng trnh

    2.8. Cc khi OB c bit

  • 2.1. nh nghaThiet b ieu khien logic kha trnh PLC (Programmable Logic Controller) la loai thiet b cho phep thc hien linh hoat cac thuat toan ieu khien so thong qua mot ngon ng lap trnh, thay cho viec phai the hien thuat toan o bang mach so.

    u im: + Nho gon+ De thay oi thuat toan + De trao oi thong tin vi moi trng xung

    quanh (vi PLC khc hoc vi my tnh)

  • *> Cc b phn chnh ca PLC: - Bo vi x l trung tam (CPU)- He ieu hanh- Bo nh chng trnh - Cac cong vao ra,

  • 2.2. Cac tn hieu ket noi vi PLC

    + Tn hieu so: La cac tn hieu thuoc dang ham Boolean, dang tn hieu ch co 2 tr 0 hoac 1. oi vi PLC Siemens:

    - Mc 0: tng ng vi 0V hoac h mach - Mc 1 : tng ng vi 24V

    V d: Cac tn hieu t nut nhan, t cac cong tc hnh trnh, u l nhng tn hiu s.

    + Tn hieu tng t: L tn hiu lin tc t 0-10V hoc 4-20mA.V d: tn hiu c t cm bin loadcell,

  • 2.3.2.3. CCcc modulemodule ccaa PLC S7PLC S7 -- 300300

    2.3.1. Module CPU

    Modul CPU la loai Module cha vi x l, he ieu hanh, bo nh, cac bo thi gian, b m, cng truyn thng vacong vao ra so. Cac cong vao ra so tren CPU c goi la cong vao ra Onboard.Trong h PLC S7 300 c nhiu loi CPU khc nhau: CPU312, CPU314, CPU315,

  • 2.3.2. 2.3.2. CCcc module module mm rrngng::cc chiachia ththnhnh 5 5 loloii chchnhnh sausau::

    -- NguNgunn nuinui (PS: Power Supply):(PS: Power Supply): cungcung ccpp ngungunn chocho CPU CPU vv cccc module module khkhcc..

    -- SM (Signal Module):SM (Signal Module): Module Module ttnn hihiuu vvoo rara, , baobao ggmm::+ DI: Digital Input+ DI: Digital Input+ DO: Digital Output+ DO: Digital Output+ DI/DO: Digital In/Output+ DI/DO: Digital In/Output+ AI: Analog Input+ AI: Analog Input+ AO: Analog Output+ AO: Analog Output+ AI/AO: Analog In/Output+ AI/AO: Analog In/Output

    -- IM (Interface Module):IM (Interface Module): Module Module ghghpp nnii-- FM (Function Module):FM (Function Module): Module Module iiuu khikhinn ringring: : iiuu

    khikhinn Servo,Servo,-- CP (Communication Module):CP (Communication Module): Module Module truytruynn thngthng

  • 2.4. 2.4. KiKiuu dd liliuu vv phnphn chiachia bb nhnh

    KiKiuu BOOL:BOOL: dung dung llngng mmtt bit, bit, cc gigi trtr 0 0 hohocc 11

    KiKiuu BYTE:BYTE: ggmm 8 bits, 8 bits, cc ddngng bibiuu didinn ssnguynnguyn dngdng trongtrong khokhongng tt 0 0 nn 255.255.

    KiKiuu WORD:WORD: ggmm 2 bytes, 2 bytes, bibiuu didinn mmtt ss nguynnguyndngdng tt 0 0 nn 65535.65535.

    KiKiuu INT:INT: 2 bytes, 2 bytes, bibiuu didinn ss nguynnguyn trongtrong khokhongng tt--32768 32768 nn 32767.32767.

    KiKiuu DINT:DINT: 4 bytes, 4 bytes, bibiuu didinn ss nguynnguyn tt --2147483648 2147483648 nn 2147483647.2147483647.

  • 2.4. 2.4. KiKiuu dd liliuu vv phnphn chiachia bb nhnh ((tttt))

    KiKiuu S5TS5T (hay S5TIME): (hay S5TIME): khokhongng ththii giangian, , cc ttnhnhtheotheo gigi/ph/pht/giy/milit/giy/mili giygiy. .

    KiKiuu TOD:TOD: bibiuu didinn gigi trtr ththii giangian ttnhnh theotheogigi/ph/pht/giyt/giy..

    KiKiuu DATE:DATE: bibiuu didinn gigi trtr ththii giangian ttnhnh theotheo nmnm//ththng/ngng/ngyy..

    KiKiuu CHAR:CHAR: bibiuu didinn mmtt hohocc nhinhiuu kk tt ((nhinhiuunhnhtt ll 4 4 kk tt).).

  • 2.5.2.5. CCuu trtrcc bb nhnh ccaa CPUCPU

    BB nhnh ccaa S7 S7 300 300 cc chiachia llmm 3 3 vvngngchchnhnh::

    VVngng chchaa chngchng trtrnhnh ngng ddngng:: cc chiachia llmm 3 3 miminn::+ OB+ OB (Organization block): (Organization block): miminn chchaa chngchng trtrnhnh ttchchcc..+ FC+ FC (Function): (Function): miminn chchaa chngchng trtrnhnh con con cc ttchchcc ththnhnh hhmm cc bibinn hhnhnh ththcc traotrao ii dd liliuuvvii chngchng trtrnhnh ggii nn..+ FB+ FB (Function block): (Function block): miminn chchaa chngchng trtrnhnh con, con, cc tt chchcc ththnhnh hhmm, , cc khkh nngnng traotrao ii dd liliuuvvii bbtt cc mmtt khkhii chngchng trtrnhnh nnoo khkhcc. .

  • VVngng chchaa thamtham ss ccaa hh iiuu hhnhnh vv chngchngtrtrnhnh ngng ddngng+ I+ I (Process image input): (Process image input): miminn bb mm cccc dd liliuu ccngng vvooss. . + Q+ Q (Process image output): (Process image output): miminn bb mm cccc dd liliuu ccngng rarass..+ M:+ M: miminn cccc bibinn cc. . ChngChng trtrnhnh ngng ddngng ss ddngng vvngngnhnh nnyy lulu gigi cccc thamtham ss ccnn thithitt vv cc thth truytruy nhnhppnn theotheo bit (M), byte (MB), bit (M), byte (MB), tt (MW) hay (MW) hay tt kkpp (MD).(MD).+ T:+ T: miminn nhnh phphcc vv bb ththii giangian (Timer) (Timer) baobao ggmm vivicc lulugigi gigi trtr ththii giangian tt trtrcc (PV: Preset value), (PV: Preset value), gigi trtr mmththii giangian ttcc ththii (CV: Current value)(CV: Current value)+ C:+ C: miminn nhnh phphcc vv bb mm (Counter), (Counter), baobao ggmm vivicc lulugigi gigi trtr tt trtrcc, , gigi trtr mm ttcc ththii, , gigi trtr logic logic uu raraccaa bb mm..+ PI:+ PI: MiMinn aa chch ccngng vvoo ccaa cccc module module tngtng tt+ PQ:+ PQ: miminn aa chch ccngng rara chocho cccc module module tngtng tt

  • VVngng chchaa cccc khkhii dd liliuu: : cc chiachia ththnhnh 2 2 loloii

    + DB+ DB (Data block): (Data block): MiMinn chchaa cccc dd liliuu cc tt chchccththnhnh khkhii. . KKnhnh ththcc vv ss llngng khkhii do do ngngii ssddngng quyquy nhnh, , phph hhpp vvii ttngng bbii totonn iiuu khikhinn

    + L+ L (Local data block): (Local data block): MiMinn dd liliuu aa phngphng, , cccccc khkhii chngchng trtrnhnh OB, FC, FB OB, FC, FB tt chchcc, , ss ddngng chochocccc bibinn nhnhpp ttcc ththii vv traotrao ii dd liliuu ccaa bibinn hhnhnhththcc vvii nhnhngng khkhii chngchng trtrnhnh ggii nn. . NNii dung dung ccaa mmtt ss dd liliuu trongtrong miminn nhnh nnyy ss bb xxaa khikhi kkttththcc chngchng trtrnhnh tngtng ngng trongtrong OB, FC, FB. OB, FC, FB.

  • 2.6. 2.6. VngVng ququtt chngchng trtrnhnh PLC PLC ththcc hihinn chngchng trtrnhnh theotheo chuchu trtrnhnh llpp. . MMii

    vngvng llpp cc ggii ll vngvng ququtt (scan). (scan). MMii vngvng ququttcc bbtt uu bbngng giaigiai oonn chuychuynn dd liliuu tt cccc ccngngvvoo ss ttii vvngng bb mm oo I, I, titipp theotheo ll giaigiai oonn ththcchihinn chngchng trtrnhnh. .

    TrongTrong ttngng vngvng ququtt, , chngchng trtrnhnh cc ththcc hihinn ttllnhnh uu tintin nn llnhnh kktt ththcc ccaa khkhii OB1. OB1.

    SauSau giaigiai oonn ththcc hihinn chngchng trtrnhnh ll giaigiai oonnchuychuynn cccc nnii dung dung ccaa bb mm oo Q Q ttii cccc ccngng rarass. .

    VngVng ququtt cc kktt ththc