s7300 variables

Upload: djeff71

Post on 06-Apr-2018

252 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 S7300 Variables

    1/38

    KUKTEM

    Working with STEP 7-300 V5.1

    Adriad CHOO Siemens S7 introduction 08.03.2012 1/30

  • 8/2/2019 S7300 Variables

    2/38

    KUKTEMWhat you will learn?

    Defining Symbols

    Contact switches and Logic gates

    Adriad CHOO Siemens S7 introduction 08.03.2012 2/30

    p- ops

    Timers

    Counters

  • 8/2/2019 S7300 Variables

    3/38

    KUKTEMBasic LAD instruction

    What is LAD?

    stand for Ladder Logic

    graphic programming language

    syntax of the instruction is similar to circuit diagram

    consists of elements and boxes which are connect graphically to form networks

    Adriad CHOO Siemens S7 introduction 08.03.2012 3/30

  • 8/2/2019 S7300 Variables

    4/38

    KUKTEMConfiguration and Element of LAD

    individual element no need address or parameters as this is a Logic Gate

    Elements and boxes can be classify as following group

    Adriad CHOO Siemens S7 introduction 08.03.2012 4/30

    individual element need to enter address and value as this is an Output

  • 8/2/2019 S7300 Variables

    5/38

    KUKTEM

    individual box with line indicating inputs and outputs

    fill in the input parameters

    S7 place the output information for you

    Adriad CHOO Siemens S7 introduction 08.03.2012 5/30

    EN/ENO function principles

    EN not activated ENO not activated

    EN activated ENO also activated if the box function executed (comparison done) without error EN activated ENO not activated if the box function executed (comparison done) with error

  • 8/2/2019 S7300 Variables

    6/38

    KUKTEMMemory area and their functions

    Global

    1

    8

    16

    32

    Adriad CHOO Siemens S7 introduction 08.03.2012 6/30

    Variables

    (for all

    programs)(Flag words)

    For Analogue use only

  • 8/2/2019 S7300 Variables

    7/38

    KUKTEM

    Global

    Variables

    (for all

    programs)

    Adriad CHOO Siemens S7 introduction 08.03.2012 7/30

    Local

    Variables

    (only for aparticular

    program)

    Counter and Data Block are only meant for High- end PLC programming

  • 8/2/2019 S7300 Variables

    8/38

    KUKTEMBit logic instructions

    Normally open contact

    If the instruction used is series, its combines the result of its signal state check according to the AND

    truth table

    If the instruction used is parallel, its combines the result of its signal state check according to the OR

    truth table

    Adriad CHOO Siemens S7 introduction 08.03.2012 8/30

    M30.0 is energized when input M10.0 AND M10.1 are ON

    M30.0 is energized when input M20.0 (OR) is ON

  • 8/2/2019 S7300 Variables

    9/38

    KUKTEM

    Normally close contact

    If the instruction used is series, its combines the result of its signal state check according to the AND

    truth table

    If the instruction used is parallel, its combines the result of its signal state check according to the OR

    truth table

    Adriad CHOO Siemens S7 introduction 08.03.2012 9/30

    M30.0 is energized when input M20.0 is OFF

    M30.0 is energized when input M10.0 and M10.1 are ON

    Switching between open & closed contact is not possible. Need to delete and re-insert!

  • 8/2/2019 S7300 Variables

    10/38

    KUKTEM

    Output coil

    If the power can flow across the circuit to reach the coil, the power energized the coil (green line)

    If the power cannot flow across the entire circuit to reach the coil, the power cannot energized the coil

    Adriad CHOO Siemens S7 introduction 08.03.2012 10/30

    M30.0 is energized when input M10.0 and M10.1 are ON M30.0 is energized when input M20.0 is OFFM30.1 is energized when input M10.0 and M10.1 and M20.1 are ON M30.1 is energized when input M20.0 is OFF and M20.1 is ON

  • 8/2/2019 S7300 Variables

    11/38

    KUKTEM

    Midline output (especially as an indicator)

    Intermediate assigning element that store the last Result of Logic Operation (RLO) status

    Function as normal contact, cannot be located at the end of network or end of an open branch

    Adriad CHOO Siemens S7 introduction 08.03.2012 11/30

    M40.0 is energized when input M10.0 and M10.1 are ON. As such, M40 is the RLO of M10.0 and M10.1

    M40.1 is energized when either midline coil M40.0, input M10.2 or M10.3 is Off

    M40.2 and M30.0 are energized when M40.1 is not energized

  • 8/2/2019 S7300 Variables

    12/38

    KUKTEM

    Invert power flow (Logic NOT)

    Reverse the RLO status

    Adriad CHOO Siemens S7 introduction 08.03.2012 12/30

    M30.0 is energized when input M10.0 is off or M20.0 and M20.1 are OFF

    M30.0 is not energized when M10.0 is ON or M20.0 and M20.1 are ON

  • 8/2/2019 S7300 Variables

    13/38

    KUKTEM

    Set coil

    Only execute when the RLO = 1, these instruction sets the specified address to 1

    If RLO = 0 the instruction has no effect on the specified address. The address remains unchanged

    Adriad CHOO Siemens S7 introduction 08.03.2012 13/30

    M30.0 energized when input M10.0 and M10.1 are On or M20.0 is OFF

    If the RLO of the branch is 0, The signal state of the M30.0 remains

    unchanged

  • 8/2/2019 S7300 Variables

    14/38

  • 8/2/2019 S7300 Variables

    15/38

    KUKTEM

    Set counter value

    To place a preset value into the counter you specified (max. count is 999)

    The transition is executed only if the RLO has a positive edge detection

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 15/30

    If the positive edge of the RLO detected, the counter C1

    is preset with a value 100

    If there is no positive edge, the preset value of the counter

    remains unchanged

  • 8/2/2019 S7300 Variables

    16/38

    KUKTEM

    Up counter coil

    Increments the value of the specified counter by one if RLO has a positive edge and the value of the

    counter less than 999 (if above 999, use Register)

    If the counter has value 999, the value of the counter does not change even RLO has a positive edge

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 16/30

    If there is a positive edge of RLO the value of counter C1

    Incremented by one

  • 8/2/2019 S7300 Variables

    17/38

    KUKTEM

    Down counter coil

    Decrements the value of the specified counter by one if RLO has a positive edge and the value of the

    counter more than 0

    If the counter has value 0, the value of the counter does not change even RLO has a positive edge

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 17/30

    If there is a positive edge of RLO the value of counter C1

    decremented by one

  • 8/2/2019 S7300 Variables

    18/38

    KUKTEM

    Pulse timer coil

    Produce a signal state of 1 after positive edge of RLO detected as long as the timer is running

    Produce a signal state of 0 after the timer expire or the RLO change to 0 before timer expire(As according to the

    preset time or the input,

    whichever shorter

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 18/30

    T1 is on after RLO detection and as long as the timer

    T1 is running

    T1 is off after timer T1 expire or M10.1 off before timer

    T1 is expire

  • 8/2/2019 S7300 Variables

    19/38

    KUKTEM

    Extended pulse timer coil (TP)

    Produce a signal state of 1 after positive edge of RLO detected as long as the timer is running

    Produce a signal state of 0 after the timer expire without regard the negative edge of the RLO(As according to the

    preset time only)

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 19/30

    T1 is on after RLO detection and as long as the timer

    T1 is running without regard the negative edge of the RLO

    T1 is off after timer T1 expire

  • 8/2/2019 S7300 Variables

    20/38

    KUKTEM

    On delay timer coil (Timer ON)

    Produce a signal state of 1 after positive edge of RLO and a specified time elapsed without error and

    RLO is still 1

    Produce a signal state of 0 if RLO change to 0 while the timer is running, the timer will stop

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 20/30

    If positive edge in the RLO, the timer T1 startIf the time elapses and the M10.1 still ON the M30.0 will switch to ONIf M10.1 change from 1 to 0 before timer T1 expired, the timer will stop and M30.0 remain OFF

  • 8/2/2019 S7300 Variables

    21/38

    KUKTEM

    Retentive on delay timer coil

    Produce a signal state of 1 after positive edge of RLO and a specified time elapsed without error even

    if the RLO change to 0 before the time elapsed

    Produce a signal state of 0 only when you reset the timer (external input to reset)

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 21/30

    Timer T1 start after positive edge of RLO, T1 will turn on after

    A specified time elapsed without regard negative edge of RLO

    T1 will remain on until reset by the reset instruction (external)

  • 8/2/2019 S7300 Variables

    22/38

    KUKTEM

    Off delay timer coil (Timer OFF)

    Produce a signal state of 0 after negative edge of RLO and a specified time elapsed without error and

    RLO is still 0

    Produce a signal state of 1 if RLO change to 1 while the timer is running, the timer will stop

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 22/30

    If M10.1 change from 1 to 0, the timer startIf M10.1 remain 0 after a specified time elapsed, T1 will turn offIf M10.1 change back to 1 while the timer is running, the timer will stop

  • 8/2/2019 S7300 Variables

    23/38

    KUKTEM

    Positive RLO edge detection (similar to counter but count above 999)

    recognized a change status of RLO from 0 to 1, the last state of the RLO will store in one address

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 23/30

  • 8/2/2019 S7300 Variables

    24/38

    KUKTEM

    Negative RLO edge detection (similar to positive RLO edge detection but used on NPN sensor)

    recognized a change status of RLO from 1 to 0, the last state of the RLO will store in one address

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 24/30

  • 8/2/2019 S7300 Variables

    25/38

    KUKTEM

    Address Positive edge detection (similar to AND gate)

    recognized a change status of address1 (exp: a sensor) from 0 to 1, the last state of the address1

    will store in address2

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 25/30

    In this case, I0.3 and

    M0.0 is combined asone

  • 8/2/2019 S7300 Variables

    26/38

    KUKTEM

    Address negative edge detection (similar to NAND gate)

    recognized a change status of address1 from 1 to 0, the last state of the address1 will store in

    address2

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 26/30

  • 8/2/2019 S7300 Variables

    27/38

    KUKTEM

    Set Reset flip-flop

    Signal state is 1 if 1 at the S input and 0 at the R input

    Signal state is 0 if 0 at the S input and 1 at the R input

    Signal state is 0 if 1 at the S input and 1 at the R input (therefore R is the Master)

    Using Functions in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 27/30

    Signal state and address is 1 if 1 at the S input and 0 at the R inputSignal state and address is 0 if 0 at the S input and 1 at the R inputSignal state is 0 if both S and R input are 1

  • 8/2/2019 S7300 Variables

    28/38

    KUKTEM

    Reset Set flip-flop

    Signal state is 0 if 1 at the R input and 0 at the S input

    Signal state is 1 if 0 at the R input and 1 at the S input

    Signal state is 1 if 1 at the S input and 1 at the R input (therefore S is the Master)

    Using Functions in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 28/30

    Signal state and address are 0 if 1 at the R input and 0 at the S inputSignal state and address are 1 if 0 at the R input and 1 at the S inputSignal state and address are 1 if both S and R input are 1

  • 8/2/2019 S7300 Variables

    29/38

    KUKTEMTimer Functions in Block Instruction

    Time value

    Method used to preload a value to a timer

    i. w#16#wxyz

    - Where w = time base (time interval or resolution)

    - Where xyz = time value in BCD format (up to max. 999)

    Adriad CHOO Siemens S7 introduction 08.03.2012 29/30

    ii. S5T#aH_bbM_ccS_ddMS (exp: 2hr42m36s = S5T#2H42M36S)

    - Where a = hours, bb = minutes, cc = seconds, d = milliseconds

    - Time base selected automatically, the value is rounded to the next lower number

    with that time base (exp: 42m36s to 43m)

    - This is the preferred method used

  • 8/2/2019 S7300 Variables

    30/38

    KUKTEM

    Time base

    Bit 12 & 13 of the timer word contain the time base in binary code.

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 30/30

    Resolutions and ranges

  • 8/2/2019 S7300 Variables

    31/38

    KUKTEM

    Choosing the right timer

    5 types of timer

    Using Functions in Bit Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 31/30

  • 8/2/2019 S7300 Variables

    32/38

    KUKTEM

    Pulse timer

    Using Functions in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 32/30

    Extended pulse timer

  • 8/2/2019 S7300 Variables

    33/38

    KUKTEM

    On delay timer

    Using Functions in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 33/30

    Retentive on delay timer

  • 8/2/2019 S7300 Variables

    34/38

    KUKTEM

    Off delay timer

    Using Functions in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 34/30

  • 8/2/2019 S7300 Variables

    35/38

    KUKTEMCounter Function in Block Instruction

    3 types of counter

    Up down counter

    - Input S = 1, set the counter with a preset value

    - Input R = 1, reset the counter with value 0

    - Input CU change from 0 to 1 and the value of the counter less than 999, the counter value

    increase by one

    Adriad CHOO Siemens S7 introduction 08.03.2012 35/30

    - ,decrease by one

    - Output Q = 1, if counter value more than 0

  • 8/2/2019 S7300 Variables

    36/38

    KUKTEM

    example

    Counter Function in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 36/30

    orce . on w oa to an _

    Reset M10.2

    Set M10.3 will reset CV and CV_BCD to 0

    Reset M10.3 to 0

    Set to 1 to increase CV by one

    Set to 1 to decrease CV by one

  • 8/2/2019 S7300 Variables

    37/38

    KUKTEM

    Up counter

    - Input S = 1, set the counter with a preset value

    - Input R = 1, reset the counter with value 0

    - Input CU change from 0 to 1 and the value of the counter less than 999, the counter value

    increase by one

    Counter Function in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 37/30

    - u pu = , coun er va ue more an

  • 8/2/2019 S7300 Variables

    38/38

    KUKTEM

    Down counter

    - Input S = 1, set the counter with a preset value

    - Input R = 1, reset the counter with value 0

    - Input CU change from 0 to 1 and the value of the counter less than 999, the counter value

    decrease by one

    Counter Function in Block Instruction

    Adriad CHOO Siemens S7 introduction 08.03.2012 38/30

    - u pu = , coun er va ue more an