Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
32 views19 pages

Advanced PLC 1

The document provides an overview of Siemens PLC hardware and software, detailing various data types used in programming such as elementary, complex, and parameter types. It explains the construction of PLCs, including the central processing unit and input/output interface systems, as well as the handling of analog and digital signals. Additionally, it covers the function of analog-to-digital converters (ADCs) and their importance in converting signals for processing within PLC systems.

Uploaded by

Sherif Said
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views19 pages

Advanced PLC 1

The document provides an overview of Siemens PLC hardware and software, detailing various data types used in programming such as elementary, complex, and parameter types. It explains the construction of PLCs, including the central processing unit and input/output interface systems, as well as the handling of analog and digital signals. Additionally, it covers the function of analog-to-digital converters (ADCs) and their importance in converting signals for processing within PLC systems.

Uploaded by

Sherif Said
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

17/08/1444

ADVANCED PLC
Dr. Tamer Fetouh

PLC PLC
Siemens

Hardware Software

1
17/08/1444

Siemens PLC- Hardware

DI: Digital Input


DO: Digital Output
AI: Analog Input
AO: Analog
Output

SM: Signal Module


CP: Communication Module

PS: Power Supply


CPU: Central Processing Unit
IM: Interface Module

Data Types
• Data types are used to specify the size and format of your program’s data
elements.
• For your program to work properly, each instruction must be assigned an
address of the correct data type.
• After data is processed, the output data have a certain data type that can vary
from the data type for the input data.
• If you want the output of one instruction to be the input for another, and the
data types are incompatible, you must insert a data type conversion function
between them.

• There are three categories of data types.


1 - Elementary Data Types (such as: MW, INT, DINT)
2 - Complex Data Types (such as: STRING, ARRAY)
3 - Parameter Types (such as: C1, T1, FC101, DB42)

2
17/08/1444

Data Types
Each elementary data type identifier defines the size and format
of a data element.
1 Bit 1 Byte (8 Bits) 1 Word (2 Bytes) (16 Bits) 2 Words (4 Bytes) (32 Bits)

BOOL BYTE WORD DWORD


CHAR
INT DINT
DATE
S5TIME
REAL
TIME
TOD = Time-of-Day

Data Types

BOOL Data Type


BYTE Data Type
Data Type
BOOL
Length (bits)
1
Data Type
BYTE BYTE
Format
Boolean
Length (bits)
8 8
Examples
TRUE, FALSE
Format
Binary Hexadecimal
Min
0000 0000 00
Max
1111 1111 FF

MSB: Most Significant Bit


LSB: Least Significant Bit

3
17/08/1444

INT Data Type (16-Bit Integers)


• An integer has a sign that indicates whether it is a positive or
negative integer.
• The space that an integer (16 bits) occupies in the memory is one
word.
• The following table shows the range of an integer (16 bits).
Format Range
Integer (16 bits) -32 768 to +32 767
• The following figure shows the integer (+44) as a binary number.

DINT Data Type (32-Bit Integers)

• An integer has a sign that indicates whether it is a positive or negative


integer.
• The space that an integer (32 bits) occupies in the memory is Two
words.
• The following table shows the range of an integer (32 bits).
Format Range
Integer (32 bits) -2 147 483 648 to +2 147 483 647
• The following figure shows the integer (-500000) as a binary number.

4
17/08/1444

WORD & DWORD Data Type

• The binary-coded decimal (BCD) format represents a decimal


number by using groups of binary digits (bits).
• One group of 4 bits represents one digit of a signed decimal
number or the sign of the decimal number.
• The groups of 4 bits are combined to form a word (16 bits) or
double word (32 bits).
• The four most significant bits indicate the sign of the number
(1111 indicates minus and 0000 indicates plus).
• Commands with BCD coded addresses only evaluate the highest-
value bit (15 in word, 31 in double word format).

WORD & DWORD Data Type

• The following table shows the format and range for the two types of
BCD numbers.
Format Range
Word
-999 to +999
(16 bits, three-digits BCD number with sign)
Double word
-9 999 999 to +9 999 999
(32 bits, seven-digits BCD number with sign)

10

5
17/08/1444

WORD & DWORD Data Type

• The following figures provide an example of a binary coded decimal


number in the following formats:

11

REAL Data Type (Floating-Point Numbers)

• Numbers in floating-point format are represented in the general


form "number = m * b to the power of E."
• The base "b" and the exponent "E" are integers; the mantissa "m" is a
rational number.
• The following table shows the range of a Floating-Point Number
(32 bits).

Format Range
Floating-point numbers 3.402 823E+38 to -1.175 495E-38
according to the and 0 and
ANSI/IEEE standard +1.175 495E-38 to +3.402 823E+38
12

6
17/08/1444

Programming tools

13

Programming tools

14

7
17/08/1444

Bit Logic Operations

---( N )--- Negative Edge Detection

Detects a signal change from "1" to "0"

---( P )--- Positive Edge Detection


Detects a signal change from "0" to "1"

1
0 0
positive edge negative edge

15

Bit Logic Operations


---( S ) Set Coil ---( R ) Reset Coil

SR RS
S Q SR Flip-Flop R Q RS Flip-Flop
R S

S R Q R S Q
0 0 NC 0 0 NC
0 1 0 0 1 1
1 0 1 1 0 0
1 1 0 1 1 1

16

8
17/08/1444

PLC Hardware Construction


✓ A programmable controller consists of two basic sections:
1. Central Processing Unit
2. Input/Output Interface System

17

PLC Hardware Construction

18

9
17/08/1444

INPUT / OUTPUT UNITS

• Input signals from sensors and outputs required for


actuating devices can be:

Analog A signal for which the size is related to


the size of the quantity being sensed
I/O Units

Discrete Essentially just an on/off signal

Digital A sequence of pulses

19

INPUT / OUTPUT UNITS

• The CPU, however, must have an input of digital signals of a


particular size, normally 0 to 5 V.
• The output from the CPU is digital, normally 0 to 5 V.
• Thus, there is generally a need to manipulate input and output
signals so that they are in the required form.

INPUT Digital Digital OUTPUT


0-5 volt CPU 0-5 volt
Unit
Unit

20

10
17/08/1444

INPUT / OUTPUT UNITS

• The I/O units of PLCs are designed so that a range of input


signals can be changed into 5 V digital signals and so that
a range of outputs are available to drive external devices.
• It is built-in facility to enable a range of inputs and outputs
to be handled that makes PLCs so easy to use.

21

INPUT / OUTPUT UNITS

• The following is a brief indication of the basic circuits used for input
and output units.

• In the case of rack instruments, they are mounted on cards that


can be plugged into the racks, and so the input/output
characteristics of the PLC can thus be changed by changing the
cards.

• A single box form of PLC has input/output units incorporated by the


manufacturer.

22

11
17/08/1444

INPUT UNITS

• The terms sourcing and sinking refer to the


manner in which DC devices are interfaced
with the PLC.
• For a PLC input unit with sourcing, it is the
source of the current supply for the input
device connected to it (Fig. a).
• With sinking, the input device provides the
current to the input unit (Fig.b).

23

INPUT UNITS

• Figures 4.2 and 4.3 show the basic input unit circuits for DC and AC
inputs.

• Opto-isolators are used to provide protection for the CPU.

• With the AC input unit, a rectifier bridge network is used to rectify the
AC so that the resulting DC signal can provide the signal for use by
the opto-isolator to give the input signals to the CPU of the PLC.
• Individual status lights are provided for each input to indicate when
the input device is providing a signal.
24

12
17/08/1444

INPUT UNITS

25

INPUT UNITS

26

13
17/08/1444

ANALOG INPUT SIGNAL

• When analog signals are inputted to a PLC, the input channel needs to
convert the signal to a digital signal using an analog-to-digital converter
(ADC).
• With a modular system this may be achieved by mounting a suitable
analog input card in the rack.

• One analog card is not required for each


analog input, multiplexing is generally used
(Figure 4.4).

27

ANALOG INPUT SIGNAL

 This involves more than one analog input being connected to the
card and then electronic switches used to select each input in
turn.
 Cards are typically available containing 4, 8, or 16 analog inputs.

28

14
17/08/1444

ANALOG-TO-DIGITAL CONVERTER
(ADC)

• A single analog input signal gives rise to on/off output signals along
perhaps eight separate wires.
• The eight signals then constitute the so-termed digital word
corresponding to the analog input signal level.
• With such an 8-bit converter there are 28 = 256 different digital
values possible; these are 0000 0000 to 1111 1111, that is, 0 to 255.

29

ANALOG-TO-DIGITAL CONVERTER
(ADC)

30

15
17/08/1444

• The digital output goes up in steps (Figure 4.5b) and the analog
voltages required to produce each digital output are termed
quantization levels.
• If the binary output is to change, the analog voltage has to change
by the difference in analog voltage between successive levels.
• The term resolution is used for the smallest change in analog voltage
that will give rise to a change in 1 bit in the digital output.
• With an 8-bit ADC, if, say, the full-scale analog input signal varies
between 0 and 10 V, a step of one digital bit involves an analog
input change of 10/255 V or about 0.04 V.
• This means that a change of 0.03 V in the input will produce no
change in the digital output.
31

 The following illustrates the


A/D conversion for an 8-bit
converter when the analog
input is in the range 0 to 10 V:

32

16
17/08/1444

• The number of bits in the output from an ADC thus


determines the resolution, and hence accuracy, that is
possible.
• In general, the resolution of an n-bit ADC is:

𝒇𝒖𝒍𝒍 − 𝒔𝒄𝒂𝒍𝒆 𝒂𝒏𝒂𝒍𝒐𝒈 𝒊𝒏𝒑𝒖𝒕 𝒗𝒐𝒍𝒕𝒂𝒈𝒆


𝒓𝒆𝒔𝒐𝒍𝒖𝒕𝒊𝒐𝒏 =
(𝟐𝒏 − 𝟏)

33

Example 1
For a 10-bits ADC with a full-scale input voltage varies between 0 ~ 10
V, find:
1. The ADC resolution
2. The digital output equivalent to input signal of 6.5 volt.
3. Find the input voltage required to produce (1100101001) at
the output

34

17
17/08/1444

Example 1
- The ADC resolution
n = 10 bits
𝒇𝒖𝒍𝒍 𝒔𝒄𝒂𝒍𝒆 𝟏𝟎 𝟏𝟎
𝑹𝒆𝒔𝒐𝒍𝒖𝒕𝒊𝒐𝒏 = = = = 𝟎. 𝟎𝟎𝟗𝟖
𝟐𝒏 −𝟏 𝟐𝟏𝟎 −𝟏 𝟏𝟎𝟐𝟑
- The digital output equivalent to input signal of 6.5 volt.
Y = 6.5 * 1023/10 = 664.95 ≈ 665
Digital input = (1010011001)2
- Find the input voltage required to produce (1100101001) at the output.
(1100101001)2 = (809)10
Input voltage = 809* 10/1023 = 7.9 volt

35

ANALOG-TO-DIGITAL CONVERTER
(ADC)
 To illustrate this idea, consider a thermocouple used as a sensor with a
PLC and giving an output of 0.5 mV per oC.
 What will be the accuracy with which the PLC will activate the output
device if the thermocouple is connected to an analog input with a range
of 0 to 10 V DC and using a 10-bit analog-to-digital converter?
 With a 10-bit converter, there are 210 =1024 bits covering the 0 to 10 V
range.
 Thus a change of 1 bit corresponds to 10/1023 V or about 0.01 V, that is,
10 mV.
 Hence, the accuracy with which the PLC recognizes the input from the
thermocouple is ± 5 mV or ± 10 oC.

36

18
17/08/1444

ANALOG-TO-DIGITAL CONVERTER
(ADC)

 Conversion from analog to digital takes time.


 In addition, the use of a multiplexer means that an analog input
card of a PLC only takes “snapshot” samples of input signals.
 For most industrial systems, signals from a plant rarely vary so
fast that this presents a problem.
 Conversion times are typically a few milliseconds.

37

19

You might also like