Programming in Siemens Plcs

13
PROGRAMMING IN SIEMENS PLCs The STEP 5 programming language is used for writing user programs for programmablle controllers of the SIMATIC S5 system. STEP 7 language is used for SIMATIC S7 system PLCs. THIS PROGRAM CAN BE REPRESENTED IN 3 WAYS LADDER DIAGRAM (LAD) STATEMENT LIST (STL) CONTROL SYSTEM FLOW CHART (CSF) / FUNCTIONAL BLOCK DIAGRAM (FBD) The LADDER DIAGRAM (LAD) uses graphic circuit diagram symbols (american representation) to represent the automation task. The STATEMENT LIST (STL) describes the automation task by means of mnemonic function designations. The CONTROL SYSTEM FLOWCHART (CSF) is a graphic representation of the automation task, using symbols. The type of representation to be used for programming depends on the relevant programming unit and the type of representation selected for that particular programming unit. The Programming Unit converts the control system flowchart or ladder diagram into a statement list. In the memory of the programmable controller the program is stored in MC5 machine code. ADDRESSING IN SIEMENS PLCs Each I/O address will have a "Byte No.", "." & "Bit No." Byte No. : 0 to 7 / 15 / 63 / 127 depending on the PLC Model & capacity Bit No. : 0 to 7 Inputs are denoted by : "I" Outputs are denoted by : "Q" Internal Flags are denoted by : "F" Examples of addresses : I 0.0, I 5.6, I 63.7, I 127.7 Q 0.4, Q 10.3, Q 100.1 F 0.0 to F 255.7

description

pl

Transcript of Programming in Siemens Plcs

PROGRAMMING IN SIEMENS PLCs

The STEP 5 programming language is used for writing user programs for programmablle controllers of the SIMATIC S5 system. STEP 7 language is used for SIMATIC S7 system PLCs.

THIS PROGRAM CAN BE REPRESENTED IN 3 WAYS

LADDER DIAGRAM (LAD)

STATEMENT LIST (STL)

CONTROL SYSTEM FLOW CHART (CSF) /

FUNCTIONAL BLOCK DIAGRAM (FBD)

The LADDER DIAGRAM (LAD) uses graphic circuit diagram symbols (american representation) to represent the automation task.

The STATEMENT LIST (STL) describes the automation task by means of mnemonic function designations.

The CONTROL SYSTEM FLOWCHART (CSF) is a graphic representation of the automation task, using symbols.

The type of representation to be used for programming depends on the relevant programming unit and the type of representation selected for that particular programming unit.

The Programming Unit converts the control system flowchart or ladder diagram into a statement list. In the memory of the programmable controller the program is stored in MC5 machine code.

ADDRESSING IN SIEMENS PLCs

Each I/O address will have a "Byte No.", "." & "Bit No."

Byte No. : 0 to 7 / 15 / 63 / 127 depending on the PLC Model & capacity

Bit No.

: 0 to 7

Inputs are denoted by

: "I"

Outputs are denoted by : "Q"

Internal Flags are denoted by : "F"

Examples of addresses: I 0.0, I 5.6, I 63.7, I 127.7

Q 0.4, Q 10.3, Q 100.1

F 0.0 to F 255.7

HOW ADDRESSING IS DONE PHYSICALLY IN I/O MODULES

FIXED LOCATION ADDRESS : In some PLC models, each I/O module location / plug-in slot will have a fixed address as specified in the Manufacturer's manual.

JUMPERS IN MODULE : In these PLCs, the jumpers provided in each I/O module will decide the address of that module. The jumper combination table will be given in the manufacturer's manual.

DIP SWITCHES ON INTERFACE MODULE : In these PLCs DIP switches will be provided for each location. By setting these switches as given the manufacturer's table, the address of each I/O module can be set.

FORMAT FOR STATEMENT LIST (STL)

OPERATION

OPERANDADDRESS

AND Operation

A

I0.0 to 127.7

Q

F

OR Operation

O

I0.0 to 127.7

Q

F

ASSIGNMENT

=

Q0.0 TO 127.7

F

EXAMPLES OF BASIC BINARY LOGIC OPERATIONS

OPERATIONCSF / FBDLADSTL

3 Input ANDingI 1.1

I 2.2 Q 4.4

F 3.3

I 1.1 I 2.2 I 3.3 Q 4.4

( )A I 1.1

A I 2.2

A F 3.3

= Q 4.4

3 Input ORingI 1.1

I 2.2 Q 4.4

F 3.3

I 1.1 Q 4.4

( )

I 2.2

I 3.3

O I 1.1

O I 2.2

O I 3.3

= Q 4.4

NEGATIONI 1.1 Q 4.4 I 1.1 Q 4.4

( )AN I 1.1

= Q 4.4

SET F 5.5

I 1.1

I 1.1 F 5.5

( S )A I 1.1

S F 5.5

RESET F 5.5

I 1.1 I 1.1 F 5.5

( R )A I 1.1

R F 5.5

OVERVIEW OF STEP 5 OPERATIONS

BOOLEAN / BINARY LOGIC OPERATIONS

STATEMENT LISTLADDER DIAGRAMDESCRIPTION

A

Normally open contact in series, scanning for "1"

AN

Normally closed contact in series, scanning for "0"

O

Normally open contact in parallel, scanning for "1"

ON

Normally closed contact in parallel, scanning for "0"

S ( S )Latch if RLO = "1",

No action if RLO = "0"

R

Unlatch if RLO = "1",

No action if RLO = "0"

=

Assignment (Latch if RLO = "1", unlatch if RLO= "0")

O

ORing of AND functions

(Return path for connecting two circuits in parallel)

A(

ANDing of bracketed expressions

(Start of a branch)

O(

ORing of bracketed expressions

(Return path and start of a branch)

)

Right paranthesis

(Termination of a bracketed expression)

NOP 0NOP 0No operation. Overwriting erroneously programmed statements

NOP 1NOP 1No operation. Keeping memory locations free.

BEBEUnconditional block end; Return to beginning of program

BECBECConditional block end; if RLO = "1", return to beginning of program.

If RLO = "0", no operation is executed.

LOADING AND TRANSFER OPERATIONS

STATEMENT LISTLOAD (INTO ACCU 1) :

L IB 0 to 127 an input byte (from PII)

L IW 0 to 126an input word (from PII)

L QB 0 to 127an output byte (from PIO)

L QW 0 to 126an output word (from PIO)

L FB 0 to 256a flag byte

L FW 0 to 254a flag word

L DR 0 to 255data (right-hand byte)

L DL 0 to 255data (left-hand byte)

L DW 0 to 255data word

L T 0 to 127a time

L C 0 to 127a count

L PB 0 to 127a peripheral byte of the digital inputs (bypassing the PIO)

a peripheral byte of the analog inputs

L PW 0 to 127a peripheral byte of the digital inputs (bypassing the PIO)

a peripheral word of the analog inputs

LC T 0 to 127times (BCD)

LC C 0 to 127counts (BCD)

L KB 0 to 255a constant, 1 byte

L KS 0 to 127a constant, two ASCII symbols

L KT 0.0 to 999.3a time (constant)

L KC 0 to 999a count (constant)

L KM 0 to 127a constant as bit pattern

L KH 0 to 127a constant in hexadecimal code

L KF 0 to 127a constant as fixed-point number

L KY 0 to 127 a constant, 2 bytes

TRANSFER (THE CONTENTS OF ACCU 1 ) TO :

T IB 0 to 127 an input byte (into the PII)

T IW 0 to 126an input word (into the PII)

T QB 0 to 127an output byte (into the PIO)

T QW 0 to 126an output word (into the PIO)

T FB 0 to 256a flag byte

T FW 0 to 254a flag word

T DR 0 to 255data (right-hand byte)

T DL 0 to 255data (left-hand byte)

T DW 0 to 255data word

T PB 0 to 127

128 to 255 a peripheral byte of the digital outputs (bypassing the PIO)

a peripheral byte of the analog outputs

T PW 0 to 127

128 to 254a peripheral word of the outputs (bypassing the PIO)

a peripheral word of the analog outputs

TIMER AND COUNTER OPERATIONS

STATEMENT LISTFUNCTION

S T 0 to 127Start Timer as PULSE

SE T 0 to 127Start Timer as EXTENDED PULSE

SI T 0 to 127Start Timer as "ON" DELAY

SS T 0 to 127Start Timer as STORED "ON" DELAY

SF T 0 to 127Start Timer as "OFF" DELAY

R T 0 to 127Reset Timer

S C 0 to 127Set Counter

R C 0 to 127Reset Counter

CU C 0 to 127Increment counter (Count Up)

CD C 0 to 127Decrement counter (Count Down)

COMPARISON OPERATIONS

STATEMENT LISTCOMPARE FIXED-POINT NUMBERS in accu 1 and accu 2

(the first operand specified is compared with the operand following, according to the comparison function)

! = Ffor equal to : ACCU 2 = ACCU 1

> < Ffor not equal to : ACCU 2 ( ACCU 1

> Ffor greater than : ACCU 2 > ACCU 1

> = Ffor greater than or equal to : ACCU 2 ( ACCU 1

< Ffor less than : ACCU 2 < ACCU 1

< = Ffor less than or equal to : ACCU 2