Sie sind auf Seite 1von 128

1 Introduction ABT

1.1 Introduction

Our age is often referred to as the “age of automation”. That means it is characterized by machines and
devices that do their work automatically, often integrated in very complex industrial processes and systems.
Sequences of work which some decades ago still had to be carried out in tedious manual work nowadays
can be done by machines in an efficient way and at a constant high quality level.

1
1 Introduction ABT

1.2 History II

The industrial development began when it became possible to provide the energy required for technological
processes, particularly for driving machines, i.e., when it became possible to mechanizethe processes. The
steam engine by James Watt (1769) and the dynamoelectric principle (Werner von Siemens 1867) for
generating electrical power and converting it back into motive power by means of an electric motor were
pioneering inventions in this context.

2
1 Introduction ABT

1.3 Basic functions of automation

In colloquial language, the term automation means the introduction of automated sequences of work into
processes (in most cases technological processes), for example, in car industry or process engineering. The
basic functions of automation are controlling and monitoring a process (e.g. based on a process visualization
system).

3
1 Introduction ABT

1.4 Controlling production processes

Monitoring and controlling production processes is a typical application example of automation technology.
The video on the right shows as an example a system which inserts tiny electronic components into printed
circuit boards. The speed at which the components are inserted into the corresponding holes is so high that
the human eye can hardly follow what is going on.

4
1 Introduction ABT

1.5 From the relay to the PLC

Controlling tasks used to be performed by hard-wired relay control systems 1 . However, nowadays
programmable logic controllers 2 (PLC 3 ) are well established standard devices for automation purposes. In
PLCs, the functionality to be executed is implemented as a software so that, in contrast to relay control,
changes and extensions can be introduced without changing components or the wiring.

1
Relay control

Plant control on the basis of electrical and electronic relays. The control logic is simulated by the mutual
wiring of the relays.
2
Programmable logic controller

Electronic control that - according to a user-written program - scans signals and states of machines,
processes these data and outputs them for the purpose of controlling the machines.
3
PLC

Abbreviation of programmable logic controller

5
1 Introduction ABT

1.6 Check your knowledge

Check whether you have understood the material which has just been imparted by means of the task set on
the right.

Check your knowledge

Which are the advantages of a PLC compared with a hard-wired control system?

More flexibility

Higher performance

More cost-effective in simple applications

No programming skills required

6
1 Introduction ABT

1.7 Bus systems

In recent years, there has been a trend towards hierarchically structured communications systems in
automation technology. The backbone of these communication systems is given by standardized open bus
systems 1 such as the Ethernet TCP/IP known from office communication or the PROFIBUS-DP 2 which is
part of the material of this course. In most cases, the exchange of process signals between actuators or
sensors and the process control takes place cyclically according to the master-slave principle 3.

1
Bus system

All stations that are connected physically via a bus cable form a bus system.
2
http://www.profibus.com
3
Master-slave

Bus access procedure where always one station is the master and all other stations are slaves. In a
communications network, a master is a device that is able to initiate communications. A station that is not
able to initiate communications is called a slave.

7
1 Introduction ABT

1.8 Overall view of the course

This course, “Bus and Automation Technology”, focusses on programmable controllers 1 (PLC), how to
program them and how to combine them with decentralized periphery 2 (in particular, sensors and actuators)
via bus systems. Because of its paramount importance for automation technology, PROFIBUS 3 will play a
central role throughout the course. The opposite diagram gives you an overall view of how the course
contents are structured.

1
Automation system (AS)

also programmable controller (PC); modular system for solving automation tasks; comprehensive
spectrum of modules, which can be put together according to particular requirements (different power
supply modules, CPUs of various performance levels, digital and analog periphery modules,
communications processors and functional modules).
2
Decentralized periphery

Input/output devices that are not directly integrated in the central control unit of the PLC, but that are
addressed in a decentralized way via the bus cable.
3
PROFIBUS

PROcess Field BUS, European process and fieldbus standard, which is laid down in the PROFIBUS
standard (EN 50 170, Volume 2, PROFIBUS). PROFIBUS works with three different protocols:
PROFIBUS-DP (decentralized periphery), PROFIBUS-FMS (fieldbus message specification) and
PROFIBUS-PA (process automation).

8
2 The COM3LAB-Board ABT ABT

2.1 The COM3LAB-Board ABT

The central components of the COM3LAB 1-Board "Bus and Automation Technology" are a PROFIBUS
master 2 and two slaves 3 with variable address assignment. The master has PLC functionality and can be
programmed according to the PLC standard IEC EN 61 131-3 out of this course. The slaves have both
analog and digital inputs and outputs, which can be used for measured-value acquisition and for driving
actuators. Two actuators (motor and incandescent lamp) are directly attached to the board.

1
com3lab.hlp
2
DP master

The DP master of a PROFIBUS network is allowed to send data to other stations in the network and to
require data from them if it has the token.
3
DP slave

The DP slave is only allowed to exchange data in the PROFIBUS network if it has received the
corresponding request from the master.

9
2 The COM3LAB-Board ABT ABT

2.2 Installing the board

In order that the subsequent experiments can be carried out successfully, first of all the COM3LAB board has
to be installed. In this procedure, the PROFIBUS components (master and slaves) are configured so that
they can later on be addressed from the control program by their correct addresses. At this stage it is not yet
necessary to understand all details. The theory required is explained in more advanced chapters of this
course.

10
3 Components of the programmable controller ABT

3.1 Components of the programmable controller

A distinction is made between two types of programmable controllers: compact devices and modular
systems. Compact devices such as the LOGO! 1family are particularly suited for simple tasks; they contain all
necessary components within a small volume and can often be configured and programmed via operator
buttons at the device and an integrated display without a personal computer being required. In the opposite
pictures compact devices of the market leaders Siemens 2 and Mitsubishi 3

1
LOGOManual.pdf
2
http://www.ad.siemens.com
3
http

11
3 Components of the programmable controller ABT

3.2 Modular PCs

For more complex tasks, modular automation systems 1 , which are more flexible, are usually employed. They
consist of modules that can be combined with each other in an almost arbitrary way. In most cases, these
modules are arranged on a mounting rail and connected to one another via a backplane bus. A “minimum
configuration” of an individual control consists of a power supply, a central processing unit 2 (CPU) and digital
input and/or output modules.

1
Automation system (AS)

also programmable controller (PC); modular system for solving automation tasks; comprehensive
spectrum of modules, which can be put together according to particular requirements (different power
supply modules, CPUs of various performance levels, digital and analog periphery modules,
communications processors and functional modules).
2
Central controller module

Core of a PLC, where the program is stored and processed. The central controller module contains the
processor, memory modules, mode switches, a back-up battery, a connection for 24 V DC, LEDs for
status and error display, an interface for a programming unit.

12
3 Components of the programmable controller ABT

3.3 The central processing unit (CPU)

The central processing unit (CPU) is the central module of a PLC. It is responsible for program execution.
Usually PLC manufacturers supply CPUs with different performance for different tasks. At the front of the
module, there is a mode selector switch for setting the desired operating mode 1 of the programmable
controller manually. An internal back-up battery makes sure that the program is saved when the mains
voltage is switched off or fails.

1
Operating modes (of a PLC’s CPU)

RUN-P: user-written program is being executed; access to the user-written program possible via PC/PG;
RUN: user-written program is being executed; access not possible;
STOP: user-written program is not executed;
MRES: overall reset

13
3 Components of the programmable controller ABT

3.4 Digital signal modules

In most cases, digital input/output modules comprise 8, 16 or 32 bit 1 inputs or outputs, respectively, which
can be addressed in the user-written program by bits, bytes, words or double words. Thus they are suited for
processing binary signals 2 (e.g. switches) and digital signals (e.g. setters for digits). Usually they are
available for both 24 V DC and 120/230 V AC. The definition of the permissible voltage levels for the signal
states "0"- and "1", respectively, is vendor-independent.

1
Bit

Abbreviation of binary digit. Smallest unit in information technology, corresponds to a storage location. A
bit can either assume the value 0 or 1.
2
Signal

(Physical) representation of messages or data. A distinction is made between analog and digital/binary
signals. The latter can only assume the values "0" or "1". Internally, the programmable controller
processes digital signals.

14
3 Components of the programmable controller ABT

3.5 Analog signal modules

Analog input modules convert analog signals coming from the process into digital signals for internal
processing. Voltage and current sensors, thermocouples and resistors are examples of devices that can be
connected to an analog input. In most cases, the modules have parametrizable resolution, several measuring
ranges and interrupt capability. Analog output modules convert digital signals from the PC 1 into analog
signals for the process. Their resolution is, e.g., 12 to 15 bits.

1
PC

Programmable controller

15
3 Components of the programmable controller ABT

3.6 Check your knowledge

Check whether you have understood the material which has just been imparted by means of the task set on
the right.

Check your knowledge

Which components are always present in a modular PLC that works as an operational individual
control?

Power supply

Central processing unit (CPU)

Analog or digital input and/or output module

16
3 Components of the programmable controller ABT

3.7 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

A distinction is made between two types of programmable controllers (PCs): compact devices and
modular systems.
For complex tasks, usually modular programmable controllers are employed.
Modular programmable controllers consist of a CPU with power supply, digital and, in many cases,
analog signal modules.
The digital inputs and outputs can be addressed by bits, bytes, words and double words.

17
4 Address assignment of inputs and outputs ABT

4.1 Address assignment of inputs and outputs

In order that the individual inputs and outputs of the programmable controller and thus the connected sensors
and actuators can be addressed unambiguously from the user-written program, every input and every output
is marked by its address 1 . Depending on the type of input or output such addresses can be specified by bits,
bytes, words or double words.

1
Address

Value that specifies the location in the user memory where a piece of information is to be stored or read,
or which device is to be addressed in an input or output operation. In most cases, the address has two
parts, which are separated by a dot. On the left-hand side of the dot, the byte address is written, on the
right-hand side the bit address.

18
4 Address assignment of inputs and outputs ABT

4.2 Bit and byte addresses

Every input byte (IB) and output byte (QB) obtains an unambiguous byte address, which depends on the
module location (start address of the module) and the position of the byte (i.e. the corresponding eight
signals) on the respective module (offset). Individual inputs and outputs are marked by the associated byte
address and the position of the bit within the byte. As a module can have up to 32 binary inputs/outputs, the
start address is raised by the value four for every module.

19
4 Address assignment of inputs and outputs ABT

4.3 Word and double-word addresses

By joining two input or output bytes, a word address is generated (IW or QW, respectively) with 16 bits length.
The word address is determined by the address of the first (left) byte (example: IW10 = IB10 + IB11). Four
bytes or two words make up a double-word address (ID or QD, respectively) with 32 bits length. In the case
of double words, too, the double word address is determined by the address of the leftmost byte (example:
ID12 = IB12 + IB13 + IB14 + IB15).

20
4 Address assignment of inputs and outputs ABT

4.4 Symbolic addresses

In most programmable controllers, the assignment of a module address to a module location is fixed ("fixed
address assignment 1"). Instead of accessing certain inputs or outputs of via the corresponding bit, byte word
or double-word address (absolute address), there is also the possibility of using symbolic addresses in the
user-written program. The corresponding absolute addresses are assigned to the symbolic addresses in an
assignment list (symbol table 2).

1
Address assignment

Specification of an address in programming. Fixed address assignment: an address assignment is fixed if


the addresses cannot be selected, i.e. the address is determined by its slot. Symbolic address
assignment: instead of addresses, names (symbols) are used that are laid down in an assignment list.
Variable address assignment: if the address of a module is parametrizable.
2
Symbol table

Table with the assignment of symbolic names to absolute addresses and blocks; for a symbol the
absolute address and the data type has to be specified. Comments are optional.

21
4 Address assignment of inputs and outputs ABT

4.5 Address assignment according to IEC 61131-3

The naming of absolute addresses described up to now corresponds to that of the widely used programming
language STEP 7 for the Siemens Simatic family. However, in what follows, naming according to the
standard Norm IEC 61131-3, which will be explained in detail later, will be used. Following this standard,
inputs are named "I..." and outputs "Q...", whereby an “X” is always appended in the case of bit addresses.
An overview is given in the opposite table.

22
4 Address assignment of inputs and outputs ABT

4.6 Check your knowledge

Check whether you have understood the material which has just been imparted by means of the task set on
the right.

Check your knowledge

What does the address QB3 refer to?

An input address

An output address

A bit address

A byte address

A word address

23
4 Address assignment of inputs and outputs ABT

4.7 Address assignment of the board components

When a program is written for the COM3LAB-Board "Bus Technology", the inputs and outputs of the two
slaves of the board can be addressed the same way as “normal” central PLC components although they
communicate with the PLC master via the PROFIBUS (this will be explained in detail in subsequent
chapters). In the opposite overview of the board you find all required addresses of the digital and analog
inputs and outputs of the two slaves.

24
4 Address assignment of inputs and outputs ABT

4.8 The STL editor

This course provides a powerful editor for writing control programs in the form of a statement list 1 (STL).
Statement lists are explained later in the course. The editor has an integrated syntax check, which checks
whether the syntax of the entered code is correct before the code is transmitted to the board PLC. Moreover
it enables control programs to be stored and loaded.

1
STL (Statement List)

Programming language in the form of individual statement lines; assembler-like language close to
machine level

25
4 Address assignment of inputs and outputs ABT

4.9 Experiment

In the following experiment, a simple demo program will be written, where two binary signals are combined,
first with absolute and then with symbolic address assignment. As programming the programmable controller
will only be introduced in chapter 6, the source text of the program is provided here. It has simply to be
entered into the COM3LAB STL editor and then transferred to the experiment board.

26
4 Address assignment of inputs and outputs ABT

4.10 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

Each input and output of a PLC is marked by an unambiguous address.


Depending on the type of input or output, the address is given by bits, by bytes, by words or by double
words.
In order to make reading a PLC program easier, symbolic addresses (e.g. ‘SWITCH_S1’) can be used
instead of absolute addresses.
All specifications regarding address assignment are defined by the “PLC standard” IEC 61131-3.

27
5 The PLC standard IEC 61131 ABT

5.1 Overview

The international standard IEC 1 61131 aims at a worldwide, vendor-independent standardization in the field
of programmable logic controllers. It has been adopted as a European and German standard (DIN 2 EN
61131). Part 3 of the standard (IEC 61131-3), which defines the items of PLC programming languages and a
language-independent common set of language elements and programming rules, is of particular
importance.

Components of the standard IEC 61131

General definitions and functional characteristics of a PLC


Electrical, mechanical and functional requirements to be met by a PLC
Programming languages of a PLC
Guidelines for PLC users in different phases of a project
Standard modules for the communication between PLCs of different manufacturers

1
IEC

International Electrotechnical Commission


2
DIN

Deutsches Institut für Normung (German Standards Institution)

28
5 The PLC standard IEC 61131 ABT

5.2 Overview of programming languages

According to IEC 61131-3, five programming languages are available for generating user-written programs by
means of a programming software. Two of these languages (STL, ST) are text-oriented languages, and two
of them are graphics-oriented (LAD, FBD). The higher-level sequential function chart (SFC) contains both
graphics and text elements. In this course, emphasis is laid on the Statement list (STL) because it can be
used to program the board PLC.

29
5 The PLC standard IEC 61131 ABT

5.3 Application example

To illustrate the different ways of programming, FBD, LAD and STL will be compared in a simple example. A
control for the lighting system H in a lecture hall is to be designed. The lighting, which is meant to be an aid
for making notes, is only be on if the main light switch S1 is switched off, the room darkening (blinds, switch
S2) is on and switch S3 for the lighting is switched on as well.

30
5 The PLC standard IEC 61131 ABT

5.4 Function block diagram

In the function block diagram (FBD) representation, the user-written program is displayed as a logic diagram
in a form familiar from logic algebra. Here the individual functions are represented by interconnected boxes
with function-specific symbols. The signal inputs (measured quantities, sensors) are on the left, whereas the
signal outputs (manipulated variables, actuators) are on the right.

31
5 The PLC standard IEC 61131 ABT

5.5 Ladder diagram

The ladder diagram (LAD) representation is immediately derived from the circuit diagram. In the ladder
diagram, contacts correspond to the switches in the circuit diagram, and the output variables are represented
as stylized coils. Functions that go beyond the basic logic operations are introduced as boxes with the
corresponding symbols for characterizing the function as in the function block diagram.

32
5 The PLC standard IEC 61131 ABT

5.6 Statement list

In the statement list (STL) representation, even functions can be programmed that are not easily realized
graphically in a function block diagram or in a ladder diagram. Similarly to a conventional procedure-oriented
programming language such as assembler or Pascal, the program to be run is written in the statement list
line by line, each line containing a simple control statement (absolute address assignment on the right). The
control statements are processed by the CPU one after another.

33
5 The PLC standard IEC 61131 ABT

5.7 Experiment

In the following experiment the example of the “lighting system for taking notes” will be implemented on the
COM3LAB PLC. According to the symbol table specified on the previous pages, the sliding-dolly switches of
slave 1 are used as inputs and one of the digital outputs of slave 1 as output.

34
5 The PLC standard IEC 61131 ABT

5.8 Example: warning light

In conclusion, the representations according to IEC 61131-3 are compared once more by means of another
example. A control for the warning light of an electrical machine will be designed. The control is to make the
warning light shine if the speed of the machine is too high or if the machine temperature exceeds a maximum
value. In the diagram, output Q 0.1 is the warning light. The speed is measured at input I 0.0 and the
temperature at input I 0.1. If the speed or the temperature is too high, input I 0.0 or input I 0.1, respectively, is
set to logical one.

35
5 The PLC standard IEC 61131 ABT

5.9 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

The international standard IEC 61131 provides a vendor-independent standardization in the field of
programmable logic controllers.
The most important PLC programming languages are Statement List (STL), Ladder Diagram (LAD) and
Function Block Diagram (FBD).
Ladder Diagram and Function Block Diagram are graphics-oriented languages, whereas Statement List
is text-oriented.
Statement List is the most flexible way of programming a PLC, however, it takes more time to get
familiar with than the other languages.

36
6 Processing numbers and programs ABT

6.1 Processing numbers and programs

It is the purpose of the control program to acquire the data coming from a plant, to process these data in a
certain way and, if necessary, to return the resulting manipulated variables to the plant. In the user-written
program, the data are represented by variables , i.e. memory locations to which a name has been assigned
and which can be changed during the execution time, if necessary. Depending on the type of data (e.g. digital
or analog), different data types are used.

37
6 Processing numbers and programs ABT

6.2 Task

In order to check your knowledge, compare some of the basic data types just discussed with regard to the
memory they occupy.

38
6 Processing numbers and programs ABT

6.3 Structure of a control statement

The control program is usually written in lines, whereby a line is the smallest unit of the control program
containing a single control statement 1 . First of all, each control statement consists of an operator 2 which
specifies the operation to be executed ("What has to be done?"). Most operators - but not all - are followed by
an operand 3, which is subject to the operation. Usually this operand consists of an operand identifier and the
operand parameter.

1
Control statement

Smallest unit of a control program, consists of an operation part and an operand part.
2
Operation part

Part of a control statement that determines what has to be executed.


3
Operand part

Part of a control statement that, via the corresponding address, determines which memory area the
statement of the operation part refers to.

39
6 Processing numbers and programs ABT

6.4 Program cycle

The user-written program is always executed cyclically by the programmable controller. At the beginning of
each cycle, the current states of all inputs are read into the so-called process input image (PII 1). After
execution of the user-written program, the process output image (POI 2) is transmitted to the real outputs. The
user-written program always accesses the process image, but never the real inputs and outputs.

1
PII

Process input image. During program execution, the signal states of all inputs are loaded into the memory
of the CPU, i.e. they are imaged there.
2
POI

Process output image. While the user-written program is executed, a process image of the outputs is
created in the memory of the CPU. From there the signals are transferred to the output modules when
the program cycle has been finished.

40
6 Processing numbers and programs ABT

6.5 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

The variables of a PLC program can have different data types. BOOL, BYTE, WORD, DWORD, INT,
DINT and REAL are important types.
A control program in the form of a statement list is made up of single control statements, which are
arranged line by line.
The control program is executed by the PLC cyclically. After execution of the last statement, the next
cycle starts.
The control program uses the process input and process output image as an “temporary memory” for
the input and output values.

41
7 Basic binary operations ABT

7.1 Basic binary operations

The signal value of the output variable of an AND operation 1 is “1” if and only if all input variables have the
signal value “1”. That means, the AND operation combines binary input variables into a binary output
variable. Example: an electrical machine runs only if the protective screen is closed AND if the START key is
pressed.

In the function block diagram, the AND operation is represented by the symbol "&".

1
AND operation

The result of the AND operation is the signal state "1" if and only if all operands that are scanned render
the scan result "1".

42
7 Basic binary operations ABT

7.2 OR operation

The signal value of the output variable of an OR operation 1 is “1” if and only if at least one of the input
variables has the signal value "1". Example: a machine is supposed to send a message to the control room if
the oil temperature exceeds a maximum value, a maximum permissible operating time has been reached or
the emergency stop switch is pressed.

In the function block diagram, the OR operation is represented by the symbol "≥1".

1
OR operation

The result of the OR operation is the signal state "1" if at least one of the operands that are scanned has
the signal state "1".

43
7 Basic binary operations ABT

7.3 Exclusive OR operation

The signal value of the output variable of an exclusive OR operation 1 acting on two input variables is “1” if
and only if one and only one of the two input variables has the signal value "1". Example: in a two-way circuit
for a room lighting with two switching points, the lighting can be switched on and off alternately by each of the
two switches.

In the function block diagram, the exclusive OR operation is represented by the symbol "=1".

1
XOR operation

The result of the XOR operation (exclusive OR operation) is the signal state "1" if one and only one of the
operands that are scanned has the signal state "1". An alternative term is "exclusive OR operation".

44
7 Basic binary operations ABT

7.4 Negation

The negation inverts the signal value of a variable, i.e., the output of an inverter block takes the value “1” if
the input value is “0” and vice versa. Example: a light barrier is arranged for a drill control in a way that the
drill is just between the light transmitter and the light detector. The release signal for drilling is only given if the
drill is intact, i.e. if the light barrier is interrupted and, correspondingly, the light detector carries the signal
value "0".

45
7 Basic binary operations ABT

7.5 Result of logic operation

The result of logic operation 1 (RLO) is a status bit in the CPU, which is changed by binary operations such as
AND, OR, etc. The RLO (as well as some other operations) is scanned via the assignment '='. The statement
following this assignment is called first input bit scan it deletes the old RLO and immediately takes the result
of the scan as the new RLO. It is also possible to set the RLO to “1” or “0” immediately by means of the
operations SET or CLR, respectively.

1
Result of logic operation (RLO)

The result of logic operation (RLO) is temporarily stored in the RLO bit of the status word and used in
binary signal processing. Many operations are executed in dependence on the RLO.

46
7 Basic binary operations ABT

7.6 Negation of logic operations

By negating, the signal value of a logic operation can be inverted, too. For an AND operation this leads to the
NAND operation shown on the right, and in the case of an OR operation it results in a NOR operation. In the
statement list, this is achieved by the keyword “NOT”, which causes the current result of logic operation to be
inverted.

47
7 Basic binary operations ABT

7.7 Example: stirred-tank reactor

The safety valve V2 of a stirred-tank reactor has to be opened (output Q logical zero) if the reaction
temperature is too high (sensor S1 logical zero) or if the tank pressure exceeds a maximum value (sensor S2
logical zero) or if a certain desired concentration is reached (sensor S3 logical one) or if the feed valve is
open (sensor S4 logical zero). The opening of the valve is to be indicated by a warning light (output H logical
one).

48
7 Basic binary operations ABT

7.8 Combined logic operations

In complex user-written programs, not just the pure basic operations AND, OR, XOR and NOT do occur, but
the processing code for the binary signals is made up of more or less complicated combinations of the basic
operations. If necessary, the order of processing can be determined by brackets in the statement list, as it is
customary in boolean algebra 1.

1
Boolean algebra

Named after the English mathematician George Boole; operates with two values only: TRUE and FALSE.
In programming, the data type BOOL refers to a bit, whose signal state is “1” or “0”(“TRUE” or “FALSE”).

49
7 Basic binary operations ABT

7.9 Example: load of a supply system

Four machines with different power consumption (6 kW, 4 kW, 3 kW, 1 kW), which can independently be
switched on and off, are connected to a supply system. the state of each machine is indicated by a pilot lamp.
As soon as the total power consumption exceeds 10 kW, this is to be indicated by an overload warning light.
The control program is to be realized exclusively by means of basic logic operations.

50
7 Basic binary operations ABT

7.10 Markers

Markers 1 are used for temporary storage of results and for giving the control program a clear structure. They
are globally valid in the program and can usually be accessed (i.e. read and written) by bits, by bytes, by
words and by double words like inputs and outputs. The letter symbol for markers is ‘M’ (e.g. M 1.4 for bit 4 of
the marker byte 1 or MB 3 for the marker byte 3). The COM3LAB PLC has eight 8-bit markers (MB0 ... MB7).

1
Marker

Temporary storage for results of logic operations and other temporary results; can be addressed via an
absolute address whose first character is an "M".

51
7 Basic binary operations ABT

7.11 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

The PLC can use the basic binary logic operations AND, OR, XOR and NOT.
The result of the most recent logic operation is stored in the result of logic operation (RLO), which is a
status bit of the CPU.
Complex operations can be built up from the basic logic operations.
Markers can be used for temporary storage of results.

52
8 Memory functions ABT

8.1 Memory functions

The purpose of flipflops is durable storage of a signal state that occurs at an input for a short time only (e.g.
caused by pressing a pushbutton). For this a flipflop has an additional “internal” state Q, which is set to “1” by
a signal value “1” at the set input S and reset to “0” by a signal value “1” at the reset input R. If “0” is applied
to both inputs, the output retains its current value.

53
8 Memory functions ABT

8.2 SR and RS flipflops

If the signal state “1” is applied to both inputs, the output is set in the case of an RS flipflop and reset (i.e. set
to “0”) in the case of an SR flipflop. In the statement list, an output or a marker is set and reset by means of
the operators S and R. The type of flipflop (RS or SR) is determined by the order of the operations.

54
8 Memory functions ABT

8.3 Example: storage basin

The water level of a rainwater catchment is controlled via two float switches S1 and S2. The two switches
each supply a “1” signal as long as they are covered with water, otherwise a “0” signal. As soon as the water
level reaches float switch S2, the discharge valve V1 is to be opened (output Q set to “1”) and remain open
until the basin has completely drained (switch S1 provides a “0” signal). Then the valve is to be closed again
until the basin has been refilled.

55
8 Memory functions ABT

8.4 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

For the purpose of storing signal states that only occur over short time intervals, flipflops are used.
Flipflops have a set input (S) and a reset input (R).
Depending on the behaviour at R = S = "1", a distinction is made between RS and SR flipflops.
In the statement list, flipflops are implemented with the operators 'S' and 'R'.

56
9 Timer and counter operations ABT

9.1 Timer and counter operations

The purpose of timer functions is the coordination of time sequences. They enable, for example, pulses of a
fixed duration, ON and OFF delays as well as time measurements to be implemented. Timer functions can
be programmed in all representations (FBD, LAD, STL). The standard IEC 61131-3 provides for three
standard blocks for timing generation. Apart from that, manufacturers of automation systems usually supply a
number of vendor-specific supplements and extensions.

57
9 Timer and counter operations ABT

9.2 ON delay

The timer function “ON delay” effects a delay by an interval TW in the jump of a "0" → "1" edge at the start
input S before it is applied to output Q. The signal is only relayed to the output if the level is still applied to the
start input when the interval TW is over. The COM3LAB board PLC has eight timers (T0 ... T7), which can be
used for implementing an ON delay: They operate at a fixed time base of 100 ms so that delay times of 0.1 to
25.5 s can be implemented.

58
9 Timer and counter operations ABT

9.3 Example: escalator

An escalator is to start 3 s after the start pushbutton has been pressed (driving motor M1 runs). If S1 is
pressed again during operation, this shall have no effect. If either the stop pushbutton or the emergency stop
button is pressed, the escalator is to stop immediately (driving motor M1 stands still). The corresponding
control program is to be implemented by means of basic logic operations, flipflops and timer functions.

59
9 Timer and counter operations ABT

9.4 Counter operations

For counting pulses (e.g. in order to measure quantities or frequencies), the automation system has a
number of edge-triggered counters, which usually can count up and down. The counter value derives from
the number of positive edges (i.e. signal changes "0" → "1") at the inputs for up or down counters,
respectively. The counter value can be initiated or set to 0 via set and reset inputs. The COM3LAB board
PLC has eight 8-bit counters (C0 ... C7).

60
9 Timer and counter operations ABT

9.5 Example: car park

There are 5 parking places in a small car park. Every time a car enters or leaves the car park, two light
barriers at the entrance and exit of the car park generate a pulse. At the entrance of the car park a green light
indicates whether places are available. If all places are occupied this is indicated by a red light. In addition, a
digital display indicates the number of free places. In the case of an error, the display can be reset by means
of a reset pushbutton.

61
9 Timer and counter operations ABT

9.6 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

On the basis of timers, the PLC provides the possibility of coordinating time sequences.
Timers can be used, e.g., for generating pulses, for ON/OFF delay or for time measurements.
For counting operations, counters are available, which can be used, for example, for frequency
measurements.
Counters are edge triggered and can be set to count up or down.

62
10 Edge evaluation ABT

10.1 Edge evaluation

Often it is necessary to detect positive or negative edges of a signal (changes "0" → "1" or "1" → "0",
respectively). For this purpose edge detectors can be used. On a change of a signal they generate a pulse,
which usually has the length of a program cycle. For an edge to be detected the current signal state has to be
compared with the previous one. Therefore a marker is required to store the old value. In most cases, edge
detection is provided by the PC 1 as a ready-made function.

1
PC

Programmable controller

63
10 Edge evaluation ABT

10.2 Example: traffic census

On occasion of a traffic census, all vehicles that pass a side street in the direction A are to be counted. For
detecting the direction, two light barriers are used, whose sensors S1 and S2 change from level “1” to level
“0” when the respective light beam is interrupted. The counting mechanism can be reset by means of a reset
pushbutton. The corresponding control program is to be implemented using basic logic operations, a counter
and an edge detector.

64
11 Controlling program execution ABT

11.1 Controlling program execution

Sometimes it is necessary to give up linear program execution and to execute alternative program branches.
Within a program module (“block”), this can take place, e.g., via jump functions that make the program
execution continue at another place. The execution of program branching can be conditional or unconditional.
Instead of the jump function, loops can be introduced.
As jump instructions are not used very frequently, only the jump instruction BEC is implemented in the
COM3LAB board PLC.

65
11 Controlling program execution ABT

11.2 Example: display switchover

Depending on a changeover switch, either the state of the group of switches A1, A2, A3 (if S = “0”) or the
state of the group of switches B1, B2, B3 (if S = "1") is to be indicated by the three LEDs LED 1, LED 2 and
LED 3 in a control room. The corresponding control program is to be implemented by means of a jump
instruction.

66
12 Digital operations ABT

12.1 Digital operations

The PC has two accumulators 1 , (accumulator 1 2 and accumulator 2 3 ), which have a width of 8 bits in the
case of the COM3LAB PLC. Accumulators serve as general-purpose registers for processing values (e.g. for
arithmetic operations). A value can be loaded into accumulator 1 by means of the loading operation, whereby
the current content of accumulator 1 is shifted into accumulator 2. By means of the transfer operation ‘T’, the
content of accumulator 1 can be copied, e.g. to an output or marker byte. The content of the two
accumulators is retained in this case.

1
Accumulator

Accumulators are general-purpose registers of the CPU. They are necessary for temporary storage in
loading, transfer, timer, counter, arithmetic, comparing and converting operations. At first the accumulator
contains the operand. After execution of the operation it contains the result.
2
Accumulator 1

Accumulators are general-purpose registers of the CPU. They are necessary for temporary storage in
loading, transfer, timer, counter, arithmetic, comparing and converting operations. The COM3LAB board
PLC has two 8-bit accumulators, which are called accumulator 1 and accumulator 2. In loading
operations, first the current content of accumulator 1 is shifted into accumulator 2, then the new value is
loaded into accumulator 1. Transfer operations always refer exclusively to accumulator 1.
3
Accumulator 2

Accumulators are general-purpose registers of the CPU. They are necessary for temporary storage in
loading, transfer, timer, counter, arithmetic, comparing and converting operations. The COM3LAB board
PLC has two 8-bit accumulators, which are called accumulator 1 and accumulator 2. In loading operation,
first the current content of accumulator 1 is shifted into accumulator 2, then the new value is loaded into
accumulator 1. Transfer operations always refer exclusively to accumulator 1.

67
12 Digital operations ABT

12.2 Comparison operations

By means of comparison operations, the values of two operands of equal type (in the case of the COM3LAB
PLC always byte operands) can be compared. The result of the comparison is available as a boolean value in
the result of logic operation (RLO). The comparison itself takes place regardless of the current RLO. The
operands have to be in accumulator 1 (operand 2) and accumulator 2 (operand 1). The contents of the
accumulators are not changed by the comparison operation.

68
12 Digital operations ABT

12.3 Example: one-armed bandit

An example of the application of comparison operations is given by the control program of a so-called “one-
armed bandit”. After each game it has to be checked whether the symbol combination (position of the rolls)
coincides with one of the possible winning patterns. If this is the case, the corresponding amount has to be
paid or credited to the player’s account.

69
12 Digital operations ABT

12.4 Example: access code

At a cash dispenser, the access to client data or dispensation of cash shall only be possible after an eight-
digit binary code has been entered correctly. As long as the code has not yet been entered or if a wrong code
has been entered, a red light lights up. When the correct code has been entered, a green light shines (and
the desired options are available).

Remark: here the PIN code is determined at random when the page is called.

70
12 Digital operations ABT

12.5 Arithmetic operations

The execution of the fundamental operations of arithmetic ADD, SUB, MUL and DIV and the modulo
operation MOD, which are applied to operands of the same type, is also based on the two accumulators. Like
the comparison operations, all these operations are executed regardless of the RLO. After the operation, its
result is contained in accumulator 1.

Remark: The COM3LAB PLC supports addition (+I) and subtraction (-I).

71
12 Digital operations ABT

12.6 Shift and rotate operations

By means of shift and rotate operations, the bit pattern of a variable can be shifted to the left or to the right by
a certain number of digit positions. In the case of a shift operation, the positions left behind the bit pattern are
set to 0. All operations take place in accumulator 1. The corresponding STL instructions have an operand 1
indicating by how many binary positions the pattern is shifted or rotated.

1
Operand part

Part of a control statement that, via the corresponding address, determines which memory area the
statement of the operation part refers to.

72
12 Digital operations ABT

12.7 Example: neon advertising signs

For neon signs on a building a running light consisting of eight LEDs is to be implemented, whereby a bit
pattern M, which can be preselected arbitrarily, rotates to the left at a frequency of 1 Hz. When the
pushbutton S is pressed, the pattern is taken into the running light. In the experiment, the pulse generator IG
for the clocking is to be implemented by means of the COM3LAB function generator. The pattern is
preselected via sliding-dolly switches.

73
12 Digital operations ABT

12.8 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

All digital operations are based on two accumulators, accumulator 1 and accumulator 2.
Data can be loaded into the accumulators by means of loading operations and passed on via transfer
operations.
Comparison and arithmetic operations compare or combine the contents of the accumulators.
The content of accumulator 1 can be manipulated bit by bit via shift and rotate operations.

74
13 Analog value processing ABT

13.1 Analog value processing

If analog signals (e.g. currents or voltages) are to be processed, this requires analog input modules and
analog output modules, respectively. As the programmable controller can only process digital quantities
internally, an analog input module converts the analog value into a digital one by means of an A/D converter.
On the other hand, an analog output module converts a digital value supplied by the CPU into an analog
value by means of a D/A converter before it is output.

75
13 Analog value processing ABT

13.2 Analog inputs of the COM3LAB board

The COM3LAB PLC has eight 8-bit analog inputs for the acquisition of electrical and non-electrical quantities.
They are located in the fields ‘Analog In’ of slave 1 and are marked CH7 ... CH0. The inputs are addressed
from the statement list via the input byte IB1. It is possible to change over between the channels via a
multiplexer, which is set via the output bits Q1.6 ... Q1.4.

76
13 Analog value processing ABT

13.3 Resolution and measuring range

The conversion of the analog value into the digital value depends on the range of values and on the
resolution of the A/D converter. Most manufacturers have the digital value represented in the two’s
complement. If, e.g., the range of values is -10 V ... +10 V at a resolution of 8 bits, the analog value is
digitalized in steps of 20 V / 2 8 = 78.125 mV. The digital value derives from the analog value U AE. It is

77
13 Analog value processing ABT

13.4 Example: battery indicator

A battery indicator continuously monitors the voltage of a battery. As long as the voltage is higher than 8.5 V,
a green light indicates that the voltage level is sufficient. If the battery voltage drops below 8.5 V, a red
warning lamp will shine instead.

Remark: the threshold value of 8.5 V, which is not usual in common practice, is chosen here because the
function generator of the COM3LAB can generate a maximum of 10 V DC.

78
13 Analog value processing ABT

13.5 Processing several analog values

If several analog inputs (e.g. CH0 and CH1) are to be processed at the same time within a control program, a
trick has to be applied because in each program cycle only a single analog input can be connected to the
input byte IB1 via the multiplexer. A marker bit, for example, can be used as a “toggle bit” so that alternately
one of the two channels to be processed is read during each program cycle.

79
13 Analog value processing ABT

13.6 Example: comparator

Comparators are often used for comparing two voltages at high precision. In analog technology, comparators
can be set up by operating an operational amplifier as a difference amplifier which, depending on the two
applied voltages, switches the output either to the maximum or the minimum output voltage. In this
experiment, such a comparator will be set up using the board PLC.

80
13 Analog value processing ABT

13.7 Example: fan control

Temperatures are usually converted into electric voltages by temperature dependent resistors or
thermocouples. In this experiment, the fan control of a PC will be studied. As long as the temperature U T
supplied by the temperature sensor is below 8 V, none of the two fans will be running. If the voltage exceeds
this value, fan V1 starts. If the voltage exceeds 9 V, fan V2 is also switched on for additional cooling.

81
13 Analog value processing ABT

13.8 Example: luminosity measurement

In order to measure luminosity, a photosensor will be used which, depending on the luminosity, supplies an
electric voltage U L between 0 V (minimum luminosity) and 10 V (maximum luminosity). For displaying the
measured luminosity, an LED line consisting of eight LEDs is used. The measuring voltage is to be converted
linearly into the number of LEDs that are switched on. The system can be switched on and off via a switch S.

82
13 Analog value processing ABT

13.9 Analog outputs of the COM3LAB board

Slave 2 of the COM3LAB board ABT has two analog outputs with an output voltage of 0 ... 10 V at a
maximum output current of 100 mA. Both outputs share the output byte QB3 thus having a resolution of 4 bits
each. The outputs are connected to 2-mm sockets and can also be operated in bridge connection, whereby
the range of the output voltage is enhanced to -10 V ... +10 V.

83
13 Analog value processing ABT

13.10 Calculation of the output voltage

As the width of the analog outputs is only four bits, only digital values between 0 and 15 can be represented.
The conversion of a digital value into the associated output voltage between 0 V and 10 V is obtained
according to the formula quoted on the previous page. Because of the narrow bit width, the resolution of the
output voltage is 10 V / (2 4 - 1) = 0.66 V in this case.

84
13 Analog value processing ABT

13.11 Example: dimmer

An incandescent lamp H can be switched on and off via a switch S. If the lamp is switched on, a control
voltage U S is employed to control its brightness between minimum brightness (U S = 0 V) and maximum
brightness (U S = 1.3 V).

Hint: use the COM3LAB function generator to set the control, and connect the incandescent lamp on the
board to the analog output CH0.

85
13 Analog value processing ABT

13.12 Example: motor control

Two switches S1 and S2 are employed to control the sense of rotation of a motor. If the two switches are
both switched on or off, the motor is to be at rest. If S1 is switched on and S2 is switched off, the motor is to
be running clockwise at maximum speed, and if S1 is switched off and S2 is switched on, it is to be running
anti-clockwise at maximum speed.

Hint: operate the motor in bridge-connection at the two analog outputs CH0 and CH1.

86
13 Analog value processing ABT

13.13 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

For processing analog signals or manipulated variables, the PLC needs analog modules.
Non-electric quantities have to be converted into suitable voltage or current levels before they can be
processed.
As the PLC can only process digital values internally, the modules perform conversions by means of
A/D and D/A converters.
Important characteristics of analog modules are the measuring or manipulating range and the resolution
(e.g. 14 bits).

87
14 Bus systems in automation technology ABT

14.1 Bus systems in automation technology

In recent years, a development has taken place in automation technology that is characterized by an
increasing use of communication systems in conjunction with a decentralization of the control periphery. The
backbone of communications is formed by networks 1 in the sense of coupled, standardized and open bus
systems. At the level of automation (process and field communication), the PROFIBUS-DP 2 is of increasing
importance.

1
Network

System consisting of several computers and peripherals which makes it easier to exchange data and to
use the peripherals jointly. Prerequisites are an interconnected hardware, an operating system with
network capability and a network software.
2
PROFIBUS

PROcess Field BUS, European process and fieldbus standard, which is laid down in the PROFIBUS
standard (EN 50 170, Volume 2, PROFIBUS). PROFIBUS works with three different protocols:
PROFIBUS-DP (decentralized periphery), PROFIBUS-FMS (fieldbus message specification) and
PROFIBUS-PA (process automation).

88
14 Bus systems in automation technology ABT

14.2 PROFIBUS-DP

PROFIBUS stands for Process Field Bus and is a field bus system that has been standardized since 1996. It
works according to the master-slave principle and is available in three variants (PROFIBUS-DP, PROFIBUS-
FMS, PROFIBUS-PA). The variant PROFIBUS-DP (Decentralized Periphery), which is most frequently used,
is optimized for quick data exchange and efficiency and makes possible cost-efficient solutions. The
input/output modules (DP slaves 1) distributed in the field in a decentralized manner and are organized by the
DP master 2 .

1
DP slave

The DP slave is only allowed to exchange data in the PROFIBUS network if it has received the
corresponding request from the master.
2
DP master

The DP master of a PROFIBUS network is allowed to send data to other stations in the network and to
require data from them if it has the token.

89
14 Bus systems in automation technology ABT

14.3 INTERBUS

The INTERBUS was especially designed by Phoenix Contact 1 for use in machine systems and fast
processes. Therefore this field bus system is mainly applied in production automation at the area control level
and as a field bus in the process environment for connecting high-grade sensors and actuators. The
requirements for using the INTERBUS in standard PLC applications and industry PCs are relatively easy to
meet.

1
http://www.phoenixcontact.com

90
14 Bus systems in automation technology ABT

14.4 AS-i bus

AS-i is the abbreviation of Actuator-Sensor-Interface and represents a bus system for the lowest field level. It
is supported by a great number of manufacturers. Actuators and sensors are mostly simple bus components
which require and supply bit signals and which are necessary for the operation of a plant process. Technical
data and transmission protocols of the AS-i bus are laid down in the standard EN 50 295.

91
14 Bus systems in automation technology ABT

14.5 AS-i-topology and lines

AS-i networks can be set up in linear, star and tree topology, and they can consist of up to 31 stations at a
maximum cycle time of 5 ms. In most cases, data transfer is made via an unshielded, untwisted two-wire flat
cable (yellow), whose particular geometry ensures that the installation is protected against polarity reversal.
For transmitting the auxiliary power, also an unshielded, black two-wire cable is used.

92
14 Bus systems in automation technology ABT

14.6 Industrial Ethernet

At the communications levels, Ethernet TCP/IP 1 is a globally tested and accepted standard for local area
networks (LANs 2) in the sphere of offices with access to ISDN and the Internet. The bit rate of 10 Mbit/s or
100 Mbit/s (Fast Ethernet) makes possible fast data exchange between the stations. The term "Industrial
Ethernet" refers to an Ethernet TCP/IP network that is used at the cell level and is adapted to the more
difficult operating conditions.

1
TCP/IP

Abbreviation of Transmission Control Protocol/Internet Protocol.


2
LAN

Abbreviation of Local Area Network

93
14 Bus systems in automation technology ABT

14.7 instabus EIB

Some time ago, a number of manufacturers developed the installation bus instabus EIB 1
(www.eiba.com) 2which is especially designed for building system automation. The instabus EIB is particularly
suited for the demand-oriented and process-dependent control of lighting, heating, air conditioning and
ventilation, e.g. in residential buildings. Appropriate interfaces enable, for example, a connection to the
PROFIBUS to be implemented, thus providing a link between production and building system automation.

1
EIB

Abbreviation of European Installation Bus or Electrical Installation Bus


2
http://www.eiba.com

94
14 Bus systems in automation technology ABT

14.8 Check your knowledge

Check whether you have understood the material which has just been imparted by means of the task set on
the right.

Check your knowledge

Which of the following bus systems are used at the field level?

AS-Interface

PROFIBUS

Ethernet TCP/IP

Installation bus EIB

95
15 PROFIBUS transmission technology ABT

15.1 PROFIBUS transmission technology

PROFIBUS stations are connected to each other via a symmetric pair cable (data lines A and B) according to
the standard RS 485 (half duplex 1). In data transmission, the line B is stipulated to be the original line
(DATA+) and the line B the inverted data line (DATA-). The logic signal level “1” is given when the potential of
line B is positive with respect to line A, whereas a negative potential of line B with respect to line A means
signal level “0”.

1
Half-duplex transmission

In half-duplex transmission, both stations can send and receive, but not at the same time.

96
15 PROFIBUS transmission technology ABT

15.2 Signals of the data lines

PROFIBUS-DP stations exchange data in the NRZ code 1 (Non Return To Zero). Therefore the signal shape
of a binary "0" or "1" does not change for the duration of a bit. According to the UART 2standard (Universal
Asynchronous Receiver and Transmitter), a transmitted character consists of eleven bits: a start bit (0), eight
data bits, a bit for even parity 3 and a stop bit (1). The voltage between the two lines for "0" and "1" level
should be greater than 1.5 V on the transmitter side and greater than 0.2 V on the receiver side.

1
NRZ code

Stands for Non Return to Zero. In the case of the NRZ code, the signal level does not change for the
duration of a bit, but remains constant (e. g. HIGH level for logical "1", LOW level for logical "0"). A
change in level can only occur when the bit changes.
2
UART

Universal asynchronous receiver/transmitter. An interface for the serial/parallel conversion and for
temporary storage of data and addition of check bits.
3
Parity

Even parity: the sum of ones in a byte has to be an even number. Odd parity: the sum of ones in a byte
has to be an odd number. By means of a parity bit a one or zero is added so that the corresponding parity
is achieved.

97
15 PROFIBUS transmission technology ABT

15.3 Experiment

In the following experiment, the signals on the two PROFIBUS data lines A and B (DATA-and DATA+) of the
COM3LAB board 700 31 BUS TECHNOLOGY will be studied. This can be done be means of the COM3LAB
oscilloscope. First the input signals and then the differential signal A-B will be recorded.

Remark: for carrying out the experiment, the COM3LAB board PLC should be in the mode 'PLC off'

98
15 PROFIBUS transmission technology ABT

15.4 Result

It is clearly seen that the connection is symmetric as the signal on the data line A is just the inverted signal of
data line B. The amplitude of the two signals is about 3 V. The differential signal A - B corresponds to the
potential difference between the two data lines. Therefore its peak-to-peak value is about 6 V.

99
16 Structure of PROFIBUS frames ABT

16.1 Structure of PROFIBUS frames

A PROFIBUS frame consists of a sequence of UART characters, whose meaning within the frame is
determined by the PROFIBUS protocol 1 . The frame comprises the frame header (which, among other
things, contains the start delimiter (SD)), the user data, a security byte (checksum 2) and the end delimiter
(ED). There are four different types of frames, which are distinguished by means of the start delimiter.

1
Protocol

A set of conventions that define the format and the timing of data transmission between communicating
devices.
2
Checksum

A method of error detection, where a sum of bits in a sequence of data bytes is generated and afterwards
used for checking changes in the data. Checksums are frequently used in communication programs for
detecting transmission errors.

100
16 Structure of PROFIBUS frames ABT

16.2 The protocol analyzer

The PROFIBUS protocol analyzer of the COM3LAB course “Automation and Bus Technology” enables all
frames sent by the stations to be analyzed comprehensively. The marking of the different fields of a frame by
different colours and the possibility of filtering frames that have already been displayed make it possible to
quickly identify and analyze the frames.

101
16 Structure of PROFIBUS frames ABT

16.3 Structure of the function code

The function code FC in the frame header distinguishes between request frames (frame = 1) and
acknowledge frames (frame = 0) and between first frames and repeated frames. If, for example, an active
station requests the status of a station via an SD1 frame (Request_FDL_Status), then FC = 49 (hex) in the
request frame. In the response frame, the bits 4 and 5 contain the station type of the addressed station
according to the opposite table.

102
16 Structure of PROFIBUS frames ABT

16.4 Initialization phase

During the initialization phase of the PROFIBUS system, the master has to exchange a number of frames
with the slaves in a particular order to be able to exchange user data with a slave later on. The purpose of
these frames is the parametrization of the slaves (SET_PRM), the configuration of the slaves (GET_CFG)
and the diagnostics request (SLAVE_DIAG) to make sure that the initialization phase has been finished
correctly. All frames are distinguished by their SAPs.

103
16 Structure of PROFIBUS frames ABT

16.5 Data exchange

After the initialization phase, which basically comprises the parametrization and configuration of the slaves,
the state of the slaves changes into "Data_Exch", i.e., they are now ready to exchange user data with the
master. In this data exchange mode, a default SAP (service access point) is used in the frame header so that
the fields SSAP and DSAP are dropped. The master sends the output data to a slave and, in return, receives
the input data if there are any.

104
16 Structure of PROFIBUS frames ABT

16.6 Summary

The list on the right gives a survey of the most important items dealt with in this chapter.

Summary of this chapter

In this chapter you have learnt:

Communication between PROFIBUS components takes place via so-called “frames”.


A frame is a sequence of UART characters between a start delimiter (SD) and an end delimiter (ED).
There are different types of frames. They are distinguished by different start delimiters.
The service access point (SAP) carries information about which data are requested.
The user data (e.g. input/output values of the slaves) are located in the part of the frame called data
unit.

105
17 Commissioning the PROFIBUS and trouble shooting ABT

17.1 Commissioning the PROFIBUS and trouble shooting

For a PROFIBUS system, project planning basically consists of configuring the participating hardware
components. In STEP 7, this comprises configuring the S7 PLC station, setting up the DP master system and
configuring the DP slave system. Particular attention has to be paid to the correct assignment of the
PROFIBUS addresses. The characteristics of a DP device are described in the associated GSD file 1 x.

1
GSD

Device data base file (German: Geräte-Stamm-Daten); electronic device data sheet, which describes the
characteristics unambiguously and completely in an exactly defined format.

106
17 Commissioning the PROFIBUS and trouble shooting ABT

17.2 GSD file

GSD files are ASCII files and, therefore, can be written using an ASCII editor. Every line of the file begins with
one of the standardized PROFIBUS keywords, which can be supplemented by vendor-specific keywords.
Every GSD file begins with the keyword #Profibus_DP. On the right hand side you can see the GSD file for
the Profi-CASSY Interface to be explained later.

107
17 Commissioning the PROFIBUS and trouble shooting ABT

17.3 Ident number

The keyword Ident_Number indicates the device type of the DP device. Every device is characterized by an
unambiguous ident number, which is conferred by the PROFIBUS User Organization. The ident number is a
reference to the GSD file and thus to the technical data of the device. Data exchange with a device is only
possible if the DP master identifies the device with its ident number during system initialization
(parametrization frame).

108
17 Commissioning the PROFIBUS and trouble shooting ABT

17.4 Experiment

In the case of the COM3LAB-Board-PLC, no GSD files are required because only selected slaves can be
used, whose characteristics are known. However, the choice of the master and slave addresses has an
effect on the assignment of input and output addresses. This will be demonstrated in the following
experiment.

109
17 Commissioning the PROFIBUS and trouble shooting ABT

17.5 Fault simulation I

In the following experiment, a typical fault scenario is used to illustrate trouble shooting in a PROFIBUS
system. For this a simple control program is written and started. Then a fault is simulated by changing over a
relay within the COM3LAB master unit. The fault is to be located by means of appropriate COM3LAB
instruments (oscilloscope, multimeter, PROFIBUS analyzer...).

110
17 Commissioning the PROFIBUS and trouble shooting ABT

17.6 Fault simulation II

In the following experiment, trouble shooting in a PROFIBUS system will be practised once more by means of
another fault scenario. Again a simple control program is written and started. The fault scenario is simulated
internally in COM3LAB by changing over a relay within the COM3LAB master unit. The fault is to be located
as in the previous experiment.

111
18 Experiments with external components ABT

18.1 Experiments with external components

The goal of a closed-loop control is to influence the output variable of the controlled system 1 (controlled
variable 2 x) by appropriately selecting a manipulated variable y in a way that it follows the reference input
variable 3 w as quickly and exactly as possible. This is achieved by continuously comparing the controlled
variable and the reference input variable with each other in a comparing element and, if a error signal 4 e
occurs, counteracting via the controller by means of the manipulated variable 5 y so that the control variable
approaches the reference input variable.

1
Controlled system

The controlled system is the part of the system or the corresponding part of the block diagram that is to
be influenced according to the set task.
2
Controlled variable

The controlled variable is the variable of a controlled system that is measured.


3
Reference input variable

The reference input variable (setpoint) of a control is a variable that is not influenced by the respective
control, but is supplied to the open or closed control loop from outside. The output variable of the control
has to follow the reference input variable according to a defined dependence.
4
Error signal

The error signal is the difference between the reference input value and the controlled variable.
5
Manipulated variable

112
18 Experiments with external components ABT

The manipulated variable is the output variable of the controller and, at the same time, the input variable
of the controlled system.

113
18 Experiments with external components ABT

18.2 Room temperature control

Keeping the room temperature at a constant value, e.g. 18° C, is a typical example of fixed setpoint control.
Here the goal consists in making the actual temperature (controlled variable, actual value) equal the desired
value (reference input variable, setpoint) as exactly as possible, regardless of external influences (e.g.
outside temperature) and disturbances (e.g. opening a window or lighting a fireplace).

114
18 Experiments with external components ABT

18.3 Two-step control

In the following experiment, a two-step controller for the temperature control system of the COM3LAB-board
700 82 CONTROL TECHNOLOGY will be implemented. The controller is to drive the system at the maximum
value of the manipulated variable (10 V) if the actual value is below the setpoint, otherwise at 0 V. The
setpoint (e.g. 6 V) is supplied via the function generator to the analog input CH7; the actual value is read via
the analog input CH4. The manipulated variable is output via the analog output CH0.

115
18 Experiments with external components ABT

18.4 Three-step control

In order to improve the control behaviour, you can implement a so-called split-range control using a three-
step controller, which does not just have the two operating points “Heating” and “No heating”, but a third
operating point “Cooling” in addition. The characteristic of this three-step controller can be represented as a
two-step characteristic with the values of the manipulated variable y max (heating) and y min (cooling) and a
dead band of the width 2 ∆ where there is neither heating nor cooling.

116
18 Experiments with external components ABT

18.5 Experiment: three-step controller

In the following experiment, a three-step controller with adjustable dead band will be implemented instead of
the two-step controller previously investigated. In the operating mode “Heating”, the heating is driven at 10 V
via CH0 (CH1 = 0 V), whereas in the operating mode “Cooling”, the fan is driven at 10 V via CH1 (CH0 =
0 V). The half width ∆ of the dead band can be adjusted via the sliding-dolly switches 0.2, 0.1 and 0.0 of slave
1 in the range of digital values between 0 and 7 (corresponding to approx. 0 and 0.5 V).

117
18 Experiments with external components ABT

18.6 DANFOSS frequency converter

The DANFOSS frequency converter 735 313 has a PROFIBUS interface and thus can be driven from the
COM3LAB board 700 31 as an external slave. It can then be used, for instance, for driving a motor (e.g. of
the type 732 104). Within the PROFIBUS control panel, the correct station address (namely 1) has to be
assigned to the frequency converter for the purpose of configuration. When the address has been assigned,
the frequency converter is displayed in the monitoring window with its address ID (0404).

118
18 Experiments with external components ABT

18.7 Control word for the frequency converter

In order to initialize the frequency converter, you have to write a special control word at the beginning of the
control program into the addresses QB 4 (High Byte) and QB 5 (Low Byte) in accordance with the
PROFIDRIVE specification. This control word has to activate the ramp stop and to mark the data as being
valid. Detailed hints regarding the meaning of the individual control word bits are found in the related PDF
documentation 1 pages 22 ff.

1
mg90a102.pdf

119
18 Experiments with external components ABT

18.8 Experiment: frequency converter

In the following experiment, the speed setpoint of the frequency converter motor will be controlled via an
analog input of slave 1. The analog input is selected via the switches 0.2 ... 0.0 of slave 1, and the motor is
started via switch 0.7. For speed control, the read analog value has to be transferred to QB 6 and QB 7 has
to be set to 0. The motor is started by setting the bit Q 5.6. For the purpose of monitoring, the setpoint and
the actual value of the speed are displayed on LED lines.

120
18 Experiments with external components ABT

18.9 Profi-CASSY

The new Profi-CASSY Interface, too, has a PROFIBUS interface and can thus be used as a slave on the
COM3LAB board 700 31. It has both digital and analog inputs and outputs (12 bit resolution) and is
connected to the board via a 9-pole sub D connector. The PROFIBUS station address can be set via the
configuration software. The interface can be connected to a PC via a USB port. Sensor-CASSYs and Power-
CASSYs can be connected via the CASSY bus.

121
18 Experiments with external components ABT

18.10 Configuration of the Profi-CASSY

For configuring the Profi-CASSY, it has first to be connected to the COM3LAB via a 9-pole PROFIBUS cable.
Then the desired PROFIBUS station address has to be set in the Profi-CASSY by means of the configuration
software supplied with the Profi-CASSY if this has not been done yet. Finally this station address has to be
transferred to the COM3LAB.

122
18 Experiments with external components ABT

18.11 Address assignment for the Profi-CASSY

The opposite diagram shows the address assignment for the inputs and outputs of the Profi-CASSY. The 16
digital inputs are addressed from the control program via the input bytes IB 4 and IB 5, whereas the digital
outputs are addressed via the output bytes QB 4 and QB 5. The analog inputs and outputs of the Profi-
CASSY can be connected directly to the inputs and output of the board.

123
18 Experiments with external components ABT

18.12 Profi-CASSY and software process models I

The Profi-CASSY can also be used for controlling the software process models (e.g. "Temperature control "
or "Filling machine"). The connection between the software process models and the Profi-CASSY is
established via the USB interface.

Experiment instructions and tasks are enclosed with the respective software process models.

List Process Simulation, 1 Universal Display Simulation, 2 Motor Control Simulation, 3 Traffic Light System 4 and
Temperature Control Simulation 5

1
728802.pdf
2
728822.pdf
3
728832.pdf
4
728842.pdf
5
728862.pdf

124
18 Experiments with external components ABT

18.13 Profi-CASSY and software process models II

For the software process model “filling machine” shown on the right, a sample statement list is available,
which demonstrates the control of the plant model via the board PLC and the Profi-CASSY. You can have a
look at the statement list after clicking the button.

Experiment instructions and tasks are enclosed with the software model.

125
Contents ABT

1 Introduction
1.1 Introduction 1
1.2 History II 2
1.3 Basic functions of automation 3
1.4 Controlling production processes 4
1.5 From the relay to the PLC 5
1.6 Check your knowledge 6
1.7 Bus systems 7
1.8 Overall view of the course 8

2 The COM3LAB-Board ABT


2.1 The COM3LAB-Board ABT 9
2.2 Installing the board 10

3 Components of the programmable controller


3.1 Components of the programmable controller 11
3.2 Modular PCs 12
3.3 The central processing unit (CPU) 13
3.4 Digital signal modules 14
3.5 Analog signal modules 15
3.6 Check your knowledge 16
3.7 Summary 17

4 Address assignment of inputs and outputs


4.1 Address assignment of inputs and outputs 18
4.2 Bit and byte addresses 19
4.3 Word and double-word addresses 20
4.4 Symbolic addresses 21
4.5 Address assignment according to IEC 61131-3 22
4.6 Check your knowledge 23
4.7 Address assignment of the board components 24
4.8 The STL editor 25
4.9 Experiment 26
4.10 Summary 27

5 The PLC standard IEC 61131


5.1 Overview 28
5.2 Overview of programming languages 29
5.3 Application example 30
5.4 Function block diagram 31
5.5 Ladder diagram 32
5.6 Statement list 33
5.7 Experiment 34
5.8 Example: warning light 35
5.9 Summary 36

6 Processing numbers and programs


6.1 Processing numbers and programs 37
6.2 Task 38
6.3 Structure of a control statement 39
6.4 Program cycle 40
6.5 Summary 41

7 Basic binary operations


7.1 Basic binary operations 42
7.2 OR operation 43
7.3 Exclusive OR operation 44
7.4 Negation 45
7.5 Result of logic operation 46
7.6 Negation of logic operations 47

126
Contents ABT

7.7 Example: stirred-tank reactor 48


7.8 Combined logic operations 49
7.9 Example: load of a supply system 50
7.10 Markers 51
7.11 Summary 52

8 Memory functions
8.1 Memory functions 53
8.2 SR and RS flipflops 54
8.3 Example: storage basin 55
8.4 Summary 56

9 Timer and counter operations


9.1 Timer and counter operations 57
9.2 ON delay 58
9.3 Example: escalator 59
9.4 Counter operations 60
9.5 Example: car park 61
9.6 Summary 62

10 Edge evaluation
10.1 Edge evaluation 63
10.2 Example: traffic census 64

11 Controlling program execution


11.1 Controlling program execution 65
11.2 Example: display switchover 66

12 Digital operations
12.1 Digital operations 67
12.2 Comparison operations 68
12.3 Example: one-armed bandit 69
12.4 Example: access code 70
12.5 Arithmetic operations 71
12.6 Shift and rotate operations 72
12.7 Example: neon advertising signs 73
12.8 Summary 74

13 Analog value processing


13.1 Analog value processing 75
13.2 Analog inputs of the COM3LAB board 76
13.3 Resolution and measuring range 77
13.4 Example: battery indicator 78
13.5 Processing several analog values 79
13.6 Example: comparator 80
13.7 Example: fan control 81
13.8 Example: luminosity measurement 82
13.9 Analog outputs of the COM3LAB board 83
13.10 Calculation of the output voltage 84
13.11 Example: dimmer 85
13.12 Example: motor control 86
13.13 Summary 87

14 Bus systems in automation technology


14.1 Bus systems in automation technology 88
14.2 PROFIBUS-DP 89
14.3 INTERBUS 90
14.4 AS-i bus 91
14.5 AS-i-topology and lines 92
14.6 Industrial Ethernet 93

127
Contents ABT

14.7 instabus EIB 94


14.8 Check your knowledge 95

15 PROFIBUS transmission technology


15.1 PROFIBUS transmission technology 96
15.2 Signals of the data lines 97
15.3 Experiment 98
15.4 Result 99

16 Structure of PROFIBUS frames


16.1 Structure of PROFIBUS frames 100
16.2 The protocol analyzer 101
16.3 Structure of the function code 102
16.4 Initialization phase 103
16.5 Data exchange 104
16.6 Summary 105

17 Commissioning the PROFIBUS and trouble shooting


17.1 Commissioning the PROFIBUS and trouble shooting 106
17.2 GSD file 107
17.3 Ident number 108
17.4 Experiment 109
17.5 Fault simulation I 110
17.6 Fault simulation II 111

18 Experiments with external components


18.1 Experiments with external components 112
18.2 Room temperature control 114
18.3 Two-step control 115
18.4 Three-step control 116
18.5 Experiment: three-step controller 117
18.6 DANFOSS frequency converter 118
18.7 Control word for the frequency converter 119
18.8 Experiment: frequency converter 120
18.9 Profi-CASSY 121
18.10 Configuration of the Profi-CASSY 122
18.11 Address assignment for the Profi-CASSY 123
18.12 Profi-CASSY and software process models I 124
18.13 Profi-CASSY and software process models II 125

128

Das könnte Ihnen auch gefallen