PLC: Learning Note (Siemens) 2

Source: Internet
Author: User

Traditional industrial control systems: relays-CONTACTOR PLC (Programmable logic Controller)

PLC Features:
1, high reliability of the PLC (software to replace complex lines, anti-jamming CPU, power supply using multistage filtering and integrated voltage regulator block regulator, IO using photoelectric isolation technology)
2, Rich IO port (AC, DC, switching volume, analog, voltage, current, pulse, potential, strong power, weak electricity have the corresponding IO module and industrial field equipment)
3, modular structure (PLC auxiliary contact is not limited by the number of times, just consider the input, the number of output points can be)
4. Simple programming (ladder diagram), simple installation, short design and construction period

Working mode of PLC: Using cyclic scanning operation mode its input/output has a response lag

PLC Basic components: central processing unit (large multi-redundant system or three-CPU voting system), memory, input/output interface (field commonly used input interface: Button switch, travel switch, contactor contact, Sensor output switching or analog (after DAC input into the PLC) input general connected photoelectric coupling circuit and microcomputer input interface circuit (input data register, circuit, interrupt request circuit) on-site commonly used output: solenoid valve, CONTACTOR, relay, signal lamp, motor, etc. Its circuit composition and input are similar: output interface circuit and Power drive circuit (relay mode output, Thyristor mode output, transistor mode output)) 4, Power 5, Backplane and rack 6, PLC external equipment (programming equipment (RS232, RS422), monitoring equipment, storage devices, input/output devices) 7, PLC Communication Network (all manufacturers are moving towards the standard communication protocol)


PLC programming language: Because of the different manufacturers and models, there is no standard programming language today
1, Ladder programming language: Only using dynamic and dynamic break two electric shock, the most left is actually the bus every logical line must start from the bus, the order from left to right, from top to bottom controller execution order is this, Ladder diagram language in the electric shock can be arbitrary series and parallel, note output relay can not be connected in parallel (! ), end of program should have a Terminator (general end)
2. Instruction statement programming language: minicomputer without CRT is used when programming plc, similar to assembly language
3. Functional Block Diagram programming language: A graphical language that consists of a function block to express commands with logical function symbols


PLC Performance Index:
1. Input/output points (IO points): Includes host points and maximum extension points
2, Storage Capacity: (PLC program in accordance with "step" to store, a command often more than one step, a "step" accounted for an address unit, an address unit accounted for two of its own (16-bit CPU) such as a memory capacity of 1000 steps of the PLC, memory 2KB) must note that the "Memory capacity" Refers to the actual user's program capacity, excluding the capacity of the System program memory
3, scanning speed: Generally refers to the time to execute one-step instruction (microseconds/steps)
4, instruction number: the more the type of instruction, the more powerful software
5. Internal register: Store variable state, intermediate result and data. In addition, many auxiliary registers provide user-specific functionality to simplify the design of the entire system.
6, Function module: (Common) A/d d/A converter module, high-speed counting module, position control module, speed control module, axis positioning module, temperature control module, remote communication module, advanced language editing module (? ), various physical volume conversion modules

PLC Basic working principle:
1. Working method:
The key point: the traditional relay control is parallel processing, that is, when some steps meet the conduction condition, the relay coil will power up at the same time. And the PLC uses "cycle Scan" work mode, working in the serial state, this is the difference between the two.
Solution: In order to make the response of the PLC and the traditional relay response speed is similar, generally make the PLC scanning user program time less than 100ms (because the traditional relay action time generally above 100ms)
Scan cycle: Self-diagnosis, communication, input processing (scanning method in order to read all input, terminal status or data from the input latch, and put it into the memory of the special hold zone, and then into the program execution phase. Note: Any changes in the input state at the time of execution of the program, the input image area will not change, only the next scan cycle changes, user program execution, output processing (with input processing, at this time the output status image area of the output of all once to the latch, and output by certain means)
2. Scan cycle:
T= (read in a little time * input points) + (operation speed * program steps) + (output a little time * output points) + Monitoring service time
General industrial use of the PLC is about 10MS, for the general switching control system is fully permissible, but also anti-interference (industrial field interference is more pulse type, short time)

PLC Internal resource allocation (CPM1A for example): Internal relay Area (IR), Special Auxiliary relay Zone (SR), Staging relay Zone (TR), maintain relay area (HR), auxiliary memory relay area (AR), Link relay area (LR), Timer/timer zone (TC), System Settings Area (DM). (? The individual is understood as the relay in the PLC equivalent to the registers in the other controller, because the special auxiliary relay zone can be pushed, the Siemens 200 plc in the SM Relay is a certain symbol of the system


Take Siemens as an example:
First, the hardware system
Basic composition:
1, the host unit: itself is a complete system.
2, Expansion unit: expansion of various IO (quantity, nature or function, supply voltage, etc.)
3, Special function module: Need special function Module (Motion control module, special communication module)
4, Related equipment: programming equipment, human-machine interface, network equipment, etc.
5, Software: Management and use of equipment and development of the corresponding program, for s7-200: Programming software Step7-micro/win and HMI configuration programming software Protool, WinCC flexible.
Host structure and performance characteristics:
1, the host module:
1-1:cpu221:6 input/4 output, no expansion capability, a certain high-speed counting and communication functions.
1-2:cpu222:8 input/6 output, up to two modules.
1-3:cpu224:14 input/10 output, expandable up to 7 modules with built-in clock, higher analog and high-speed counting capabilities
The enhanced version of the 1-4:cpu224xp:cpu224 adds a 2 input/1 output analog unit and a communication port to the host, and is suitable for use in systems with a small amount of analog signals.
1-5:cpu226:24 input/16 output, data storage up to 10KB, there are 2 communication ports.
2. CPU Module Technical Specification:
2-1: Supply voltage: 24VDC or 220VAC
2-2: Output mode: Transistor (DC) or relay (DC/AC)
2-3: Integrated power supply: The Host Integration 24VDC can be used directly for sensor and actuator power supply.
2-4: High-speed count: can use ordinary terminal to capture faster than the CPU scan cycle pulse signal, high-speed count up to 200kHz (CPU224XP)
2-5: Pulse output: 2 way up to 100kHz (CPU224XP) high frequency pulse output, can drive stepper motor or servo motor to achieve accurate positioning.
2-6: Integrated analog potentiometer: Use the potentiometer on the module to change the value in the corresponding special register (such as timer/counter, etc. process volume parameters)
2-7: Real-time Clock: Marking of information filling time, recording machine running time or time control of the process
3. Storage System:
3-1: Retention type data memory
3-2: Permanent memory: limited storage times (less than 1 million times), although it can be stored permanently, but not for the user program to write data.
3-3: Memory card: Optional, removable memory card, can be stored: User program, data block, system block, mandatory setting value, recipe and data archive, document file, etc.
Expansion of I/O and expansion of functions:
Cause: IO points are not sufficient or require special function control.
Type: expansion of IO points/expansion of functions
1. IO expansion module:
1-1: Input expansion module EM221: Three kinds: 8-point DC, 16-point DC, 8-point AC
1-2: Output Expansion module EM222: Five kinds: 8-point DC, 4-point DC (5A), 8-point AC, 8-point relay, 4-point relay (10A)
1-3: input/Output Hybrid expansion module EM223: Eight kinds: 4 points (8 points, 16 points, 32 points) DC input/4 points (8 points, 16 points, 32 points) DC output, 4 points (8 points, 16 points, 32 points) DC input/4 points (8 points, 16 points, 32 points) relay output
1-4: Analog Input expansion module EM231: Six kinds: 4-way (8-way) AI, 2-way (4-way) RTD input, 4-way (8-way) thermocouple input
1-5: Analog Output expansion module EM232: Two types: 2-way AO, 4-Way AO
1-6: Analog input/Output expansion module EM235:4 Way Ai/1 Road AO (2 output address)?
2. Special Function Expansion Module
2-1: Modem module EM241
2-2: Positioning module EM253: For high-precision motion control system
2-3:PROFIBUS-DP Module EM277
2-4: Ethernet Module Cp243-1
2-5: Ethernet Module Cp243-1 IT
2-6:as-i Interface Module Cp243-2
2-7:siwarex MS Weigh Module
2-8:sinaut md720-3 Modem
! 3. IO point expansion and addressing:
Address Space allocation principle:
1, the same type of input or output points of the module sequence address (must be the same type, different types of modules between the address does not affect)
2, for digital (io switch): input/Output Image Register unit length is 8 bits (one byte half word). The module is not 8 bits high, and cannot be assigned to subsequent modules in the IO chain, and subsequent similar addresses must be re-started from a "contiguous byte".
3, for analog (): input/Output Image Register unit length 32 bits (two words two points two channels) increments the allocation of space, the same, the module is not full of high-level can not be divided to follow, follow-up must start from the new 2 word address.


Iii. Internal Resources
Soft components (soft relays)
Definition: Each input/output, internal storage unit, timer, counter in the PLC used by the user
Features: Has its different functions, has its fixed address.
Essence: There are electronic circuits, registers, storage units (which can be considered registers, not solid relays!!). What is the relationship between relays and image registers? )
1. Input relay (I):
Consists of an input circuit and an input image register. Each input relay corresponds to an input terminal. At the beginning of the scanning cycle, each input point is sampled and then stored in the image register. No change in user program execution. Note: Additional IO cannot exceed the input image register
2. Output relay (Q):
The output circuit and the output image register are composed. Each output terminal corresponds to an output relay. When the user program executes, the result is transmitted only to the output image register, which is only "simultaneously" transmitted to the output latch at the last stage of the scan cycle, and the output point is refreshed
3. General Auxiliary Relay (M):
Equivalent to the "Relay contact control System" in the intermediate relay, no input/output. Undertake the process logic control task in the program design.
4. Special relays (SM)
Functions: state variables with special functions or storage systems, relevant control parameters and information.
Objective: To establish the relationship between the PLC and the controlled object, and to read the information of the equipment status and operation results during the running of the program, and use these to carry out some special control actions (high-speed count, interrupt)
Mainly include:
4-1: State: SMB0, SMB1, SMB5
4-2: Storage scan time: SMW22, SMW26
4-3: Storage analog potentiometer value: SMB28, SMB29
4-4: For communication:
smb2\smb3\smb30\smb130: For free-port communication
smb86~smb94\smb186~smb194: Receive information control.
4-5: For high speed count: smb36~smb65\smb131~smb165
4-6: for pulse output: smb66~smb85\smb166~smb185
4-7: for interrupts: smb4\smb34\smb35
Common SMB0 and SMB1 status bit information:
SM0.1: Always on SM0.1: First scan is on, commonly used as initialization pulse SM0.2: To keep the data loss is on a scan cycle, can be used to do error memory bit SM0.3: On a scan cycle when booting into run, can be replaced by "constant power" in the case of SM0.1 SM0.4: Clock pulse: 30s closed/30s disconnect SM0.5: Clock pulse: 0.5s closed/0.5s disconnect SM0.6: Scan clock pulse: Close 1 scan cycles/Disconnect one scan cycle SM0.7: switch is placed at run 1, 0 in term Commonly used in the processing of free-mouth communication
SM1.0: Executes certain instructions, resulting in 0 o'clock SM1.1: Performs certain instructions, results in overflow or illegal values when the set bit SM1.2: Executes the operation instruction, the result is negative when the position SM1.3: try to divide by 0 o'clock place SM1.4: Execute att instruction, beyond the table range set position SM1.5: Set position when reading from empty table SM1.6: Set bit sm1.7:ascii when non-BCD is converted to binary number-16 binary conversion error
5. Variable memory (V)
The value of the stored variable (the intermediate result of the Process Control logical operation, the save other data related to the operation or task) can be numeric, or it can be a logical value
6. Local variable memory (L)
Storing local variables, similar to V (Note: Global validity refers to any program such as the main program, subroutine, interrupt program Access) is generally used for temporary memory or to the subroutine to pass parameters most of the occasion is in the process of subroutine calls with parameters.
7. Sequential control Relays (S)
Also known as the "State device" for sequential control or step control, it can be used as a general intermediate relay.
8. Timer (T)
The internal component of the cumulative time increment. Enter the time preset in advance when the timer input condition is satisfied, start the timer at the beginning of the 0 unit, and the Timer contact action (virtual contact is equivalent to the contact of the time relay) when it reaches the preset value.
9. Counter (C)
The number of accumulated pulses. Cumulative number of rising edges of input pulses, contact action when preset value is reached (same as virtual contact)
10. Analog Input Image Register (AI)/Analog output image Register (AQ)
Note: The addressing content includes "component name + data length + start byte address" (AIW6 AQW12) 6 and 12 for the starting byte.
11, High-speed counter (HC)
The principle is basically the same as the normal counter. High-speed pulses that accumulate faster than host frequencies.
12. Accumulator (AC)
S7-200 PLC provides 4 32-bit accumulators for AC0 AC1 AC2 AC3 respectively. Purpose: Registers that are used to stage data.
Note: Supplementary points such as double word use movd AC1 VD200//vb200=. vb201=. Vb202=. vb203=.


Four, the way of addressing
1. Data types and Constants
Data type:
String, Boolean, reshape, solid (floating-point). A solid is represented by a 32-bit single-precision number.
In Siemens PLC, the distinction is unsigned:
Unsigned: Byte B (8-bit), Word w (16-bit), double-word D (32-bit)
Signed: Byte B (for SHRB instruction only), INT (16-bit), DINT (32-bit)
Constant Representation Method:
Decimal: Decimal Value 1052
Hex: 16# hexadecimal value 16#8AC6
Binary: # Binary Value 2#1010_0011_1101_0001
ASCII code: ' Text ' ' Show terminals '
Floating point: ansi/ieee754-1985 standard
String: "Text" "Why"
2. Direct addressing
ATX.Y where A (component name), T (data type B W D "default is bit addressed"), X (byte address), Y (bit address within bytes only has this item)
Addressing formats for special devices: "Do not indicate their byte addresses, but write their numbers directly"
BYTE, Word, and double-word addressing format (as long as "big-endian mode" is remembered)
Addressing strings: Each character is stored as a "byte"
3. Indirect addressing:
Build pointers, no more learning


V. Structure of the procedure
Three parts: User program, data block, parameter block

Vi. several basic concepts
Output coil: For output relay Q, intermediate relay m and other devices in the way of coils
Instruction Box: to the Timer T, Counter C, most of the function instructions.
Network block: The S7-200 plc is specifically labeled as a minimum independent logic block.

Seven: Several characteristics of s7-200 PLC
1. Define the power-down protected area: Define the address range of the power-down (element includes v M C T), defined interval, maintain data after power outage
2. Immediately read/write I/O: direct access to real input/output points. Do not use image registers
3, set the output value in the Stop mode: For security reasons (can be set to keep the state before the stop, or set value to transmit to the output side)
4. Increase the filter on the input signal: Allows the filter to be set for the input point on the CPU module and defines the delay time. For analog: A software filter can be selected for each path, and the filter value is the average of the input sample value
5, Catch narrow pulse: When an input point set pulse capture function, the input point state changes will be locked and continue to the next scan cycle.
6, Analog potentiometer: The value of a special register SMB28, SMB29, not intuitive, low accuracy
7, high-speed IO: high-speed pulse count, high-speed pulse output.

PLC: Learning Note (Siemens) 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.