Download as pdf or txt
Download as pdf or txt
You are on page 1of 38

KUKTEM

Working with STEP 7-300 V5.1

Adriad CHOO

Siemens S7 introduction

08.03.2012

1/30

What you will learn?

KUKTEM

Defining Symbols
Contact switches and Logic gates Flip-flops Timers Counters

Adriad CHOO

Siemens S7 introduction

08.03.2012

2/30

Basic 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

KUKTEM

Adriad CHOO

Siemens S7 introduction

08.03.2012

3/30

Configuration and Element of LAD


Elements and boxes can be classify as following group
individual element no need address or parameters as this is a Logic Gate

KUKTEM

individual element need to enter address as this is a Contact or Switch

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

4/30

KUKTEM
individual box with line indicating inputs and outputs

fill in the input parameters S7 place the output information for you

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

5/30

Memory area and their functions

KUKTEM
1 8 16 32

Global Variables (for all programs)

(Flag words)

For Analogue use only

Adriad CHOO

Siemens S7 introduction

08.03.2012

6/30

KUKTEM
Global Variables (for all programs)

Local Variables (only for a particular program)


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

Adriad CHOO

Siemens S7 introduction

08.03.2012

7/30

Bit logic instructions


Normally open contact

KUKTEM

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

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

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

8/30

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

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

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

Switching between open & closed contact is not possible. Need to delete and re-insert!
Adriad CHOO
Siemens S7 introduction 08.03.2012 9/30

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

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

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

10/30

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

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


Adriad CHOO
Siemens S7 introduction 08.03.2012 11/30

KUKTEM
Invert power flow (Logic NOT) Reverse the RLO status

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

12/30

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

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

13/30

KUKTEM
Reset coil Only execute when the RLO = 1, these instruction resets the specified address to 0 If RLO = 0 the instruction has no effect on the specified address. The address remains unchanged

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

M30.0 reset to 0 when input M10.0 and M10.1 are ON or M20.0 is OFF

Adriad CHOO

Siemens S7 introduction

08.03.2012

14/30

Using Functions in Bit Instruction


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

KUKTEM

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

15/30

Using Functions in Bit Instruction


Up counter coil

KUKTEM

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

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

16/30

Using Functions in Bit Instruction


Down counter coil

KUKTEM

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

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

17/30

Using Functions in Bit Instruction


Pulse timer coil

KUKTEM

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)

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

18/30

Using Functions in Bit Instruction


Extended pulse timer coil (TP)

KUKTEM

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)

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


Adriad CHOO
Siemens S7 introduction 08.03.2012 19/30

Using Functions in Bit Instruction


On delay timer coil (Timer ON)

KUKTEM

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

If the timeIf M10.1 change M10.1 still before M30.0 will switch to ON elapses RLO, from 1 to 0 start If positive edge in theand thethe timer T1ON the timer T1 expired, the timer will stop and M30.0 remain OFF

Adriad CHOO

Siemens S7 introduction

08.03.2012

20/30

Using Functions in Bit Instruction


Retentive on delay timer coil

KUKTEM

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)

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)

Adriad CHOO

Siemens S7 introduction

08.03.2012

21/30

Using Functions in Bit Instruction


Off delay timer coil (Timer OFF)

KUKTEM

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

IfIf M10.1 remainback to a while the time is running, the turn will M10.1 change 1 to 0, specified timer If M10.1 change from0 after 1the timer start elapsed, T1 willtimer off stop

Adriad CHOO

Siemens S7 introduction

08.03.2012

22/30

Using Functions in Bit Instruction


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

KUKTEM

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

23/30

Using Functions in Bit Instruction

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

24/30

Using Functions in Bit Instruction


Address Positive edge detection (similar to AND gate)

KUKTEM

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

In this case, I0.3 and M0.0 is combined as one

Adriad CHOO

Siemens S7 introduction

08.03.2012

25/30

Using Functions in Bit Instruction


Address negative edge detection (similar to NAND gate)

KUKTEM

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

26/30

Using Functions in Block Instruction


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)

KUKTEM

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

27/30

Using Functions in Block Instruction


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)

KUKTEM

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

28/30

Timer 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)

KUKTEM

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

Adriad CHOO

Siemens S7 introduction

08.03.2012

29/30

Using Functions in Bit Instruction


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

KUKTEM

Resolutions and ranges

Adriad CHOO

Siemens S7 introduction

08.03.2012

30/30

Using Functions in Bit Instruction


Choosing the right timer 5 types of timer

KUKTEM

Adriad CHOO

Siemens S7 introduction

08.03.2012

31/30

Using Functions in Block Instruction


Pulse timer

KUKTEM

Extended pulse timer

Adriad CHOO

Siemens S7 introduction

08.03.2012

32/30

Using Functions in Block Instruction


On delay timer

KUKTEM

Retentive on delay timer

Adriad CHOO

Siemens S7 introduction

08.03.2012

33/30

Using Functions in Block Instruction


Off delay timer

KUKTEM

Adriad CHOO

Siemens S7 introduction

08.03.2012

34/30

Counter Function in Block Instruction


3 types of counter Up down counter - Input S = 1, set the counter with a preset value

KUKTEM

- 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 - Input CD = change from 0 to 1 and the value of the counter more than 0, the counter value decrease by one - Output Q = 1, if counter value more than 0

Adriad CHOO

Siemens S7 introduction

08.03.2012

35/30

Counter Function in Block Instruction


example

KUKTEM

Reset M10.2

Force M10.2 on will load PV to CV and CV_BCD Set M10.3 will reset CV and CV_BCD to 0 Set to 1 to decrease CV by one Set to 1 to increase CV by one

Reset M10.3 to 0

Adriad CHOO

Siemens S7 introduction

08.03.2012

36/30

Counter Function in Block Instruction


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

KUKTEM

- 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 - Output Q = 1, if counter value more than 0

Adriad CHOO

Siemens S7 introduction

08.03.2012

37/30

Counter Function in Block Instruction


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

KUKTEM

- 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 - Output Q = 1, if counter value more than 0

Adriad CHOO

Siemens S7 introduction

08.03.2012

38/30

You might also like