4. PLC S7-1200

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

S7-1200 PLC Hardware

Nguyễn Tấn Đời


S7-1200 Overview

 It provides the flexibility and power to control a wide variety of devices in


support of your automation needs.
 The CPU combines a microprocessor, an integrated power supply, input
and output circuits, built-in PROFINET, high-speed motion control I/O, and
on-board analog inputs in a compact one.
 The CPU provides a PROFINET port for communication over a PROFINET
network.
 Additional modules: are available for communicating over PROFIBUS, GPRS,
RS485 or RS232 networks.
Components of CPU
CPU Models
Expansion Capability of The CPU

 The S7-1200 family provides a


variety of modules and plug-in
boards for expanding the
capabilities of the CPU with
additional I/O or other
communication protocols.
SB Modules

The CPU supports one plug-in


expansion board:
 A signal board (SB) provides
additional I/O for your CPU. The SB
connects on the front of the CPU.
 A communication board (CB) allows
you to add another communication
port to your CPU.
 A battery board (BB) allows you to
provide long term backup of the
realtime clock.
SM Modules

Signal modules (SMs) add additional


functionality to the CPU. SMs
connect to the right side of the CPU.
 Digital I/O
 Analog I/O
 RTD and thermocouple
CM and CP Modules

Communication modules (CMs) add


communication options to the CPU such
as PROFIBUS or RS232 / RS485, or the
AS-i master.
Communications processors (CPs)
provides capabilities for other types of
communication, such as to connect the
CPU over a GPRS network.
 The CPU supports up to 3 CMs or CPs
 Each CM or CP connects to the
 left side of the CPU (or to the
 left side of another CM or CP)
Operating modes of the CPU
 The CPU has three modes of operation: STOP mode, STARTUP mode, and
RUN mode.
 Status LEDs on the front of the CPU indicate the current mode of operation.
 In STOP mode, the CPU is not executing the program. You can download a
project.
 In STARTUP mode, the startup OBs (if present) are executed once. Interrupt
events are not processed during the startup mode.
 In RUN mode, the program cycle OBs are executed repeatedly. Interrupt events
can occur and be processed at any point within the RUN mode. Some parts of a
project can be downloaded in RUN mode
Memory Areas
 Global memory: the CPU provides a variety of specialized memory areas,
including inputs (I), outputs (Q) and bit memory (M).
 PLC tag table: enter the symbolic names in the STEP 7 PLC tag table for
specific memory locations. These tags are global to the STEP 7 program and
allow programming with names that are meaningful for your application.
 Data block (DB): include the DBs in user program to store data for the code
blocks. A "global" DB stores data used by all code blocks, an “instance” DB
stores data for a specific FB and is structured by the parameters for the FB.
 Temp memory: whenever a code block is called, the operating system of the
CPU allocates the temporary, or local, memory (L) to be used during the
execution of the block. When the execution of the code block finishes, the CPU
reallocates the local memory for the execution of other code blocks.
Memory Areas
Memory Address
 Each different memory location has a unique
address.
 An user program uses these addresses to
access the information in the memory location.
 The absolute address consists of the following
elements:
 Memory area identifier (such as I, Q, or M)
 Size of the data to be accessed ("B' for Byte,
"W" for Word, or "D" for DWord)
 Starting address of the data (such as byte 3 or
word 3)
Rules of Addressing Memory
 Bit:
Name of area memory + Byte Add + “.” + Bit order
Ex: I0.2, M2.5, Q1.0
 Byte:
Name of area memory + “B” + Byte Add
Ex: IB2 (= I2.7 … I2.0) QB0 (= Q0.7 … Q0.0)
 Word:
Name of area memory + “W” + High Byte of Word Add
Ex: MW0 (= MB0 MB1) QW2 (= QB2 QB3)
 Dword:
Name of area memory +“D”+ High-High Byte of Word Add
Ex: ID0 (= IW0 IW2 = IB0 IB1 IB2 IB3)
Analog Memory

IW64
IW66
...

QW96
QW98
...
Processing of Analog Values

 Analog signal modules provide input signals or expect output values that represent
either a voltage range or a current range.
 These ranges are ±10V, ±5V, ±2.5V, or 0 - 20mA. The values returned by the
modules are integer values where 0 to 27648 represents the rated range for current,
and -27648 to 27648 for voltage.
 In a program, have to use these values in engineering units, for example to
represent a volume, temperature, weight or other quantitative value.
 For an analog input, first normalize the analog value to a real value from 0.0 to 1.0,
then scale it to the minimum and maximum values of the engineering units that it
represents.
 For values that are in engineering need to convert to an analog output value, first
normalize the value in engineering units to a value between 0.0 and 1.0, then scale it
between 0 and 27648 or -27648 to 27648, depending on the range of the analog
module.
Data Types
Data types are used to specify both the size of a data element as well as how
the data are to be interpreted.
 Bit and Bit sequences: Bool, Byte, Word, Dword
 Integer: Unsigned or Signed Integer + SInt (8 bit), Int (16 bit), DInt (32 bit)
 Floating point Real: Real (32 bit), LReal (64 bit)
 Time and Date: Time (32-bit time value), Date (16-bit date value), TOD (32-bit
time-off-day value), DT (64-bit date-and-time value)
 Character and String: Char (8 bit), String (up to 254 characters)
 Array
 Data structure
 Pointers
CPU 1214C AC/DC/RLY Wiring Diagrams
CPU 1214C DC/DC/RLY Wiring Diagrams
CPU 1214C DC/DC/DC Wiring Diagrams
CPU 1214C Technical Data
CPU 1214C Digital Inputs
CPU 1214C Digital Outputs
CPU 1214C Analog Inputs
Convert Relay circuits to CPU 1214C DC/DC/DC circuits
Convert Relay circuits to CPU 1214C DC/DC/DC circuits
S7-300 PLC (Siemens)
CompactLogix PLC (Allen Bradley)
Melsec Q-Series PLC (Mitsubishi)
S7-1200 Instructions
Nguyễn Tấn Đời

29
What are the PLC programs
Two types:
 System program
 Be intergrated in CPU of PLC
 User program
 A set of instructions are arranged in order
 User program is loaded into PLC systems in machine code
 A sequence of binary code numbers represent the program instructions

30
PLC Operation

31
Start Events in the Operating System

32
Blocks of User program
When you create a user program for the automation tasks, you insert the
instructions for the program into code blocks:
 An organization block (OB) responds to a specific event in the CPU and can interrupt the
execution of the user program.
 The default for the cyclic execution of the user program (OB 1) provides the base
structure for your user program and is the only code block required for a user program.
 A function block (FB) is a subroutine that is executed when called from another code block
(OB, FB, or FC).
 The calling block passes parameters to the FB and also identifies a specific data block (DB)
that stores the data for the specific call or instance of that FB.
 A function (FC) is a subroutine that is executed when called from another code block (OB, FB,
or FC).
 The FC does not have an associated instance DB. The calling block passes parameters to the
FC. The output values from the FC must be written to a memory address or to a global DB.

33
Bit Instructions – Check Bit

Checked bit

Checked bit
Checked bit

34
Bit Instructions – Asign Bit

35
Bit Instructions – Set/ Reset Bit

36
Example_1
 Draw the wiring diagram.
 Inputs Sinking
 Outputs Sourcing
 The motor 3 phases, the lamp 24VDC.
 The Coil contactor 220VAC (optional).

 Write the PLC program in 2 cases:


using Asign Bit instruction and
using Set/ Reset Bit instructions.
 NO button pushed: the motor runs.
 Sensor actived: the lamp turned on.
 NC button pushed: the motor stops
and the lamp turned off.

37
Example_2
 Draw the wiring diagram.
 Inputs Sinking
 Outputs Relay
 The motor 3 phases, the solenoids 24VDC.
 The Coil contactor 220VAC (optional).
 Write the PLC program.
 The tank is empty (FS signals low): solenoids
A and B energized, C de-energized.
 Start button pushed: solenoids A and B
energized. Motor runs forward.
 When the tank is full (FS signals high):
STOP
solenoid B de-energized, C energized. Motor
runs reverse.
 Stop button pushed: Motor stops, all solenoids START
de-energized
38
Positive and Negative Edge Instructions

39
Timers Instructions
You use the Timer instructions to create programmed time delays. Each Timer uses a 16 byte
IEC_Timer data type DB structure to store timer data that is specified at the top of the box or coil
instruction. STEP 7 automatically creates the DB when you insert the instruction.

40
The Parameters of Timer

41
The PT and IN Parameters

42
Operation of the Timer – TON
 TON: ON-delay timer
 The TON timer sets output Q to ON after a preset time delay.

43
Timer Programming

44
Example_3
 Draw the wiring diagram. S7-1200
 DI Sourcing.
 DO RLY.
 Write the PLC program.
 The barrow must be in the correct
position (limit switch S1 actived).
 Start button pushed (NO): M2 runs.
5s later M1 runs. 10s later Y opens.
 Stop button pushed (NC): Y closes.
5s later M1 stops. 5s later M2 stops.
 One of two motors overloaded: the
system stop. The lamp turned on.
 Lamp and Valve Y 24VDC. Motors M1
and M2 3 phases. Contactor 220V

45
Example_4

The system to be controlled by PLC consists of two


belts. Using PLC S7-1200 DC/DC/DC
Motor 3 phases, Contactor 220VAC.
 Draw the wiring diagram.
 Construct a LAD for PLC to control the system.
 If the Start button is pressed, Conveyor Belt-1 will
begin to run. After 5 seconds Conveyor Belt-2 will
be active. After the whole system runs for 15
seconds, Conveyor Belt-1 will stop. Then Conveyor
Belt-2 continues to move for 5 seconds and then it
will stop, too.
 Also the system can be reset by the emergency-
stop button at any time.

46
Counter Instructions

47
The Parameters of Counter

48
Operation of the CTU

 The CTU counter counts up by 1 when the


value of CU changes from 0 to 1.
The CTU timing diagram shows the
operation for an unsigned integer count
value (where PV = 3).
 If the value of CV (current count value) is
greater than or equal to the value of PV
(preset count value), then the counter output
Q = 1.
 If the value of the reset R changes from 0 to
1, then the current count value is reset to 0.

49
Operation of the CTD

 The CTD counter counts down by 1 when


the value of CD changes from 0 to 1.
The CTD timing diagram shows the
operation for an unsigned integer count
value (where PV = 3).
 If the value of CV (current count value) is
equal to or less than 0, the counter output
Q = 1.
 If the value of LOAD changes from 0 to 1,
the value at PV (preset value) is loaded to
the counter as the new CV (current count
value).

50
Example_5
The ball classification system is controlled by S7-1200
CPU1214C DC/DC/DC.
 The system contains two conveyor belts. The conveyor
carries balls and boxes, moving by two 3 phases motors.
 If the Start button is pushed, box conveyor will begin to move.
When the box triggers the sensor SE2, the box conveyor
stops and after 5s the ball conveyor begins to move.
 The weight sensor WS measures the ball weights. If the ball
weight is 500g, the WS is on state (it’s contact is closed).
 The ball conveyor carries two size of the balls, 250g and
500g. If weight of the first ball is 500g, the box is filled with 3
balls. Otherwise the box filled with 5 balls with 250g.
 In the system, the sensor SE1 is used to detect the balls.
After the box is filled with the balls as specified above, the ball
conveyor stops and box conveyor begins to move. 1. Draw the wiring diagram of the system.
 The system can be reset by a Stop button any time. 2. Construct the PLC LAD program to control
SE1 and SE2 are NPN photoelectric sensors. WS is limit switch. the system.
51
Compare Instructions

52
Math Instructions – Calculate instruction

53
Add, Subtract, Multiply and Divide Instructions

54
Move and Block Move Instructions

55
Move and Block Move Instructions

56
Example_6

 The parking lot which has a capacity of 100


cars is to be controlled by a PLC system.
 The sensor S1 and S2 are used to count the
car at the entrance and exit.
 If the number of the cars reaches to 100, red
light is lit and the gate arm is closed. The arm
stays closed until one or more parking space
is available in the lot.
 The gate arm is controlled by activating or
deactivating the gate solenoid (GS).
Construct LAD for the parking lot controller by
using math instructions.

57
Analog Instructions
 Using Scale and Normalize instructions to read and write analog value.

58
Data types of SCALE_X and NORM_X

59
Normalizing and Scaling an AI value
 An analog input from an analog signal module or signal board using input in current is in the
range 0 to 27648 for valid values. Suppose an analog input represents a temperature where the
0 value of the analog input represents -30.0 degrees C and 27648 represents 70.0 degrees C.
 To transform the analog value to the corresponding engineering units, normalize the input to a
value between 0.0 and 1.0, and then scale it between -30.0 and 70.0. The resulting value is the
temperature represented by the analog input in degrees C:

Khi mô phỏng AI trong TIA Portal V15.1


Giá trị IW82 trên SIM Table giảm 256 Dec

60
Normalizing and Scaling an AO value
 An analog output to be set in an analog signal module or signal board using output in current
must be in the range 0 to 27648 for valid values. Suppose an analog output represents a
temperature setting where the 0 value of the analog input represents -30.0 degrees C and
27648 represents 70.0 degrees C.
 To convert a temperature value in memory that is between -30.0 and 70.0 to a value for the
analog output in the range 0 to 27648, you must normalize the value in engineering units to a
value between 0.0 and 1.0, and then scale it to the range of the analog output, 0 to 27648:

Note that if the analog output


was for an analog signal
module or signal board using
voltage, the MIN value for the
SCALE_X instruction would
be -27648 instead of 0.

61
BT1
BT2: HT phân loại theo màu sắc Green, Blue, Grey 7h45-9h00
Phân loại theo khối lượng

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy