Function-Blocks S40 e

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

Software Description

Advant Controller 31 Intelligent Decentralized Automation System

Function Block Library 40/50 Series

TP S40

Contents
The Base_S40 function block library 3
Considerable changes in ABB library 907 AC 1131 compared to CE library 907 PC 331 ............................ 3 Special characteristics in the ABB library ............................................ 4 Functions ............................................ 4 Function blocks ............................................ 4 Special characteristics of individual blocks ............................................ 4

Overview of blocks arranged according to their call names


ADDITION DOUBLE WORD OFF DELAY ASV S40 SELECTION GATE, WORD BINARY SELECTION GATE BCD TO DUAL CONVERSION, WORD LIMITER, WORD BINARY VALUE CHANGE ANNUNCIATOR ANALOG CHANNEL CONFIGURATION COPYING MEMORY AREAS CONFIGURE AC31 MODULES ACKNOWLEDGE AC31 ERRORS UP COUNTER HIGH SPEED COUNTER READ DIRECT INPUTS DIVISION DOUBLE WORD WRITE DIRECT OUTPUTS OUTPUT OF ASCII CHARACTERS DUAL TO BCD CONVERSION, WORD AND COMBINATION, DOUBLE WORD OR COMBINATION, DOUBLE WORD DOUBLE WORD TO WORD CONVERSION XOR COMBINATION, DOUBLE WORD RECEPTION OF ASCII CHARACTERS ON DELAY FUNCTION GENERATOR FALLING EDGE DETECTION RISING EDGE DETECTION READ BINARY VARIABLE, INDEXED READ WORD VARIABLE, INDEXED WRITE BINARY VARIABLE, INDEXED WRITE WORD VARIABLE, INDEXED LIST ALLOCATOR MONOSTABLE ELEMENT ABORT MONOSTABLE ELEMENT ABORT OPERATION MODE MODBUS MASTER MONOSTABLE ELEMENT CONSTANT MULTIPLICATION BY 2 TO THE POWER OF N, WORD MULTIPLICATION DOUBLE WORD MULTIPLICATION WITH DIVISION

5
ADDD S40 .......................... 8 10 AWT S40........................... 12 AWTB S40 ........................ 13 BCDDUAL S40 ................. 14 BEG S40 ........................... 17 BMELD(8..127) S40.......... 19 CONFIO(1..8) S40 ............ 22 COPY S40 ........................ 25 CS31CO S40 .................... 27 CS31QU S40 .................... 35 CTU S40 ........................... 37 CTUH S40......................... 39 DIN S40 ............................ 42 DIVD S40 .......................... 44 DOUT S40 ........................ 46 DRUCK S40...................... 48 DUALBCD S40 ................. 52 DWAND S40 ..................... 54 DWOR S40 ....................... 55 DWW S40 ......................... 56 DWXOR S40..................... 57 EMAS S40 ........................ 58 ESV S40 ........................... 62 FKG(2..256) S40............... 64 I_MINUS S40 .................... 66 I_PLUS S40 ...................... 68 IDLB S40........................... 70 IDLM S40 .......................... 72 IDSB S40 .......................... 74 IDSM S40.......................... 76 LIZU(8..256) S40 .............. 78 MOA S40 .......................... 80 MOAT S40 ........................ 82 MODMASTB/W S40 ......... 84 MOK S40 .......................... 92 MUL2N S40 ...................... 94 MULD S40 ........................ 96 MULDI S40 ....................... 98

907 AC 1131/Issued: 02.2001

Base_S40-Library

NEGATION WORD PULSES GENERATOR PACK BINARY VARIABLES IN WORD PULSE DURATION MODULATOR PROPORTIONAL INTEGRAL CONTROLLER PIDT1 CONTROLLER RESET MEMORY , DOMINATING SERIAL LINE INITIALIZATION SQUARE ROOT, DOUBLEWORD SQUARE ROOT, WORD SET MEMORY , DOMINATING SUBTRACTION DOUBLE WORD TIME WORD CONVERSION OFF DELAY ON DELAY MONOSTABLE ELEMENT CONSTANT DISPLAY AND SET CLOCK UNPACKING A WORD INTO BINARY VARIABLES UP-DOWN COUNTER INTERRUPTION TASK VALIDATION AND COMBINATION, WORD WORD TIME CONVERSION WORD TO DOUBLE WORD CONVERSION READ WORD WITH ENABLING OR COMBINATION, WORD XOR COMBINATION, WORD

NEGW S40......................100 NPULSE S40 ..................101 PACK(4..16) S40.............103 PDM S40.........................105 PI S40..............................107 PIDT1 S40.......................112 RS S40 ............................118 SINIT S40........................119 SQRTD S40 ....................122 SQRTW S40 ...................124 SR S40 ............................126 SUBD S40.......................127 TIME_W S40...................129 TOF S40..........................131 TON S40 .........................133 TP S40 ............................135 UHR S40 .........................137 UNPACK(4,..) S40 ..........142 VRZ S40..........................144 VTASK S40 .....................146 WAND S40......................147 W_TIME S40...................148 WDW S40 .......................150 WOL S40.........................151 WOR S40 ........................153 WXOR S40......................154

Glossary Index

155 157

Base_40-Library

907 AC 1131/Issued: 02.2001

THE BASE_S40 FUNCTION BLOCK LIBRARY

The Base_S40 function block library


Considerable changes in ABB library 907 AC 1131 compared to CE library 907 PC 331
All blocks and functions are divided into groups of operators, functions and function blocks according to the IEC norm. (The respective definition can be found in the programming software manual.) l All operators listed in the table Overview of blocks are part of the programming software. l The standard library contains all blocks described in the programming manual. l The ABB library for PLC series 40 and series 50 contains all ABB specific blocks (functions and function blocks, no operators). Note: The blocks defined in the ABB library cannot be used in simulation mode. In order to use the ABB specific blocks the ABB library (Base_S40_Vxx) must be included in the library window.

907 AC 1131/Issued: 02.2001

Base_S40-Library

THE BASE_S40 FUNCTION BLOCK LIBRARY

Special characteristics in the ABB library


In the ABB library all manufacturer functions and function blocks are integrated. The assignment of the block types is listed in the table Overview of blocks. The functionality of the blocks was identically transformed in accordance to the known blocks defined in 07 KR 51 - EBS. However, some special characteristics have to be observed when calling and selecting the blocks.

Blocks: e.g. PACK, UNPACK In the FBD editor the number of duplications is not permitted and is fixed to 4, 8 or 16. Input n is assigned accordingly and the block is displayed. 4) Insert Inline ABB Instruction List with Inline Pragma : ABB Instruction List may be add in a project as a Program POU. The ABB Instruction list must be inserted into Pragma in a IL Program POU. The syntax is: LD 0 necessary, if POU include only Inline Pragma

Functions
The FBD blocks are identically constructed compared to the blocks available in the previous programming software. Some input and output names have been changed as not all characters are allowed. In all programming languages the order of the inputs and outputs is identical. The library window displays the assignment of the blocks (order and variable type).

{S40Inline . . . . ABB ASCII-Instruction List

Function blocks
A main characteristic of the function blocks is that an instance has to be defined when calling them. In this case it has to be observed that instance names may not be defined several times.

Blocks: DRUCK, EMAS The DRUCK and EMAS block are only available under this format.

Example: Name VRZ1 VRZ2 . . Type VRZ VRZ . .

Caution: No syntax control is done inside Pragma !!! 5) Special solutions: Blocks: LIZU8, LIZU16, LIZU32, LIZU64, LIZU256 The number assigned to LIZU represents the number of direct constants in the list. This number is a direct constant value (#8, #16, #32, #64, #256)

The instance name can be defined without any restrictions. The type is preset and identical to the function block name.

Special characteristics of individual blocks


1) Negation of inputs and outputs: In the 907 AC 1131 the negation of inputs and outputs is only possible for bit operands (variable types: BOOL, BYTE, WORD, DWORD). The known operands word flag %MW (MW) and double word flag %MD (MD) are of the variable type INT and DINT. 2) Duplication of inputs: The operators (ADD, DIV, MUL, SUB) can be used and duplicated as often as required. 3) Duplication of inputs and outputs:

Base_40-Library

907 AC 1131/Issued: 02.2001

OVERVIEW OF BLOCKS ARRANGED ACCORDING TO THEIR CALL NAMES

Blocks: FKG2, FKG4, FKG16, FKG32, FKG256 The number assigned to FKG represents the number of interpolation points . This number is a direct constant value (#2, #4, #16, #32, #256)

Blocks: BMELD8, BMELD16, BMELD32, BMELD64, BMELD127 The number assigned to BMELD represents the number of input values . This number is a direct constant value (#8, #16, #32, #64, #127)

Overview of blocks arranged according to their call names


Character description: FBmV FBoV F Function block with historical values Function block without historical values Function Type FBoV FBmV FBoV FBoV F F FBmV FBmV FBmV FBmV FBmV FBmV FBmV FBmV FBoV FBmV FBoV FBmV FBmV FBoV FBoV FBoV Function Addition double word Off delay Selection gate word Binary selection gate BCD DUAL conversion word Limiter word Binary value change annunciator with a maximum of 8 comparison values, binary Binary value change annunciator with a maximum of 16 comparison values, binary Binary value change annunciator with a maximum of 32 comparison values, binary Binary value change annunciator with a maximum of 64 comparison values, binary Binary value change annunciator with a maximum of 127 comparison values, binary 1 Analog Channel Configuration 4 Analog Channels Configuration 8 Analog Channels Configuration Copying memory areas Configure AC31 modules Acknowledge AC31 errors Up counter High speed counter Read direct inputs Division double word Write direct outputs Page 8 10 12 13 14 17 19 19 19 19 19 22 22 22 25 27 35 37 39 42 44 46

CE name ADDD ASV AWT AWTB BCDDUAL BEG BMELD8 BMELD16 BMELD32 BMELD64 BMELD127 CONFIO1 CONFIO4 CONFIO8 COPY CS31CO CS31QU CTU CTUH DIN DIVD DOUT

907 AC 1131/Issued: 02.2001

Base_S40-Library

OVERVIEW OF BLOCKS ARRANGED ACCORDING TO THEIR CALL NAMES

CE name DRUCK DUALBCD DWAND DWW DWOR DWXOR EMAS ESV FKG2 FKG4 FKG16 FKG32 FKG64 FKG256 I_MINUS I_PLUS IDLB IDLm IDSB IDSm LIZU8 LIZU16 LIZU32 LIZU64 LIZU256 MOA MOAT MODBUSB MODBUSW MODMASTB MODMASTW MOK MUL2N MULD MULDI NEGW NPULSE

Type FBmV F F FBoV F F FBmV FBmV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBoV FBmV FBmV FBmV FBmV FBmV FBmV FBmV F FBoV F F FBmV

Function Output of ASCII characters DUAL BCD conversion word AND combination, double word Double word to word conversion OR combination, double word XOR combination, double word Reception of ASCII characters On delay Function generator with a maximum of 2 nodes Function generator with a maximum of 4 nodes Function generator with a maximum of 16 nodes Function generator with a maximum of 32 nodes Function generator with a maximum of 64 nodes Function generator with a maximum of 256 nodes Falling edge detection Rising edge detection Read binary variable, indexed Read word variable, indexed Write binary variable, indexed Write word variable, indexed List allocator with a maximum of 8 word inputs List allocator with a maximum of 16 word inputs List allocator with a maximum of 32 word inputs List allocator with a maximum of 64 word inputs List allocator with a maximum of 256 word inputs Monostable element abort Monostable element abort MODBUS master for COM1 and BOOL data MODBUS master for COM1 and INT data MODBUS master with interface identifier and BOOL data MODBUS master with interface identifier and INT data Monostable element constant Word multiplication by 2 to the power of n Multiplication double word Multiplication with division Negation word Pulses generator

Page 48 52 54 54 55 57 57 62 64 64 64 64 64 64 66 68 70 72 74 74 78 78 78 78 78 80 82 84 84 84 84 92 94 96 98 100 101

Base_40-Library

907 AC 1131/Issued: 02.2001

OVERVIEW OF BLOCKS ARRANGED ACCORDING TO THEIR CALL NAMES

CE name PACK4 PACK8 PACK16 PDM PI PIDT1 SINIT SUBD TIME_W TOF TON TP UHR UNPACK4 UNPACK8 UNPACK16 VRZ VTASK WAND W_TIME WDW WOL WOR WXOR

Type FBoV FBoV FBoV FBmV FBmV FBmV FBmV FBoV FBoV FBmv FBmv FBmV FBmV FBoV FBoV FBoV FBmV FBoV F FBoV F F F F

Function Pack binary variables in word (max 4 inputs) Pack binary variables in word (max 8 inputs) Pack binary variables in word (max 16 inputs) Pulse duration modulator PI controller PIDT1 controller Serial line Initialization Subtraction double word Time word conversion Off delay On delay Monostable element "constant" Display and set clock Unpacking a word into binary variables (max 4 outputs) Unpacking a word into binary variables (max 8 outputs) Unpacking a word into binary variables (max 16 outputs) Up-down counter, word Interruption task validation AND combination, word Word time conversion Word to double word conversion Read word with enabling OR combination, word XOR combination, word

Page 103 103 103 105 107 112 119 127 129 131 133 135 137 142 142 142 144 146 147 147 150 151 153 154

907 AC 1131/Issued: 02.2001

Base_S40-Library

ADDITION DOUBLE WORD

ADDD S40

ADDITION DOUBLE WORD


The value of the operand at input E1 is added to the value of the operand at input E2 and the result is assigned to the operand at output A. The result is limited to the maximum or minimum value of the number range. If limiting occurred, a TRUE signal is assigned to the binary operand at output Q. If no limiting occurred, a FALSE signal is assigned to the binary operand at output Q. Block type Function block without historical values Parameters Instance E1 E2 A Q ADDD DINT DINT DINT BOOL Instance name Summand 1 Summand 2 Total Total, limited

ADDD S40

Description The value of the operand at input E1 is added to the value of the operand at input E2 and the result is assigned to the operand at output A. The result is limited to the maximum or minimum value of the number range (-2147483647 2147483647). If limiting occurred, a TRUE signal is assigned to the binary operand at output Q. If no limiting occurred, a FALSE signal is assigned to the binary operand at output Q. The inputs and outputs can neither be duplicated nor negated.

Base_40-Library

907 AC 1131/Issued: 02.2001

ADDITION DOUBLE WORD

ADDD S40

Example Declaration: ADDD_1 : ADDD; ADDD_E1 AT %MD2000.0 : DINT; ADDD_E2 AT %MD2000.1 : DINT; ADDD_A AT %MD2000.2 : DINT; ADDD_Q AT %MX0.0 : BOOL; FBD: Translation in ABB IL: !BA 0 ADDD E1 E2 A Q ABB IL of example: !BA 0 ADDD MD0,0 MD0,1 MD0,2 M0,0

Function call in IL CAL LD ST LD ST ADDD_1(E1 := ADDD_E1, E2 := ADDD_E2) ADDD_1.Q ADDD_Q ADDD_1.A ADDD_A

Function call in ST ADDD_1 (E1 := ADDD_E1, E2 := ADDD_E2);

ADDD_Q:=ADDD_1.Q; ADDD_A:=ADDD_1.A;

907 AC 1131/Issued: 02.2001

Base_S40-Library

OFF DELAY

ASV S40

OFF DELAY
The TRUE/FALSE edge of input E is delayed by the time T and is output as a TRUE/FALSE edge at output A. If input E returns to the TRUE level before the time T is expired, output A remains in the TRUE level.

ASV S40

Block type Function block with historical values Parameters Instance E T A ASV BOOL TIME BOOL Instance name Input signal Delay time Delayed signal, opernds M, A (not E, S)

Description The TRUE/FALSE edge of input E is delayed by the time T and is output as a TRUE/FALSE edge at output A. If input E returns to the TRUE level before the time T is expired, output A remains in the TRUE level. Maximum time offset at the output: < 1 cycle time Reasonable range for T: > 1 cycle time The inputs and the output can neither be duplicated nor inverted. General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

Base_40-Library

10

907 AC 1131/Issued: 02.2001

OFF DELAY

ASV S40

Example Declaration: ASV_1 : ASV; ASV_E AT %MX0.0 : BOOL; ASV_T AT %MD4001.0 : TIME := t#2s500ms; (* 2500ms*) ASV_A AT %MX0.1 : BOOL; FBD: Translation in ABB IL: !BA 0 ASV E T A ABB IL of example: !BA 0 ASV M0,0 KD1,0 M0,1

; 2500

Function call in IL CAL ASV_1(E := ASV_E, T := ASV_T) ASV_1.A ASV_A

Function call in ST ASV_1 (E := ASV_E, T := ASV_T); := ASV_1.A;

LD ST

ASV_A

907 AC 1131/Issued: 02.2001

11

Base_S40-Library

SELECTION GATE, WORD

AWT S40

SELECTION GATE, WORD


The AWT copy input1 (E1) or input2 (E2) in output (A1) depending of input switch (SWI) values.

AWT S40

Block type Function block without historical values Parameters Instance SWI E1 E2 A1 AWT BOOL INT INT INT Instance name Switchover input Word input for SWI = FALSE Word input for SWI = TRUE Word output

Description A FALSE signal at the binary input SWI allocates the value of the word operand at the input E1 to the word operand at the output A1. Example Declaration: AWT1 : AWT; AWT_SWI AT %MX0.0 : BOOL; AWT_E1 AT %MW1000.0 : INT; AWT_E2 AT %MW1000.1 : INT; AWT_A1 AT %MW1000.2 : INT; FBD: Translation in ABB IL: !BA 0 AWT SWI E1 E2 A1 ABB IL of example: !BA 0 AWT M0,0 MW0,0 MW0,1 MW0,2 A TRUE signal at the binary input SWI allocates the value of the word operand at the input E2 to the word operand at the output A1.

Function call in IL CAL AWT_1(SWI := AWT_SWI, E1 := AWT_E1, E2 := AWT_E2) AWT_1.A1 AWT_A1

Function call in ST AWT_1 (SWI := AWT_SWI, E1 := AWT_E1, E2 := AWT_E2); := AWT_1.A1;

LD ST

AWT_A1

Base_40-Library

12

907 AC 1131/Issued: 02.2001

BINARY SELECTION GATE

AWTB S40

BINARY SELECTION GATE


The AWTB copy input1 (E1) or input2 (E2) in output (A1) depending of input switch (SWI) values.

AWTB S40

Block type Function block without historical values Parameters Instance SWI E1 E2 A1 AWTB BOOL BOOL BOOL BOOL Instance name Switchover input Binary input for SWI = FALSE Binary input for SWI = TRUE Binary output

Description

A FALSE signal at the binary input SWI allocates the status of the operand at the input E1 to the operand at the output A1. Example Declaration: AWTB1 : AWTB; AWTB_SWI AT %MX0.0 : BOOL; AWTB_E1 AT %MX0.1 : BOOL; AWTB_E2 AT %MX0.2 : BOOL; AWTB_A1 AT %MX0.3 : BOOL; FBD:

A TRUE signal at the binary input SWI allocates the status of the operand at the input E2 to the operand at the output A1.

Translation in ABB IL: !BA 0 AWTB SWI E1 E2 A1 ABB IL of example: !BA 0 AWTB M0,0 M0,1 M0,2 M0,3

Function call in IL CAL AWTB_1(SWI := AWTB_SWI, E1 := AWTB_E1, E2 := AWTB_E2) AWTB_1.A1 AWTB_A1

Function call in ST AWTB_1 (SWI := AWTB_SWI, E1 := AWTB_E1, E2 := AWTB_E2); := AWTB_1.A1;

LD ST

AWTB_A

907 AC 1131/Issued: 02.2001

13

Base_S40-Library

BCD TO DUAL CONVERSION, WORD

BCDDUAL S40

BCD TO DUAL CONVERSION, WORD


The positive BCD coded number at input E is converted to a binary number and is assigned to the operand at output A.

BCDDUAL S40

Block type Function Parameters E (A) INT INT BCD coded number Binary number

Description The positive BCD coded number at input E is converted to a binary number and is assigned to the operand at output A. The input and the output can neither be duplicated nor negated. BCD NUMBER
15 11 7 3 0 BIT 15

Definition: The significance of the digits in a BCD coded number and a hexadecimal number is defined as follows:

HEX NUMBER
11 7 3 0

Z4

Z3

Z2

Z1

Z4

Z3

Z2

Z1

Numerical value: Z1 * 1 Z2 * 10 Z3 * 100 Z4 * 1000 0 < Zi < 9

Numerical value: Z1 * 1 Z2 * 16 Z3 * 256 Z4 * 4096 0 < Zi < F

Remark: At the BCD input, the block additionally accepts digits to which the following applies: 0 < Zi < F

Base_40-Library

14

907 AC 1131/Issued: 02.2001

BCD TO DUAL CONVERSION, WORD

BCDDUAL S40

Example 1 BCD NUMBER


15 11 7 3 0 BIT 15

HEX NUMBER
11 7 3 0

->
4 30 200

Z1 = 4 * 1 Z2 = 3 * 10 Z3 = 2 * 100 Z4 = 1 * 1000

= = = =

Z1 = 2 * 1 Z2 = 13 * 16 Z3 = 4 * 256 Z4 = 0 * 4096

= = = =

2 208 1024 0 1234

1000 1234

Example 2 BCD NUMBER


15 11 7 3 0 BIT 15

HEX NUMBER
11 7 3 0

->
4 150 200

Z1 = 4 * 1 Z2 = 15 * 10 Z3 = 2 * 100 Z4 = 10 * 1000

= = = =

Z1 = 2 * 1 Z2 = 7 * 16 Z3 = 8 * 256 Z4 = 2 * 4096

= = = =

2 112 2048 8192 10354

10000 10354

Representation of a negative BCD number A negative BCD number can be represented in the PLC by separate representation of the value and the sign. In

doing so, the value of the BCD number is stored in a word variable and the information about the sign is stored in a binary variable.

907 AC 1131/Issued: 02.2001

15

Base_S40-Library

BCD TO DUAL CONVERSION, WORD

BCDDUAL S40

Example Declaration: BCDDUAL_E AT %MW1002.0 : INT; BCDDUAL_A AT %MW1002.1 : INT; Translation in ABB IL: !BA 0 BCDDUAL E A ABB IL of example: !BA 0 BCDDUAL MW2,0 MW2,1

FBD:

Function call in IL LD BCD_E BCDDUAL ST BCD_A

Function call in ST BCD_A:=BCDDUAL(BCD_E);

Base_40-Library

16

907 AC 1131/Issued: 02.2001

LIMITER, WORD

BEG S40

LIMITER, WORD
The value of the operand at input E is limited to the range between the upper and lower limits.

BEG S40

Block type Function Parameters E OG UG (A) INT INT INT INT Input value Upper limit Lower limit Limited value

Description The value of the operand at input E is limited to the range between the upper and lower limits. The upper limit is specified by the operand at the OG input and the lower limit is specified by the one at the UG input. The following applies: A = UG for E < UG A = E for UG < E < OG A = OG for E > OG The inputs and the output can neither be duplicated nor negated.

907 AC 1131/Issued: 02.2001

17

Base_S40-Library

LIMITER, WORD

BEG S40

Example Declaration: BEG_E AT %MW1000.0 : INT; BEG_OG AT %MW3001.0 : INT := 20000; BEG_UG AT %MW3001.1 : INT := 10000; BEG_A AT %MW1000.1 : INT; Translation in ABB IL: !BA 0 BEG E OG UG A ABB IL of example: !BA 0 BEG MW0,0 KW1,0 KW1,1 MW0,1

FBD:

; 20000 ; 10000

Function call in IL LD BEG ST BEG_E BEG_OG, BEG_UG BEG_A

Function call in ST BEG_A := BEG(BEG_E, BEG_OG, BEG_UG);

Base_40-Library

18

907 AC 1131/Issued: 02.2001

BINARY VALUE CHANGE ANNUNCIATOR

BMELD(8..127) S40

BINARY VALUE CHANGE ANNUNCIATOR


This block monitors the binary values present at input E0 capable of duplication for a change. The BMELD number indicates the maximum number of input values. The following change annunciators are available: BMELD8 BMELD16 BMELD32 BMELD127 Binary value change annunciator with a maximum of 8 input values Binary value change annunciator with a maximum of 16 input values Binary value change annunciator with a maximum of 32 input values Binary value change annunciator with a maximum of 127 input values

BMELD(8..127) S40

Block type Function block with historical values Parameters Instance FREI RESET N E0 .. En-1 NR A AEND Description This block monitors the binary values present at the input E0 ... En-1 capable of duplication for a change. The inputs and outputs cannot be negated/inverted. Recognition of a change Each time the block is processed, the current input values at the inputs E0 ... En-1 are successively compared against the historical values (input values from the previous processing of the block). If a change is recognized at one of the inputs E0 ... En-1: this is indicated at output AEND the number of the input where the change was recognized is applied at output NR the changed input value is applied at output A Initialization of historical values The first time the block is processed after PLC initialization (FREI = TRUE) or enabling of processing after it has been disabled (FREI changes from FALSE to TRUE), all current input values are assumed once as historical values and all outputs are set to the value 0. These initialized historical values now represent the starting basis for recognition of changes. Each time the block is processed, a change at only one input is recognized. If a change is recognized, the inputs following the one where the change was previously determined are monitored the next time the block is processed. BMELD(8..32) BOOL BOOL INT BOOL INT INT BOOL Instance name Block enabling Reset Number of input values Input values Number of the input value Current input value Change detected

907 AC 1131/Issued: 02.2001

19

Base_S40-Library

BINARY VALUE CHANGE ANNUNCIATOR

BMELD(8..127) S40

FREI

BOOL

NR

INT

Processing of the block is enabled with the FREI input. FREI = FALSE Block is not processed FREI = TRUE Processing of the block is enabled If FREI = FALSE, the outputs of the block are also no longer updated. RESET RESET = FALSE RESET = TRUE A reset means: Adoption of the current values at the inputs E0 ... En-1 as historical values. All outputs are set to the value FALSE (0). n INT BOOL

The serial number of the input E0 ... En-1 where a change has been determined is applied at output NR. If no change is determined during processing of the block, the number of the last changed input is still applied at output NR. The following allocation applies: Change determined at E0 NR = 0 Change determined at E1 NR = 1 Change determined at En-1 NR = n-1 A BOOL

The block can be reset with the RESET input. No reset Reset of the block

If a change is determined at one of the inputs E0 ... En-1, the changed input value is assigned to output A. If no change is determined at the inputs E0 ... En-1 during processing of the block, the value of the last changed input is still applied at output A. AEND BOOL

The number of values to be monitored at the inputs E0 ... En-1 is specified at input n. Range for n: 1 < n < max. number (8..127) E0 .. En-1 BOOL

The output AEND indicates whether or not a change has been determined at the inputs E0 ... En-1. AEND = FALSE AEND = TRUE No change determined Change determined

The operands to be monitored for a change are specified at the inputs E0 ... En-1.

Base_40-Library

20

907 AC 1131/Issued: 02.2001

BINARY VALUE CHANGE ANNUNCIATOR

BMELD(8..127) S40

Example Declaration: BMELD_8 : BMELD8; BMELD_FREI AT %MX0.0 : BOOL; BMELD_RESET AT %MX0.1 : BOOL; BMELD_E0 AT %MX1.0 : BOOL; BMELD_E1 AT %MX1.1 : BOOL; BMELD_E2 AT %MX1.2 : BOOL; BMELD_E3 AT %MX1.3 : BOOL; BMELD_E4 AT %MX1.4 : BOOL; BMELD_E5 AT %MX1.5 : BOOL; BMELD_E6 AT %MX1.6 : BOOL; BMELD_E7 AT %MX1.7 : BOOL; BMELD_NR AT %MW1010.0 : INT; BMELD_A AT %MX0.2 : BOOL; BMELD_AEND AT %MX0.3 : BOOL; Translation in ABB IL: !BA 0 BMELD FREI RESET #n E0 E1 E2 E3 E4 E5 E6 E7 NR A AEND ABB IL of example: !BA 0 BMELD M0,0 M0,1 M1,0 M1,1 M1,2 M1,3 M1,4 M1,5 M1,6 M1,7 MW10,0 M0,2 M0,3

FBD:

Function call in IL CAL BMELD_1(FREI := BMELD_FREI, RESET := BMELD_RESET, n := 8, E0 := BMELD_E0, E1 := BMELD_E1, E2 := BMELD_E2, E3 := BMELD_E3, E4 := BMELD_E4, E5 := BMELD_E5, E6 := BMELD_E6, E7 := BMELD_E7 ) BMELD_1.NR BMELD_NR BMELD_1.A BMELD_A BMELD_1.AEND BMELD_AEND

Function call in ST BMELD_1 ( FREI := BMELD_FREI, RESET := BMELD_RESET, n := 8, E0 := BMELD_E0, E1 := BMELD_E1, E2 := BMELD_E2, E3 := BMELD_E3, E4 := BMELD_E4, E5 := BMELD_E5, E6 := BMELD_E6, E7 := BMELD_E7 ); BMELD_NR := BMELD_1.NR; BMELD_A := BMELD_1.A; BMELD_AEND := BMELD_1.AEND;

LD ST LD ST LD ST

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

21

Base_S40-Library

ANALOG CHANNEL CONFIGURATION

CONFIO(1..8) S40

ANALOG CHANNEL CONFIGURATION


The function block CONFIO1 is used to -configure the type (voltage, current or BALCO500/NI1000/PT100/PT1000) of one analog channel on the AC31 extensions. -change the filtering time of the analog input -change the scale of the display value. -lock or unlock the configuration for all analog channels of one analog extension. CONFIO1 CONFIO4 CONFIO8 Block type Function block with historical values Parameters Instance ENA CHAN0..8 TYPE0..8 DOT0..8 OFFS0..8 MULT0..8 FILT0..8 RDY ERR Description The function block CONFIO is used to: configure the type (voltage, current or BALCO500/NI1000/PT100/PT1000) of one analog channel on the AC31 extensions. change the filtering time of the analog input change the scale of the display value. lock or unlock the configuration for all analog channels of one analog extension. CONFIO(1..8) BOOL INT INT INT INT INT INT BOOL BOOL Instance name Block enabling Channel identification Type of analog channel Position of dot of the display value Value of the offset for the display value Value of the multiplication for the display value Filtering time Processing of the configuration is completed An error is detected 1 Analog Channel Configuration 4 Analog Channels Configuration 8 Analog Channels Configuration

CONFIO(1..8) S40

Display value = int value * MULT0 / 32767 + OFFS0 The latest configured channel number of one analog extension is displayed. ENA BOOL

The function block is processed when ENA is on the rising edge FALSE->TRUE CHAN0 INT

The analog channel configuration is set through the function block instead of the pushbutton on the front plate of the analog extension. The configuration is stored in an internal EEPROM in the analog extension. The scale of the display value is set according to the formula:

The analog channel to be configured is directly set. For example, %IW1000.0 for the analog input 0 on the analog extension at the address 0, %QW1065.01 for the analog output 1 on the analog extension at the address 65

Base_40-Library

22

907 AC 1131/Issued: 02.2001

ANALOG CHANNEL CONFIGURATION

CONFIO(1..8) S40

TYPE0 Type of analog signal: 0 : the channel is set to +/- 10 V 1 : the channel is set to 0-20mA 2 : the channel is set to 4-20mA 3 : the channel is set to Pt100 4 : the channel is set to Pt1000 5 : the channel is set to Pt100 3 wires 6 : the channel is set to Pt1000 3 wires 8 : the channel is set to Ni1000 9 : the channel is set to BALCO500

INT

MULT0 Value of the multiplication: -32767 < MULT0 < 32767

INT

If MULT0 = 0, the parameters OFFS0 and DOT0 are not used. In this case the scale is set to factory setting scale. The parameter MULT0 can be used to set a channel value to the display. FILT0 Filtering time: 0: internal filter according to the documentation of analog extension INT

14 : unlock the configuration through the pushbutton on the analog extension front plate at the address xx when CHAN0 is %IW10xx.yy or %QW10xx.yy 15 : lock the configuration through the pushbutton on the analog extension front plate at the address xx when CHAN0 is %IW10xx.yy or %QW10xx.yy The configuration is automatically unlocked after a power supply ON. DOT0 Position of the dot on the display: 0: 1: 2: 3: 4 digits are displayed without dot Example: value=1234 display: 1234 4 digits are displayed with dot on position 1 Example: value=1234 display: 123.4 4 digits are displayed with dot on position 2 Example: value=1234 display: 12.34 4 digits are displayed with dot on position3 Example: value=1234 display: 1.234 INT

1 - 127 : integration number 160 : 192 : 224 : fast refresh time (50 ms instead of 120 ms in standard) 60 Hz filter 50 Hz filter

All channels of one extension will be affected by this parameter. RDY BOOL

This bit is set to FALSE during the function processing. ERR BOOL

This bit is set to TRUE during one cycle (the bit RDY is set to TRUE in the same time). An error is detected if: one parameter value is wrong the analog channel doesnt exist communication problem between central unit and analog extension

If DOT0 < 0 or DOT0 > 3, the bit ERR is TRUE and the function is not processed. OFFS0 Value of the offset: -32767 < OFFS0 < 32767 INT

Note: One historical value is used by the function CONFIO1

907 AC 1131/Issued: 02.2001

23

Base_S40-Library

ANALOG CHANNEL CONFIGURATION

CONFIO(1..8) S40

Example Declaration: CONFIO1 : CONFIO1; CONFIO1_ENA AT %MX0.0 : BOOL; CONFIO1_CHAN0 AT %MW1000.0 : INT; CONFIO1_TYPE0 AT %MW1000.1 : INT; CONFIO1_DOT0 AT %MW1000.2 : INT; CONFIO1_OFFS0 AT %MW1000.3 : INT; CONFIO1_MULT0 AT %MW1000.4 : INT; CONFIO1_FILT0 AT %MW1000.5 : INT; CONFIO1_RDY AT %MX0.1 : BOOL; CONFIO1_ERR AT %MX0.2 : BOOL; Translation in ABB IL: !BA 0 CONFIO #1 ENA CHAN0 TYPE0 DOT0 OFFS0 MULT0 FILT0 RDY ERR ABB IL of example: !BA 0 CONFIO #1 M0,0 MW0,0 MW0,1 MW0,2 MW0,3 MW0,4 MW0,5 M0,1 M0,2

FBD:

Function call in IL CAL CONFIO1(ENA := CONFIO1_ENA, CHAN0 := CONFIO1_CHAN0, TYPE0 := CONFIO1_TYPE0, DOT0 := CONFIO1_DOT0, OFFS0 := CONFIO1_OFFS0, MULT0 := CONFIO1_MULT0, FILT0 := CONFIO1_FILT0) CONFIO1.RDY CONFIO1_RDY CONFIO1.ERR CONFIO1_ERR

Function call in ST CONFIO1 (ENA := CONFIO1_ENA, CHAN0 := CONFIO1_CHAN0, TYPE0 := CONFIO1_TYPE0, DOT0 := CONFIO1_DOT0, OFFS0 := CONFIO1_OFFS0, MULT0 := CONFIO1_MULT0, FILT0 := CONFIO1_FILT0); CONFIO1_RDY := CONFIO1.RDY; CONFIO1_ERR := CONFIO1.ERR ;

LD ST LD ST

Note: In IL, the function call has to be performed in one line.

Base_40-Library

24

907 AC 1131/Issued: 02.2001

COPYING MEMORY AREAS

COPY S40

COPYING MEMORY AREAS


This block copies n words from a source memory area into a target memory area.

COPY S40

Block type Function block without historical values Parameters Instance FREI ANZ QOFF QSEG ZOFF ZSEG Description This function block copies n words from a source memory area into a target memory area. The contents of the source memory area are not changed. In each case, the start of the source and target memory areas is specified at the blocks inputs by means of the offset and segment addresses. The inputs and outputs can neither be duplicated nor negated/inverted. FREI Block enabling FREI = FALSE FREI = TRUE BOOL The block is not processed The block is processed ANZ Number n of words to be copied. The following applies: 0 < n < +8000H n = 0: No copying n = 8000H: A complete segment (64 kBytes) is copied QOFF INT INT COPY BOOL INT INT INT INT INT Instance name Block enabling Number of word(s) to be copied Offset address of the start of the source area Segment address of the start of the source area Offset address of the start of the target area Segment address of the start of the target area

Offset address of the start of the source area QSEG INT

Segment address of the start of the source area ZOFF Offset address of the start of the target area ZSEG INT INT

Segment address of the start of the target area

907 AC 1131/Issued: 02.2001

25

Base_S40-Library

COPYING MEMORY AREAS

COPY S40

Example Declaration: COPY1 : COPY; COPY_FREI AT %MX0.0 : BOOL; COPY_ANZ AT %MW3002.0 : INT := 16; COPY_QOFF AT %MW3002.1 : INT := 16#1C00; (*MW00,00*) COPY_QSEG AT %MW3002.2 : INT := 0; COPY_ZOFF AT %MW3002.3 : INT := 16#1C40; (*MW03,00*) COPY_ZSEG AT %MW3002.4 : INT := 0; FBD: Translation in ABB IL: !BA 0 COPY FREI ANZ QOFF QSEG ZOFF ZSEG ABB IL of example: !BA 0 COPY M0,0 KW2,0 KW2,1 KW2,2 KW2,3 KW2,4

; 16 ; #H1C00 ;0 ; #H1C40 ;0

Function call in IL CAL COPY1(FREI := COPY_FREI, ANZ := COPY_ANZ, QOFF := COPY_QOFF, QSEG := COPY_QSEG, ZOFF := COPY_ZOFF, ZSEG := COPY_ZSEG)

Function call in ST COPY1 (FREI := COPY_FREI, ANZ := COPY_ANZ, QOFF := COPY_QOFF, QSEG := COPY_QSEG, ZOFF := COPY_ZOFF, ZSEG := COPY_ZSEG);

Note: In IL, the function call has to be performed in one line.

Base_40-Library

26

907 AC 1131/Issued: 02.2001

CONFIGURE AC31 MODULES

CS31CO S40

CONFIGURE AC31 MODULES


The function block is used to configure the AC31 remote modules. The block can both send configuration parameters to the remote modules and also scan their currently set configuration.

CS31CO S40

Block type Function block with historical values Parameters Instance FREI GRN CODE D1 . . D8 RDY OK ERR A1 . . A7 CS31CO BOOL INT INT INT . . INT BOOL BOOL INT INT . . INT Instance name Enable (FALSE/TRUE edge) for processing the block Group number of the remote module to which the job refers Identification of the job to be performed 1st parameter of the job . . 8th parameter of the job Processing of the job is completed The job could be processed correctly Error message/status message 1st parameter of the response . . 7th parameter of the response

Description The function block is used to configure the AC31 remote modules. The block can both send configuration parameters to the remote modules and also scan their currently set configuration. Apart from configuration of the AC31 remote modules, the function block can also process further jobs (see list of jobs). Enable for processing a job once is triggered by a FALSE/TRUE edge at input FREI. The required job identification is specified at input CODE. The parameters required for the job are planned at the inputs D1 ... D8. Status messages are signalized at the outputs RDY, OK and ERR. The response data of the job are available at the outputs A1 ... A7. It may take several PLC cycles to process the job.

907 AC 1131/Issued: 02.2001

27

Base_S40-Library

CONFIGURE AC31 MODULES

CS31CO S40

FREI

BOOL

Processing of the block is controlled via input FREI. FREI = FALSE: All block outputs are set to the value FALSE. However, this is not valid, if a job is currently being processed, i. e. processing of a job which is currently being processed, is not affected by FREI = FALSE. FREI = FALSE/TRUE edge: Processing of the job is enabled. Input FREI is no longer evaluated during processing of the job. FREI = TRUE: The block is not processed, i. e. it no longer changes its outputs. However, this is not valid, if a job is currently being processed. GRN INT

RDY = FALSE: Processing of an enabled job has not yet been completed(job is still running) or output RDY has been reset with FREI = FALSE. OK BOOL

Output OK indicates whether the job has been handled successfully or whether an error has been detected during processing. In case of an error, an error number is indicated at output ERR. The output OK is not valid until the job has been completed, i. e. if RDY = TRUE. The following applies: If RDY = TRUE and OK = TRUE: The job has been processed successfully. OK = FALSE: During processing of the job an error has been detected. ERR INT

Group number with which the remote module is addressed by the PLC program. Range: 0 63 Example: On binary input E 12,08, 12 is the group number and 08 is the channel number. CODE INT

At the output ERR status and error identifications are output. The status identifications are output during processing of a job in order to signalize in what stage of processing the job currently is. After enabling a job, status identifications are signalized only for as long as RDY = FALSE. The error identifications are output after completion of the job processing if an error has occurred. Error identifications are thus not signalized until RDY = TRUE and OK = FALSE Error identifications ERR = 1: ERR = 2: An illegal job identification has been specified at input CODE. Incorrect parameters have been specified at the inputs D1 ... D8 (e.g. a group number for which there is no remote module on the CS31 system bus). The addressed AC31 remote module does not accept the job.

The identification of the job to be executed is specified at input CODE (see list of jobs on the next page). D1D8 INT

The parameters required for the job are preset at the inputs D1 ... D8. The number of parameters depends on the job to be executed. There are also jobs requiring no parameters (see list of jobs on the next page). RDY BOOL

The output RDY indicates that processing of the job currently being processed is completed. This output does not indicate whether processing of the job was successful or not. The output RDY has therefore always to be considered together with the output OK. RDY = TRUE and OK = TRUE: Processing of the job is completed without errors. A new job can be started with a FALSE/TRUE edge at input FREI. RDY = TRUE and OK = FALSE: During processing of the job an error has been detected. The corresponding error identification is present at output ERR. A new job can be started with a FALSE/TRUE edge at input FREI.

ERR = 3:

Status identifications ERR = 8: ERR = 10: The function block is waiting since a job of another user is currently being processed. The job has been sent to the receiver and the block is waiting for its response. INT

A1A7

After completion of job processing, the response is available at the outputs A1 ... A7. The number of response parameters depends on the job performed (see list of jobs).

Base_40-Library

28

907 AC 1131/Issued: 02.2001

CONFIGURE AC31 MODULES

CS31CO S40

List of jobs Processing a job consists of: transferring the job and supplying the OK response or not-OK response The OK response is described in connection with the corresponding job. The not-OK response of the individual jobs always looks as follows: RDY: OK: ERR: TRUE FALSE 1. inadmissible job identification 2. wrong parameter; e. g. group number to which there exists no remote module 3. remote module does not accept the job 0

Inquiring the open-circuit monitoring of an output


Job GRN: CODE: D1: D2 D8: group number 0 63 33 channel number not used

to determine whether it is activated or deactivated

OK response RDY: TRUE OK: TRUE A1: 47. open-circuit monitoring ON 32. open-circuit monitoring OFF A2 A7: 0

Deactivating or activating the open-circuit


monitoring of an input Job GRN: CODE: D1: D2 D8: group number 0 63 224. open-circuit monitoring ON 160. open-circuit monitoring OFF channel number not used

A1 A7:

Updating of the maximum number of remote


modules detected The input INT EW 07,15 contains, amongst other things, the maximum number of remote modules detected in the past. The actual number of remote modules which exist at the moment may be less. This command is used to update this value. The modules which exist are counted and the value is stored. The user can inquire this value in the PLC program (EW 07,15, bit 8 15). Job GRN: CODE: D1 D8: 255 (Master PLC with bus) 132 not used

OK response RDY: TRUE OK: TRUE A1 A7: 0

Deactivating or activating the open-circuit


monitoring of an output Job GRN: CODE: D1: D2 D8: group number 0 63 225. open-circuit monitoring ON 161. open-circuit monitoring OFF channel number not used

OK response RDY: TRUE OK: TRUE A1 A7: 0

Inquiring the open-circuit monitoring of an input


Job GRN: CODE: D1: D2 D8: group number 0 63 32 channel number not used

to determine whether it is activated or deactivated

OK response RDY: TRUE OK: TRUE A1 A7: 0

Inquiring a channel to determine whether it is


configured as input or input/output Job GRN: CODE: D1: D2 D8: group number 0 63 34 channel number not used

OK response RDY: TRUE OK: A1: A2 A7: TRUE 47. open-circuit monitoring ON 32. open-circuit monitoring OFF 0

OK response RDY: TRUE OK: TRUE A1: 34. input 35. input/output A2 A7: 0

907 AC 1131/Issued: 02.2001

29

Base_S40-Library

CONFIGURE AC31 MODULES

CS31CO S40

Configuration of a channel as input or


input/output Job GRN: CODE: D1: D2 D8: group number 0 63 162. Input 163. input/output channel number not used

Job GRN: CODE: D1:

OK response RDY: TRUE OK: TRUE A1 A7: 0

D2:

Inquiring the input delay of a channel


Job GRN: CODE: D1: D2 D8: group number 0 63 38 channel number not used

group number 0 63 232 lowest channel number on the module: 0. lowest channel number on the module is 0 (<7) 8. lowest channel number on the module is 8 (>7) module type: 0. binary input 1. analog input 2. binary output 3. analog output 4. binary input/output 5. analog input/output Note: Bit: even number (0, 2, 4) Word: odd number (1, 3, 5) not used

D3 D8:

OK response RDY: TRUE OK: TRUE A1: input delay: 2. 2 ms 4. 4 ms : : : 30. 30 ms 32. 32 ms A2 A7: 0

OK response RDY: TRUE OK: TRUE A1 A7: 0

Acknowledging errors on remote module and

resetting configuration values to default setting In addition to the job Acknowledging errors on remote module, all configurable settings are reset to the default setting. Job GRN: CODE: D1: group number 0 63 233 first channel number on the module: 0. first channel number on the module is 0 (<7) 8. first channel number on the module is 8 (>7) module type: 0. binary input 1. analog input 2. binary output 3. analog output 4. binary input/output 5. analog input/output Note: Bit: even number (0, 2, 4) Word: odd number (1, 3, 5) not used

Setting the input delay of a channel


Job GRN: CODE: D1: D2: group number 0 63 166 channel number input delay 2. 2 ms 4. 4 ms : : : 30. 30 ms 32. 32 ms

D2:

OK response RDY: TRUE OK: TRUE A1 A7: 0

D3 D8:

Acknowledging errors on remote module


This command can be used to reset the error messages registered on the selected remote module. A reset is possible only if the cause of the error is no longer operative.

OK response RDY: TRUE OK: TRUE A1 A7: 0

Base_40-Library

30

907 AC 1131/Issued: 02.2001

CONFIGURE AC31 MODULES

CS31CO S40

Inquiring the configuration of an anlog input


Job GRN: CODE: D1: D2 D8: group number 0 63 42 channel number not used

Inquiring the bus configuration


The bus interface of the Master PLC has a list which stores specific data of the remote modules. The remote modules are numbered in this list in the order in which they can be found on the CS31 system bus. The internal number of the modules must be specified with this command. The response to this command is the group number stored under this number and status information on the corresponding module. Job GRN: not evaluated CODE: 80 D1: number from the module list (1 ... 31) D2 D8: not used OK response RDY: TRUE OK: TRUE A1: status of the remote module: Bit 0 3: number of process data bytes (binary module) or words (word module), which the module sends to the master. Bit 4 ... 7: number of process data bytes (binary module) or words (word module), which the master sends to the module A2: group number (0 63) A3: Bit 0: 0. lowest channel number <7 1. lowest channel number >7 Bit 1: 0. binary module 1. word module A4 A7: 0

OK response RDY: TRUE OK: TRUE A1: 50. input 0 20 mA 49. input 4 20 mA A2 A7: 0

Inquiring the configuration of an anlog output


Job GRN: CODE: D1: D2 D8: group number 0 63 43 channel number not used

OK response RDY: TRUE OK: TRUE A1: 50. output 0 20 mA 49. output 4 20 mA 51. output + 10V A2 A7: 0

Configuration of an analog input


Job GRN: CODE: D1: D2: D3 D8: group number 0 63 170 channel number 50. input 0 20 mA 49. input 4 20 mA not used

Read 1 ... 6 bytes


Job GRN: CODE: group number 0 63 49. read 1 byte 50. read 2 bytes 51. read 3 bytes 52. read 4 bytes 53. read 5 bytes 54. read 6 bytes first channel number on the module: 0. first channel number on the module is 0 (<7) 8. first channel number on the module is 8 (>7) module type: 0. binary input 1. analog input 2. binary output 3. analog output 4. binary input/output 5. analog input/output Note: Bit: even number (0, 2, 4) Word: odd number (1, 3, 5)

OK response RDY: TRUE OK: TRUE A1 A7: 0

Configuration of an analog output


Job GRN: CODE: D1: D2: group number 0 63 171 channel number 50. output 0 20 mA 49. output 4 20 mA 51. output +10 V not used

D1:

D2:

D3 D8:

OK response RDY: TRUE OK: TRUE A1 A7: 0

907 AC 1131/Issued: 02.2001

31

Base_S40-Library

CONFIGURE AC31 MODULES

CS31CO S40

D3: D4: D5 D8:

byte start address (Low Byte) byte start address (High Byte) not used

D2:

OK response RDY: TRUE OK: TRUE A1: value of 1st byte A2: value of 2nd byte or 0 A3: value of 3rd byte or 0 A4: value of 4th byte or 0 A5: value of 5th byte or 0 A6: value of 6th byte or 0 A7: 0

module type: 0. binary input 1. analog input 2. binary output 3. analog output 4. binary input/output 5. analog input/output Note: Bit: even number (0, 2, 4) Word: odd number (1, 3, 5) byte start address (Low Byte) byte start address (High Byte) value of 1st byte value of 2nd byte or not used value of 3rd byte or not used value of 4th byte or not used

Read 1 bit from 1 byte


Job GRN: CODE: D1: group number 0 63 63 first channel number on the module: 0. first channel number on the module is 0 (<7) 8. first channel number on the module is 8 (>7) module type: 0. binary input 1. analog input 2. binary output 3. analog output 4. binary input/output 5. analog input/output Note: Bit: even number (0, 2, 4) Word: odd number (1, 3, 5) byte start address (Low Byte) byte start address (High Byte) bit position within bytes 0 ... 7 not used

D3: D4: D5: D6: D7: D8:

OK response RDY: TRUE OK: TRUE A1 A7: 0

Write 1 bit of 1 byte


Job GRN: CODE: D1: group number 0 63 79 first channel number on the module: 0. first channel number on the module is 0 (<7) 8. first channel number on the module is 8 (>7) module type: 0. binary input 1. analog input 2. binary output 3. analog output 4. binary input/output 5. analog input/output Note: Bit: even number (0, 2, 4) Word: odd number (1, 3, 5) byte start address (Low Byte) byte start address (High Byte) bit position within bytes 0 ... 7 bit value (0 or 1) not used

D2:

D2:

D3: D4: D5: D6 D8:

OK response RDY: TRUE OK: TRUE A1: bit value (0 or 1) A2 A7: 0

Write 1 ... 4 bytes


Job GRN: CODE: group number 0 63 65. write 1 byte 66. write 2 bytes 67. write 3 bytes 68. write 4 bytes first channel number on the module: 0. first channel number on the module is 0 (<7) 8. first channel number on the module is 8 (>7)

D3: D4: D5: D6: D7 D8:

OK response RDY: TRUE OK: TRUE A1 A7: 0

D1:

Base_40-Library

32

907 AC 1131/Issued: 02.2001

CONFIGURE AC31 MODULES

CS31CO S40

Example Declaration: CS31CO_1 : CS31CO; CS31CO_FREI AT %MX0.0 : BOOL; CS31CO_GRN AT %MW1001.0 : INT; CS31CO_CODE AT %MW1001.1 : INT; CS31CO_D1 AT %MW1002.0 : INT; CS31CO_D2 AT %MW1002.1 : INT; CS31CO_D3 AT %MW1002.2 : INT; CS31CO_D4 AT %MW1002.3 : INT; CS31CO_D5 AT %MW1002.4 : INT; CS31CO_D6 AT %MW1002.5 : INT; CS31CO_D7 AT %MW1002.6 : INT; CS31CO_D8 AT %MW1002.7 : INT; CS31CO_RDY AT %MX0.1 : BOOL; CS31CO_OK AT %MX0.2 : BOOL; CS31CO_ERR AT %MW1001.2 : INT; CS31CO_A1 AT %MW1002.8 : INT; CS31CO_A2 AT %MW1002.9 : INT; CS31CO_A3 AT %MW1002.10 : INT; CS31CO_A4 AT %MW1002.11 : INT; CS31CO_A5 AT %MW1002.12 : INT; CS31CO_A6 AT %MW1002.13 : INT; CS31CO_A7 AT %MW1002.14 : INT; FBD: Translation in ABB IL: !BA 0 CS31CO FREI GRN CODE D1 D2 D3 D4 D5 D6 D7 D8 RDY OK ERR A1 A2 A3 A4 A5 A6 A7 ABB IL of example: !BA 0 CS31CO M0,0 MW1,0 MW1,1 MW2,0 MW2,1 MW2,2 MW2,3 MW2,4 MW2,5 MW2,6 MW2,7 M0,1 M0,2 MW1,2 MW2,8 MW2,9 MW2,10 MW2,11 MW2,12 MW2,13 MW2,14

907 AC 1131/Issued: 02.2001

33

Base_S40-Library

CONFIGURE AC31 MODULES

CS31CO S40

Function call in IL CAL CS31CO1(FREI := CSCO_FREI, GRN := CSCO_GRN, CODE := CSCO_CODE, D1 := CSCO_D1, D2 := CSCO_D2, D3 := CSCO_D3, D4 := CSCO_D4, D5 := CSCO_D5, D6 := CSCO_D6, D7 := CSCO_D7, D8 := CSCO_D8) CS31CO1.OK CS31CO_OK CS31CO1.ERR CS31CO_ERR CS31CO1.A1 CS31CO_A1 CS31CO1.A2 CS31CO_A2 CS31CO1.A3 CS31CO_A3 CS31CO1.A4 CS31CO_A4 CS31CO1.A5 CS31CO_A5 CS31CO1.A6 CS31CO_A6 CS31CO1.A7 CS31CO_A7 CS31CO1.RDY CS31CO_RDY

Function call in ST CS31CO1 (FREI := CSCO_FREI, GRN := CSCO_GRN, CODE := CSCO_CODE, D1 := CSCO_D1, D2 := CSCO_D2, D3 := CSCO_D3, D4 := CSCO_D4, D5 := CSCO_D5, D6 := CSCO_D6, D7 := CSCO_D7, D8 := CSCO_D8); := CS31CO1.OK; := CS31CO1.ERR; := CS31CO1.A1; := CS31CO1.A2; := CS31CO1.A3; := CS31CO1.A4; := CS31CO1.A5; := CS31CO1.A6; := CS31CO1.A7; := CS31CO1.RDY;

LD ST LD ST LD ST LD ST LD ST LD ST LD ST LD ST LD ST LD ST

CS31CO_OK CS31CO_ERR CS31CO_A1 CS31CO_A2 CS31CO_A3 CS31CO_A4 CS31CO_A5 CS31CO_A6 CS31CO_A7 CS31CO_RDY

Note: In IL, the function call has to be performed in one line.

Base_40-Library

34

907 AC 1131/Issued: 02.2001

ACKNOWLEDGE AC31 ERRORS

CS31QU S40

ACKNOWLEDGE AC31 ERRORS


This block allows to acknowledge automatically error messages of AC31 remote modules.

CS31QU S40

Block type Function block without historical values Parameters Instance CS31QU FREI BOOL Description This function block allows to acknowledge automatically FK3 and FK4 error messages of AC31 remote modules. Error messages are stored on the AC31 remote modules until they are acknowledged. Even if the error has been removed, the error message is still pending on the module until acknowledgement and is also signalized to the PLC until the message is acknowledged. Processing of the block is enabled with a TRUE signal at input FREI, and the block then acknowledges AC31 errors continuously until the signal at the input FREI changes from TRUE to FALSE. It may take several PLC cycles to acknowledge an error on an AC31 module. If the function block is enabled, it constantly checks whether an AC31 error of class 3 or 4 has occurred and acknowledges this error. 1. An AC31 error of class 3 has occurred: The block acknowledges the error on the AC31 remote module which signalizes the error and also clears the error message on the PLC, i.e. the error flag M255,13 / MX255.13 is reset and LED FK3 is deactivated. Example of a FK3 error: a remote module is disconnected from the CS31 system bus. 2. An AC31 error of class 4 has occurred: The block acknowledges the error on the AC31 remote module which signalizes the error and also clears the error message on the PLC, i.e. the error flag M255,14 / MX255.14 is reset. Example of a FK4 error: a remote module signalizes an open circuit Instance name Enabling of the block processing

907 AC 1131/Issued: 02.2001

35

Base_S40-Library

ACKNOWLEDGE AC31 ERRORS

CS31QU S40

Example Declaration: CS31QU_1 : CS31QU; CS31QU_FREI AT %IX62.0 : BOOL; FBD: Translation in ABB IL: !BA 0 CS31QU FREI ABB IL of example: !BA 0 CS31QU E62,0

Function call in IL CAL CS31QU_1(FREI := CS31QU_FREI)

Function call in ST CS31QU_1(FREI := CS31QU_FREI);

Base_40-Library

36

907 AC 1131/Issued: 02.2001

UP COUNTER

CTU S40

UP COUNTER
This function block serves to count pulses.

CTU S40

Block type Function block with historical values Parameters Instance CU RESET PV Q CV CTU BOOL BOOL INT BOOL INT Instance name Pulse input Counter reset input High counter limit Limit indicator Counter value

Description Each positive edge (FALSE->TRUE edge) at the input CU increases the current value specified at output CV by 1. CU BOOL Q BOOL

The output Q indicates if the counter value is higher or not than the value at the input PV. CV > PV CV < PV CV ->Q = TRUE ->Q = FALSE INT

The pulse signal is allocated to the input CU. The positive edge of the pulse is evaluated in each case. R BOOL

A 1 signal at the input R sets the counter content to the value 0. The reset input R has the highest priority. PV INT

The current counter value is avaliable at the output CV. If the counter reaches the positive or negative limit of number range, the counter is limited to this value. Number range Low limit : High limit : 0 7FFFH +32767

The high limit of the counter is specified at the input PV.

907 AC 1131/Issued: 02.2001

37

Base_S40-Library

UP COUNTER

CTU S40

Example Declaration: CTU1: CTU; CTU_CU AT %MX1.0: BOOL; CTU_RESET AT %MX0.0 : BOOL; CTU_PV %MW3002.0 : INT := 1000; CTU_Q AT %MX1.1 : BOOL; CTU_CV AT %MW1002.2 : INT; FBD: Translation in ABB IL: !BA 0 CTU CU RESET PV Q CV ABB IL of example: !BA 0 CTU M1,0 M0,0 KW2,0 M1,1 MW2,2

; 1000

Function call in IL CAL CTU_1(CU := CTU_CU, RESET := CTU_RESET, PV := CTU_PV) CTU_1.Q CTU_Q CTU_1.CV CTU_CV

Function call in ST CTU ( CU= CTU_CU, RESET:= CTU_RESET, PV := CTU_PV);

LD ST LD ST

CTU_Q := CTU_1.Q; CTU_CV := CTU_.CV;

Note: In IL, the function call has to be performed in one line.

Base_40-Library

38

907 AC 1131/Issued: 02.2001

HIGH SPEED COUNTER

CTUH S40

HIGH SPEED COUNTER


The CTUH function block allows the counting of high speed counters of units series 40 and 50.

CTUH S40

Block type Function block with historical values Parameters Instance NUM RE SE INIT RPI CATCH R_Q Q CV CATV CTUH INT BOOL BOOL INT BOOL BOOL BOOL BOOL INT INT Instance name Counter mode Counter reset input Counter set input Set value Reset point indicator Catch counter value Reset bit overflow Overflow Counter value Caught counter value

Description Units series 40..50 have two high speed counters that can be used in the following modes : - C1 : counting on the %IX62.00 input Counting start: on positive edge(FALSE->TRUE edge) Representation:1 INT (16 bits) Overflow : when passing from -1 to 0. Capture : on positive edge of the %IX62.02 input - C2 : counting on the %IX62.01 input Counting start : on positive edge (FALSE->TRUE edge) Representation:1 INT (16 bits) Overflow : when passing from -1 to 0. Capture : on positive edge of the %IX62.03 input - Incremental encoder : counting on the %IX62.00 and %IX62.01 inputs Counting start : on positive edge (FALSE/TRUE edge) Representation:1 INT (16 bits) Overflow : when passing from -1 to 0 or from 0 to -1 Capture : on positive edge of the %IX62.02 input NUM DIRECT CONSTANT The counting mode is specified at the input NUM. 1 = counter mode C1 2 = counter mode C2 3 = incremental encoder >3 = the block is not processed R BOOL In case of defective channel (i. e. one input not connected) the value increases of +1 and decreases of -1.

A TRUE signal at the input R resets the counter value and the capture register to the value 0. The reset input R has the highest priority. If R = TRUE then CV = 0 and CATV = 0 S BOOL

A TRUE signal at the input S loads the counter value with the preset value specified at the input INIT. If S = TRUE then CV = INIT

907 AC 1131/Issued: 02.2001

39

Base_S40-Library

HIGH SPEED COUNTER

CTUH S40

INIT

INT

R_Q

BOOL

The preset value is specified at the input INIT. RPI BOOL

A TRUE signal at the input R_Q resets the overflow to the value FALSE. If R_Q = TRUE then Q = FALSE Q The overflow is specified at the output Q. Q = TRUE when CV passes from -1 to 0 or from 0 to -1. CV INT BOOL

A TRUE signal at the input RPI validates the counter value capture and the counter reset during the capture. The RPI input has a higher priority than CATCH. RPI = TRUE Capture is valid on all the counters.

If there is a positive edge on %IX62,02 or %IX62,03, there is a hard capture of the counter. The counter is reset to 0. CATCH BOOL

The current counter value is available at the output CV. A TRUE signal at the input CATCH validates the counter value capture. CATCH = 0 CATCH = 1 Capture not valid Capture is valid on all the counters. CATV INT

The counter value when CATCH = TRUE is available at the output CATV. Number range: Integer word (16 bits) Low limit : High limit : 8000H 7FFFH - 32768 + 32767

If there is a positive edge on %IX62,02 or %IX62,03, there is a hard capture of the counter. The counter is not reset to 0.

Base_40-Library

40

907 AC 1131/Issued: 02.2001

HIGH SPEED COUNTER

CTUH S40

Example Declaration: CTUH_1: CTUH; CTUH_RE AT %MX1.0: BOOL; CTUH_SE AT %MX1.1: BOOL; CTUH_INIT AT %MW3002.0: INT := 100; CTUH_RPI AT %MX1.2: BOOL; CTUH_CATCH AT %MX1.3: BOOL; CTUH_R_Q AT %MX1.4: BOOL; CTUH_Q AT %MX1.5: BOOL; CTUH_CV AT %MW1010.0: INT; CTUH_CATV AT %MW1010.1: INT; Translation in ABB IL: !BA 0 CTUH #NUM RE SE INIT RPI CATCH R_Q Q CV CATV ABB IL of example: !BA 0 CTUH #1 M1,0 M1,1 KW2,0 M1,2 M1,3 M1,4 M1,5 MW10,0 MW10,1

FBD:

; 100

Function call in IL CAL CTUH1( NUM := 01, RE := CTUH_RE, SE := CTUH_SE, INIT := CTUH_INIT, RPI := CTUH_RPI, CATCH := CTUH_CATCH, R_Q := CTUH_R_Q) CTUH1.Q CTUH_Q CTUH1.CV CTUH_CV CTUH1.CATV CTUH_CATV

Function call in ST CTUH1 ( NUM := 01, RE := CTUH_RE, SE := CTUH_SE, INIT := CTUH_INIT, RPI := CTUH_RPI, CATCH := CTUH_CATCH, R_Q := CTUH_R_Q); := CTUH1.Q; := CTUH1.CV; := CTUH1.CATV;

LD ST LD ST LD ST

CTUH_Q CTUH_CV CTUH_CATV

907 AC 1131/Issued: 02.2001

41

Base_S40-Library

READ DIRECT INPUTS

DIN S40

READ DIRECT INPUTS


The function block DIN reads ONE direct input of the central unit and its extensions. The direct input to be read is specified at the input INP.

DIN S40

Block type Function block without historical values Parameters Instance EN INP Description This function can only be used with series 40..50 central units. The function block DIN reads ONE direct input of the central unit and its extensions. The direct input to be read is specified at the input INP. The function block is useful : - if the cycle time is long - if the capacity utilization of the central unit is high The PLC processor automatically builds an updated process image of the inputs at the start of each program cycle. The DIN function block is able to get the physical input value specified at the input INP within a program cycle. This may be required in conjunction with specific applications, in order to detect and process the input signal changes more than once per program cycle. - If the input to be read is on the central unit : The new input value can be read instantaneously. - If the input to be read is on an central extension unit : The DIN function reads the present input value and generates at the same time a refreshment of the extension bus. The DIN function block is useful if it is used in a time interruption knowing that the present input value read in one interruption is the input value refreshed by the DIN function of the previous interruption. Note: Remote inputs are refreshed every cycle time. The DIN function block can not be used for remote units on the CS31 bus. DIN BOOL BOOL Instance name Enable Direct Input

Base_40-Library

42

907 AC 1131/Issued: 02.2001

READ DIRECT INPUTS

DIN S40

Example Declaration: DIN_1 : DIN; DIN_EN AT %MX0.0 : BOOL; DIN_INP AT %IX62.0 : BOOL; FBD: Translation in ABB IL: !BA 0 DI EN INP ABB IL of example: !BA 0 DI M0,0 E62,0

Function call in IL CAL DIN_1(EN := DIN_EN, INP := DIN_INP)

Function call in ST DIN_1 (EN := DIN_EN, INP := DIN_INP);

907 AC 1131/Issued: 02.2001

43

Base_S40-Library

DIVISION DOUBLE WORD

DIVD S40

DIVISION DOUBLE WORD


The value of the operand at input E1 is divided by the value of the operand at input E2 and the result is assigned to the operand at output A. The remainder is assigned to the operand at the output REST. If a remainder is produced, the result will always be rounded down. If the result lies outside of the permissible number range, it will be limited to the maximum or minimum value of the number range. If a limiting has been performed, a TRUE signal is assigned to the binary operand at output Q and the value 0 is assigned to output REST. If no limiting occurred, a FALSE signal is assigned to the binary operand at output Q. Block type Function block without historical values Parameters Instance E1 E2 A REST Q Description The value of the operand at input E1 is divided by the value of the operand at input E2 and the result is assigned to the operand at output A. The remainder is assigned to the operand at output REST. If a remainder is produced, the result will always be rounded down. If the result lies outside of the permissible number range, it will be limited to the maximum or minimum value of the number range: -2147483647 (8000 0001H) 2147483647 (7FFF FFFFH). If a limiting has been performed, a TRUE signal is assigned to the binary operand at output Q and the value 0 is assigned to output REST. If no limiting occurred, a FALSE signal is assigned to the binary operand at output Q. Division by zero is therefore also signalized at the binary output Q. The inputs and outputs can neither be duplicated nor negated. Limitation of Divisor The divisor E2 is limited to the range 32767+32767 Remainder handling DIVD DINT DINT DINT DINT BOOL Instance name Dividend Divisor Result (quotient) Remainder Result limited

DIVD S40

If the division results in a remainder, this is available at the double word output REST. The result of the division is always rounded down if a remainder occurs. Example: 3 : 3 = 1 Remainder 0 4 : 3 = 1 Remainder 1 5 : 3 = 1 Remainder 2 6 : 3 = 2 Remainder 0

As the remainder is available at the output REST, the user can compare this to the divisor and can round the result at output A according to his own requirements. Example: Remainder > divisor / 2 round up the result at output A

Base_40-Library

44

907 AC 1131/Issued: 02.2001

DIVISION DOUBLE WORD

DIVD S40

Division by zero If the divisor has the value zero, the positive or negative limit of the number range is assigned to output A. For the division by zero the following applies: A = -2147483647 (8000 0001H) if dividend is negative A = +2147483647 (7FFF FFFFH) if dividend is positive REST = 0 Q = TRUE Output for the remainder Output to signalize that the value at output A has been limited

Invalid result value If the invalid value 8000 0000H is the result of the division, this will be corrected to the permissible limit 8000 0001H (-2 147 483 647), the binary output Q will be set to the value TRUE and the output REST will be set to the value 0.

Example Declaration: DIVD_1 : DIVD; DIVD_E1 AT %MD2002.0 : DINT; DIVD_E2 AT %MD2002.1 : DINT; DIVD_A AT %MD2002.2 : DINT; DIVD_REST AT %MD2002.3 : DINT; DIVD_Q AT %MX0.0 : BOOL; FBD: Translation in ABB IL: !BA 0 DIVD E1 E2 A REST Q ABB IL of example: !BA 0 DIVD MD2,0 MD2,1 MD2,2 MD2,3 M0,0

Function call in IL CAL LD ST LD ST LD ST DIVD1(E1 := DIVD_E1, E2 := DIVD_E2) DIVD1.REST DIVD_REST DIVD1.Q DIVD_Q DIVD1.A DIVD_A

Function call in ST DIVD1 DIVD_REST DIVD_Q DIVD_A (E1 := DIVD_E1, E2 := DIVD_E2); :=DIVD1.REST; :=DIVD1.Q; :=DIVD1.A;

907 AC 1131/Issued: 02.2001

45

Base_S40-Library

WRITE DIRECT OUTPUTS

DOUT S40

WRITE DIRECT OUTPUTS


The function block DOUT writes ONE direct output of the central unit and its extensions. The direct output to be write is specified at the input OUT.

DOUT S40

Block type Function block without historical values Parameters Instance EN OUT Description The function block DOUT writes ONE direct output of the central unit or its extension. The direct output to be written is specified at the output OUT. The function block is useful : - if the cycle time is long - if the capacity utilization of the central unit is high The PLC processor automatically outputs a process image of the direct outputs, which was updated during the program cycle, at the end of each program cycle. The DOUT function block is able to set the physical output specified at the OUT parameter within program cycles. This may be required in conjunction with specific applications, in order to have available the output signal changes more than once per program cycle. If the output to be written is on the central unit : The new output value can be write instantaneously. If the output to be written is on an extension unit : The new output value can be write with a delay of max 2 ms. Note: Remote outputs are refreshed every cycle time. The DOUT function block can not be used for remote outputs. DOUT BOOL BOOL Instance name Enable Direct Output

Base_40-Library

46

907 AC 1131/Issued: 02.2001

WRITE DIRECT OUTPUTS

DOUT S40

Example Declaration: DOUT_1 : DOUT; DOUT_EN AT %MX0.0 : BOOL; DOUT_OUT AT %QX62.0 : BOOL; FBD: Translation in ABB IL: !BA 0 DO EN OUT ABB IL of example: !BA 0 DO M0,0 A62,0

Function call in IL CAL LD ST DOUT_1(EN := DOUT_EN) DOUT_1.OUT DOUT_OUT

Function call in ST DOUT_1 DOUT_OUT (EN := DOUT_EN); := DOUT_1.OUT;

907 AC 1131/Issued: 02.2001

47

Base_S40-Library

OUTPUT OF ASCII CHARACTERS

DRUCK S40

OUTPUT OF ASCII CHARACTERS


A central unit of S40..50 can send ASCII messages through its RS232 serial interface with the DRUCK function block. Each message has an identification number and can be composed of ASCII texts and operands values. The texts and operand identifiers to be output are stored in the user program in the PLC directly by the DRUCK block. The numerical values to be output are conditioned for a diversity of representations by specifying a format identifier. Block type ABB IL Program block inside Pragma Parameters FREI SSK TXNR RDY TX Description IMPORTANT NOTE : Initialization of the serial interface Before the DRUCK block can communicate with the serial interface, it must be initialized with the SINIT block. Communication between several DRUCK blocks and the same serial interface: Several DRUCK blocks can use the same serial interface. If the serial interface is engaged by one of the DRUCK blocks, the other DRUCK blocks automatically wait until it is free again. The priority access to the serial interface when several DRUCK blocks simultaneously have access to the same interface, corresponds to the sequence in which the DRUCK blocks are called in the user program : the first DRUCK block located at the beginning of the user program is given access first. The processing sequence must be planned by an appropriate mutual interlocking of the DRUCK blocks. ABB IL Type BOOL INT INT BOOL Texts Description Enable signal for output of one text (FALSE/TRUE edge ) Serial interface identification Number of the text to be output Ready Texts/operands capable of duplication {S40Inline !BA 0 DRUCK FREI TXNR SSK RDY TX }

DRUCK S40
The block DRUCK is only in IL and ST available !

Communication by a DRUCK and EMAS block with the same serial interface: A DRUCK block and a EMAS block (receiving of ASCII messages) can use the same serial interface without any special precaution. FREI BOOL

If the block is ready (RDY = TRUE) and a FALSE/TRUE edge appears at the FREI input, the text identified at the input TXNR is sent through the serial interface specified at the SSK input. If a FALSE/TRUE edge appears at the FREI input although the RDY output is equal to FALSE (i. e. the block is not ready yet for a new transfer), the FALSE/TRUE edge is ignored. Therefore, no new text transfer is started as long as the RDY signal is FALSE.

Base_40-Library

48

907 AC 1131/Issued: 02.2001

OUTPUT OF ASCII CHARACTERS

DRUCK S40

SSK

INT

Central units can have one or two RS232 serial interface. The number of the interface through which the text is to be output is specified at the SSK input : SSK = 1 for COM1 SSK = 2 for COM2 TXNR INT

- Each bit operand counts as 1 character - Each word operand counts as 1 to 6 characters * - Each double word operand counts as 10 to 11 characters * * depends on the format When the program is started, the PLC checks the texts to determine whether or not the maximum length is exceeded. Syntax of texts : A text for the DRUCK block consists of : - The text number - One or several subtexts (optional) - Operands with format identifier (optional) #n : Number of the text to be entered as a direct constant (1..99). #" : # : Subtext : Start identifier for text input. Stop identifier for text input All ASCII characters (from hexadecimal code 00 up to 7F). Operand : BOOL, INT or DINT operands whose values are output depending on the display format. => the operands must be written in ABB IL format !

The number of the text to be output is specified at the TXNR input : 1 < TXNR < 99 The number of the text to be output must be present at the TXNR input until the block indicates the end of text transfer with a TRUE signal at its RDY output. RDY BOOL

In the program cycle in which the block is called for the first time, and during the time when a text is output, RDY is equal to FALSE. As long as RDY is equal to FALSE, no new text output can be activated and all FALSE/TRUE edge present at the FREI input are ignored and lost. After the first call of the block or after termination of a text output, RDY is equal to TRUE and the block is ready again for output of a new text. FREI FALSE/ TRUE edge RDY TRUE TX NR 2 SSK 1 MEANING The text with the number 2 is output through interface 1 FALSE/TRUE edge is ignored because the block is not ready No output of a new text

Format identifier : The PLC is capable of presenting the numerical values to be output on a screen or a printer in diverse ways. The format identifier specifies the type of the operand and the display format of its value. This is planned directly before the operand to be output and consists of three digits. The 1st digit from the left specifies the operand type. There are 3 operand types : BOOL : INT : DINT : 1 2 3

FALSE/ TRUE edge

FALSE

No FALSE/ TRUE edge

=> The RDY signal can be used for example at the FREI input to activate a new text transfer. TX ALL

Texts and operands to be output are directly written at the TX inputs. The way to write the messages is described here below. Storage of texts in the central unit : Quantity : Length : 1...99 messages Up to 256 characters (owing to the send buffer length = 256) 1 character 3 characters

Numbers 2 and 3 define the display format. Examples : - Format identifier 103 Digit 1 : 1 : BOOL operand Digits 2 and 3 : 03 : Display format 03 (see table) -Format identifier 204 Digit 1 : 2 : INT operand Digits 2 and 3 : 04 : Display format 04 (see table)

- Each text character counts as - Each format identifier counts as

907 AC 1131/Issued: 02.2001

49

Base_S40-Library

OUTPUT OF ASCII CHARACTERS

DRUCK S40

- Format identifier 341 Digit 1 : 3 : DINT operand Digits 2 and 3 : 41 : Display format 41 (see table) Possible display formats : All possible display formats are listed in the following table: - identifiers applicable to word data types : 01 to 16, 21 to 26, 33 to 36, 42 to 51, and 99 - identifiers applicable to double word data types : 05 to 16 and 41 to 62 There are formats - with leading zeros and - with leading zeros substituted by blanks which are indicated in the table here below by -. Format identifier ASCII output

Numerical example=00347 33 +/-xxx,xx +--3,47 34 +/-xx,xxx +--,347 35 +/-x,xxxx +-,0347 36 +/-,xxxxx +,00347 Numerical example=0012345678 41 xxxxxxxxxx 0012345678 Numerical example=0011223344 42 xxxxxxxxx,x 001122334,4 43 xxxxxxxx,xx 00112233,44 44 xxxxxxx,xxx 0011223,344 45 xxxxxx,xxxx 001122,3344 46 xxxxx,xxxxx 00112,23344 47 xxxx,xxxxxx 0011,223344 48 xxx,xxxxxxx 001,1223344 49 xx,xxxxxxxx 00,11223344 50 x,xxxxxxxxx 0,011223344 51 ,xxxxxxxxxx ,0011223344 Numerical example=0055667788 52 +/- xxxxxxxxxx +0055667788 53 +/- xxxxxxxxx,x +005566778,8 54 +/- xxxxxxxx,xx +00556677,88 55 +/- xxxxxxx,xxx +0055667,788 56 +/- xxxxxx,xxxx +005566,7788 57 +/- xxxxx,xxxxx +00556,67788 58 +/- xxxx,xxxxxx +0055,667788 59 +/- xxx,xxxxxxx +005,5667788 60 +/- xx,xxxxxxxx +00,55667788 61 +/- x,xxxxxxxxx +0,055667788 62 +/- ,xxxxxxxxxx +,0055667788 Special format : Output of a word operands HEX value : The value of a INT operand is output directly as a hexadecimal value. Therefore, the value is not converted to ASCII before output. 98 Only the LOW BYTE (8 bits) of the word operand is output 99 The LOW BYTE of the word operand is output first, followed by its HIGH BYTE Important : This special format is only permissible for the "word" data type. Permissible format : 298 and 299 Inadmissible format : 198, 199, 398 and 399

Numerical example=0012345678 01 x 8 02 xx 78 03 xxx 678 04 xxxx 5678 05 xxxxx 45678 Numerical example=1102215 06 xxxx,x 0221,5 07 xxx,xx 022,15 08 xx,xxx 02,215 09 x,xxxx 0,2215 10 ,xxxxx ,02215 Numerical example=00331 11 +/- xxxxx +00331 12 +/- xxxx,x +0033,1 13 +/- xxx,xx +003,31 14 +/- xx,xxx +00,331 15 +/- x,xxxx +0,0331 16 +/- ,xxxxx +,00331 Numerical example=00234 21 xxxxx --234 Numerical example=00347 22 xxxx,x --347 23 xxx,xx --3,47 24 xx,xxx --,347 25 x,xxxx -,0347 26 ,xxxxx ,00347

Base_40-Library

50

907 AC 1131/Issued: 02.2001

OUTPUT OF ASCII CHARACTERS

DRUCK S40

- Input of texts: The following parts of the overall message are treated as independent operands : - the text number e.g. #1 - a subtext e.g. #" Text1 # - a format identifier e.g. # 203 - an operand e.g. MW002,03 - a further subtext e.g. #" Text2 # Input of special characters for screen or printer control : Control characters such as "line feed" <LF> or "carriage return" <CR> are needed to arrange the message when output to a screen or printer. These special characters can be placed anywhere within a subtext. In the programming system, these special characters are entered by means of : \Numerical value of the character The numerical value of the character is specified as a three-digit decimal number. Example :

Notes : - The characters with the ASCII code >20H (=32D) must be entered with the keyboard. As an example, the character "!" can be entered with the keyboard, and not as \033. - Characters, which are not special characters and which can not be entered with the keyboard, can be generated in the following way : Press and hold down the <ALT> key, now type the numerical code (decimal code) on the numerical keypad of the keyboard, then release the <ALT> key. - The character with the ASCII code 255 is reserved for internal use of the programming software and must not be used otherwise. - Example : Text 1: The machine is ready Text 2: The machine is not ready Text 3: Level is (%MW1001.1=>MW01,01)m and temperature is (%MW1001,0=>MW01,00)C. The Program will be in Instruction List : LD 0 {S40Inline !BA0 DRUCK M0,0 MW00,00 MW00,01 A00,00 #01 #"\010\013 The machine is ready : "# #02 #"\010\013 The machine is not ready. "# #03 #"\010\013 It is "# #202 MW01,01 #"m and temperature is "# #203 MW01,00 #"C. "# }

The following output is to be made on a printer : First line Blank line Second line To do this, the following text must be planned : First line <CR> <LF> <LF> second line The following applies : <CR> = 013 <LF> = 010 The text input in the programming system is as follows : #"First line\013\010\010second line#

907 AC 1131/Issued: 02.2001

51

Base_S40-Library

DUAL TO BCD CONVERSION, WORD

DUALBCD S40

DUAL TO BCD CONVERSION, WORD


The binary number at input E is converted to a BCD coded number and assigned to the operand at output A. The binary number is represented in 16 bits and must lie within the range 0 < E < 270FH (corresponding to BCD 9999). The BCD number is limited to 9999 if it lies outside of this range. The BCD number is stored in a 16 bit INT. Block type Function Parameters E (A) INT INT Binary number BCD coded number

DUALBCD S40

Description The binary number at input E is converted to a BCD coded number and assigned to the operand at output A. The binary number is represented in 16 bits and must lie within the range 0 < E < 270FH (corresponding to BCD 9999). The BCD number is limited to 9999 if it lies outside of this range. The BCD number is stored in a 16 bit INT. The input and the output can neither be duplicated nor negated. Definition: The significance of the digits in a hexadecimal number and a BCD coded number is defined as follows:

HEX NUMBER
15 11 7 3 0 BIT 15

BCD NUMBER
11 7 3 0

Z4

Z3

Z2

Z1

Z4

Z3

Z2

Z1

Numerical value: Z1 * 1 Z2 * 16 Z3 * 256 Z4 * 4096 0 < Zi < F

Numerical value: Z1 * 1 Z2 * 10 Z3 * 100 Z4 * 1000 0 < Zi < 9

Base_40-Library

52

907 AC 1131/Issued: 02.2001

DUAL TO BCD CONVERSION, WORD

DUALBCD S40

Example HEX NUMBER


15 11 7 3 0 BIT 15

BCD NUMBER
11 7 3 0

->
2 208 1024 0 1234

Z1 = 2 * 1 Z2 = 13 * 16 Z3 = 4 * 256 Z4 = 0 * 4096

= = = =

Z1 = 4 * 1 Z2 = 3 * 10 Z3 = 2 * 100 Z4 = 1 * 1000

= = = =

4 30 200 1000 1234

Conversion of a negative binary number to a BCD number A negative binary number with an amount less than 270FH can be converted to a BCD number, whereby the value and the sign of the BCD number are each stored in one flag. Example Declaration: DUALBCD_E AT %MW1002.1 : INT; DUALBCD_A AT %MW1002.2 : INT;

Converting a binary number with an amount higher than 270FH Not available for S40..50.

Translation in ABB IL: !BA 0 BINBCD E A ABB IL of example: !BA 0 BINBCD MW2,1 MW2,2

FBD:

Function call in IL LD DUAL_E DUALBCD ST DUAL_A

Function call in ST DUAL_A:= DUALBCD(DUAL_E);

907 AC 1131/Issued: 02.2001

53

Base_S40-Library

AND COMBINATION, DOUBLE WORD

DWAND S40

AND COMBINATION, DOUBLE WORD


This function block generates, bit-by-bit, the AND combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output.

DWAND S40

Block type Function Parameters E1 E2 A DINT DINT DINT Operand 1 Operand 2 Result of the AND combination

Description This function block generates, bit-by-bit, the AND combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output. Example Declaration: DWAND_E1 AT %MD2000.0 : DINT; DWAND_E2 AT %MD2000.1 : DINT; DWAND_A AT %MD2000.2 : DINT; Translation in ABB IL: !BA 0 DWAND E1 E2 A ABB IL of example: !BA 0 DWAND MD0,0 MD0,1 MD0,2 The inputs and outputs can neither be duplicated nor negated.

FBD:

Function call in IL LD DWAND ST DWAND_E1 DWAND_E2 DWAND_A

Function call in ST DWAND_A := DWAND(E1 := DWAND_E1, E2 := DWAND_E2);

Base_40-Library

54

907 AC 1131/Issued: 02.2001

OR COMBINATION, DOUBLE WORD

DWOR S40

OR COMBINATION, DOUBLE WORD


This function block generates, bit-by-bit, the OR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output.

DWOR S40

Block type Function Parameters E1 E2 A DINT DINT DINT Operand 1 Operand 2 Result of the OR combination

Description This function block generates, bit-by-bit, the OR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output. Example Declaration: DWOR_E1 AT %MD2000.0 : DINT; DWOR_E2 AT %MD2000.1 : DINT; DWOR_A AT %MD2000.2 : DINT; Translation in ABB IL: !BA 0 DWOR E1 E2 A ABB IL of example: !BA 0 DWOR MD0,0 MD0,1 MD0,2 The inputs and outputs can neither be duplicated nor negated.

FBD:

Function call in IL LD DWOR ST DWOR_E1 DWOR_E2 DWOR_A

Function call in ST DWOR_A := DWOR(E1 := DWOR_E1, E2 := DWOR_E2);

907 AC 1131/Issued: 02.2001

55

Base_S40-Library

DOUBLE WORD TO WORD CONVERSION

DWW S40

DOUBLE WORD TO WORD CONVERSION


The value of the double word operand at input E is converted to a word variable and the result is assigned to the word operand at output A1.

DWW S40

Block type Function block without historical values Parameters Instance E A1 A2 DWW DINT INT BOOL Instance name Double word variable to be converted Result of conversion, word variable Result limited

Description The value of the double word operand at input E1 is converted to a word variable and the result is assigned to the word operand at output A1. The result is limited to the maximum or minimum number range. max. number range: min. number range: Example Declaration: DWW_1 : DWW DWW_E AT %MD2000.0 : DINT; DWW_A1 AT %MW1000.0 : INT; DWW_A2 AT %MW1000.1 : INT; FBD: Translation in ABB IL: !BA 0 DWW E A1 A2 ABB IL of example: !BA 0 DWW MD0,0 MW0,0 MW0,1 +32767 (7FFFH) -32767 (8001H) If limiting occurred, a TRUE signal is assigned to the binary operand at output A2. If no limiting occurred, a FALSE signal is assigned to the binary operand at output A2. The input and the outputs can neither be duplicated nor negated.

Function call in IL CAL LD ST LD ST DWW_1(E := DWW_E) DWW_1.A2 DWW_A2 DWW_1.A1 DWW_A1

Function call in ST DWW_1 DWW_A2 DWW_A1 (E := DWW_E); := DWW_1.A2; := DWW_1.A1;

Base_40-Library

56

907 AC 1131/Issued: 02.2001

XOR COMBINATION, DOUBLE WORD

DWXOR S40

XOR COMBINATION, DOUBLE WORD


This function block generates, bit-by-bit, the XOR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output.

DWXOR S40

Block type Function Parameters E1 E2 A DINT DINT DINT Operand 1 Operand 2 Result of the XOR combination

Description This function block generates, bit-by-bit, the XOR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output. Example Declaration: DWXOR_E1 AT %MD2000.0 : DINT; DWXOR_E2 AT %MD2000.1 : DINT; DWXOR_A AT %MD2000.2 : DINT; Translation in ABB IL: !BA 0 DWXOR E1 E2 A ABB IL of example: !BA 0 DWXOR MD0,0 MD0,1 MD0,2 The inputs and outputs can neither be duplicated nor negated.

FBD:

Function call in IL LD DWXOR ST DWXOR_E1 DWXOR_E2 DWXOR_A

Function call in ST DWXOR_A := DWXOR(E1 := DWXOR_E1, E2 := DWXOR_E2);

907 AC 1131/Issued: 02.2001

57

Base_S40-Library

RECEPTION OF ASCII CHARACTERS

EMAS S40

RECEPTION OF ASCII CHARACTERS


The function block EMAS: receives telegram through a serial interface of the PLC compares these telegrams to comparision telegrams stored in the user program and, if these agree, provides the user data of the telegram received at the blocks outputs. {S40Inline !BA 0 EMAS QUIT SSK #ANU MEUN RDY TELN MW0 VT0 }

EMAS S40
The block EMAS is only in IL and ST available !

Block type ABB IL Program block inside Pragma Parameters QUIT SSK #ANU MEUN RDY TELN MW0 VT0 Description ASCII communication function block. A AC31 central unit can receive ASCII messages through its RS232 serial interface with the EMAS function block. The EMAS function block : - receives telegrams through a serial interface of the PLC - compares these telegrams to comparison telegrams stored in the user program - and, if these agree, provides the user data of the telegram received at the block's outputs. The received telegrams are fetched from the serial interface by an interface driver and are provided in a BUFFER for further processing by EMAS. The driver recognizes the end of the telegram by the end of telegram character. This end of telegram character is planned in the SINIT block. IMPORTANT NOTE : Initialization of the serial interface. Before using the EMAS block, the serial interface used has to be initialized with the SINIT block. Communication between several EMAS blocks and the same serial interface : - EMAS blocks of a user program which access the same serial interface must be interlocked so that only ever one EMAS block is active. If this is not done, telegrams may be processed by the wrong EMAS and declared invalid. - If both user program 1 and also user program 2 contain EMAS blocks which access the same serial interface, they must be interlocked so that only ever one EMAS block is active. If this is not done, telegrams may be processed by the wrong EMAS and declared invalid. A telegram loss can be avoided by interlocking of the EMAS blocks. Interlocking must be planned so that only the EMAS block is enabled for which the telegram arriving through the interface is intended. ABB IL Type BOOL INT Direct constant BOOL BOOL INT INT Texts Description Reception of telegrams not enabled. Serial interface identification Number of outputs for user information; in format: #number Data invalid Ready : telegram has been received Number of the comparison telegram with which the received one agrees User data; in ABB IL format Comparison telegram; capable of duplication

Base_40-Library

58

907 AC 1131/Issued: 02.2001

RECEPTION OF ASCII CHARACTERS

EMAS S40

Communication by an EMAS block and a DRUCK block with the same serial interface: An EMAS and a DRUCK block can use the same serial interface without special precautions having to be taken. QUIT BOOL

RDY

BOOL

The input QUIT controls reception of telegrams and also serves the purpose of acknowledgement in the event of an error occurring. QUIT = FALSE : QUIT = TRUE : Reception of telegrams enabled. Reception of telegrams not enabled. Acknowledgment after reception of an invalid telegram.

The output RDY (ready) indicates that a telegram has been received and processed. The output RDY does not provide any information as to whether or not a valid or invalid telegram has been received. RDY = FALSE -> Still no telegram has been received RDY = TRUE -> A telegram has been received and processed QUIT TRUE MEUN RDY Meaning FALSE FALSE The EMAS is disabled by QUIT=TRUE. In doing so, the outputs MEUN and RDY are permanently set to FALSE. FALSE TRUE FALSE EMAS is enabled for reception, but still no telegram has been received and evaluated. FALSE TRUE TRUE EMAS has received a valid telegram and is ready to receive a new telegram. FALSE TRUE TRUE EMAS has received an invalid telegram. An acknowledgement at the QUIT input is necessary in order to be able to receive a new telegram. QUIT: FALSE->TRUE edge FALSE FALSE TRUE Acknowledgement after reception of an invalid ->TRUE telegram. After edge acknowledgement, the EMAS is enabled again by QUIT=FALSE TELN INT

If agreement with none of the stored comparison telegrams is ascertained on comparison of a received telegram, the EMAS automatically assumes the "error" state. In this case, EMAS no longer processes any new telegrams until the error is acknowledged with a 1 signal at the input QUIT and reception of telegrams is enabled again (next cycle) with a 0 signal at the input QUIT. SSK INT

The number of the interface through which the block receives its telegrams is specified at the SSK input (interface identifier). The following applies : COM1 : number = 1 COM2 : number = 2 #ANU DIRECT CONSTANT

The number of outputs MW0 at which the block provides the received user information is specified at the input #ANU (number of user information items). This is specified as a direct constant. I. e. numer =10 => #ANU = #10 or #H0A MEUN BOOL

The output MEUN (flag invalid) indicates whether or not the data at the outputs MW is valid or invalid. If a telegram is received and processed properly, the data at the outputs MW is declared valid. The data at the outputs MW is declared invalid if the received telegram does not agree with any of the stored comparison telegrams or if the received telegram cannot be processed properly. MEUN = FALSE -> Data at the outputs MW is valid MEUN = TRUE -> Data at the outputs MW is invalid

If a valid telegram is received, the number of the affiliated comparison telegram is output through the output TELN (telegram number). MW0 INT

The output MW0 can be duplicated. The user data communicated in the telegram currently received is output through the MW0 parameters. This user data may consist of numerical values or any characters. This depends on which kind of dummy parameters have been planned in the comparison telegram. The user data of a telegram is stored beginning with the first MW parameter and in the sequence in which they are planned in the comparison telegram. As many outputs MW0 must be provided as are sufficient for the telegram with the most user data. => the operands must be written in ABB IL format !

907 AC 1131/Issued: 02.2001

59

Base_S40-Library

RECEPTION OF ASCII CHARACTERS

EMAS S40

VT0

ALL in IL

The comparison telegrams to be stored in the PLC program are specified at the inputs VT0. The block is capable of processing from 1 to 99 telegrams. One telegram occupies 2 inputs, each telegram number being specified at one input and the actual telegram text being specified at the next one. The exact syntax and handling of the comparison telegrams are described here below. The way to write the messages is described here below and an example is given at the end. Detailed description of Comparison telegrams 1...99 comparison telegrams are stored directly after the EMAS block. The comparison telegrams serve to identify - the current telegrams received - and the user data contained in the telegrams received Each stored comparison telegram has a telegram number to identify it and may comprise up to 255 characters. The comparison telegrams consist of : - ASCII characters serving only to identify the telegram received, - Dummy parameters for the user information to be received and to be output through the blocks outputs. As regards the dummy parameters for the user information, EMAS function block distinguishes between dummy parameters for digits and dummy parameters for characters. Dummy parameter for digits : # (1 # per digit) Dummy parameter. for characters : * (1 * per character/byte) Dummy parameter for digits : For each dummy digit parameter (#) of the comparison telegram, EMAS expects precisely one ASCII coded decimal digit in the telegram to be received. Up to 5 dummy digits constitute one dummy parameter group. Such a group of dummy digits represents the numerical value of a decimal number comprising up to 5 digits. No dummy parameter is specified for the decimal numbers sign because EMAS takes it into account automatically. The EMAS allocates one user information output to each numerical value belonging to a dummy parameter group.

E.g. : Decimal number 1234 +1234 -1234

Dummy parameters #### #### ####

The EMAS block checks the received decimal number in relation to its significant range. Only numbers within the +32767 range can be processed in the PLC. If the received decimal number exceeds the significant range, the EMAS will automatically insert the maximum respective limit. The limit for a positive number is +32767 and the limit is -32767 for a negative number. Dummy parameter for characters : For each dummy character (*) of the comparison telegram, EMAS expects any one character/byte in the telegram to be received. These may comprise ASCII characters of letters, but also all other hex values from 0...FF. The length of a dummy character group is up to 255. If this were the case, the complete comparison telegram would consist of dummy characters only. EMAS allocates the characters/bytes received without change and successively to its user information outputs MW0. Syntax diagram : Structure of comparison telegrams
#

#n

#"

T EX T

#n : Successive telegram number (direct constant 1...99) #" : # : *: #: Start identifier for text input Stop identifier for text input Dummy parameter for character/byte Dummy parameter for digits

TEXT : All ASCII characters 01 to FF except * and #

Base_40-Library

60

907 AC 1131/Issued: 02.2001

RECEPTION OF ASCII CHARACTERS

EMAS S40

Input of comparison telegrams - Each comparison telegram consists of : the telegram number the telegram text The telegram number and the telegram text are two separate operands. This is why the telegram number and the telegram text occupy separate inputs in the FBD symbol of the EMAS block. Therefore, two inputs are needed for one comparison telegram. Example : First TEXT Input : #1 (No. of the first comparison telegram) Second TEXT Input : #"PRINT### IDENTIFIER**** (Text of the first comparison telegram) - Apart from the ASCII characters for * and #, all ASCII characters are possible in the telegram text. - When entering special ASCII characters such as "start of line" <CR>, the following must be observed : special characters are entered by : \Numerical value of the character The characters numerical value is specified as a three-digit decimal number. Example for the EMAS block: The following telegram text is to be compared : Temperature <CR> boiler 1 The following applies : <CR> = 013

The text input in the programming system is as follows : #"temperature\013boiler 1 Note : - The characters with the ASCII code >20H or >32D must be entered with the keyboard. As an example, the character "!" must be entered with the keyboard, and not as \033. - Characters, which are no special characters and which also could not be entered with the keyboard, can be generated in the following way : Press and hold down the <ALT> key, now type the numerical code (decimal code) on the numeric keypad of the keyboard, then release the <ALT> key. - The character with the ASCII code 255 is reserved for internal use of the programming software and must not be used otherwise. The Program will be in Instruction List : LD 0 {S40Inline !BA 0 EMAS M00,00 MW00,00 #1 AW00,00 AW00,01 #1 #"###"# }

907 AC 1131/Issued: 02.2001

61

Base_S40-Library

ON DELAY

ESV S40

ON DELAY
The FALSE/TRUE edge of input E is delayed by the time T and is output as a FALSE/TRUE edge at output A. If input E returns to the FALSE level before the time T is expired, output A remains in the FALSE level.

ESV S40

Block type Function block with historical values Parameters Instance E T A ESV BOOL TIME BOOL Instance name Input signal Delay time Delayed signal, operands M, A (not E, S)

Description The FALSE/TRUE edge of input E is delayed by the time T and is output as a FALSE/TRUE edge at output A. If input E returns to the FALSE level before the time T is expired, output A remains in the FALSE level. Maximum time offset at the output: < 1 cycle time Reasonable range for T: > 1 cycle time The inputs and the output can neither be duplicated nor inverted. General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

Base_40-Library

62

907 AC 1131/Issued: 02.2001

ON DELAY

ESV S40

Example Declaration: ESV_1 : ESV; ESV_E AT %MX0.0 : BOOL; ESV_T AT %MD4002.0 : DINT := t#3s; (* 3000 ms*) ESV_A AT %MX0.1 : BOOL; FBD: Translation in ABB IL: !BA 0 ESV EI A Q ABB IL of example: !BA 0 ESV M0,0 KD2,0 M0,1

; 3000

Function call in IL CAL ESV_1(E := ESV_E, T := ESV_T ) ESV_1.A ESV_A

Function call in ST ESV_1 (E := ESV_E, T := ESV_T ); := ESV1.A;

LD ST

ESV_A

907 AC 1131/Issued: 02.2001

63

Base_S40-Library

FUNCTION GENERATOR

FKG(2..256) S40

FUNCTION GENERATOR
In an x/y coordinate system, a polygon is defined by n coordinate points X0/Y0...Xn-1/Yn-1. For each value at input X, the function block outputs the assigned y value of the polygon at output Y. The FKG number indicates the maximum number of nodes. The following function generators are available: FKG2 FKG4 FKG16 FKG32 FKG64 FKG256 Block type Function generator with max. 2 nodes Function generator with max. 4 nodes Function generator with max. 16 nodes Function generator with max. 32 nodes Function generator with max. 64 nodes Function generator with max. 256 nodes

FKG(2..256) S40

Function block without historical values Parameters Instance X n XC0..XCn-1 YC0..YCn-1 Y Description The FKG number indicates the maximum number of nodes. The following function generators are available: FKG2 FKG4 FKG16 FKG32 FKG64 FKG256 Function generator with max. 2 nodes Function generator with max. 4 nodes Function generator with max. 16 nodes Function generator with max. 32 nodes Function generator with max. 64 nodes Function generator with max. 256 nodes (x - Xi-1) * (Yi - Yi-1) y = + Yi-1 Xi - Xi-1 Note: At the division it is always rounded down, i.e. a remainder with the division is not considered. For the range outside of the nodes the following applies: for x < X0, y = Y0 for x > Xn-1, y = Yn-1 FKG(2..256) INT INT INT INT INT Instance name Input for the x value of the polygon Number of nodes Input for x-values of the nodes Input for y-values of the nodes Output for the y value of the polygon

In an x/y coordinate system, a polygon is defined by n coordinate points X0/Y0...Xn-1/Yn-1. For each value at input x, the function block outputs the assigned y value of the polygon at output y. To the x-coordinate is valid: X0 < X1 < X2 < Xn-1 2 < n < FKG number Example: For FKG 16, the following applies: 2 < n < 16

The block performs a linear interpolation between the nodes. The resulting polygon represents the connection between the input value x and the output value y. For the interpolation between two nodes the following applies:

Base_40-Library

64

907 AC 1131/Issued: 02.2001

FUNCTION GENERATOR

FKG(2..256) S40

INT

XC0--XCn-1

INT

The current x coordinate is specified at input X. The block then defines the y coordinate assigned by the polygon. n INT

The x coordinates of the n nodes are specified at the inputs XC0 ... XCn-1. YC0--YCn-1 INT

The number of nodes which are necessary to define the polygon is specified at input n.

The y coordinates of the n nodes are specified at the inputs YC0 ... YCn-1. Y INT

The y coordinate assigned by the polygon of the specified x coordinate is output at output Y.

Example Declaration: FKG_2 : FKG; FKG_X AT %MW1000.0 : INT; FKG_XC0 AT %MW3002.0 : INT := 0; FKG_YC0 AT %MW3002.1 : INT := 10000; FKG_XC1 AT %MW3002.2 : INT := 0; FKG_YC1 AT %MW3002.3 : INT := 20000; FKG_Y AT %MW1000.1 : INT; Translation in ABB IL: !BA 0 FKG X #(2 * n) XC0 YC0 XC1 YC1 Y ABB IL of example: !BA 0 FKG MW0,0 #4 KW2,0 KW2,1 KW2,2 KW2,3 MW0,1

FBD:

(* 2 * n *)

Function call in IL CAL FKG_1(X := FKG2_X, n := 2, XC0 := FKG2_XC0, YC0 := FKG2_YC0, XC1 := FKG2_XC1, YC1 := FKG2_YC1) LD ST FKG_1.Y FKG2_Y

Function call in ST FKG_1(X := FKG2_X, n := 2, XC0 := FKG2_XC0, YC0 := FKG2_YC0, XC1 := FKG2_XC1, YC1 := FKG2_YC1); FKG2_Y:=FKG_1.Y;

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

65

Base_S40-Library

FALLING EDGE DETECTION

I_MINUS S40

FALLING EDGE DETECTION


A negative edge (TRUE/FALSE) at the input CLK generates a pulse at theoutput PULS wich has the duration of 1 PLC program cycle.

I_MINUS S40

Block type Function block without historical values Parameters Instance CLK Q PULS I_MINUS BOOL BOOL BOOL Instance name Input for TRUE/FALSE edge Output for interrogation of the direct flag, operand M (not E, S) Pulse output, operand M, A (not E, S)

Description A negative edge (TRUE/FALSE) at the input CLK generates a pulse at theoutput PULS wich has the duration of 1 PLC program cycle The output Q is needed for edge detection. This flag must not be used again in the PLC program. Duration of the pulse: From recognition of the TRUE/FALSE edge by the connection element up to renewed processing of this connection element in the next program cycle

Base_40-Library

66

907 AC 1131/Issued: 02.2001

FALLING EDGE DETECTION

I_MINUS S40

Example Declaration: I_MINUS_1 : I_MINUS; I_MINUS_CLK AT %IX62.0 : BOOL; I_MINUS_Q AT %MX80.0 : BOOL; I_MINUS_PULS AT %MX0.0 : BOOL; Translation in ABB IL: ! CLK =S Q !N CLK &Q =R Q = PULS ABB IL of example: ! E62,0 =S M80,0 !N E62,0 & M80,0 =R M80,0 =M0,0

FBD:

Function call in IL CAL LD ST LD ST I_MINUS_1(CLK := I_MINUS-CLK) I_MINUS_1.Q I_MINUS_Q I_MINUS_1.PULS I_MINUS_PULS

Function call in ST I_MINUS_1(CLK := I_MINUS_CLK, ); I_MINUS_Q I_MINUS_PULS := I_MINUS_1.Q; := I_MINUS_1.PULS;

907 AC 1131/Issued: 02.2001

67

Base_S40-Library

RISING EDGE DETECTION

I_PLUS S40

RISING EDGE DETECTION


A positive edge (FALSE/TRUE ) at the input CLK generates a pulse with the duration of one PLC program cycle at the PULS output.

I_PLUS S40

Block type Function block without historical values Parameters Instance CLK Q PULS I_PLUS BOOL BOOL BOOL Instance name Input for FALSE/TRUE edge Output for interrogation of the direct flag, operand M (not E, S) Pulse output, operand M, A (not E, S)

Description A positive edge (FALSE/TRUE ) at the input CLK generates a pulse with the duration of one PLC program cycle at the PULS output. The output Q is needed for edge detection. This flag must not be used again in the PLC program Duration of the pulse: From recognition of the FALSE/TRUE edge by the connection element until renewed processing of this connection element in the next program cycle

Base_40-Library

68

907 AC 1131/Issued: 02.2001

RISING EDGE DETECTION

I_PLUS S40

Example Declaration: I_PLUS_1 : I_PLUS; I_PLUS_CLK AT %IX62.1 : BOOL; I_PLUS_Q AT %MX80.1 : BOOL; I_PLUS_PULS AT %MX0.1 : BOOL; Translation in ABB IL: !N CLK =R Q ! CLK &N Q =S Q = PULS ABB IL of example: !N E62,1 =R M80,1 ! E62,1 &N M80,1 =S M80,1 = M0,1

FBD:

Function call in IL CAL LD ST LD ST I_PLUS_1(CLK := I_PLUS_CLK) I_PLUS_1.Q I_PLUS_Q I_PLUS_1.PULS I_PLUS_PULS

Function call in ST I_PLUS_1(CLK := I_PLUS_CLK, ); I_PLUS_Q I_PLUS_PULS := I_PLUS_1.Q; := I_PLUS_1.PULS;

907 AC 1131/Issued: 02.2001

69

Base_S40-Library

READ BINARY VARIABLE, INDEXED

IDLB S40

READ BINARY VARIABLE, INDEXED


The function block serves for the purpose of indexed reading of binary variables.

IDLB S40

Block type Function block without historical values Parameters Instance FREI IDLB BOOL Instance name Block enabling FREI = FALSE: Block is not processed FREI = TRUE: The value of the source variable is read and assigned to the target variable. The index and the basic variable result in the source variable Basic address of the binary variable Target variable, operand M, A (not E, S)

INDEX BASIS ZIEL

INT BOOL BOOL

Description This function block serves the purpose of indexed reading of binary variables. The source variable to be read is obtained from indexing the basic variable. The value of the source variable read is allocated to the target variable. The group and channel numbers of the source flag (source variable) are determined from the basic flag and the index INDEX. The source flag is : M (G_Basis + A) , (K_Basis + B) where : G_Basis : Group number of the basic flag K_Basis : Channel number of the basic flag Formula : INDEX ---------- = A 16 Remainder B Example : Basic variable : M00,00 AT %MX000.00 INDEX = 10 -> A = 10 : 16 -> A = 0, Remainder B = 10 ->Source variable : %MX(000+A).(00+B) = %MX(000+0).(00+10) = %MX000.10 Further examples : Basic variable INDEX %MX000.00 %MX000.00 %MX000.00 %MX000.02 FREI Enable block FREI = FALSE -> Block is not processed FREI = TRUE -> The value of the source variable is read and allocated to the target variable ZIEL. 0 2 16 18 Source variable %MX000.00 %MX000.02 %MX001.00 %MX001.04 BOOL

Group No. of the source flag : Group No. of the basic flag + A Channel No. of the source flag : Channel No. of the basic flag + B

Base_40-Library

70

907 AC 1131/Issued: 02.2001

READ BINARY VARIABLE, INDEXED

IDLB S40

INDEX

INT

ZIEL

BOOL

The index value is specified at the input INDX. The source variable (see above for a calculation) results from the index and the basic variable. Value range : -16383 < INDEX < +16383 BASIS BOOL

The target variable is specified at the output ZIEL. The value of the selected source variable is allocated to the target variable ZIEL.

The basic variable is specified at the input BASIS. The source variable (see above for a calculation) results from the index and the basic variable. Example Declaration: IDLB_1 : IDLB; IDLB_FREI AT %MX0.0 : BOOL; IDLB_INDEX AT %MW1000.0 : INT; IDLB_BASIS AT %MX20.0 : BOOL; IDLB_ZIEL AT %MX0.1 : BOOL; FBD: Translation in ABB IL: !BA 0 IDLB FREI INDEX BASIS ZIEL ABB IL of example: !BA 0 IDLB M0,0 MW0,0 M20,0 M0,1

Function call in IL CAL IDLB_1(FREI := IDLB_FREI, INDEX := IDLB_INDEX, BASIS := IDLB_BASIS) IDLB_1.ZIEL IDLB_ZIEL

Function call in ST IDLB_1 (FREI := IDLB_FREI, INDEX := IDLB_INDEX, BASIS := IDLB_BASIS);

LD ST

IDLB_ZIEL:=IDLB_1.ZIEL;

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

71

Base_S40-Library

READ WORD VARIABLE, INDEXED

IDLM S40

READ WORD VARIABLE, INDEXED


The function block serves for the purpose of indexed reading of word variables.

IDLM S40

Block type Function block without historical values Parameters Instance FREI IDLm BOOL Instance name Block enabling FREI = FALSE: Block is not processed FREI = TRUE: The value of the source variable is read and assigned to the target variable. The index and the basic variable result in the source variable Basic variable Target variable

INDEX BASIS ZIEL

INT INT INT

Description The function block serves for the purpose of indexed reading of word variables. The source variable to be read is obtained from indexing the basic variable. The value of the source variable read is assigned to the target variable. The inputs and outputs can neither be duplicated nor inverted nor negated. The group and channel numbers of the source flag (source variable) are determined from the basic flag and the index. The source flag is : MW (G_Basis + A) , (K_Basis + B) where : G_Basis : Group number of the basic flag K_Basis : Channel number of the basic flag Formula : INDEX ---------- = A 16 Remainder B Example : Basic variable : MW00,00 AT %MW1000.00 INDEX = 10 -> A = 10 : 16 -> A = 0, Remainder B = 10 -> Source variable : %MW(1000+A).(00+B) = %MW(1000+0).(00+10) = %MW1000.10 Further examples : Basic variable INDEX %MW1000.00 %MW1000.00 %MW100.00 %MW1000.02 0 2 16 18 Source variable %MW1000.00 %MW1000.02 %MW1001.00 %MW1001.04

Group No. of the source flag : Group No. of the basic flag + A Channel No. of the source flag : Channel No. of the basic flag + B

Base_40-Library

72

907 AC 1131/Issued: 02.2001

READ WORD VARIABLE, INDEXED

IDLM S40

FREI Block enabling FREI = FALSE Block is not processed

BOOL

BASIS

INT

The basic variable is specified at input BASIS. The source variable results from the index and the basic variable. ZIEL INT

FREI = TRUE The value of the source variable is read and assigned to the target variable ZIEL. INDEX INT

The target variable is specified at output ZIEL. The value of the selected source variable is assigned to the target variable ZIEL.

The index value is specified at input INDEX. The source variable results from the index and the basic variable. Value range: -32767 < INDEX < +32767 If INDEX is not within this range, the function block is not processed. Example Declaration: IDLm_1 : IDLm; IDLm_FREI AT %MX0.0 : BOOL; IDLm_INDEX AT %MW1002.0 : INT; IDLm_BASIS AT %MW1020.0 : INT; IDLm_ZIEL AT %MW1002.1 : INT; FBD: Translation in ABB IL: !BA 0 IDL FREI INDEX BASIS ZIEL ABB IL of example: !BA 0 IDL M0,0 MW2,0 MW20,0 MW2,1

Function call in IL CAL IDLM_1(FREI := IDLM_FREI, INDEX := IDLM_INDEX, BASIS := IDLM_BASIS) IDLM_1.ZIEL IDLM_ZIEL

Function call in ST IDLM_1 (FREI := IDLM_FREI, INDEX := IDLM_INDEX, BASIS := IDLM_BASIS); := IDLM_1.ZIEL;

LD ST

IDLM_ZIEL

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

73

Base_S40-Library

WRITE BINARY VARIABLE, INDEXED

IDSB S40

WRITE BINARY VARIABLE, INDEXED


The function block serves for the purpose of indexed writing of binary variables.

IDSB S40

Block type Function block without historical values Parameters Instance FREI IDSB BOOL Instance name Block enabling FREI = FALSE: Block is not processed FREI = TRUE: The value of the source variable is read and assigned to the target variable. Source variable The current target variable results from the index and the basic variable Basic variable, operands M, A (not E, S)

QUELL INDEX BASIS Description

BOOL INT BOOL

The function block serves for the purpose of indexed writing of binary variables. When the block is enabled, the value of the source variable is read and assigned to the target variable. The target variable is defined by indexing the basic variable. The inputs and outputs can neither be duplicated nor inverted nor negated. The group and channel numbers of the target flag (target variable) are determined on the basic flag and the index INDEX. The target flag is called: M (G_Basis + A) , (K_Basis + B) where : G_Basis : Group number of the basic flag K_Basis : Channel number of the basic flag Formula : INDEX ---------- = A 16 Remainder B

Example : Basic variable : M00,00 AT %MX000.00 INDEX = 10 -> A = 10 : 16 -> A = 0, Remainder B = 10 ->Target variable : %MX(000+A).(00+B) = %MX(000+0).(00+10) = %MX000.10 Further examples : Basic variable INDEX %MX000.00 %MX000.00 %MX000.00 %MX000.02 0 2 16 18 Target variable %MX000.00 %MX000.02 %MX001.00 %MX001.04

Group No. of the target flag : Group No. of the basic flag + A Channel No. of the target flag : Channel No. of the basic flag + B

Base_40-Library

74

907 AC 1131/Issued: 02.2001

WRITE BINARY VARIABLE, INDEXED

IDSB S40

FREI Block enabling FREI = FALSE Block is not processed

BOOL

INDEX

INT

FREI = TRUE The value of the source variable is read and assigned to the target variable. QUELL BOOL

The index value is specified at input INDEX. The source variable results from the index and the basic variable. Value range: -16383 < INDEX < +16383 If INDEX is not within this range, the function block is not processed. BASIS BOOL

The source variable is specified at input QUELL. The value of this variable is read and assigned to the target variable.

The basic variable is specified at the output BASIS. The target variable (see above for a calculation) results from the index INDEX and the basic variable.

Example Declaration: IDSB_1 : IDSB; IDSB_FREI AT %MX0.0 : BOOL; IDSB_QUELL AT %MX1.0 : INT; IDSB_INDEX AT %MW1001.1 : INT; IDSB_BASIS AT %MX20.0 : INT; FBD: Translation in ABB IL: !BA 0 IDSB FREI QUELL INDEX BASIS ABB IL of example: !BA 0 IDSB M0,0 M1,0 MW1,1 M20,0

Function call in IL CAL IDSB_1(FREI := IDSB_FREI, QUELL := IDSB_QUELL, INDEX := IDSB_INDEX) IDSB_1.BASIS IDSB_BASIS

Function call in ST IDSB_1 (FREI := IDSB_FREI, QUELL := IDSB_QUELL, INDEX := IDSB_INDEX); := IDSB_1.BASIS;

LD ST

IDSB_BASIS

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

75

Base_S40-Library

WRITE WORD VARIABLE, INDEXED

IDSM S40

WRITE WORD VARIABLE, INDEXED


The function block serves for the purpose of indexed writing of word variables.

IDSM S40

Block type Function block without historical values Parameters Instance FREI IDSm BOOL Instance name Block enabling FREI = FALSE: Block is not processed FREI = TRUE: The value of the source variable is read and assigned to the target variable. Source variable The index and the basic variable result in the source variable Basic variable

QUELL INDEX BASIS Description

INT INT INT

The function block serves for the purpose of indexed writing of word variables. When the block is enabled, the value of the source variable is read and assigned to the target variable. The target variable is defined by indexing the basic variable. The inputs and outputs can neither be duplicated nor inverted nor negated. The group and channel numbers of the target flag (target variable) are determined on the basic flag and the index INDEX. The target flag is called: MW (G_Basis + A) , (K_Basis + B) where : G_Basis : Group number of the basic flag K_Basis : Channel number of the basic flag Formula : INDEX ---------- = A 16 Remainder B

Example : Basic variable : MW00,00 AT %MW1000.00 INDEX = 10 -> A = 10 : 16 -> A = 0, Remainder B = 10 ->Target variable : %MW(1000+A).(00+B) = %MW(1000+0).(00+10) = %MW1000.10 Further examples : Basic variable INDEX %MW1000.00 %MW1000.00 %MW1000.00 %MW1000.02 0 2 16 18 Target variable %MW1000.00 %MW1000.02 %MW1001.00 %MW1001.04

Group No. of the target flag : Group No. of the basic flag + A Channel No. of the target flag : Channel No. of the basic flag + B

Base_40-Library

76

907 AC 1131/Issued: 02.2001

WRITE WORD VARIABLE, INDEXED

IDSM S40

FREI Block enabling FREI = FALSE Block is not processed

BOOL

INDEX

INT

FREI = TRUE The value of the source variable is read and assigned to the target variable. QUELL INT

The index value is specified at input INDEX. The source variable results from the index and the basic variable. Value range: -32767 < INDEX < +32767 If INDEX is not within this range, the function block is not processed. BASIS INT

The source variable is specified at input QUELL. The value of this variable is read and assigned to the target variable.

The basic variable is specified at output BASIS. The target variable (see above for a calculation) results from the index INDEX and the basic variable.

Example Declaration: IDSm_1 : IDSm IDSm_FREI AT %MX0.0 : BOOL; IDSm_QUELL AT %MW1020.0 : INT; IDSm_INDEX AT %MW1002.1 : INT; IDSm_BASIS AT %MW1002.2 : INT; FBD: Translation in ABB IL: !BA 0 IDSm FREI QUELL INDEX BASIS ABB IL of example: !BA 0 IDSm M0,0 MW20,0 MW2,1 MW2,2

Function call in IL CAL IDSM_1(FREI := IDSM_FREI, QUELL := IDSM_QUELL, INDEX := IDSM_INDEX) IDSM_1.BASIS IDSM_BASIS

Function call in ST IDSM_1 ( FREI := IDSM_FREI, QUELL := IDSM_QUELL, INDEX := IDSM_INDEX); := IDSM_1.BASIS;

LD ST

IDSM_BASIS

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

77

Base_S40-Library

LIST ALLOCATOR

LIZU(8..256) S40

LIST ALLOCATOR
The function block has a list of word data at its inputs. With a list pointer, it selects a value out of this list and applies it at its output. The LIZU number indicates the maximum number of word data. The following list allocators are available: LIZU8 LIZU16 LIZU32 LIZU64 LIZU256 List allocator for max. 8 word data List allocator for max. 16 word data List allocator for max. 32 word data List allocator for max. 64 word data List allocator for max. 256 word data

LIZU(8..256) S40

Block type Function block without historical values Parameters Instance ZEIG E0..En-1 A_E A Description The function block has a list of word data at its inputs. With a list pointer, it selects a value out of this list and applies it at its output. The inputs and outputs cannot be inverted and duplicated. ZEIG INT E0 .. En-1 INT LIZU(8..256) INT INT BOOL INT Instance name Pointer to the list of word data List of direct constants 0 < ZEIG < n, i.e. pointer in the valid range, operands M, A (not E, S) Selected word value

The word values out of which one is selected with the value at input ZEIG and assigned to output A are specified at the inputs E0 ... En-1. A_E BOOL

The pointer to the word value to be selected from the list is specified at input ZEIG. The following allocation applies: ZEIG = 0 Word value at E0 ZEIG = 1 Word value at E1 : : : ZEIG = n-1 Word value at En-1 The value at input ZEIG is subjected to a validity check. The result of this range check is signalized at output A_E. Allowed range: 0 < ZEIG < n-1 With n: Number of the inputs E0..En-1. No allocation to output A takes place if the value at input ZEIG is outside the allowed range.

Output A_E indicates whether the value of the list pointer (input ZEIG) is within the allowed range. Allowed range: 0 < ZEIG < n-1 With n: Number of the inputs E0..En-1. The following applies: ZEIG in the allowed range A_E = TRUE ZEIG in the forbidden range A_E = FALSE If the list pointer has a forbidden value, no allocation of a value to output A takes place because no word value can be selected. In this case, output A is not updated. A INT

The value of the selected word value is assigned to the operand at output A.

Base_40-Library

78

907 AC 1131/Issued: 02.2001

LIST ALLOCATOR

LIZU(8..256) S40

Example Declaration: LIZU8_1 : LIZU8; LIZU_ZEIG AT %MW1000.0: INT; LIZU_A_E AT %MX0.0 : BOOL; LIZU_A AT %MW1000.1 : INT; Translation in ABB IL: !BA 0 LIZU ZEIG #n #E0 #E1 #E2 #E3 #E4 #E5 #E6 #E7 A_E A ABB IL of example: !BA 0 LIZU MW0,0 #8 #1 #2 #3 #4 #5 #6 #7 #8 M0,0 MW0,1

FBD:

Function call in IL CAL LIZU_8(ZEIG := LIZU8_ZEIG, n := 8, E0 := 1, E1 := 2, E2 := 3, E3 := 4, E4 := 5, E5 := 6, E6 := 7, E7 := 8) LIZU8_1.A_E LIZU_A_E LIZU8_1.A LIZU8_A

Function call in ST LIZU_8 ZEIG := LIZU8_ZEIG, n := 8, E0 := 1, E1 := 2, E2 := 3, E3 := 4, E4 := 5, E5 := 6, E6 := 7, E7 := 8); := LIZU8_1.A_E; := LIZU8_1.A;

LD ST LD ST

LIZU8_A_E LIZU8_A

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

79

Base_S40-Library

MONOSTABLE ELEMENT ABORT

MOA S40

MONOSTABLE ELEMENT ABORT


A FALSE/TRUE edge at input E causes a FALSE/TRUE edge at output A. If input E remains at TRUE level, a TRUE/FALSE edge is applied at output A after the duration T has elapsed. Output A is also immediately set back to FALSE level if input E returns to FALSE level before the time period T has expired. Maximum time offset at the output: < 1 cycle time Block type Function block with historical values Parameters Instance E T A MOA BOOL TIME BOOL Instance name Input signal Pulse length Output signal, operands M, A (not E, S)

MOA S40

Description A FALSE/TRUE edge at input E causes a FALSE/TRUE edge at output A. If input E remains at TRUE level, a TRUE/FALSE edge is applied at output A after the duration T has elapsed. Output A is also immediately set back to FALSE level if input E returns to FALSE level before the time period T has expired. Valid time range: 5 ms .. 24,8 days. Maximum time offset at the output: < 1 cycle time Reasonable range for T: > 1 cycle time The inputs and the output can neither be duplicated nor inverted. General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

Base_40-Library

80

907 AC 1131/Issued: 02.2001

MONOSTABLE ELEMENT ABORT

MOA S40

Example Declaration: MOA_1 : MOA; MOA_E AT %MX0.0 : BOOL; MOA_T %MD4001.0 : TIME := t#1m; (*60000 ms*) MOA_A AT %MX0.1 : BOOL; FBD: Translation in ABB IL: !BA 0 MOA E T A ABB IL of example: !BA 0 MOA M0,0 KD1,0 M0,1

; 60000

Function call in IL CAL LD ST MOA_1(E := MOA_E, T := MOA_T) MOA_1.A MOA_A

Function call in ST MOA_1 MOA_A (E := MOA_E, T := MOA_T); := MOA_1.A;

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

81

Base_S40-Library

MONOSTABLE ELEMENT ABORT

MOAT S40

MONOSTABLE ELEMENT ABORT


A FALSE/TRUE edge at input E causes a FALSE/TRUE edge at output A. If input E remains at TRUE level, a TRUE/FALSE edge is applied at output A after the duration T has elapsed. Output ET displays the current time. Output A is also immediately set back to FALSE level if input E returns to FALSE level before the time period T has expired. Block type Function block with historical values Parameters Instance IN PT Q ET MOA BOOL TIME BOOL TIME Instance name Input signal Pulse length Output signal, operands M, A (not E, S) Time visualization

MOAT S40

Description A FALSE/TRUE edge at input E causes a FALSE/TRUE edge at output A. If input E remains at TRUE level, a TRUE/FALSE edge is applied at output A after the duration T has elapsed. Output A is also immediately set back to FALSE level if input E returns to FALSE level before the time period T has expired. The output ET indicates the current time. Valid time range: 5 ms .. 24,8 days. Maximum time offset at the output: < 1 cycle time Reasonable range for T: > 1 cycle time The inputs and the output can neither be duplicated nor inverted. General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

Base_40-Library

82

907 AC 1131/Issued: 02.2001

MONOSTABLE ELEMENT ABORT

MOAT S40

Example Declaration: MOAT_1 : MOAT MOAT_IN AT %MX0.0 : BOOL; MOAT_PT AT %MD4002.0 : TIME := t#2s500ms; (*2500 ms*) MOAT_Q AT %MX0.1 : BOOL; MOAT_ET AT %MD2002.0 : TIME; FBD: Translation in ABB IL: !BA 0 MOAT IN PT Q ET ABB IL of example: !BA 0 MOAT M0,0 KD2,0 M0,1 MD2,0

; 2500

Function call in IL CAL LD ST MOAT_1(E := MOAT_E, T := MOAT_T) MOAT_1.A MOAT_A

Function call in ST MOAT_1 MOAT_A (E := MOAT_E, T := MOAT_T); := MOAT_1.A;

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

83

Base_S40-Library

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

OPERATION MODE MODBUS MASTER


MODBUS master communication: MODBUSB MODBUSW MODMASTB MODMASTW COM1 by default and DATA is a BOOL COM1 by default and DATA is an INT COM1 or COM2 and DATA is a BOOL COM1 or COM2 and DATA is an INT

MODMASTB/W S40

Block type Function block with historical values Parameters Instance EN COM SLAVE FCT TIMEOUT ADDR NB DATA RDY ERR ERNO Description MODBUS master communication function block The central unit is a master on a MODBUS network and can communicate with other products with MODBUS protocol. The function MODBUS MASTER in the central unit is valided by : - system constant KW 00,06 / %MW1000.6 = 100 - and connection between pins 7 and 6 on the connector of the serial interface Several function blocks MODBUS/MODMAST can be used in one user program. The MODBUS protocol is a master/slave protocol. The master sends a frame to a slave and waits for the answer (a timeout is defined). Binary or numeric data can be read or written in a slave. The area of data in the master is chosen by the address of the first variable. The size of area is necessary for sending or receiving. Reading or writing data are done automatically from these areas. EN BOOL MODBUS B/W MODMAST B/W BOOL INT INT INT INT INT INT BOOL / INT BOOL BOOL INT Instance name Enabling of the block processing Interface identifier (COM1, COM2) Slave address (1...255) Function code Telegram timeout in milliseconds Operand/register address in the slave Number of data Data to send to the slave or to write with the data received from a slave MODBUS Ready message, communication in progress, operands M, A Error message, operands M, A (not E, S) Error identifier

A rising edge at the FREI input leads to an output of a request to a MODBUS slave, provided that the block is ready to do this (RDY = TRUE). If a rising edge appears at the FREI input although the RDY output is equal to FALSE, i.e. the block is not ready for a new MODBUS communication, the rising edge will be ignored. Therefore, no new MODBUS communication can be started as long as the RDY output is FALSE.

Base_40-Library

84

907 AC 1131/Issued: 02.2001

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

COM

INT

DATA

INT, BOOL

At input COM the MODBUS interface number is specified. COM = 1: COM1 (PLC) COM = 2: COM2 (PLC) SLAV INT

INT: MODBUSW or MODMASTW BOOL: DATA defines the first variable of the data area in the master. The size of this area depends on the NB parameter. Different cases are possible according to the function code and the operand : Reading : ADDR DATA INT INT BOOL BOOL BOOL INT INT BOOL Result Idem Idem Same as the function block PACK The first bit of the word is ranged in the first bit of the group number

Address of the slave which receives the request. Value : 0 < ADDR < 255 In case of address 0 (ADDR = 0), all slaves on the MODBUS network will read the frame. FCT INT

The function depends on the type of parameters and if it is reading or writing. Value : 1 (01H): 2 (02H): 3 (03H): 4 (04H): 5 (05H): 6 (06H): 7 (07H): 8 (08H): 15 (0FH): 16 (10H): reading n bits reading n bits reading n words reading n words writing one bit writing one word fast reading of 8 bits Diagnosis/initialization writing n bits writing n words

Example : data = %MX00.07 : The first bit of the read word will be written in %MX 00.00. Writing : ADDR INT BOOL BOOL INT DATA INT BOOL INT BOOL Result Idem Idem Same as the function block PACK Same as the function block UNPACK BOOL

The other function codes are not supported by the central units series 40..50. In case of a wrong function code, an error 1 is generated in the word ERNO. TIME INT

RDY

Timeout for the communication (maximum time for an answer of the MODBUS slave). The value is given in milliseconds. Cycle time (KD00,00 / %MD4000.0) < TIME < 32767 In case of a timeout, the output ERN provides the value of 9. ADDR INT

The output RDY (ready) indicates whether a MODBUS communication is in progress or not. As long as a communication is in progress, the output RDY is equal to FALSE. The function block can only be used if RDY = TRUE. ERR BOOL

The output ERR indicates an error occurred during communication. The word output ERN indicates the details of the error. If ERR = 1 ERR = 0 -> error, -> no error or communication in progress.

Address of data in the slave memory to read or write. NB Number of data to read or write in the slave. This number defines also the size of the data area in the master to send to the slave or to receive from the slave. INT

The error is clear after one cycle time. ERNO Details of error : 0: no error 1: unknown function code 2: address error 3: data error 9: timeout 10 : checksum error The error is clear after one cycle time. INT

907 AC 1131/Issued: 02.2001

85

Base_S40-Library

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

Operands (symbolic)

Operands (IEC) %IX000.00


:

MODBUS address (HEX) Operand description

E000_00
:

0000HEX
:

Binary inputs, CS31 bus

E061_15 E062_00
:

%IX061.15 %IX062.00
:

03DFHEX 03E0HEX
:

Binary inputs, local

E068_15 A000_00
:

%IX068.15 %QX000.00
:

044FHEX 1000HEX
:

Binary outputs, CS31 bus

A061_15 A062_00
:

%QX061.15 %QX062.00
:

13DFHEX 13E0HEX
:

Binary outputs, local

A068_15 M000_00
:

%QX068.15 %MX0000.00
:

144FHEX 2000HEX
:

Binary flags

M099_15 M230_00
:

%MX0099.15 %MX0000.00
:

263FHEX 2000HEX
:

Binary flags

M254_15 M255_00
:

%MX0254.15 %MX0255.00
:

2FEFHEX 2FF0HEX
:

Binary flags (system)

M255_15 S000_00
:

%MX0255.15 %MX5000.00
:

2FFFHEX 3000HEX
:

Steps

S125_15 EW000_00
:

%MX5125.15 %IW1000.00
:

37DFHEX 0000HEX
:

Analog inputs, CS31 bus

EW061_15 EW062_00
:

%IW1061.15 %IW1062.00
:

03DFHEX 03E0HEX
:

Analog inputs, local

EW068_15 AW000_00
:

%IW1068.15 %QW1000.00
:

044FHEX 1000HEX
:

Analog outputs, CS31 bus

AW061_15 AW062_00
:

%QW1061.15 %QW1062.00
:

13DFHEX 13E0HEX
:

Analog outputs, local

AW068_15

%QW1068.15

144FHEX

Base_40-Library

86

907 AC 1131/Issued: 02.2001

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

Operands (symbolic)

Operands (IEC) %MW1000.00


:

MODBUS address (HEX) Operand description

MW000_00
:

2000HEX
:

Word flags

MW099_15 MW230_00
:

%MW1099.15 %MW1230.00
:

263FHEX 2E60HEX
:

Word flags

MW253_15 MW254_00
:

%MW1253.15 %MW1254.00
:

2FCFHEX 2FD0HEX
:

Word flags (error message)

MW255_15 KW000_00
:

%MW1255.15 %MW3000.00
:

2FFFHEX 3000HEX
:

Word constants (system)

KW000_15 KW001_00
:

%MW3000.15 %MW3001.00
:

300FHEX 3010HEX
:

Word constants

KW031_15 MD000_00
:

%MW3031.15 %MD2000.00
:

31FFHEX 4000HEX
:

Double word flags

MD007_15 KD000_00
:

%MD2007.15 %MD4000.00
:

40FEHEX 5000HEX
:

Double word constants

KD000_15 KD001_00
:

%MD4000.15 %MD4000.00
:

501EHEX 5020HEX
:

Double word constants

KD007_15

%MD4007.15

50FEHEX

907 AC 1131/Issued: 02.2001

87

Base_S40-Library

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

Example 1: MODBUSB MODBUS master only for COM1 and BOOL - data Declaration: MOD_1: MODBUSB; MOD_EN AT %MX13.0: BOOL; MOD_SLAV AT %MW3002.1: INT := 10; MOD_FCT AT %MW3002.2: INT := 3; MOD_TIMEOUT AT %MW3002.3: INT := 5000; MOD_ADDR AT %MW3002.4: INT := 16#2000; (*8192*) MOD_NB AT %MW3002.5: INT := 16; MOD_DATA_B AT %MX40.0: BOOL; MOD_RDY AT %MX30.0: BOOL; MOD_ERR AT %MX30.1: BOOL; MOD_ERNO AT %MW1039.0: INT; Translation in ABB IL: !BA 0 CALLUP EN #H0300 #H0000 #H0000 #00009 SLAV FCT TIMEOUT ADDR NB DATA RDY ERR ERNO ABB IL of example: !BA 0 CALLUP M0,0 #H0300 #H0000 #H0000 #00009 KW2,1 KW2,2 KW2,3 KW2,4 KW2,5 M40,0 M30,0 M30,1 MW39,0 Function call in IL CAL MOD_1(EN := MOD_EN, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA_B) LD ST LD ST LD ST MOD_1.RDY MOD_RDY MOD_1.ERR MOD_ERR MOD_1.ERNO MOD_ERNO

FBD:

; 10 ;3 ; 5000 ; 8192 ; 16

Function call in ST MOD_1 (EN := MOD_EN, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA_B) MOD_RDY MOD_ERR MOD_ERNO := MOD_1.RDY; := MOD_1.ERR; := MOD_1.ERNO;

Base_40-Library

88

907 AC 1131/Issued: 02.2001

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

Example 2: MODBUSW MODBUS master only for COM1 and INT - data Declaration: MOD_1: MODBUSW; MOD_EN AT %MX13.0: BOOL; MOD_SLAV AT %MW3002.1: INT := 10; MOD_FCT AT %MW3002.2: INT := 3; MOD_TIMEOUT AT %MW3002.3: INT := 5000; MOD_ADDR AT %MW3002.4: INT := 16#2000; (*8192*) MOD_NB AT %MW3002.5: INT := 16; MOD_DATA AT %MW1030.0: INT; MOD_RDY AT %MX30.0: BOOL; MOD_ERR AT %MX30.1: BOOL; MOD_ERNO AT %MW1039.0: INT; Translation in ABB IL: !BA 0 CALLUP EN #H0300 #H0000 #H0000 #00009 SLAV FCT TIMEOUT ADDR NB DATA RDY ERR ERNO ABB IL of example: !BA 0 CALLUP M0,0 #H0300 #H0000 #H0000 #00009 KW2,1 KW2,2 KW2,3 KW2,4 KW2,5 MW30,0 M30,0 M30,1 MW39,0 Function call in IL CAL MOD_1(EN := MOD_EN, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA) LD ST LD ST LD ST MOD_1.RDY MOD_RDY MOD_1.ERR MOD_ERR MOD_1.ERNO MOD_ERNO

FBD:

; 10 ;3 ; 5000 ; 8192 ; 16

Function call in ST MOD_1 (EN := MOD_EN, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA) MOD_RDY MOD_ERR MOD_ERNO := MOD_1.RDY; := MOD_1.ERR; := MOD_1.ERNO;

907 AC 1131/Issued: 02.2001

89

Base_S40-Library

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

Example 3: MODMASTB MODBUS master for COM1/COM2 and BOOL - data Declaration: MOD_1: MODMASTB; MOD_EN AT %MX13.0: BOOL; MOD_COM AT %MW3002.0: INT := 1; MOD_SLAV AT %MW3002.1: INT := 10; MOD_FCT AT %MW3002.2: INT := 3; MOD_TIMEOUT AT %MW3002.3: INT := 5000; MOD_ADDR AT %MW3002.4: INT := 16#2000; (*8192*) MOD_NB AT %MW3002.5: INT := 16; MOD_DATA_B AT %MX40.0: INT; MOD_RDY AT %MX30.0: BOOL; MOD_ERR AT %MX30.1: BOOL; MOD_ERNO AT %MW1039.0: INT; Translation in ABB IL: !BA 0 CALLUP EN #H0306 #H0000 #H0000 #00010 COM SLAV FCT TIMEOUT ADDR NB DATA RDY ERR ERNO ABB IL of example: !BA 0 CALLUP M0,0 #H0306 #H0000 #H0000 #00010 KW2,0 KW2,1 KW2,2 KW2,3 KW2,4 KW2,5 M40,0 M30,0 M30,1 MW39,0 Function call in IL CAL MOD_1(EN := MOD_EN, COM := MOD_COM, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA_B) LD ST LD ST LD ST MOD_1.RDY MOD_RDY MOD_1.ERR MOD_ERR MOD_1.ERNO MOD_ERNO

FBD:

;1 ; 10 ;3 ; 5000 ; 8192 ; 16

Function call in ST MOD_1 (EN := MOD_EN, COM := MOD_COM, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA_B) MOD_RDY MOD_ERR MOD_ERNO := MOD_1.RDY; := MOD_1.ERR; := MOD_1.ERNO;

Base_40-Library

90

907 AC 1131/Issued: 02.2001

OPERATION MODE MODBUS MASTER

MODMASTB/W S40

Example 4: MODMASTW MODBUS master for COM1/COM2 and INT - data Declaration: MOD_1: MODMASTW; MOD_EN AT %MX13.0: BOOL; MOD_COM AT %MW3002.0: INT := 1; MOD_SLAV AT %MW3002.1: INT := 10; MOD_FCT AT %MW3002.2: INT := 3; MOD_TIMEOUT AT %MW3002.3: INT := 5000; MOD_ADDR AT %MW3002.4: INT := 16#2000; (*8192*) MOD_NB AT %MW3002.5: INT := 16; MOD_DATA AT %MW1030.0: INT; MOD_RDY AT %MX30.0: BOOL; MOD_ERR AT %MX30.1: BOOL; MOD_ERNO AT %MW1039.0: INT; Translation in ABB IL: !BA 0 CALLUP EN #H0306 #H0000 #H0000 #00010 COM SLAV FCT TIMEOUT ADDR NB DATA RDY ERR ERNO ABB IL of example: !BA 0 CALLUP M0,0 #H0306 #H0000 #H0000 #00010 KW2,0 KW2,1 KW2,2 KW2,3 KW2,4 KW2,5 MW30,0 M30,0 M30,1 MW39,0 Function call in IL CAL MOD_1(EN := MOD_EN, COM := MOD_COM, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA) LD ST LD ST LD ST MOD_1.RDY MOD_RDY MOD_1.ERR MOD_ERR MOD_1.ERNO MOD_ERNO

FBD:

;1 ; 10 ;3 ; 5000 ; 8192 ; 16

Function call in ST MOD_1 (EN := MOD_EN, COM := MOD_COM, SLAV := MOD_SLAV, FCT := MOD_FCT, TIMEOUT := MOD_TIMEOUT, ADDR := MOD_ADDR, NB := MOD_NB, DATA := MOD_DATA) MOD_RDY MOD_ERR MOD_ERNO := MOD_1.RDY; := MOD_1.ERR; := MOD_1.ERNO;

907 AC 1131/Issued: 02.2001

91

Base_S40-Library

MONOSTABLE ELEMENT CONSTANT

MOK S40

MONOSTABLE ELEMENT CONSTANT


A FALSE/TRUE edge at input E causes a FALSE/TRUE edge at output A. If input E remains at TRUE level, a TRUE/FALSE edge is applied at output A after the duration T has elapsed. A possible second FALSE/TRUE edge of input E which occurs before the time period T has elapsed is ignored. Maximum time offset at the output: < 1 cycle time Block type

MOK S40

Function block with historical values Parameters Instance E T A MOK BOOL TIMER BOOL Instance name Input signal Pulse length Output signal, operands M, A (not E, S)

Description A FALSE/TRUE edge at input E causes a FALSE/TRUE edge at output A. If input E remains at TRUE level, a TRUE/FALSE edge is applied at output A after the duration T has elapsed. A possible second FALSE/TRUE edge of input E which occurs before the time period T has elapsed is ignored. Valid time range: 5 ms .. 24,8 days Maximum time offset at the output: < 1 cycle time Reasonable range for T: > 1 cycle time The inputs and the output can neither be duplicated nor inverted. General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

Base_40-Library

92

907 AC 1131/Issued: 02.2001

MONOSTABLE ELEMENT CONSTANT

MOK S40

Example Declaration: MOK_1 : MOK; MOK_E AT %MX0.0 : BOOL; MOK_T AT %MD4002.1 : TIME := 16#1s; (*1000 ms*) MOK_A AT %MX0.1 : BOOL; FBD: Translation in ABB IL: !BA 0 MOK E T A ABB IL of example: !BA 0 MOK M0,0 KD2,1 M0,1

; 1000

Function call in IL CAL LD ST MOK_1(E := MOK_E, T := MOK_T) MOK_1.A MOK_A

Function call in ST MOK_1 MOK_A (E := MOK_E, T := MOK_T); := MOK_1.A;

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

93

Base_S40-Library

MULTIPLICATION BY 2 TO THE POWER OF N, WORD

MUL2N S40

MULTIPLICATION BY 2 TO THE POWER OF N, WORD


The value of the operand at input E1 is shifted bitwise N times. If the value at input N is positive, the value is shifted to the left. Each shift by 1 bit position corresponds to a multiplication of the current value by 2. If the value at input N is negative, the value is shifted to the right. Each shift by 1 bit position corresponds to a division of the current value by 2. The result is assigned to the operand at output A1. Block type Function Parameters E1 N A1 INT INT INT Input operand Quantity Result

MUL2N S40

Description The value of the operand at input E1 is shifted bitwise N times. If the value at input N is positive, the value is shifted to the left. Each shift by 1 bit position corresponds to a multiplication of the current value by 2. If the value at input N is negative, the value is shifted to the right. Each shift by 1 bit position corresponds to a division of the current value by 2. The result is assigned to the operand at output A1. The inputs and the output can neither be duplicated nor negated. Reasonable range for N: -14 < N < +14 If N = 0, the value at input E1 is passed directly to output A1. Sign of the value at input E1: The sign of value E1 is not influenced by the shift operation. I. e. the sign of the output value is always identical with the sign of the input value. Shift to the left (Multiplication): When the value at the input is shifted to the left, the released bit 0 is filled with 0. The sign bit (bit 15) is not changed because a limiting to the limit of the number range is performed before. Limiting the value at output A1 when shifting to the left:

The following

applies to positive values at input E1: If bit 14 has a 1 and if shift operations still have to be carried out on the basis of the value at input N, these are no longer executed. Instead, the output is set to the limit of the positive number range. I.e. the limit has been reached in any case at the latest after 14 shifts. Limit value: Output A1 = +32767 (7FFFH).

The following applies to negative values at input E1:

If bit 14 has a 0 and if shift operations still have to be carried out on the basis of the value at input N, these are no longer executed. Instead, the output is set to the limit of the negative number range. I.e. the limit has been reached in any case at the latest after 14 shifts. Limit value: Output A1 = -32767 (8001H).

Base_40-Library

94

907 AC 1131/Issued: 02.2001

MULTIPLICATION BY 2 TO THE POWER OF N, WORD

MUL2N S40

Shift to the right (Division): When shifting to the right, every bit moves to the right by one position. At the same time, the sign bit (bit 15) always retains its value. The released bit (bit 14) is filled in each case with the value of the sign bit. Limiting the value at the output when shifting to the right:

Examples 1. Input value E1 = 5498 (157AH) Exponent N = 2 -> 2 * Left shift

The following applies to positive values at input E1:

If now only bit 0 has a 1 and shift operations still have to be carried out because of the value at input N, the output will be set to the value 0. I.e. value 0 has been reached in any case at the latest after 14 shifts. Output A1 = 0.

2. Input value E1 = 32612 (7F64H) Exponent N = -3 -> 3 * Right shift

The

following applies to negative values at input E1: If bit 0 ... bit 15 has a 1 as the result of the shift, the limit value (-1) has been reached. Further shifts have no effect. I.e. the value -1 has been reached at the latest after 15 shifts. Output A1 = -1 (FFFFH).

3. Input value E1 = -32612 (8008H) Exponent N = -3 -> 3 * Right shift

The inputs and the output can neither be duplicated nor negated.

Example Declaration: MUL2N_E1 AT %MW1000.0 : INT; MUL2N_N AT %MW1000.1 : INT; MUL2N_A AT %MW1000.2 : INT; Translation in ABB IL: !BA 0 MUL2N E1 N A ABB IL of example: !BA 0 MUL2N MW0,0 MW0,1 MW0,2

FBD:

Function call in IL LD MUL2N_E1 MUL2N MUL2N_N ST MUL2N_A

Function call in ST MUL2N_A:=MUL2N(MUL2N_E1, MUL2N_N);

907 AC 1131/Issued: 02.2001

95

Base_S40-Library

MULTIPLICATION DOUBLE WORD

MULD S40

MULTIPLICATION DOUBLE WORD


The value of the operand at input E1 is multiplied by the value of the operand at input E2 and the result is assigned to the operand at output A. The result is limited to the maximum or minimum value of the number range. If limiting occurred, a TRUE signal is assigned to the binary operand at output Q. If no limiting has occurred, a FALSE signal is assigned to the binary operand at output Q. Block type Function block without historical values Parameters Instance E1 E2 A Q MULD DINT DINT DINT BOOL Instance name Multiplicand Multiplier Result (product) Result limited, operands M, A (not E, S)

MULD S40

Description The value of the operand at input E1 is multiplied by the value of the operand at input E2 and the result is assigned to the operand at output A. The result is limited to the maximum or minimum value of the number range (Number range: -2147483647 2147483647). If limiting occurred, a TRUE signal is assigned to the binary operand at output Q. If no limiting occurred, a FALSE signal is assigned to the binary operand at output Q. The inputs and outputs can neither be duplicated nor negated.

Base_40-Library

96

907 AC 1131/Issued: 02.2001

MULTIPLICATION DOUBLE WORD

MULD S40

Example Declaration: MULD_1 : MULD; MULD_E1 AT %MD2000.0 : DINT; MULD_E2 AT %MD2000.1 : DINT; MULD_A AT %MD2000.2 : DINT; MULD_Q AT %M0.0 : BOOL; FBD: Translation in ABB IL: !BA 0 MULD E1 E2 A Q ABB IL of example: !BA 0 MULD MD0,0 MD0,1 MD0,2 M0,0

Function call in IL CAL LD ST LD ST MULD_1(E1 := MULD_E1, E2 := MULD_E2) MULD_1.Q MULD_Q MULD_1.A MULD_A

Function call in ST MULD_1 MULD_A MULD_Q (E1 := MULD_E1, E2 := MULD_E2); := MULD_1.A; := MULD_1.Q;

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

97

Base_S40-Library

MULTIPLICATION WITH DIVISION

MULDI S40

MULTIPLICATION WITH DIVISION


The operand value at input E1 is multiplied by the operand value at input E2, the intermediate result is divided by the operand value at E3 and then the result is assigned to output A. The result is limited to the maximum or minimum value of the number range.

MULDI S40

Block type Function Parameters E1 E2 E3 A INT INT INT INT Multiplicand Multiplier Divisor Result

Description The operand value at input E1 is multiplied by the operand value at input E2, the intermediate result is divided by the operand value at E3 and then the result is assigned to output A. Internal, the block performs the multiplication and division with the accuracy of a double word (32 bit). Only when assigning the result to output A, the limiting to the accuracy of a word (16 bit) is carried out. If the remainder of the division is > 0,5, the result is rounded up. If a numerical overflow occurs during the division (e.g. division by zero), the correct signed limit of the number range is applied at output A. The result is limited to the maximum value 32767 and the minimum value -32767. The inputs and the output can neither be duplicated nor negated.

Base_40-Library

98

907 AC 1131/Issued: 02.2001

MULTIPLICATION WITH DIVISION

MULDI S40

Example Declaration: MULDI_E1 AT %MW1000.0 : INT; MULDI_E2 AT %MW1000.1 : INT; MULDI_E3 AT %MW1000.2 : INT; MULDI_A AT %MW1000.3 : INT; Translation in ABB IL: !BA 0 MULDI E1 E2 E3 A ABB IL of example: !BA 0 MULDI MW0,0 MW0,1 MW0,2 MW0,3

FBD:

Function call in IL LD MULDI_E1 MULDI MULDI_E2,MULDI_E3 ST MULDI_A

Function call in ST MULDI_A := MULDI (MULDI_E1, MULDI_E2, MULDI_E3);

907 AC 1131/Issued: 02.2001

99

Base_S40-Library

NEGATION WORD

NEGW S40

NEGATION WORD
The value of the operand at input E is negated and the result is assigned to the operand at output A.

NEGW S40

Block type Function Parameters E1 A INT INT Input value Negated value

Description The value of the operand at input E is negated and the result is assigned to the operand at output A Number range : Low limit : 8000H - 32768 High limit 7FFFH + 32767 Note : if E1 = -32768 then A = +32767. Example Declaration: NEGW_E1 AT %MW1000.0 : INT; NEGW_A AT %MW1000.1 : INT; Translation in ABB IL: !BA 0 NEGW E1 A ABB IL of example: !BA 0 NEGW MW0,0 MW0,1 The input and the output can neither be duplicated nor negated.

FBD:

Function call in IL LD NEGW_E1 NEGW ST NEGW_A

Function call in ST NEGW_A := NEGW(NEGW_E1);

Base_40-Library

100

907 AC 1131/Issued: 02.2001

PULSES GENERATOR

NPULSE S40

PULSES GENERATOR
The function block generates pulse sequences with specific frequencies and specific number of pulses. Thus, it can be used for the activation of stepper motors. The pulse sequences are available at output A62,00 / %QX62.00.

NPULSE S40

Block type Function block with historical values Parameters Instance VAL RESET FREQ NB RDY VAL_P NPULSE BOOL BOOL INT INT BOOL INT Instance name Enabling Reset Frequency Number of pulses Ready, operands M, A (not E, S) Number of processed pulses

Description The function block generates pulse sequences with specific frequencies and specific number of pulses. Thus, it can be used for the activation of stepper motors. The pulse sequences are available at output A62,00 / %QX62.00. At output VAL_P, the currently generated number of pulses is displayed. The rising edge at the input VAL starts the pulse generator from the beginning.The first period starts with a high signal. RESET = FALSE stops the pulse generator, the output A62,00 / %QX62.0 is set to FALSE till RESET = TRUE. FREQ Frequency of the pulse sequence: Pulse frequency : 10 Hz to 2,604 kHz Formula for frequency calculation: Frequency [Hz] = 1000000 / ((256 - FREQ)*384) FREQ 0 1 2 10 100 254 255 <0 > 255 NB Number of pulses to be generated. If NB < 0 then the function block NPULSE generates continuously pulses till RESET input is validated. Frequency 10,173 Hz 11,212 Hz 10,253 Hz 10,586 Hz 16,693 Hz 1,302 2,604 kHz kHz INT

VAL

BOOL

Enabling the output of the impulse sequence at the fixed output A62,00 / %QX62.0. FALSE/TRUE edge at the input VAL : The pulse mode is validated. A62,00 / %QX62.00 can not be used normally. RESET BOOL

10,173 Hz 2,604 kHz INT

907 AC 1131/Issued: 02.2001

101

Base_S40-Library

PULSES GENERATOR

NPULSE S40

RDY Ready bit RDY = FALSE Pulses are generated RDY = TRUE

BOOL

VAL_P Number of pulses elapsed.

INT

Pulse sequence is finished

This number is estimated by the function block every cycle time. It doesnt represent the exact value. The internal memory bit %QX62.00 is disabled during pulses are generating.

Example Declaration: NPULSE1 : NPULSE; NPULSE_VAL AT %MX0.0 : BOOL; NPULSE_RESET AT %MX0.1 : BOOL; NPULSE_FREQ AT %MW1000.0 : INT; NPULSE_NB AT %MW1000.1 : INT; NPULSE_RDY AT %MX0.2 : BOOL; NPULSE_VAL_P AT %MW1000.2 : INT; FBD: Translation in ABB IL: !BA 0 NPULSE VAL RESET FREQ NB RDY VAL_P ABB IL of example: !BA 0 NPULSE M0,0 M0,1 MW0,0 MW0,1 M0,2 MW0,2

Function call in IL CAL NPULSE1(VAL := NPULSE_VAL, RESET := NPULSE_RESET, FREQ := NPULSE_FREQ, NB := NPULSE_NB) NPULSE1.RDY NPULSE_RDY NPULSE1.VAL_P NPULSE_VAL_P

Function call in ST NPULSE1 (VAL := NPULSE_VAL, RESET := NPULSE_RESET, FREQ := NPULSE_FREQ, NB := NPULSE_NB); := NPULSE1.RDY; := NPULSE1.VAL_P;

LD ST LD ST

NPULSE_RDY NPULSE_VAL_P

Note: In IL, the function call has to be performed in one line.

Base_40-Library

102

907 AC 1131/Issued: 02.2001

PACK BINARY VARIABLES IN WORD

PACK(4..16) S40

PACK BINARY VARIABLES IN WORD


This block packs n binary variables into one word variable.

PACK(4..16) S40

Block type Function block without historical values Parameters Instance N B0..B15 A Description The PACK number indicates the maximum number of bits to pack. The following PACK blocks are available: PACK4 PACK8 PACK16 PACK for max. 2 binary variables PACK for max. 8 binary variables PACK for max. 16 binary variables B0B15 BOOL PACK INT BOOL INT Instance name Number of binary variables to be packed Binary variable to be packed Word variable

The binary variables to be packed are specified at the inputs B0 ... Bn-1. A INT

This block packs n binary variables into one word variable. n INT

The value of each binary variable at the inputs B0 ... Bn-1 is loaded into the corresponding bit (bit 0 ... bit 15) of the variable at output A. Assignment: B0 bit0 of the output variable B1 bit1 of the output variable . . B15 bit15 of the output variable Note: If the user plans less than 16 binary input variables, the unnecessary bits of the output variable are set to the value FALSE.

At input n, the number of binary variables to be packed is specified. The following applies: 1 < n < 4,(8, 16) n = 0 is not allowed! (default = 1)

907 AC 1131/Issued: 02.2001

103

Base_S40-Library

PACK BINARY VARIABLES IN WORD

PACK(4..16) S40

Example Declaration: PACK_16 : PACK; PACK_B0 AT %MX0.0 : BOOL; PACK_B1 AT %MX0.1 : BOOL; PACK_B2 AT %MX0.2 : BOOL; PACK_B3 AT %MX0.3 : BOOL; PACK_A AT %MW1000.0 : INT; Translation in ABB IL: !BA 0 PACK #n B0 B1 B2 B3 A ABB IL of example: !BA 0 PACK #4 M0,0 M0,1 M0,2 M0,3 MW0,0

FBD:

Function call in IL CAL PACK_1(n := 4, B0 := PACK_B0, B1 := PACK_B1, B2 := PACK_B2, B3 := PACK_B3) PACK_1.A PACK_A

Function call in ST PACK_1 (n := 16, B0 := PACK_B0, B1 := PACK_B1, B2 := PACK_B2, B3 := PACK_B3);

LD ST

PACK_A:=PACK_1.A;

Note: In IL, the function call has to be performed in one line.

Base_40-Library

104

907 AC 1131/Issued: 02.2001

PULSE DURATION MODULATOR

PDM S40

PULSE DURATION MODULATOR


This function block generates a pulse durationmodulated binary signal at its PULS output. The pulse duty ratio is specified at the t_TA input and the period duration for the output signal is specified at the TA_T input.

PDM S40

Block type Function block with historical values Parameters Instance t_TA TA_T PULS Description This function block generates a pulse durationmodulated binary signal at its PULS output. The pulse duty ratio is specified at the t_TA input and the period duration for the output signal is specified at the TA_T input. The inputs and the output can neither be duplicated nor negated nor inverted. t_TA INT The following relationship applies to the specification of the pulse duty ratio at input t_TA: Scaled value at input t_TA results in pulse duty ratio at the output PULS: Input t_TA Negative value 0 (0 * 32767) : : 16384 (0,5 * 32767) : : 32767 (1 * 32767) TA_T Output PULS 0 ( 0 %) 0 ( 0 %) : : : : 0,5 ( 50 %) : : : : 1 (100 %) INT PDM INT INT BOOL Instance name Pulse duty ratio Period duration referred to the cycle time Pulse duration modulated signal

The required pulse duty ratio for the output signal PULS is specified at input t_TA. At the same time, TA is the period duration of the signal at output PULS and t is the time within the period duration TA during which the output signal assumes a TRUE level. The specified value for the required pulse duty ratio at input t_TA must be specified in scaled form. To do this, the required pulse duty ratio must be multiplied by the value 32767 and rounded to an integer number. The resulting numerical value is then specified at input t_TA. Boundary condition for t: t > T I.e. the required duty cycle of the output signal must be higher than the cycle time of the PLC program (T).

The required period duration TA for the signal at output PULS is specified at input TA_T. At the same time, the period duration TA must be scaled to the cycle time T. Boundary condition for TA:

TA must be an integer multiple of T (TA = n * T) TA


>> T > 0; the higher TA is in relation to T, the more exactly the required pulse duty ratio is kept

Example: TA > 10 * T inaccuracy of the pulse duty ratio at output PULS < 10%. If a value TA_T < 0 is specified for TA_T, the function block automatically replaces this meaningless value by 32767.

907 AC 1131/Issued: 02.2001

105

Base_S40-Library

PULSE DURATION MODULATOR

PDM S40

PULS

BOOL

Example Required: Pulse duty ratio: t_TA = 0,25 (25 %) Period duration: TA = 800 ms (only an integer multiple of the PLC cycle time is possible) Cycle time: T = 100 ms Block parameters to be specified: Value at input t_TA: 8192 (0,25 * 32767) Value at input TA_T: 8 (800 ms/100 ms)

The pulse duration modulated signal is available at output PULS. Combination of the PDM block with a controller If the PDM function block is connected to the output of a controller in order to realize a switching controller, the following boundary conditions apply: Period duration TA of the PDM = sampling time of the controller. Period of the pulse signal must be synchronous with the period of the controller sampling time. These boundary conditions are fulfilled by planning the controller in the same PLC program as the PDM, but within one run number block. By means of the run number block, the sampling time of the controller is prolonged by an integer multiple of the cycle time. Therefore, the controller is processed less frequently within the run number block than the PDM outside of the run number block.

Example Declaration: PDM_1 : PDM; PDM_t_TA AT %MW1000.0 : INT; PDM_TA_t AT %MW1000.1 : INT; PDM_PULS AT %MX0.0 : BOOL; FBD: Translation in ABB IL: !BA 0 PDM t_TA TA_t PULS ABB IL of example: !BA 0 PDM MW0,0 MW0,1 M0,0

Function call in IL CAL LD ST PDM_1(t_TA := PDM_t_TA, TA_T := PDM_TA_t) PDM_1.PULS PDM_PULS

Function call in ST PDM_1 (t_TA := PDM_t_TA, TA_T := PDM_TA_t);

PDM_PULS:=PDM_1.PULS;

Note: In IL, the function call has to be performed in one line.

Base_40-Library

106

907 AC 1131/Issued: 02.2001

PROPORTIONAL INTEGRAL CONTROLLER

PI S40

PROPORTIONAL INTEGRAL CONTROLLER


The PI controller changes the value at its output Y (manipulated variable) until the value at input X (controlled variable) is equal to the value at input W (command variable).

PI S40

Block type Function block with historical values Parameters Instance W X KP TN_TZ OG UG SET INIT RES OG_MELD UG_MELD Y Description The PI controller changes the value at its output Y (manipulated variable) until the value at input X (controlled variable) is equal to the value at input W (command variable). Control algorithm: Simple rectangle rule KP W-X KP Y = * + YI(z-1) + * (W-X) 100 TN_TZ 100 With: YI(z-1) is the integral component from the previous program cycle The inputs and outputs can neither be duplicated nor negated/inverted. Transfer function: 1 F(s) = KP * (1+ ) s * TN PI INT INT INT INT INT INT BOOL INT BOOL BOOL BOOL INT Instance name Command variable (set point) Controlled variable (actual value) Proportional coefficient, specified as a percentage value Integral action time scaled to the PLC cycle time High limit for the manipulated variable Y Low limit for the manipulated variable Y Enabling for setting the manipulated variable Y to the initial value INIT Initial value for the manipulated variable Y Reset of the manipulated variable Y to 0 High limit has been reached, operands M, A (not E, S) Low limit has been reached, operands M, A (not E, S) Output for the manipulated variable Y

907 AC 1131/Issued: 02.2001

107

Base_S40-Library

PROPORTIONAL INTEGRAL CONTROLLER

PI S40

PI controller: Surge-free transition from the specified value to control operation

PI controller: Surging transition from the specified initial value to control operation

Base_40-Library

108

907 AC 1131/Issued: 02.2001

PROPORTIONAL INTEGRAL CONTROLLER

PI S40

INT

The command variable (set point) is specified at input W. X INT

to a maximum value by specifying a limit at input OG (high limit) to a minimum value by specifying a limit at input UG (low limit) The high and low limits also apply to the controllers internal I component. I.e the I component can only assume values between the high and low limits. If the manipulated variable Y reaches one of the two limits, the I component of the controller is no longer changed. This prevents the I component from drifting in the event of limiting of the controller output Y, assuming meaningless values from the point of view of control and, in certain circumstances, not returning to the operating range until after a very long time. This response of a controller is also referred to as a special anti-reset windup measure. Setting and resetting the controller SET INIT RES Setting the controller to an initial value The output Y of the controller is set to the initial value specified at the INIT input by means of a TRUE signal at input SET. A TRUE signal at input RES (reset) is equivalent to specifying the initial value 0 (see above). Surge-free setting/resetting The output Y of the controller is set to the initial value specified at the INIT input by means of a TRUE signal at the binary input SET. A TRUE signal at input RES (reset) is equivalent to specifying the initial value 0. In doing so, adjustment to the initial value is performed internal to the controller. This adjustment is a shift of the controller output from the momentary value to the required initial value. Now, the controller continues operating from this initial value precisely as it would have done at the old operating point before the shift, i.e. without surges. The I component of the controller is defined so that the sum of the P component and the I component just results in the initial value. Advantage of surge-free setting: Control as from the new initial value is devoid of surges. Disadvantage of surge-free setting: The equation applies: I_component = INIT P_component BOOL INT BOOL

The controlled variable (actual value) is specified at input X. KP INT

The proportional coefficient is specified at input KP. This value is specified as a percentage value. Positive or negative values are possible. Example: 1 = 1 percent 55 = 55 percent 100 = 100 percent 1000 = 1000 percent -500 = -500 percent

1 percent means that the block multiplies the system 100

deviation by the factor 0.01 (see also control algorithm) percent means that the block multiplies the system deviation by the factor 1 (see also control algorithm) percent means that the block multiplies the system deviation by the factor 10 (see also control algorithm)

1000

Generally, proportional coefficients of more than 1000 percent are not meaningful in control systems. TN_TZ INT

The integral action time TN is scaled to the PLC cycle time TZ and is specified at input TN_TZ. Value range: 0 < TN_TZ < 328

If

values are specified which are not within the admissible value range the PLC generally uses the value 328. large integral action time TN can be achieved by choosing a large cycle time T, too. If the block is used within a run number block, the cycle time of the run number block is valid for block INTK and not the cycle time (KD 0,0) of the PLC program.

Limiting the manipulated variable Y OG UG INT INT

The controller output Y (manipulated variable) can be limited

In certain circumstances, the I component is set to high values and may take very long before this wrong I component from the point of view of control is dissipated again.

907 AC 1131/Issued: 02.2001

109

Base_S40-Library

PROPORTIONAL INTEGRAL CONTROLLER

PI S40

Surging setting/resetting The output Y of the controller is set to the initial value specified at the INIT input by means of a TRUE signal at input SET. A TRUE signal at input RES (reset) is equivalent to specifying the initial value 0. In the event of surging setting or resetting of the controller, the I component is set equal to the initial value. To do this, the P component must be suppressed during the setting procedure. The following applies: I component = INIT Surging setting to an initial value is achieved by the following measure during the setting procedure: Specifying the value 0 at input KP. This measure renders the controllers P component inactive. The controller output Y assumes the initial value during the set cycle. The P component is enabled again after the set cycle. From the initial value, the controller output Y jumps according to the P component of the controller. Advantage of surging setting: The I component is not set to wrong values from the point of view of control. Disadvantage of surging setting: Not surging-free

INT

The manipulated variable Y of the controller is applied at output Y. OG_MELD BOOL

Output OG_MELD indicates whether the value at output Y has reached the specified top limit. OG_MELD = FALSE limit has not been reached. OG_MELD = TRUE limit has been reached. UG_MELD BOOL

Output UG_MELD indicates whether the value at output Y has reached the specified low limit. UG_MELD = FALSE limit has not been reached. UG_MELD = TRUE limit has been reached.

Base_40-Library

110

907 AC 1131/Issued: 02.2001

PROPORTIONAL INTEGRAL CONTROLLER

PI S40

Example Declaration: PI_1: PI; PI_W AT %MW1000.0: INT; PI_X AT %MW1000.1: INT; PI_KP AT %MW3001.0: INT := 100; PI_TN_TZ AT %MW3001.1: INT := 20; PI_OG AT %MW3001.2: INT := 20000; PI_UG AT %MW3001.3: INT := 0; PI_SET AT %MX0.0: BOOL; PI_INIT AT %MW3001.4: INT := 10000; PI_RES AT %MX0.1: BOOL; PI_OG_MELD AT %MX0.2: BOOL; PI_UG_MELD AT %MX0.3: BOOL; PI_Y AT %MW1000.2: INT; FBD: Translation in ABB IL: !BA 0 PI W X KP TN_TZ INIT SET RES OG UG Y OG_MELD UG_MELD ABB IL of example: !BA 0 PI MW0,0 MW1,1 KW1,0 KW1,1 M0,0 M0,1 KW1,4 M0,0 M0,1 KW1,2 KW1,3 MW0,2 M0,2 M0,3

; 100 ; 20

; 10000

; 20000 ;0

Function call in IL CAL PI_1(W := PI_W, X := PI_X, KP := PI_KP, TN_TZ := PI_TN_TZ, OG := PI_OG, UG := PI_UG, SET := PI_SET, INIT := PI_INIT, RES := PI_RES) LD ST LD ST LD ST PI_1.OG_MELD PI_OG_MELD PI_1.UG_MELD PI_UG_MELD PI_1.Y PI_Y

Function call in ST PI_1(W := PI_W, X := PI_X, KP := PI_KP, TN_TZ := PI_TNTZ, OG := PI_OG, UG := PI_UG, SET := PI_SET, INIT := PI_INIT, RES := PI_RES); PI_OG_MELD:=PI_1.OG_MELD; PI_UG_MELD:=PI_1.UG_MELD; PI_Y:=PI_1.Y;

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

111

Base_S40-Library

PIDT1 CONTROLLER

PIDT1 S40

PIDT1 CONTROLLER
The PI controller changes its output Y (manipulated variable) until input X (controlled variable) is equal to input W (command variable).

PIDT1 S40

Block type Function block with historical values Parameters Instance W X KP TN_TZ TV_TZ T1_TZ DT1_FR OG UG SET INIT RES OG_MELD UG_MELD Y Description The PI controller changes its output Y (manipulated variable) until input X (controlled variable) is equal to input W (command variable). Transfer function:
F(s) = KP * (1 + 1 s * TN + s * TV ) 1 + (s T1)

PIDT1 INT INT INT INT INT INT BOOL INT INT BOOL INT INT BOOL BOOL INT

Instance name Command variable (set point) Controlled variable (actual value) Proportional coefficient, specified as a percentage value Integral action time scaled to the PLC cycle time Derivative action time scaled to the PLC cycle time Returning time scaled to the PLC cycle time Enable DT component High limit for the manipulated variable Y Low limit for the manipulated variable Y Enable for setting to initial value INIT Initial value for the manipulated variable Y Reset of the manipulated variable Y to 0 High limit has been reached, operands M, A (not E, S) Low limit has been reached, operands M, A (not E, S) Output for the manipulated variable Y

Control algorithm: Simple rectangle rule:


KP*XD Y = 100 KP + 100 XD * TN_TZ + YI(z-1) T1_TZ + 1+(T1_TZ) * (YDTI(z-1) 1 + T1_TZ TV KP * * TZ 100 * (XD XD(z-1)))

Where: YI(z-1): The integral portion from the previous program cycle (YDTI(z-1) The differential portion from the previous program cylce

XD(z-1):

Control system difference previous program cycle

from

the

The inputs and outputs can neither be duplicated nor negated/inverted.

Base_40-Library

112

907 AC 1131/Issued: 02.2001

PIDT1 CONTROLLER

PIDT1 S40

PIDT1 controller: Surge-free transition from the specified value to control operation

PIDT1 controller: Surging transition from the specified initial value to control operation

907 AC 1131/Issued: 02.2001

113

Base_S40-Library

PIDT1 CONTROLLER

PIDT1 S40

INT

TV_TZ

INT

The command variable (set point) is specified at input W. X INT

The derivative action time TV is scaled to the PLC cycle time TZ and is specified at input TV_TZ: (0 < TN_TZ < 32767). T1_TZ INT

The controlled variable (actual value) is specified at input X. KP INT

The returning time T1 is scaled to the PLC cycle time TZ and is specified at input T1_TZ: (0 < TN_TZ < 32767). The returning time is the time in which the DT1 component has decreased to approximately 37% of its initial value. Invalid time parameters: Every time value is set to the maximum positive value 32767 if the time value at the input is erroneously specified as less than or equal to 0. DT1_FR BOOL

The proportional coefficient is specified at input KP. This value is specified as a percentage value. Positive or negative values are possible. Example: 1 55 100 1000 -500 = 1 percent = 55 percent = 100 percent = 1000 percent = -500 percent

1 percent means that the block multiplies the system 100

The DT1 component of the controller can be activated or deactivated by means of the D-FR input. D_FR 0 1 Meaning DT1 component is deactivated DT1 component is activated pure PI controller PIDT1 controller

deviation by the factor 0.01 (see also control algorithm) percent means that the block multiplies the system deviation by the factor 1 (see also control algorithm) percent means that the block multiplies the system deviation by the factor 10 (see also control algorithm)

1000

Generally, proportional coefficients of more than 1000 percent are not meaningful in control systems. TN_TZ INT

In the following cases, from the control point of view it is often disturbing and not meaningful for the DT1 component to be active: During activations In the event of large system deviations When setting the controller to a specified initial value When resetting the controller to the value 0

The integral action time TN is scaled to the PLC cycle time TZ and is specified at input TN_TZ. Value range: 0 < TN_TZ < 328

If

values are specified which are not within the admissible value range, the PLC generally uses the value 328. large integral action time TN can be achieved by choosing a large cycle time T, too. If the block is used within a run number block, the cycle time of the run number block is valid for block INTK and not the cycle time (KD00,00 / MD4000.0) of the PLC program.

The command and controlled variables can be compared outside of the controller. Depending on this comparison, the DT1 component can be activated or deactivated specifically using the D-FR input. For example, the activation can be restricted to the condition that the system deviation is within a required bandwidth. I.e. the DT1 component is only active if the controlled variable fluctuates around the set point within a specific bandwidth. The DT1 component is deactivated if the controlled variable leaves this tolerance band.

Base_40-Library

114

907 AC 1131/Issued: 02.2001

PIDT1 CONTROLLER

PIDT1 S40

Limiting the manipulated variable Y OG UG INT INT

Control as from the new initial value is devoid of surges. Disadvantage of surge-free setting: The equation applies: I component = INIT P component DT1 comp. In certain circumstances, the I component is set to high values and may take very long before this wrong I component from the point of view of control is dissipated again. Surging setting/resetting The output Y of the controller is set to the initial value specified at the INIT input by means of a TRUE signal at input SET. A 1 signal at input RES (reset) is equivalent to specifying the initial value 0. In the event of surging setting or resetting of the controller the I component is set equal to the initial value. To do this, the P component and the DT1 component must be suppressed during setting procedure. The following applies: I component = INIT Surging setting to an initial value is achieved by the following measures during setting procedure: Deactivation of the DT1 component via the D-FR control input and Specifying the value 0 at the input KP. These measures render the P component and the DT1 component inactive during setting of the controller. The controller output assumes the initial value during the set cycle. The P component and the DT1 component are enabled again after the set cycle. From the initial value, the controller output Y jumps according to the P component and the DT1 component of the controller. Advantage of surging setting: The I component is not set to wrong values from the point of view of control. Disadvantage of surging setting: Not surging-free Y INT

The controller output Y (manipulated variable) can be limited to a maximum value by specifying a limit at input OG (high limit) to a minimum value by specifying a limit at input UG (low limit). The high and low limits also apply to the controllers internal I component. I.e the I component can only assume values between the high and low limits. If the manipulated variable Y reaches one of the two limits, the controller's I component is no longer changed. This prevents the I component from drifting in the event of limiting of the controller output Y, assuming meaningless values from the point of view of control and, in certain circumstances, not returning to the operating range until after a very long time. This response of a controller is also referred to as a special anti-reset windup measure. Setting and resetting the controller SET INIT RES Setting the controller to an initial value The output Y of the controller is set to the initial value specified at the INIT input by means of a TRUE signal at input SET. A 1 signal at input RES (reset) is equivalent to specifying the initial value 0 (see above). Surge-free setting/resetting Output Y of the controller is set to the initial value specified at the INIT input by means of a TRUE signal at the binary input SET. A 1 signal at input RES (reset) is equivalent to specifying the initial value 0. In doing so, adjustment to the initial value is performed internal to the controller. This adjustment is a shift of the controller output from the momentary value to the required initial value. Now, the controller continues operating from this initial value precisely as it would have done at the old operating point before the shift, i.e. without surges. The controllers I component is defined in a way that the sum of the P, I and the DT1 component just results in the initial value. Advantage of surge-free setting: BOOL INT BOOL

The manipulated variable Y of the controller is applied at output Y.

907 AC 1131/Issued: 02.2001

115

Base_S40-Library

PIDT1 CONTROLLER

PIDT1 S40

OG_MELD

BOOL

UG_MELD

BOOL

Output OG_MELD indicates whether the value at output Y has reached the specified top limit. OG_MELD = FALSE OG_MELD = TRUE limit has not been reached. limit has been reached.

Output UG_MELD indicates whether the value at output Y has reached the specified low limit. UG_MELD = FALSE UG_MELD = TRUE limit has not been reached. limit has been reached.

Example Declaration: PIDT1_1 : PIDT1; PIDT1_W AT %MW1000.0: INT; PIDT1_X AT %MW1000.1: INT; PIDT1_KP AT %MW3001.0: INT := 100; PIDT1_TN_TZ AT %MW3001.1: INT := 20; PIDT1_TV_TZ AT %MW3001.2 : INT := 0; PIDT1_T1_TZ AT %MW3001.3 : INT := 0; PIDT1_DT1_FR AT %MX0.4 : BOOL; PIDT1_OG AT %MW3001.5: INT := 20000; PIDT1_UG AT %MW3001.6: INT := 0; PIDT1_SET AT %MX0.0: BOOL; PIDT1_INIT AT %MW3001.7: INT := 10000; PIDT1_RES AT %MX0.1: BOOL; PIDT1_OG_MELD AT %MX0.2: BOOL; PIDT1_UG_MELD AT %MX0.3: BOOL; PIDT1_Y AT %MW1000.2: INT; FBD: Translation in ABB IL: !BA 0 PIDT1 W X KP TN_TZ TV_TZ T1_TZ DT1_FR INIT SET RES OG UG Y OG_MELD UG_MELD ABB IL of example: !BA 0 PI MW0,0 MW1,1 KW1,0 KW1,1 KW1,2 KW1,3 M0,4 M0,0 M0,1 KW1,5 M0,0 M0,1 KW1,6 KW1,7 MW0,2 M0,2 M0,3

; 100 ; 20 ;0 ;0

; 10000

; 20000 ;0

Base_40-Library

116

907 AC 1131/Issued: 02.2001

PIDT1 CONTROLLER

PIDT1 S40

Function call in IL CAL PIDT1_1(W := PIDT1_W, X := PIDT1_X, KP := PIDT1_KP, TN_TZ := PIDT1_TNTN, TV_TZ := PIDT1_TVTZ, T1_TZ := PIDT1_T1_TZ, DT1_FR := PIDT1_DT1_FR, OG := PIDT1_OG, UG := PIDT1_UG, SET := PIDT1_SET, INIT := PIDT1_INIT, RES := PIDT1_RES) PIDT1_1.OG_MELD PIDT1_OG_MELD PIDT1_1.UG_MELD PIDT1_UG_MELD PIDT1_1.Y PIDT1_Y

Function call in ST PIDT1_1 W := PIDT1_W, X := PIDT1_X, KP := PIDT1_KP, TN_TZ := PIDT1_TNTN, TV_TZ := PIDT1_TVTZ, T1_TZ := PIDT1_T1_TZ, DT1_FR := PIDT1_DT1_FR, OG := PIDT1_OG, UG := PIDT1_UG, SET := PIDT1_SET, INIT := PIDT1_INIT, RES := PIDT1_RES); := IDT1_1.OG_MELD; := IDT1_1.UG_MELD; := IDT1_1.Y;

LD ST LD ST LD ST

PIDT1_OG_MELD PIDT1_UG_MELD PIDT1_Y

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

117

Base_S40-Library

RESET MEMORY , DOMINATING

RS S40

RESET MEMORY , DOMINATING


A status TRUE at the input SET sets the operand Q1 to the status TRUE. A status TRUE at the input RESET1 resets the operand Q1 to the status FALSE. => dominating RESET

RS S40

Block type Function block without historical values Parameters Instance SET RESET1 Q1 RS BOOL BOOL BOOL Instance name Set input Reset input Flip-flop output

Description

A status TRUE at the input SET sets the operand Q1 to the status TRUE. A status TRUE at the input RESET1 resets the operand Q1 to the status FALSE.

A simultaneous TRUE status at the inputs SET and RESET1 sets operand Q1 to a status FALSE (dominating reset ) A status FALSE at the input SET or RESET1 has no influence on the operand Q1

Example Declaration: RS_1 : RS; RS_SET AT %MX0.0 : BOOL; RS_RESET1 AT %MX0.1 : BOOL; RS_Q1 AT %MX0.2 : BOOL; FBD: Translation in ABB IL: ! SET =S Q1 ! RESET1 =R Q1 ABB IL of example: ! M0,0 =S M0,2 ! M0,1 =R M0,2

Function call in IL CAL LD ST RS_1(SET = RS_SET, RESET1 := RS_RESET) RS_1.Q1 RS_Q

Function call in ST RS_1 ( SET := RS_SET, RESET1 := RS_RESET);

RS_Q := RS_1.Q1;

Base_40-Library

118

907 AC 1131/Issued: 02.2001

SERIAL LINE INITIALIZATION

SINIT S40

SERIAL LINE INITIALIZATION


Serial interface initialization function block. The function block SINIT is processed once with every FALSE/TRUE edge at the FREI input. It initializes the serial interface specified at the SSK input. The interface can be operated by the PLC program (e.g. with the DRUCK and EMAS blocks).

SINIT S40

Block type Function block with historical values Parameters Instance FREI SSK BAUD STOP ZL PTY E_O ECHO SBRK FEND ENDS ENDE SINIT BOOL INT INT INT INT BOOL BOOL BOOL BOOL BOOL INT INT Instance name Enable processing of the block,FALSE->TRUE edge Interface identifier (1 or 2) Baud rate; 300 ... 9600 Baud Number of stop bits; input has no effect Character length, 7 or 8 data bits per character Parity, enable/disable Parity even/odd Echo, on/off Send break character Enable end of text character for transmitting direction End of text character for transmitting direction End of text character for receiving direction

Description Serial interface initialization function block. Before using one of these interfaces, the interface must be initialized. The function block SINIT is available for this purpose. The function block SINIT is processed once with every FALSE->TRUE edge at the FREI input. It initializes the serial interface specified at the SSK input (COM1, COM2). FREI BOOL

The block is run through once when a FALSE/TRUE edge is specified at the FREI input. As the result of this, the serial interface whose number is specified at the SSK input is initialized and the interface is then operable. SSK INT

The number of the interface to be initialized is specified at the input SSK. The following applies : COM1 : number = 1 COM2 : number = 2

907 AC 1131/Issued: 02.2001

119

Base_S40-Library

SERIAL LINE INITIALIZATION

SINIT S40

BAUD

INT

The value for the baud rate is specified at the BAUD input. Baud rate : 300 ... 9600 Baud STOP INT

SBRK = 0 -> Normal state of the transmit line TxD for transfer of characters SBRK = 1 -> Transmit line TxD set to "0" FEND BOOL The input FEND specifies whether or not the end of text character planned at input ENDS is output at the same time (enable end character). FEND = 0 -> End of text character in transmitting direction is not output FEND = 1 -> End of text character in transmitting direction is output ENDS INT

The number of stop bits is set to 1 and can not be modified. The value for the number of stop bits specified at the input STOP has no significance. ZL INT

The input ZL specifies the required character length. The character length signifies the number of data bits per character. 7 or 8 data bits per character are possible. PTY BOOL

A freely selectable end of text character for the transmitting direction can be specified at the ENDS input. This end character is then appended automatically to every text (telegram) which the DRUCK block sends to the outside world through the serial interface. However, a precondition is that input FEND is enabled. The end of text character is specified as a numeric value. Example : 3 or 03H signifies <ETX> 4 or 04H signifies <EOT> 13 or 0DH signifies <CR> 10 or OAH signifies <LF> 32 or 20H signifies <SP> ... ENDE INT

The input PTY specifies whether a character is transferred with or without a parity bit. PTY = 0 -> Transfer without parity bit PTY = 1 -> Transfer with parity bit E_O BOOL

The input E/O specifies whether an even or odd parity bit is required. E/O = 0 -> Odd parity bit E/O = 1 -> Even parity bit ECHO BOOL characters are to be the sender whether or

The input ECHO specifies whether the received through the applicable interface reflected (echoed) by the PLC. In this way, of a character, for example, can determine not it has arrived correctly in the PLC.

ECHO = 0 -> No echo, character is not reflected ECHO = 1 -> Echo, character is reflected SBRK BOOL

A freely selectable end of text character for the receiving direction can be specified at the ENDE input. When a telegram is received through the serial interface, the PLC recognizes the end of the telegram by virtue of this end character. The end character is specified in the same way as in the case of the ENDS input.

The state of the transmit line TxD can be influenced at the input SBRK (send break character).

Base_40-Library

120

907 AC 1131/Issued: 02.2001

SERIAL LINE INITIALIZATION

SINIT S40

Example Declaration: SINIT1 : SINIT; SINIT_FREI AT %MX0.0 : BOOL; SINIT_SSK AT %MW3001.1 : INT := 1; SINIT_BAUD AT %MW3001.2 : INT := 9600; SINIT_STOP AT %MW3001.3 : INT := 1; SINIT_ZL AT %MW3001.4 : INT := 8; SINIT_PTY AT %MX0.1 : BOOL; SINIT_E_O AT %MX0.2 : BOOL; SINIT_ECHO AT %MX0.3 : BOOL; SINIT_SBRK AT %MX0.4 : BOOL; SINIT_FEND AT %MX0.5 : BOOL; SINIT_ENDS AT %MW3001.5 : INT := 13; SINIT_ENDE AT %MW3001.6 : INT := 13; FBD: Translation in ABB IL: !BA 0 SINIT FREI SSK BAUD STOP ZL PTY E_O ECHO SBRK FEND ENDS ENDE ABB IL of example: !BA 0 SINIT M0,0 KW1,1 KW1,2 KW1,3 KW1,4 M0,1 M0,2 M0,3 M0,4 M0,5 KW1,5 KW1,6

;1 ; 9600 ;1 ;8

; 13 ; 13

Function call in IL CAL SINIT1(FREI := SINIT_FREI, SSK := SINIT_SSK, BAUD := SINIT_BAUD, STOP := SINIT_STOP, ZL := SINIT_ZL, PTY := SINIT_PTY, E_O := SINIT_E_O, ECHO := SINIT_ECHO, SBRK := SINIT_SBRK, FEND := SINIT_FEND, ENDS := SINIT_ENDS, ENDE := SINIT_ENDE)

Function call in ST SINIT1 (FREI := SINIT_FREI, SSK := SINIT_SSK, BAUD := SINIT_BAUD, STOP := SINIT_STOP, ZL := SINIT_ZL, PTY := SINIT_PTY, E_O := SINIT_E_O, ECHO := SINIT_ECHO, SBRK := SINIT_SBRK, FEND := SINIT_FEND, ENDS := SINIT_ENDS, ENDE := SINIT_ENDE);

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

121

Base_S40-Library

SQUARE ROOT, DOUBLEWORD

SQRTD S40

SQUARE ROOT, DOUBLEWORD


The function block SQRTD generates the square root of the value at the input E. The result is available at the output A and is always rounded down to an integral number.The value at the input E must be a positive number. If the value at the input is negative, the value zero is output through the output A and the value TRUE is output through the ERR output. Block type Function block without historical values Parameters Instance E A ERR SQRTD DINT DINT BOOL Instance name Input Square root of the input value Error if the input value is negative, operands M, A (not E, S)

SQRTD S40

Description The function block SQRTD generates the square root of the value at the input E. The result is available at the output A and is always rounded down to an integral number.The value at the input E must be a positive number. If the value at the input is negative, the value zero is output through the output A and the value TRUE is output through the ERR output. E DINT A DINT

The value of the square root is available at the output A. ERR BOOL

The ERR output indicates whether the value of the input operand E is positive (>= 0) or negative (< 0). Input E >= 0 -> ERR = FALSE and A = square root Input E < 0 -> ERR = TRUE and A = 0

The square root of the value at the input E is generated and is available as a value of the output operand A.

Base_40-Library

122

907 AC 1131/Issued: 02.2001

SQUARE ROOT, DOUBLEWORD

SQRTD S40

Example Declaration: SQRTD_1 : SQRTD; SQRTD_E AT %MD2000.0 : DINT; SQRTD_A AT %MD2000.1 : DINT; SQRTD_ERR AT %MX0.0 : BOOL; Translation in ABB IL: !BA 0 SQRT K0,1 E A ERR ABB IL of example: !BA 0 SQRT K0,1 MD0,0 MD0,1 M0,0

FBD:

Function call in IL CAL LD ST LD ST SQRTD_1(E := SQRTD_E) SQRTD_1.A SQRTD_A SQRTD_1.ERR SQRTD_ERR

Function call in ST SQRTD_1(E := SQRTD_E); SQRTD_A := SQRTD_1.A; SQRTD_ERR := SQRTD_1.ERR;

907 AC 1131/Issued: 02.2001

123

Base_S40-Library

SQUARE ROOT, WORD

SQRTW S40

SQUARE ROOT, WORD


The function block SQRTW generates the square root of the value at the input E. The result is available at the output A and is always rounded down to an integral number.The value at the input E must be a positive number. If the value at the input is negative, the value zero is output through the output A and the value TRUE is output through the ERR output.

SQRTW S40

Block type Function block without historical values Parameters Instance E A ERR SQRTW INT INT BOOL Instance name Input Square root of the input value Error if the input value is negative, operands M, A (not E, S)

Description The function block SQRTW generates the square root of the value at the input E. The result is available at the output A and is always rounded down to an integral number.The value at the input E must be a positive number. If the value at the input is negative, the value zero is output through the output A and the value TRUE is output through the ERR output. E INT A INT

The value of the square root is available at the output A. ERR BOOL

The ERR output indicates whether the value of the input operand E is positive (>= 0) or negative (< 0). Input E >= 0 -> ERR = FALSE and A = square root Input E < 0 -> ERR = TRUE and A = 0

The square root of the value at the input E is generated and is available as a value of the output operand A.

Base_40-Library

124

907 AC 1131/Issued: 02.2001

SQUARE ROOT, WORD

SQRTW S40

Example Declaration: SQRTW_1 : SQRTD; SQRTW_E AT %MW1000.0 : DINT; SQRTW_A AT %MW1000.1 : DINT; SQRTW_ERR AT %MX0.0 : BOOL; Translation in ABB IL: !BA 0 SQRT K0,0 E A ERR ABB IL of example: !BA 0 SQRT K0,0 MW0,0 MW0,1 M0,0

FBD:

Function call in IL CAL LD ST LD ST SQRTW_1(E := SQRTD_E) SQRTW_1.A SQRTW_A SQRTW_1.ERR SQRTW_ERR

Function call in ST SQRTW_1(E := SQRTW_E); SQRTW_A := SQRTW_1.A; SQRTW_ERR := SQRTW_1.ERR;

907 AC 1131/Issued: 02.2001

125

Base_S40-Library

SET MEMORY , DOMINATING

SR S40

SET MEMORY , DOMINATING


A status TRUE at the input SET1 sets the operand Q1 to the status TRUE. A status TRUE at the input RESET resets the operand Q1 to the status FALSE. => dominating SET

SR S40

Block type Function block without historical values Parameters Instance SET1 RESET Q1 SR BOOL BOOL BOOL Instance name Set input Reset input Flip-flop output

Description A status TRUE at the input SET1 sets the operand Q1 to the status TRUE. A status TRUE at the input RESET resets the operand Q1 to the status FALSE. A simultaneous TRUE status at the inputs SET1 and RESET sets operand Q1 to a status TRUE (dominating set). A status FALSE at the input SET1 or RESET has no influence on the operand Q1.

Example Declaration: SR_1 : SR; SR_SET1 AT %MX0.0 : BOOL; SR_RESEET AT %MX0.1 : BOOL; SR_Q1 AT %MX0.2 : BOOL; FBD: Translation in ABB IL: ! RESET =R Q1 ! SET1 =S Q1 ABB IL of example: ! M0,1 =R M0,2 ! M0,0 =S M0,2

Function call in IL CAL LD ST SR_1(SET1 := SR_SET, RESET = SR_RESET) SR_1.Q1 SR_Q

Function call in ST SR_1 (SET1 := SR_SET, RESET := SR_RESET);

SR_Q := SR_1.Q1;

Base_40-Library

126

907 AC 1131/Issued: 02.2001

SUBTRACTION DOUBLE WORD

SUBD S40

SUBTRACTION DOUBLE WORD


The value of the operand at input E2 is subtracted from the value of the operand at input E1 and the result is assigned to the operand at output A. The result is limited to the maximum or minimum value of the number range (Number range: -2147483647 2147483647). If limiting occurred, a TRUE signal is assigned to the binary operand at output Q. If no limiting occurred, a FALSE signal is assigned to the binary operand at output Q. Block type Function block without historical values Parameters Instance E1 E2 A Q SUBD DINT DINT DINT BOOL Instance name Minuend Subtrahend Result (difference) Result limited

SUBD S40

Description The value of the operand at input E2 is subtracted from the value of the operand at input E1 and the result is assigned to the operand at output A. The result is limited to the maximum or minimum value of the number range (Number range: -2147483647 2147483647). If limiting occurred, a TRUE signal is assigned to the binary operand at output Q. If no limiting occurred, a FALSE signal is assigned to the binary operand at output Q. The inputs and outputs can neither be duplicated nor negated.

907 AC 1131/Issued: 02.2001

127

Base_S40-Library

SUBTRACTION DOUBLE WORD

SUBD S40

Example Declaration: SUBD_1 : SUBD; SUBD_E1 AT %MD2000.0 : DINT; SUBD_E2 AT %MD2000.1 : DINT; SUBD_A AT %MD2000.2 : DINT; SUBD_Q AT %MX0.0 : BOOL; FBD: Translation in ABB IL: !BA 0 SUBD E1 E2 A Q ABB IL of example: !BA 0 SUBD MD0,0 MD0,1 MD0,2 M0,0

Function call in IL CAL LD ST LD ST SUBD_1(E1 := SUBD_E1, E2 := SUBD_E2) SUBD1.A SUBD_A SUBD1.Q SUBD_Q

Function call in ST SUBD_1(E1 := SUBD_E1, E2 := SUBD_E2); SUBD_A:=SUBD1.A; SUBD_Q:=SUBD1.Q;

Base_40-Library

128

907 AC 1131/Issued: 02.2001

TIME WORD CONVERSION

TIME_W S40

TIME WORD CONVERSION


This functions is used to manage time value with word variables The time in [ms] TIMEE is converted in hours, minutes, seconds and milliseconds.

TIME_W S40

Block type Function block without historical values Parameters Instance TIMEE H M SEC MS TIME_W DINT INT INT INT INT Instance name Time value Hours value Minute value Second value Millisecond value

Description This functions is used to manage time value with word variables The Time value TIMEE is converted in hours, minutes, seconds and milliseconds. TIMEE The time value is in millisecond. Value range: 0 < TIMEE < 986399999 IF TIMEE is greater than 986399999 then H, M, SEC, MS are set to the maximum value. IF TIMEE is negative then H, M, SEC, MS are set to zero. H Output for the hours. Value range: 0 < H < 273 INT DINT M Output for the minutes. Value range: 0 < M < 59 SEC Output for the seconds. Value range: 0 < SEC < 59 MS Output for the milliseconds. Value range: 0 < MS < 999 INT INT INT

907 AC 1131/Issued: 02.2001

129

Base_S40-Library

TIME WORD CONVERSION

TIME_W S40

Example Declaration: TIME_W_1 : TIME_W; TIME_W_TIMEE AT %MD2000.0 : DINT; TIME_W_H AT %MW1000.0 : INT; TIME_W_M AT %MW1000.1 : INT; TIME_W_SEC AT %MW1000.2 : INT; TIME_W_MS AT %MW1000.3 : INT; FBD: Translation in ABB IL: !BA 0 TIME_W H M SEC MS ABB IL of example: !BA 0 TIME_W MD0,0 MW0,0 MW0,1 MW0,2 MW0,3

Function call in IL CAL LD ST LD ST LD ST LD ST TIME_W_1(TIMEE := TIME_W_TIMEE); TIME_W_1.H TIME_W_H TIME_W_1.M TIME_W_M TIME_W_1.SEC TIME_W_SEC TIME_W_1.MS TIME_W_MS

Function call in ST TIME_W_1(TIMEE := TIME_W_TIMEE); TIME_W_H := TIME_W_1.H; TIME_W_M := TIME_W_1.M; TIME_W_SEC := TIME_W_1.SEC; TIME_W_MS := TIME_W_1.MS;

Base_40-Library

130

907 AC 1131/Issued: 02.2001

OFF DELAY

TOF S40

OFF DELAY
The TRUE/FALSE edge of the input E is delayed by the time T at the output A. If the input E returns to TRUE level before expiry of the time T, the output A retains TRUE level.

TOF S40

Block type Function block with historical values Parameters Instance E T A ET TOF BOOL TIME BOOL TIME Instance name Input signal Preset time Delayed signal, operands M, A (not E, S) Time visualization

Description The TRUE/FALSE edge of the input E is delayed by the time T at the output A. If the input E returns to TRUE level before expiry of the time T, the output A retains TRUE level. The time elapsed can be consulted at the output ET and the preset time value at the input T can be modified when the timer is running. The preset time is specified in milliseconds. The time range which can be specified is : 1 ms ... 24,8 days. Maximum time offset at the output : < 1 cycle time Meaningful range for T : > 1 cycle time. General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

907 AC 1131/Issued: 02.2001

131

Base_S40-Library

OFF DELAY

TOF S40

Example Declaration: TOF_1 : TOF; TOF_IN AT %MX0.0 : BOOL; TOF_PT AT %MD40001.0 : TIME := t#10s; (* 10000 ms *) TOF_Q AT %MX0.1 : BOOL; TOF_ET AT %MD2000.0 : TIME; FBD: Translation in ABB IL: !BA 0 TOF IN PT Q ET ABB IL of example: !BA 0 TOF M0,0 KD1,0 M0,1 MD0,0

; 10000

Function call in IL CAL LD ST LD ST TOF_1(E := TOF_E, T := TOF_T) TOF_1.A TOF_A TOF_1.ET TOF_ET

Function call in ST TOF_1(E := TOF_E, T := TOF_T); TOF_A := TOF_1.A; TOF_ET := TOF_1.ET;

Base_40-Library

132

907 AC 1131/Issued: 02.2001

ON DELAY

TON S40

ON DELAY
The FALSE/TRUE edge of the input E is delayed by the time T at the output A. The output A retains FALSE level if the input E returns to FALSE level before the time T has elapsed.

TON S40

Block type Function block with historical values Parameters Instance E T A ET TON BOOL TIME BOOL TIME Instance name Input signal Preset time Delayed signal Time visualization

Description The FALSE/TRUE edge of the input E is delayed by the time T at the output A. The output A retains 0 level if the input E returns to 0 level before the time T has elapsed. The time elapsed can be consulted at the output ET and the preset time value at the input T can be modified when the timer is running. The preset time is specified in milliseconds. The time range which can be specified is : 1 ms ... 24.8 days. Maximum time offset at the output : < 1 cycle time Meaningful range for T : > 1 cycle time General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

907 AC 1131/Issued: 02.2001

133

Base_S40-Library

ON DELAY

TON S40

Example Declaration: TON_1 : TON; TON_IN AT %MX0.0 : BOOL; TON_PT AT %MD40001.0 : TIME := t#10s; (* 10000 ms *) TON_Q AT %MX0.1 : BOOL; TON_ET AT %MD2000.0 : TIME; FBD: Translation in ABB IL: !BA 0 TON IN PT Q ET ABB IL of example: !BA 0 TON M0,0 KD1,0 M0,1 MD0,0

; 10000

Function call in IL CAL LD ST LD ST TON_1(E := TON_E, T := TON_T) TON_1.A TON_A TON_1.ET TON_ET

Function call in ST TON_1(E := TON_E, T := TON_T); TON_A := TON_1.A; TON_ET := TON_1.ET;

Base_40-Library

134

907 AC 1131/Issued: 02.2001

MONOSTABLE ELEMENT CONSTANT MONOSTABLE ELEMENT CONSTANT


The FALSE/TRUE edge at the input E produces a FALSE/TRUE edge at the output A. The output A is reset to FALSE level after expiry of the period T. A second FALSE/TRUE Edge of the input E before the time T has elapsed is ignored.

TP S40

TP S40

Block type Function block with historical values Parameters Instance E T A ET ASV BOOL TIMER BOOL DINT Instance name Input signal Delay time Delayed signal Time visualization

Description The FALSE/TRUE edge at the input E produces a FALSE/TRUE edge at the output A. The output A is reset to FALSE level after expiry of the period T. A second FALSE/TRUE Edge of the input E before the time T has elapsed is ignored. The time elapsed can be consulted at the output ET and the preset time value at the input E can be modified when the timer is running. The preset time is specified in milliseconds. The time range which can be specified is : 1 ms ... 24.8 days. Maximum time offset at the output : < 1 cycle time Meaningful range for PT : > 1 cycle time. General behavior Started timers are processed by the PLC operating system and are therefore completely independent of processing of the PLC program. An appropriate message of the operating system is not issued to the affiliated timer block in the PLC program until the timer has elapsed. Processing of a timer in the PLC operating system is influenced by the following commands. All running timers are stopped and initialized when one of the following actions occurs: Abort PLC program RUN/STOP switch from RUN -> STOP Warm or cold start

907 AC 1131/Issued: 02.2001

135

Base_S40-Library

MONOSTABLE ELEMENT CONSTANT

TP S40

Example Declaration: TP_1 : TOF; TP_IN AT %MX0.0 : BOOL; TP_PT AT %MD40001.0 : TIME := t#10s; (* 10000 ms *) TP_Q AT %MX0.1 : BOOL; TP_ET AT %MD2000.0 : TIME; FBD: Translation in ABB IL: !BA 0 TP IN PT Q ET ABB IL of example: !BA 0 TP M0,0 KD1,0 M0,1 MD0,0

; 10000

Function call in IL CAL LD ST LD ST TP_1(E := TP_E, T := TP_T) TP_1.A TP_A TP_1.ET TP_ET

Function call in ST TP_1(E := TP_E, T := TP_T); TP_A := TP_1.A; TP_ET := TP_1.ET;

Base_40-Library

136

907 AC 1131/Issued: 02.2001

DISPLAY AND SET CLOCK

UHR S40

DISPLAY AND SET CLOCK


This function block allows to set and display the current time and date.

UHR S40

Block type Function block with historical values Parameters Instance FREI SET ESEC EMIN EH ETAG EMON EJHR EWO AKT ERR ASEC AMIN AH ATAG AMON AJHR AWO UHR BOOL BOOL INT INT INT INT INT INT INT BOOL INT INT INT INT INT INT INT INT Instance name Enable block processing FALSE/TRUE edge sets the time and date Set input for seconds Set input for minutes Set input for hours Set input for days Set input for months Set input for years Set input for weekdays Topicality (usefulness) of the data at the outputs Error identifier Output seconds Output minutes Output hours Output days Output months Output years Output weekday no.

Description This function block allows to set and display the current time and date. The inputs and outputs can neither be duplicated nor inverted nor negated. The clock is set by means of the set inputs for the time and date. The values present at the set inputs are adopted with the occurrence of a FALSE/TRUE edge at input SET. As long as a TRUE signal is present at the FREI input, the current date and time are indicated at the blocks outputs. FREI Enabling the block BOOL

FREI = FALSE: The block is not processed. The AKT and ERR outputs are set to FALSE or 0. The time and date outputs are no longer changed by the block. FREI = TRUE:Block is processed

907 AC 1131/Issued: 02.2001

137

Base_S40-Library

DISPLAY AND SET CLOCK

UHR S40

SET

BOOL

EWO Set input for the number of the weekday.

INT

FALSE/TRUE edge: The clock is set to the values present at the time and date inputs. During the setting procedure the time and date at the block outputs are invalid (output AKT = FALSE). Set inputs for date and time In the event of a FALSE/TRUE edge at input SET, the clock is set to the values present at the set inputs. If the specified set values are inadmissible, the AKT output is set to FALSE and an error message appears at the ERR output. In this case the values present at the time and date outputs are invalid. The clock has to be set again. ESEC Set input for seconds. Value range: 0 59. EMIN Set input for minutes. Value range: 0 59. EH Set input for hours. INT

This input specifies on which day of the week the input is made. That is to say, it is possible to determine which day of the week the day with the number 1 is to be (e. g. Sunday or Monday). Value range: 1 7. Example: The clock is set on Friday, 01.07.88. If the value 6 is entered for the week day number, Friday is now the 6th day of the week and Sunday is defined as the 1st day of the week. AKT BOOL

Indication of the topicality (usefulness) of the outputs. AKT is TRUE if:

INT

INT

The date and time outputs were updated in the current cycle. The values at the outputs are consistent, i.e. none of the values at the date or time outputs has changed during updating. They all originate from the same clock pulse. The clock was set correctly. AKT = TRUE ERR = 0: Date/time are valid AKT = FALSE ERR > 0: Date/time are invalid The reason is displayed at output ERR as an error identifier.

The clock operates in 24 hour mode, i.e. it changes from 23:59:59 h to 0:0:0 h. Value range: 0 23. ETAG INT Set input for days (which day of the month). The clock knows the number of days depending on the months and leap years. For the clock, a leap year exists when the year number is an integral multiple of 4. The maximum value for the days (28, 29, 30, 31) depends on the month. Value range: 128, 29, 30, 31. EMON Set input for months. Value range: 1 12. INT

EJHR INT Set input for years. The clock only indicates the years and decades. Value range: 0 99.

Base_40-Library

138

907 AC 1131/Issued: 02.2001

DISPLAY AND SET CLOCK

UHR S40

ERR INT In the event of an error, the relevant error identifier is available at output ERR. Meanings of the error identifiers:

ASEC Output seconds. Value range: 0 59. AMIN Output minutes. Value range: 0 59. AH Output hours. Value range: 0 23. ATAG Output days. Value range: 1 28, 29, 30, 31. AMON Output months. Value range: 1 12. AJHR Output years. Value range: 0 99. AWO Output weekday no. Value range: 1 7.

INT

No error has occurred:


ERR=0: No error has occurred or FREI = FALSE, i.e. block disabled.

INT

Error when setting the clock:


ERR=1: ERR=2: ERR=3: ERR=4: ERR=5: ERR=6: ERR=7: ERR=8: 0 < SEC < 59 has not been met 0 < MIN < 59 has not been met 0 < H < 23 has not been met 1 < TAG < 28, 29, 30, 31 (depending on the month) has not been met 1 < MON < 12 has not been met 0 < JHR < 99 has not been met 1 < WTG < 7 has not been met The transmission mailbox is currently occupied by another user. The block waits until the mailbox is free and afterwards date/time are set. Date/time at the outputs are invalid. Setting of date/time is currently performed; this may take several PLC cycles. Setting was not successful, please repeat (unknown request code). Setting was not successful, please repeat (invalid mail parameter). Setting was not successful, please repeat (request code cannot be executed).

INT

INT

INT

ERR=9: ERR=10:

INT

ERR=11: ERR=12: ERR=13:

INT

Error when displaying date and time:


ERR=9: Date/time at the outputs are invalid.Outputs for date and time The outputs are updated whenever a TRUE signal is present at the FREI input and the clock has been set once. During the setting the outputs for date and time are invalid. If the AKT output is equal to TRUE, the outputs for the date and time are valid. In case of an error, an error identifier is output at output ERR.

907 AC 1131/Issued: 02.2001

139

Base_S40-Library

DISPLAY AND SET CLOCK

UHR S40

Example Declaration: UHR_1 : UHR; UHR_FREI AT %MX0.0 : BOOL; UHR_SET AT %MX0.1 : BOOL; UHR_ESEC AT %MW1000.0 : INT; UHR_EMIN AT %MW1000.1 : INT; UHR_EH AT %MW1000.2 : INT; UHR_ETAG AT %MW1000.3 : INT; UHR_EMON AT %MW1000.4 : INT; UHR_EJHR AT %MW1000.5 : INT; UHR_EWO AT %MW1000.6 : INT; UHR_AKT AT %MX0.2 : BOOL; UHR_ERR AT MW1000.7 : INT; UHR_ASEC AT MW1000.8 : INT; UHR_AMIN AT MW1000.9 : INT; UHR_AH AT MW1000.10 : INT; UHR_ATAG AT MW1000.11 : INT; UHR_AMON AT MW1000.12 : INT; UHR_AJHR AT MW1000.13 : INT; UHR_AWO AT MW1000.14 : INT; FBD: Translation in ABB IL: !BA 0 UHR SET ESEC EMIN EH ETAG EMON EJHR EWO AKT ERR ASEC AMIN AH ATAG AMON AJHR AWO ABB IL of example: !BA 0 UHR M0,0 M0,1 MW1,0 MW1,1 MW1,2 MW1,3 MW1,4 MW1,5 MW1,6 M0,2 MW1,7 MW1,8 MW1,9 MW1,10 MW1,11 MW1,12 MW1,13 MW1,14

Base_40-Library

140

907 AC 1131/Issued: 02.2001

DISPLAY AND SET CLOCK

UHR S40

Function call in IL CAL UHR_1( FREI := UHR_FREI, SET := UHR_SET, ESEC := UHR_ESEC, EMIN := UHR_EMIN, EH := UHR_EH, ETAG := UHR_ETAG, EMON := UHR_EMON, EJHR := UHR_EJHR, EWO := UHR_EWO) UHR_1.ERR UHR_ERR UHR_1.ASEC UHR_ASEC UHR_1.AMIN UHR_AMIN UHR_1.AH UHR_AH UHR_1.ATAG UHR_ATAG UHR_1.AMON UHR_AMON UHR_1.AJHR UHR_AJHR UHR_1.AWO UHR_AWO UHR_1.AKT UHR_AKT

Function call in ST UHR_1 FREI := UHR_FREI, SET := UHR_SET, ESEC := UHR_ESEC, EMIN := UHR_EMIN, EH := UHR_EH, ETAG := UHR_ETAG, EMON := UHR_EMON, EJHR := UHR_EJHR, EWO := UHR_EWO); := UHR_1.ERR; := UHR_1.ASEC; := UHR_1.AMIN; := UHR_1.AH; := UHR_1.ATAG; := UHR_1.AMON; := UHR_1.AJHR; := UHR_1.AWO; := UHR_1.AKT;

LD ST LD ST LD ST LD ST LD ST LD ST LD ST LD ST LD ST

UHR_ERR UHR_ASEC UHR_AMIN UHR_AH UHR_ATAG UHR_AMON UHR_AJHR UHR_AWO UHR_AKT

Note: In IL, the function call has to be performed in one line.

907 AC 1131/Issued: 02.2001

141

Base_S40-Library

UNPACKING A WORD INTO BINARY VARIABLES

UNPACK(4,..) S40

UNPACKING A WORD INTO BINARY VARIABLES


This function block unpacks the word variable at input E. Each bit of the input variable is assigned to one binary variable each (B0 ... B15) at the output. UNPACK4 max. 4 output variables UNPACK8 max. 8 output variables UNPACK16 max. 16 output variables

UNPACK(4,..) S40

Block type Function block without historical values Parameters Instance E N B0..B15 Description This function block unpacks the word variable at input E. Each bit of the input variable is assigned to one binary variable each (B0 ... Bn-1) at the output. E INT B0B15 BOOL UNPACK INT INT BOOL Instance name Word variable to be unpacked Number of bit Binary output variable

The assigned bits of the variable at input E are assigned to the binary outputs B0 ... B15. Assignment: Input variable Bit0 B0 Input variable Bit1 B1 . . . . . . Input variable Bit15 B15

The variable to be unpacked is specified at input E. Each bit (bit0 ... bit15) of this input variable is assigned to the assigned output variable (B0 ... Bn-1).

Base_40-Library

142

907 AC 1131/Issued: 02.2001

UNPACKING A WORD INTO BINARY VARIABLES

UNPACK(4,..) S40

Example Declaration: UNPACK_4: UNPACK4; UNPACK_E AT %MW1001.0: INT; UNPACK_B0 AT %MX1.0: BOOL; UNPACK_B1 AT %MX1.1: BOOL; UNPACK_B2 AT %MX1.2: BOOL; UNPACK_B3 AT %MX1.3: BOOL; Translation in ABB IL: !BA 0 UNPACK E #n B0 B1 B2 B3 ABB IL of example: !BA 0 UNPACK M0,0 #4 M1,0 M1,1 M1,2 M1,3

FBD:

Function call in IL CAL LD ST LD ST LD ST LD ST UNPACK_4(E := UNPACK_E, n := 4) UNPACK_4.B0 UNPACK_B0 UNPACK_4.B1 UNPACK_B1 UNPACK_4.B2 UNPACK_B2 UNPACK_4.B3 UNPACK_B3

Function call in ST UNPACK_4 UNPACK_B0 UNPACK_B1 UNPACK_B2 UNPACK_B3 (E := UNPACK_E, n := 4); :=UNPACK_4.B0 :=UNPACK_4.B1 :=UNPACK_4.B2 :=UNPACK_4.B3;

907 AC 1131/Issued: 02.2001

143

Base_S40-Library

UP-DOWN COUNTER

VRZ S40

UP-DOWN COUNTER
This function block is used to count pulses. During counting, the positive edge of the pulse is evaluated in each case. The counter is capable of counting up and down and the counting increment can be specified. It is possible to preset the counter content to an intermediate value.

VRZ S40

Block type Function block with historical values Parameters Instance FREI ZV ZR DIFF SET ZW RESET A VRZ BOOL BOOL BOOL INT BOOL INT BOOL INT Instance name Enabling of the block processing Pulse input, up counting Pulse input, down counting Counter content change per positive edge (increment) Set counter to an intermediate value Intermediate value Reset counter Output for counter content

Description This function block is used to count pulses. During counting, the positive edge of the pulse is evaluated in each case. The counter is capable of counting up and down and the counting increment can be specified. It is possible to preset the counter content to an intermediate value. FREI BOOL DIFF INT

The increment for the counting operation is specified at input DIFF. The increment is the value by which the counter is changed at the input ZV or ZR with each positive edge. SET BOOL By means of a TRUE signal at input SET, the counter content is set to the value specified at input ZW. Counting is blocked as long as a TRUE signal is present at input SET. Setting is also effective when a TRUE signal is present at input FREI. ZW INT The value to which the counter content is set by a TRUE signal at input SET is specified at the input ZW. RESET BOOL A TRUE signal at input RESET sets the counter content to the value 0. The reset input RES has the highest priority of all inputs.

Counting is enabled or disabled by means of the FREI input. The following applies: FREI = FALSE Counting disabled FREI = TRUE Counting enabled ZV BOOL

Each positive edge (FALSE TRUE edge) at the input ZV increases the current counter content by the increment specified at input DIFF. ZR BOOL

Each positive edge (FALSE TRUE edge) at the input ZR decreases the current counter content by the increment specified at input DIFF.

Base_40-Library

144

907 AC 1131/Issued: 02.2001

UP-DOWN COUNTER

VRZ S40

A INT The current counter content is available at output A. If the counter reaches the positive or negative limit of the number range, the counter is limited to this value. The inputs and the output can neither be duplicated nor negated/inverted Example Declaration: VRZ_1 : VRZ; VRZ_FREI AT %MX0.0 : BOOL; VRZ_ZV AT %MX0.1 : BOOL; VRZ_ZR AT %MX0.2 : BOOL; VRZ_DIFF AT %MW1000.0 : INT; VRZ_SET AT %MX0.3 : BOOL; VRZ_ZW AT %MW1000.1 : INT; VRZ_RESET AT %MX0.4 : BOOL; VRZ_A AT %MW1000.2 : INT; FBD: Translation in ABB IL: !BA 0 VRZ RESET DIFF SET ZW FREI ZV ZR A ABB IL of example: !BA 0 VRZ M0,4 MW0,0 M0,3 MW0,1 M0,0 M0,1 MW0,2

Function call in IL CAL VRZ_1(FREI := VRZ_FREI, ZV := VRZ_ZV, ZR := VRZ_ZR, DIFF := VRZ_DIFF, SET := VRZ_SET, ZW := VRZ_ZW, RESET := VRZ_RESET) VRZ_1.A VRZ_A

Function call in ST VRZ_1(FREI := VRZ_FREI, ZV := VRZ_ZV, ZR := VRZ_ZR, DIFF := VRZ_DIFF, SET := VRZ_SET, ZW := VRZ_ZW, RESET := VRZ_RESET); VRZ_A:=VRZ_1.A;

LD ST

907 AC 1131/Issued: 02.2001

145

Base_S40-Library

INTERRUPTION TASK VALIDATION

VTASK S40

INTERRUPTION TASK VALIDATION


Enable or disable (interrupt) task routine.

VTASK S40

Block type Function block without historical values Parameters Instance Ene INTNUM VTASK BOOL INT Instance name Interrupt validation Interrupt number

Description The VTASK function validates the execution of an interruption whose name is specified in NAME variable In function block diagram, the block has the name of the interruption. Example Declaration: VTASK_1 : VTASK; VTASK_EN AT %MX0.0 : BOOL; Translation in ABB IL: !BA 0 VTASK EN #INTNUM ABB IL of example: !BA 0 VTASK M0,0 #1 ... !PE !BA 0 TASK #1 #1 ... RET NOP In instruction list, the function is VTASK with NAME and EN as parameters.

FBD:

(* Programmende *)

Note: The Task for INT 1 must have the name INT1, for INT 2 IN2 and for cycle task 10 INT10_cycle time [ms]

(* Code der Interrupttask *)

Function call in IL CAL VTASK_1(enable := VTASK_enable, N := VTASK_N )

Function call in ST VTASK_1 (enable := VTASK_enable, N := VTASK_N );

Base_40-Library

146

907 AC 1131/Issued: 02.2001

AND COMBINATION, WORD

WAND S40

AND COMBINATION, WORD


This function block generates, bit-by-bit, the AND combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output.

WAND S40

Block type Function Parameters E1 E2 A INT INT INT Operand 1 Operand 2 Result of the AND combination

Description This function block generates, bit-by-bit, the AND combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output. Example Declaration: WAND_E1 AT %MW1000.0 : INT; WAND_E2 AT %MW1000.1 : INT; WAND_A AT %MW1000.2 : INT; Translation in ABB IL: !BA 0 WAND E1 E2 A ABB IL of example: !BA 0 WAND MW0,0 MW0,1 MW0,2 The inputs and outputs can neither be duplicated nor negated.

FBD:

Function call in IL LD WAND_E1 WAND WAND_E2 ST WAND_A

Function call in ST WAND_A := WAND(E1 := WAND_E1, E2 := WAND_E2);

907 AC 1131/Issued: 02.2001

147

Base_S40-Library

WORD TIME CONVERSION

W_TIME S40

WORD TIME CONVERSION


This functions is used to set a TIME value through words. The words values are converted in a double word for timer functions.

W_TIME S40

Block type Function block without historical values Parameters Instance H M SEC MS TIMEE W_TIME INT INT INT INT DINT Instance name Hour value Minute value Second value Millisecond value Time value

Description This functions is used to set a time value through words. The words values are converted in a double word for timer functions. The time value is in millisecond. H Input for the hours. Value range: 0 < H < 273 M Input for the minutes. Value range: 0 < M < 32767 INT INT SEC Input for the seconds. Value range: 0 < SEC < 32767 MS Input for the milliseconds. Value range: 0 < MS < 32767 TIMEE DINT INT INT

Output for the converted time value is in milliseconds. Value range: 0 < TIMEE < 986399999 If one parameter is set to a negative value, the value used for the internal calculation is 0.

Base_40-Library

148

907 AC 1131/Issued: 02.2001

WORD TIME CONVERSION

W_TIME S40

Example Declaration: W_TIME_H AT %MW1000.0 : INT; W_TIME_M AT %MW1000.1 : INT; W_TIME_SEC AT %MW1000.2 : INT; W_TIME_MS AT %MW1000.3 : INT; W_TIME_TIMEE AT %MD2000.0 : DINT; Translation in ABB IL: !BA 0 W_TIME H M SEC MS TIMEE ABB IL of example: !BA 0 W_TIME MW0,0 MW0,1 MW0,2 MW0,3 MD0,0

FBD:

Function call in IL CAL W_TIME1( H := W_TIME_H, M := W_TIME_M, SEC := W_TIME_SEC, MS := W_TIME_MS) W_TIME1.TIMEE W_TIME_TIMEE

Function call in ST W_TIME1 ( H := W_TIME_H, M := W_TIME_M, SEC := W_TIME_SEC, MS := W_TIME_MS); W_TIME_TIMEE := W_TIME1.TIMEE;

LD ST

907 AC 1131/Issued: 02.2001

149

Base_S40-Library

WORD TO DOUBLE WORD CONVERSION

WDW S40

WORD TO DOUBLE WORD CONVERSION


The value of the word operand at input E is converted to a double word variable and the result is assigned to the double word operand at output A.

WDW S40

Block type Function Parameters E A INT DINT Word variable to be converted Result of the conversion, double word variable

Description The value of the word operand at input E is converted to a double word variable and the result is assigned to the double word operand at output A. Value range for E1: 8000H < E1 < 7FFFH -32768 < E1 < 32767 Example Declaration: WDW_E AT %MW1000.0 : INT; WDW_A AT %MD2000.0 : DINT; Translation in ABB IL: !BA 0 WDW E A ABB IL of example: !BA 0 WDW MW0,0 MD0,0 The input and the output can neither be duplicated nor negated.

FBD:

Function call in IL LD WDW ST WDW_E WDW_DW

Function call in ST WDW_DW := WDW(WDW_E);

Base_40-Library

150

907 AC 1131/Issued: 02.2001

READ WORD WITH ENABLING

WOL S40

READ WORD WITH ENABLING


If there is a TRUE signal at input FREI, the value of the specified physical address is read and assigned to the operand at output A.

WOL S40

Block type Function Parameters FREI OFF SEG A Description If there is a TRUE signal at input FREI, the value of the specified physical address is read and assigned to the operand at output A. No reading and no assignment is performed, if there is a FALSE signal at input FREI. The inputs and the output can neither be duplicated nor negated. FREI BOOL OFF INT BOOL INT INT INT Enabling the block Offset address of the memory location Segment address of the memory location Output to which the value read is assigned

The offset address to be read is specified at input OFF. This is specified as 16 bit address. SEG INT

The segment address to be read is specified at input ADRESSE. This is specified as 16 bit address. A INT

Processing of the block is enabled or disabled with the operand at input FREI. The following applies: FREI = FALSE Processing disabled FREI = TRUE Processing enabled

The value read is assigned to the operand at output A.

907 AC 1131/Issued: 02.2001

151

Base_S40-Library

READ WORD WITH ENABLING

WOL S40

Example Declaration: WOL_FREI AT %MX0.0 : BOOL; WOL_A AT %MW1000.0 : INT Translation in ABB IL: !BA 0 WOL FREI OFF SEG ABB IL of example: !BA 0 WOL M0,0 #0 #H197C

FBD:

Function call in IL LD WOL ST WOL_FREI WOL_OFF, WOL_ADR WOL_A

Function call in ST WOL_A := WOL(WOL_FREI, WOL_OFF, WOL_SEG);

Base_40-Library

152

907 AC 1131/Issued: 02.2001

OR COMBINATION, WORD

WOR S40

OR COMBINATION, WORD
This function block generates, bit-by-bit, the OR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output.

WOR S40

Block type Function Parameters E1 E2 A INT INT INT Operand 1 Operand 2 Result of the OR combination

Description This function block generates, bit-by-bit, the OR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output. Example Declaration: WOR_E1 AT %MW1000.0 : INT; WOR_E2 AT %MW1000.1 : INT; WOR_A AT %MW1000.2 : INT; Translation in ABB IL: !BA 0 WOR E1 E2 A ABB IL of example: !BA 0 WOR MW0,0 MW0,1 MW0,2 The inputs and outputs can neither be duplicated nor negated.

FBD:

Function call in IL LD WOR ST WOR_E1 WOR_E2 WOR_A

Function call in ST WOR_A := WOR(E1 := WOR_E1, E2 := WOR_E2);

907 AC 1131/Issued: 02.2001

153

Base_S40-Library

XOR COMBINATION, WORD

WXOR S40

XOR COMBINATION, WORD


This function block generates, bit-by-bit, the XOR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output.

WXOR S40

Block type Function Parameters E1 E2 A INT INT INT Operand 1 Operand 2 Result of the XOR combination

Description This function block generates, bit-by-bit, the XOR combination of the operands present at the inputs E1 and E2. The result is allocated to the operand at the output. Example Declaration: WXOR_E1 AT %MW1000.0 : INT; WXOR_E2 AT %MW1000.1 : INT; WXOR_A AT %MW1000.2 : INT; Translation in ABB IL: !BA 0 WXOR E1 E2 A ABB IL of example: !BA 0 WXOR MW0,0 MW0,1 MW0,2 The inputs and outputs can neither be duplicated nor negated.

FBD:

Function call in IL LD WXOR_E1 WXOR WXOR_E2 ST WXOR_A

Function call in ST WXOR_A := WXOR(E1 := WXOR_E1, E2 := WXOR_E2);

Base_40-Library

154

907 AC 1131/Issued: 02.2001

Glossary
BOOL
Variables of the type BOOL can have the values TRUE and FALSE. For this, 8 bit memory space are reserved.

DINT
DINT belongs to the integer data types. The different numerical types are responsible for a different numerical range. For integer data types the following range limits are valid: Type DINT: Lower limit -2147483648 Upper limit 2147483647 Memory space 32 bit

Due to this, it is possible that information are lost during the conversion of greater data types to smaller data types.

DWORD
DWORD belongs to the integer data types. The different numerical types are responsible for a different numerical range. For integer data types the following range limits are valid: Type DWORD Lower limit 0 Upper limit 4294967295 Memory space 32 bit

Due to this, it is possible that information are lost during the conversion of greater data types to smaller data types.

INT
INT belongs to the integer data types. The different numerical types are responsible for a different numerical range. For integer data types the following range limits are valid: Type INT: Lower limit -32768 Upper limit 32767 Memory space 16 bit

Due to this, it is possible that information are lost during the conversion of greater data types to smaller data types.

907 AC 1131/Issued: 02.2001

155

Base_S40-Library

WORD
WORD belongs to the integer data types. The different numerical types are responsible for a different numerical range. For integer data types the following range limits are valid: Type WORD Lower limit 0 Upper limit 65535 Memory space 16 bit

Due to this, it is possible that information are lost during the conversion of greater data types to smaller data types.

Functions
Functions are subroutines which have multiple input parameters and return exactly one result element. The returned result can be of an elementary or a derived data type. For the same input parameters, functions always return the same result (they do not have an internal memory). Therefore, the following rules can derived: Within functions, global variables can neither be read nor written. Within functions, it is not allowed to read or write absolute operands. Within functions, it is not allowed to call function blocks.

Function blocks
Function blocks are subroutines which can have as much inputs, outputs and internal variables as required. They are called by a program or by another function block. As they can be used several times (with different data records), function blocks (code and interface) can be considered as type. When assigning an individual data record (declaration) to the function block, a function block instance is generated. In contrast to functions, function blocks can contain statically local data which are saved from one call to the next. This allows for example to realize counters which may not forget their counter value. I.e. function blocks can have an internal memory. Functions and function blocks differ in two essential points: A function block has multiple output parameters. A function has maximally one output parameter. Note that the output parameters of functions and function blocks differ syntactically. In contrast to a function, a function block can have an internal memory.

For all ABB function blocks it has to be observed that instance names may not be defined several times if different data sets should be called. Example: Name VRZ1 VRZ2 . Type VRZ VRZ .

Base_40-Library

156

907 AC 1131/Issued: 02.2001

Index
IDLM 72

A
ADDD S40 8 ASV S40 10 AWT S40 12 AWTB S40 13

IDSB 74 IDSM 76 LIZU 78 MOA 80 MOAT 82 MODMAST_B/W 84

B
Base S40 ADDD 8 AWT 12 AWTB 13 BCDDUAL 14 BEG 17 BMELD 19 CONFIO 22 COPY 25 CS31CO 27 CS31QU 35 CTU 37 CTUH 39 DIN 42 DIVD 44 DOUT 46 DRUCK 48 DUALBCD 52 DWAND 54 DWOR 55 DWW 56 DWXOR 57 EMAS 58 ESV 62 FKG 64 I_MINUS 66 I_PLUS 68 IDLB 70

MOK 92 MUL2N 94 MULD 96 MULDI 98 NEGW 100 NPULSE 101 PACK 103 PDM 105 PI 107 PIDT1 112 RS 118 SINIT 119 SQRTD 122 SQRTW 124 SR 126 SUBD 127 TIME_W 129 TOF 131 TON 133 TP 135 UHR 137 UNPACK 142 VRZ 144 VTASK 146 W_TIME 148 WAND 147 WDW 150 WOL 151 WOR 153

907 AC 1131/Issued: 02.2001

157

Base_S40-Library

WXOR 154 BCDDUAL S40 14 BEG S40 17 BMELD S40 19

IDSM S40 76

L
LIZU S40 78

C
CONFIO S40 22 COPY S40 25 CS31CO S40 27 CS31QU S40 35 CTU S40 37 CTUH S40 39

M
MOA S40 80 MOAT S40 82 MODMAST_B/W S40 84 MOK S40 92 MUL2N S40 94 MULD S40 96 MULDI S40 98

D
DIN S40 42 DIVD S40 44 DOUT S40 46 DRUCK S40 48 DUALBCD S40 52 DWAND S40 54 DWOR S40 55 DWW S40 56 DWXOR S40 57

N
NEGW S40 100 NPULSE S40 101

P
PACK S40 103 PDM S40 105 PI S40 107 PIDT1 S40 112

E
EMAS S40 58 ESV S40 62

R
RS S40 118

S F
FKG S40 64 Function blocks 3 Functions 3 SINIT S40 119 SQRTD S40 122 SQRTW S40 124 SR S40 126 SUBD S40 127

I
I_MINUS S40 66 I_PLUS S40 68 IDLB S40 70 IDLM S40 72 IDSB S40 74

T
TIME_W S40 129 TOF S40 131 TON S40 133 TP S40 135

Base_40-Library

158

907 AC 1131/Issued: 02.2001

U
UHR S40 137 UNPACK S40 142

V
VRZ S40 144 VTASK S40 146

W
W_TIME S40 148 WAND S40 147 WDW S40 150 WOL S40 151 WOR S40 153 WXOR S40 154

907 AC 1131/Issued: 02.2001

159

Base_S40-Library

ABB STOTZ-KONTAKT GmbH Eppelheimer Strae 82 Postfach 101680 D-69123 Heidelberg D-69006 Heidelberg Telephone Telefax E-Mail Internet +49 6221 701-0 +49 6221 701-1111 [email protected] http://www.abb.de/sst

ABB Control 10, rue Ampre Z.I. - B.P. 114 F-69685 Chassieu cedex France Telephone +33 (0) 4 7222 1722 Telefax +33 (0) 4 7222 1935 E-mail Internet http://www.abb.com/lowvoltage

You might also like