gmprg083functio.pdf

Upload: masimerise

Post on 03-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 GMPRG083Functio.pdf

    1/23

    8. Function/Function block libraries

    8-109

    8.2 Function block libraries

  • 7/29/2019 GMPRG083Functio.pdf

    2/23

    8. Function/Function block libraries CTD

    8-110

    CTDProduct GM1 GM2 GM3 GM4 GM5Down counter

    Applicable

    Function Description

    CTD

    BOOL CD Q BOOL

    BOOL LD

    INT PV CV INT

    Input CD : Down_Count pulse inputLD : Load preset valuePV : Preset Value

    Output Q : Count_Down output

    CV : Current Value

    Function

    !"!#!$

    %!# &'() *+"

    &'()

    ,-.#!#/!#0.#1

    23!#$

    Time chart

    -/.1

    !/4!1

    !#/!1

    3/!41

    Program example

    .536$$5*$7

    LD IL

    %IX0.1.14

    %QX0.3.0

    CAL CTD COUNT_0

    CD %IX0.1.14

    LD _1ON

    PV 5

    LD COUNT_D.Q

    ST COUNT_Q

    LD COUNT_D.CV

    ST COUNT_CV

    LD COUNT_Q

    S %QX0.3.0

    .#/.1

    89/&'()1$

  • 7/29/2019 GMPRG083Functio.pdf

    3/23

    CTD 8. Function/Function block libraries

    8-111

    /1 :!"/!2;+"41

    /1 *5*6$7!

    /1 *;

  • 7/29/2019 GMPRG083Functio.pdf

    4/23

    8. Function/Function block libraries CTU

    8-112

    CTUProduct GM1 GM2 GM3 GM4 GM5Up counter(function block)

    Applicable

    Function Description

    CTU

    BOOL CU Q BOOL

    BOOL R

    INT PV CV INT

    Input CU : Up_Count pulse input

    R : Reset input

    PV : Preset Value

    Output Q : Up_Count output

    CV : Current Value

    Function

    ;!";!#!;$

    %!#'('9*+"

    '('

    ,:!#/$1

    23!#.#

    !";9.#!";!";

    Time chart

    :/:1

    !;/;4!1 89/'('1

    .#/.#1

    !#/!#1

    3/;4!1

    Program example

    .536$$5*6$

    LD IL

    %IX0.1.5

    %QX0.3.0

    CAL CTU COUNT_UCU %IX0.1.15

    R %IX0.1.5

    PV 10

    LD COUNT_U.Q

    ST COUNT_Q

    LD COUNT_U.CV

    ST COUNT_CV

    LD COUNT_Q

    S %QX0.3.0

  • 7/29/2019 GMPRG083Functio.pdf

    5/23

    CTU 8. Function/Function block libraries

    8-113

    /1 :!";/!2;+"41

    /1 *5*$!;

    /1 *$.#

    /71 ?:A!#/5*$1

    /1 */!2;+"4!#1!#

    /(1 */!2;+"4313

    /'1 >9.-!

    /)1 9/?:1

    /@1 !!#/!4!#15*$

    /$1 > !# $ +$

    3/!2;+"431

    /1 ,3/!2;+"43153$$

  • 7/29/2019 GMPRG083Functio.pdf

    6/23

    8. Function/Function block libraries CTUD

    8-114

    CTUDProduct GM1 GM2 GM3 GM4 GM5Up/Down counter(Function block)

    Applicable

    Function Description

    CTUD

    BOOL CU QU BOOL

    BOOL CD QD BOOL

    BOOL R

    BOOL LD

    INT PV CV INT

    Input CU : Up_Count pulse input

    CD : Down_Count pulse input

    R : Reset input

    LD : Preset Value load

    PV : Preset Value

    Output QU : Count_Up output

    QD : Count_Down output

    CV : Current Value

    Function

    ;B!";!#!;$!#

    !$

    !#!#&'()9'('!#

    9!#

    ,-.#!#/!#0.#1

    ,:!#/$1/!#0$1

    23;!#.#3!#$

    "9: C-C!;C!

    9

    Time chart

    -/.1

    :/:1

    !;/;4!1

    !/4!1

    !#/!1

    3;/!4;1

    3/!41

    .#/.1

    $

  • 7/29/2019 GMPRG083Functio.pdf

    7/23

    CTUD 8. Function/Function block libraries

    8-115

    ?">!D48>6/$$>1

    $

    Program example

    LD IL

    IN

    OUT

    CAL CTUD INS_CUD

    CU:= IN

    CD:= OUT

    R := %M0

    LD:= %M1

    PV:= STACK_MAX

    LD INS_CUD.QU

    ST STACK_FULL

    LD INS_CUD.QD

    ST STACK_EMPTY

    LD INS_CU.CV

    ST STORED_NUMBER

    "$$/?">!D48>61*+

    2;",

    ?">!D4!D48>612

    ?">!D48."E

    58

    58$

    *+

    2;"

    ?"2:4+;8:

    ?">!D4

  • 7/29/2019 GMPRG083Functio.pdf

    8/23

    8. Function/Function block libraries F_TRIG

    8-116

    F_TRIGProduct GM1 GM2 GM3 GM4 GM5Drop edge detection(Function block)

    Applicable

    Function Description

    F_TRIG

    BOOL CLK Q BOOL

    Input CLK : Input signal

    Output Q : Falling edge detection result

    Function

  • 7/29/2019 GMPRG083Functio.pdf

    9/23

    I_HSC 8. Function/Function block libraries

    8-117

    I_HSCProduct GM1 GM2 GM3 GM4 GM5Internal high speed counter (Function Block)

    Applicable

    Function Description

    I_HSC

    BOOL REQ DONE BOOL

    BOOL RST ERR BOOL

    USINT PO S STG USINT

    USINT M ASK OUT USINT

    UDINT PV_1 CV UDINT

    USINT ST_1

    UDINT PV_4

    USINT ST_4

    Input REQ : Counter operation input

    RST : Counter reset input

    POS : Direct output position selection

    MASK : Output contact selection of the module

    PV_1 : Stage 1 Preset Value

    ST_1 : Stage 1 output (Status)

    Stage range is from 1 to 4.

    Output DONE : Output '1' when final stage is completed

    ERR : Error display

    STG : Stage under count

    OUT : Preset value of counting stage

    CV : Current value of counting stage

    Function

    &F8"A%?!G

    %?!&"

    # H $#=7#

    * H (>/7#1('>/$#1

    82?D II ?D0(J$

  • 7/29/2019 GMPRG083Functio.pdf

    10/23

    8. Function/Function block libraries F_TRIG

    8-118

    *:3 $ ?"4 2;"

    .#4,.#4A9/.#41

    ?"4>9 .#49 $ II2+I$I 2;"

    Time chart

    Program example

    ,.#0$$.#0)$.#0$.#70$I$I$.#&

    II .#.#&II .#

    .#7&"

    "9

    #>-#H53$$$ 0C .2?0$

    #>-#K$LH536$$$

    #>-#KLH536$$

    #>-#KLH536$$ 0C 8>?D0(J$-#KLH536$$

  • 7/29/2019 GMPRG083Functio.pdf

    11/23

    I_HSC 8. Function/Function block libraries

    8-119

    LD IL

    CAL I_HSC INT_HSCREQ := START

    RST := RESET

    POS := POS

    MASK:= MASK

    PV_1:= PV1

    ST_1:= 1

    PV_2:= PV2

    ST_2:= 2

    PV_3:= PV3

    ST_3:= 4

    PV_4:= PV4

    ST_4:= 8

    LD INT_HSC.DONE

    ST END

    LD INT_HSC.ERR

    ST ERROR

    LD INT_HSC.STG

    ST STAGE

    LD INT_HSC.OUT

    ST OUT

    LD INT_HSC.CV

    ST CUR_VAL

    "

  • 7/29/2019 GMPRG083Functio.pdf

    12/23

    8. Function/Function block libraries RS

    8-120

    RSProduct GM1 GM2 GM3 GM4 GM5Reset Priority Bistable(Function block)

    Applicable

    Function Description

    RS

    BOOL S Q1 BOOL

    BOOL R1

    Input R1 : Reset condition

    S : Set condition

    Output Q1 : Operation result

    Function

    : M 3

    ? C0

    3

    *:3$?

    "3:$?

    "3$

    Time chart

    :

    ?

    3

    Program example

    LD IL

    CAL RS INS_R

    S: = SET1R1: = RESET1

    LD INS_R.Q

    ST RESULT

    ":?":?"?:?;-"

  • 7/29/2019 GMPRG083Functio.pdf

    13/23

    R_TRIG 8. Function/Function block libraries

    8-121

    R_TRIGProduct GM1 GM2 GM3 GM4 GM5Rising edge detection (Function Block)

    Applicable

    Function Description

    R_TRIG

    BOOL CLK Q BOOL

    Input CLK : Input clock

    Output Q : Rising edge detection result

    Function

    :4":*F3!-D$$99

    Time chart

    !-D

    3

    /:4":*F91

    Program example

    LD IL

    CAL R_TRIG INS_RT

    CLK: = IN_SIGNAL

    LD INS_RT.Q

    ST RISE_DETECT

    /1 2 :*?4"!" *+4?*F+>- $ $ :*?4"!" *+?4:"

    9

  • 7/29/2019 GMPRG083Functio.pdf

    14/23

    8. Function/Function block libraries SEMA

    8-122

    SEMAProduct GM1 GM2 GM3 GM4 GM5Semaphore for system resource control(Function block)

    Applicable

    Function Description

    SEMA

    BOOL CLAIM BUSY BOOL

    BOOL RELEASE

    Input CLAIM : Resource monopoly request signal

    RELEASE : Release signal

    Output BUSY : Acquisition disable signal of requested

    resource(Wait)

    Function

    "N9

    9?8>/!->*80$:->?0$1;?E

    "N?8>!->*80:->?0$

    ;?E$,;?E$9?8>!->*80$

    :->?0

    /"?8>!->*80$:->?09

    1

    O ?8>IN

    O N

    O ?F8!.;

    O *9?8>

    #>: 6H22-H0$P +4#>:

    ;?EH06P

    **8 "%+ 6H0P

    -?*? "%+ ;?EH0$P6H0$P

    +4*

    !->*8 > >

    :->? > >

    ;?E

    ! ;> ; ;> ;

  • 7/29/2019 GMPRG083Functio.pdf

    15/23

    SEMA 8. Function/Function block libraries

    8-123

    Program example

    LD IL

    CAL SEMA PRINTER

    CLAIM:= START

    RELEASE:= END

    LD PRINTER.BUSY

    ST NOT_AVAIL

    *.-!I.:*+":I

    ?8>I.:*+":I

    ;?E+2"4>#>*-N

    I.:*+":I?8>?">:"+$

    *;?E$>9I.:*+":I?8>?">:"0$+0

    #>:46":+>-

    .:*+":H?8>

    +4#>:

    ? + !->*84."

    " ."4>#>*-

    ? + .:*+"*+F

    " .:"4+

    ? . :-4.:"

    " :4.:"

    ? !->*84."P.N

    CAL SEMA PRINTER

    CLAIM:= 1

    RELEASE:= 0

    " ."4>#>*-P.N

    LDN PRINTER.BUSY

    ST TRANS

    ? .:*+"*+FP.

    Printer control program

    When completing the print, PRINT_DONE:= 1

    " .:"4+P.

    LD PRINT_DONE

    ST TRANS

    ? :-4.:"P.

    CAL SEMA PRINTER

    CLAIM:= 0

    RELEASE:= 1

    " :4.:"P.N

    LD PRT_REQ

    ST TRANS

  • 7/29/2019 GMPRG083Functio.pdf

    16/23

    8. Function/Function block libraries SEMA

    8-124

    Print output

    User FBOrProgram

  • 7/29/2019 GMPRG083Functio.pdf

    17/23

    SR 8. Function/Function block libraries

    8-125

    SRProduct GM1 GM2 GM3 GM4 GM5Set Priority Bistable

    Applicable

    Function Description

    SR

    BOOL S1 Q1 BOOL

    BOOL R

    Input S1 : Set condition

    R : Reset condition

    Output Q1 : Operation result

    Function

    ? C0 3

    : M

    3

    ,?3:

    23$?$:

    * 3$

    Time chart

    ?

    :

    3

    Program example

    LD IL

    CAL SR INS_S

    S1: = SET1

    R: = RESET1

    LD INS_S.Q1

    ST RESULT

    /1 ,?"2:?;-"

    /1 *?"2

  • 7/29/2019 GMPRG083Functio.pdf

    18/23

    8. Function/Function block libraries TOF

    8-126

    TOFProduct GM1 GM2 GM3 GM4 GM5OFF delay timer(Function block)

    Applicable

    Function Description

    TOF

    BOOL IN Q BOOL

    TIME PT ET TIME

    Input IN : Timer operation condition

    PT : Preset Time

    Output Q : Timer output

    ET : Elapsed Time

    Function

    **+33$*+0$."

    2"*+$

    **+"$

    Time chart

    *+

    3

    ."

    .."

    "

    Program example

    LD IL

    INS_TOF

    TOFT_OFF

    T#10S PT

    IN

    ET

    Q

    ET_TIME

    TIMER_OK

    CAL TOF INS_TOF

    IN:= T_OFF

    PT:= T#10S

    LD INS_TOF.Q

    ST TIMER_OK

    LD INS_TOF.ET

    ST ET_TIME

  • 7/29/2019 GMPRG083Functio.pdf

    19/23

    TOF 8. Function/Function block libraries

    8-127

    "42

  • 7/29/2019 GMPRG083Functio.pdf

    20/23

    8. Function/Function block libraries TON

    8-128

    TONProduct GM1 GM2 GM3 GM4 GM5ON delay timer(Function block)

    Applicable

    Function Description

    TON

    BOOL IN Q BOOL

    TIME PT ET TIME

    Input IN : Timer operation condition

    PT : Preset Time

    Output Q : Timer output

    ET : Elapsed Time

    Function

    2"*+

    **+$"$

    **+$33$

    Time chart

    *+

    3

    ."

    .."

    "

    Program example

    LD IL

    INS_TON

    TONT_TON

    T#10S PT

    IN

    ET

    Q

    ET_TIME

    TIMER_OK

    CAL TON INS_TON

    IN: = T_ON

    PT: = T#10S

    LD INS_TON.QST TIMER_OK

    LD INS_TON.ET

    ST ET_TIME

  • 7/29/2019 GMPRG083Functio.pdf

    21/23

    TON 8. Function/Function block libraries

    8-129

    "42+

    "*8:42D

    $

    .$

    "4"*8

    /1 *$"42+ "*8:42D

    /1 >"42+"&"*8

    /1 *"42+$"4"*8$"4"*8$

    /71 *"42+$"*8:42D"*8:42D$"4"*8$

  • 7/29/2019 GMPRG083Functio.pdf

    22/23

    8. Function/Function block libraries TP

    8-130

    TPProduct GM1 GM2 GM3 GM4 GM5Pulse timer(Function block)

    Applicable

    Function Description

    TP

    BOOL IN Q BOOL

    TIME PT ET TIME

    Input IN : Timer operation condition

    PT : Preset Time

    Output Q : Timer output

    ET : Elapsed Time

    Function

    **+3"."3$

    "*+."$*+$*

    *+$"

    Time chart

    *+

    3

    ."

    .."

    "

    Program example

    LD IL

    INS_TP

    TPT_TP

    T#10S PT

    IN

    ET

    Q

    ET_TIME

    TIMER_OK

    CAL TP INS_TP

    IN: = T_TP

    PT: = T#10S

    LD INS_TP.QST TIMER_OK

    LD INS_TP.ET

    ST ET_TIME

  • 7/29/2019 GMPRG083Functio.pdf

    23/23

    TP 8. Function/Function block libraries

    "4".

    "*8:42D $ .$

    "4"*8

    /1 >"4".$"*8:42D$>

    "4".$

    /1 "4"*8"J$?,"4".$"4"*8