4. PLC S7-1200
4. PLC S7-1200
4. PLC S7-1200
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).
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
46
Counter Instructions
47
The Parameters of Counter
48
Operation of the CTU
49
Operation of the CTD
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
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:
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:
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