Programmable controllers (Programmable Controller) should be referred to as PC, PC PC in order to distinguish, so referred to as programmable controller PLC (Programmable Logic Controller), but does not mean that PLC can control logic signal. Application and design of PLC is specifically designed for industrial environments, comes with an intuitive, simple and easy to learn programming language environment for industrial control devices. A, PLC basic composition
PLC basic components including the central processing unit (CPU), memory, input/output interface (abbreviated as I/O, including input and output interfaces, external device interface, extension, etc), external programming device and the power supply module, as shown in Figure 1. Between various units within the PLC through power bus and connected to the data bus, address bus, control bus, others based on the actual control object to configure the appropriate device and control device for PLC control system.
1. central processing unit
The central processing unit (CPU) consists of the controller, operations and registers and integrated on a chip. CPU bus via data bus, address bus, control bus, and power bus and memory, input/output interfaces, programmer, and is connected to the power supply.
Small PLC of CPU used 8 bit or 16 bit microprocessor or single tablets machine, as 8031, and M68000,, this class chip price is low; medium PLC of CPU used 16 bit or 32 bit microprocessor or single tablets machine, as 8086, and 96 series single tablets machine,, this class chip main features is integration high, and operation speed fast and reliability high; and large PLC is needed used high-speed bit tablets type microprocessor.
Procedural functions conferred by the CPU according to the PLC system command PLC control system to complete various tasks.
Memory to store system in the PLC program, user programs and data, and so on.
1) system memory
PLC PLC program the basic functions of the system, that part of the procedure by PLC manufacturers prepared and cured in the program memory of the system, there are systems management, user instructions explain procedures and functions of program and system calls, and so on.
Running System Manager main control PLC, PLC, in the right order; interpreter PLC user instructions user instructions into machine language instructions, transport within the CPU performs functional program and system calls are responsible for different functions called subroutines and its management procedures.
System procedures are needed for long-term preservation of important data, so its memory ROM or EPROM. ROM is read only memory, the memory can be read out, unable to write content, ROM is non-volatile, after disconnecting the power could still save the stored content.
EPEROM for electrically erasable programmable read only memory, ultraviolet irradiation on chip lens window must be used to erase the writing and EEPROM electrically erasable programmable read–only memory E2PROM, FLASH, etc.
2) user program memory
User program memory is used to store the PLC application user load, load the initial user program due to the need to modify and debug, called the user debug programs, stored in random access memory RAM for random read and write operations to facilitate the users to modify and debug.
By modifying the program with Debug program called user, because you do not need revision and debugging, so user programs are intrinsic to long-term use in the EPROM.
3) data memory
PLC run process in the needed generated or calls Middle results data (as entered/output components of State data, and timer, and counter of pre reset value and current value,) and group State data (as entered output group State, and set entered filter, and pulse capture, and output table configuration, and defined storage district keep range, and simulation potentiometer set, and high-speed counter configuration, and high-speed pulse output configuration, and communications group State,), this class data store in work data memory in the, due to work data and group State data constantly changes, and not need long-term save So random access memory RAM.
RAM is a high density, low power consumption semiconductor memory, available lithium-ion batteries as a backup power supply, once the power would be powered by lithium-ion batteries, keep the contents of the RAM.
3. the interface
Input/output interface is the PLC and industrial control interface circuit or sensor and actuator connections. PLC inputs with DC input and AC input, AC and DC input type; output connector output transistor, thyristor output and relay output type. Output transistors and thyristors is contactless output transistors, transistor output type used in high frequency small power load, thyristor output types for high frequency and high power load; contact output relay output circuit for low frequency loading.
Control or component input to the PLC control signal is detected, such as limit switches, buttons, selector switches and other sensors such as switching or analog output, through an input interface circuit converts these signals into CPU capable of receiving and processing of signals. Output interface circuit CPU weak control signal sent out into the field need strong electric output signal to drive solenoid valves, contactors, actuators of the controlled device.
1) input interface
Input interface for receiving and collecting two types of input signals, one button, switch, limit switch, relay contact first class switching input signals; the other is by potentiometers, speed generators and converters provide a continuous change of the analog input signal.
DC input interface circuit as shown in Figure 2 for example, R1 is the cut-off current and voltage divider resistors, R2 and c constitutes a filter circuit, filter the input signal by optical coupler t coupled to the internal circuit. SB when input button is switched on, the optical coupler t-pass DC input signal is converted to a PLC can accommodate a standard 5V signal levels (abbreviated TTL), LED input indicator lights, signal is connected. Micro-computer input interface circuit by the register, gated and interrupt request logic circuits, the circuit integrated on a chip. AC input with AC and DC input interface circuit similar to the DC–input interface circuit.
Filter to eliminate jitter of the input contact, opto-coupled circuit prevents the scene of strong electrical interference into the PLC. Because the input signal using optical signal coupling between PLC internal circuit and, therefore, the two electrically isolated so that interfaces with anti-jamming capability. Input signal passes through optically converted to 5V TTL after entering data into registers, and then by bus to the CPU.
2) output interface
Output interface circuit to control a variety of output control signal actuator. Commonly used actuator contactors, solenoid valves, control valves (analog), speed control devices (analog), lights, alarms and digital display device. Output interface circuit usually consists of micro-computer output interface circuit and power amplifier circuit, similar to the input interface circuit internal circuit of photoelectric coupler between the output circuit and electrical isolation of interference.
Micro-computer output interface circuit usually consists of output data registers, gated and interrupt request logic integrated circuits on a chip, CPU data bus output signals to the output data registers, the power amplifier is designed to adapt to the requirements of industrial control, microcomputer output signal amplification.
3) other interfaces
If the number of host I/O is not enough, through I/O interconnect cables and I/O expansion unit (without the CPU) to expand. PLC and configuration to connect various peripheral interfaces, through serial communication cable, EPROM writing function.
Programmer is designed to download user–written program to the PLC user program memory and programmers inspect, modify, and debug user programs, monitor user program execution process, shows the PLC status, internal components and system parameters.
Programmer simple programming and graphics programming in two ways. Simple programming, the volume is small, easy to carry, but can only be used online in the form of programming, programming and debugging for small PLC. Graphics programmer available programming statement form, and ladder diagram programming, as well as offline programming.
PLC manufacturer is currently developing a computer–aided support software PLC programming, when the PC after you install the PLC programming software, can be used as a graphics programmer, user program editing, modifying, and through implementation of the communication between PC and PLC interface the user program bi-directional transmission, monitoring PLC operation status.
5. power supply
PLC power supply to convert external AC supply for CPU, memory and other required direct current, is the PLC power supply center. PLC with high quality stability, strong anti-jamming ability of a switching power supply, many PLC power supply can be provided to the external DC 24V power supply, used to access electrical components to the input connector on the power supply, so as to simplify the peripheral configuration.
Second, the PLC working principle 1. PLC internal and external circuit
1) external circuit wiring
Figure 3 is a full–voltage starting control of the motor contactor electrical control circuits, control logic from AC contactor coil KM, led HL1, HL2, thermal relay normally closed contact FR SB2, start button, stop button SB1 and normally open auxiliary contact of contactor KM through the wire connections.
QS and press the Start button on SB1, coil KM power and lock, switch on led HL1 branch of the auxiliary contact KM and the main contact in the primary circuit, HL1, motor m starting; press the stop button the SB2, coil KM power LEDs HL1 off, m stalled.
Figure 4 using a SIEMENS S7 PLC to realize full–voltage starting control of the motor wiring diagram. Main circuit remains the same, the thermal relay normally closed contact FR, the stop button the SB2, start buttons SB1, as input to the PLC on the devices connected to the inputs of the PLC and AC contactor coil KM, led HL1, HL2, etc as the output of the PLC output interface on the device connected to the PLC. Business logic through the implementation according to the full voltage of the motor control requested and stored in the program memory in the user program.
2) internal I/O image area
I/O image store was opened in the PLC memory for storage I/O signal States, registers are called the input images and output image register, in addition to PLC programming elements also have corresponding image memory, called element image register.
I/O image district of size by PLC of system program determine, for system of each a entered points total has a entered image district of a one and of phase corresponds to, for system of each a output points also are has output image district of a one and of phase corresponds to, and system of entered output points of series site, and I/O image district of image registers address, also corresponds to.
PLC work Shi, will collection to of entered signal state store in entered image district corresponds to of bit Shang, operation results store to output image district corresponds to of bit Shang, PLC in implementation user program Shi by needed description entered following electrical of equivalent touch head or output following electrical of equivalent touch head, and equivalent coil State of data take for I/O image district, and not directly and external equipment sex.
When the establishment of the PLC I/O image memory about the status of the stored address, location and relationship data, and output only to the memory of an address unit set a State data. This will not only accelerate the speed of program execution, and separated from the control system to the outside world, improve the system anti-interference ability.
3) internal equivalent circuit
Figure 5 is PLC of internal equivalent circuit, to which of up moving button SB1 for cases, its access interface I0.0 and entered image district of a triggers I0.0 connected received, dang SB1 connected Shi, triggers I0.0 on was triggered for “1” State, and this “1” State can was user program directly reference for I0.0 touch head of State, at I0.0 touch head and SB1 of pass broken state same, is SB1 connected, I0.0 touch head State for “1”, instead SB1 disconnect, I0.0 contact status to “0“, I0.0 trigger functionality identical to the relay coil and no hard connection line I0.0 trigger equivalent to a I0.0 soft PLC internal relay coils directly I0.0 I0.0 coil State contact is equivalent to a normally open contact I0.0 coil control (or contacts).
Similarly, stop button SB2 and PLC internal of a soft following electrical coil I0.1 connected received, SB2 closed, I0.1 coil of State for “1”, instead for “0”, and following electrical coil I0.1 of State was user program take anti-Hou reference for I0.1 touch head of State, so I0.1 equivalent for a by I0.1 coil control of often closed touch head (or said moving broken touch head). Contact output Q0.0, Q0.1 is the PLC internal relay normally open contact of physics, once closed, KM of external coils, LEDs HL1 will be switched on. Public interfaces for PLC output power at the output port COM.
2. PLC control system
Using PLC to realize full voltage starting of the motor electrical control system, its main circuit remained unchanged, and replaced by a PLC electrical control circuits.
1) PLC control system
Input circuits are used to enter into the PLC control signal, input device buttons SB1, SB2, and FR normally closed contacts. External input to the PLC control signal input corresponds to a relay, enter any number of normally open relay offers head and normally closed contacts, programming for PLC control circuit use.
Output circuits are used to output of the PLC control signal converted to KM loop and HL1 led signal. Many of PLC control circuit output relays, each addition to providing programming within the PLC control circuit output relay normally open and normally closed contacts, but also provide output circuit with a normally open contact connected to the output port, the contact is called internal hard contacts, normally open contact is an internal physics. Through the contact–driven KM of external coils and HL1 led load, KM KM loop through the main circuit the main contacts to control the motor m starting and stopping. Drive load the power provided by the Ministry of electric power, PLC output port and output power COM public side.
The internal control circuit
Internal control circuits in accordance with controlled motor control request form by the user program, which is logical relationship in accordance with user program, perform calculations on input and output signals of the status, treatment and judgement, and then obtain the corresponding output control signals through the control signal output device: electric motor m, led the HL1.
User program through a personal computer or programming input or any other means of communication, all written to the PLC program statements in the user program memory. Modifications by the user program by simply programming devices such as changing some statements in memory will not change the internal wiring of the controller, for controlled flexibility.
2) ladder diagram of PLC control
Ladder diagram is a PLC internal equivalent to many within the relay coil, normally open contact, normally closed contact or equivalent circuit consisting of the function block. Figure 7 is the equivalent control unit of PLC ladder diagram symbols.
Ladder diagram of PLC control of the full voltage of the motor starting, by FR normally closed contact, SB2, close buttons, KM normally open auxiliary contact with SB1 normally open button in parallel unit, KM part corresponds to the equivalent control component symbols such as coil in series. Full–voltage starting control of the motor trapezoidal in form similar to the contactor control circuit diagram, there are many differences but also with the electrical control circuit diagram.
Ladder diagram relay electric different components of the physical structure in electrical components
PLC ladder diagram of the coil, contact is only functional equivalent of coil and contact with the electrical components. Ladder diagram of the coil, contact only in a physical sense inputs, outputs, stored in memory, to control different components of the physical structure.
Ladder diagram switching status of the relay electrical components electrical components
Ladder diagram relay switching of the electrical components associated with the data saved on the appropriate storage, if the stored data to “1“, then the component is in a “pass“ status, if the data is “0“, then in “off“ State. Different from the actual switching State electrical components.
Ladder diagram relay switch electrical components process different from electrical components
Trapezoidal figure relay electrical components of State switch just PLC on storage bit of State data of operation, if PLC on often open touch head equivalent of storage bit data assigned value for “1”, on completed moving collection operation process, also as on often closed touch head equivalent of storage bit data assigned value for “0”, on can completed moving broken operation process, switch operation process no time delay. Electrical element coils, contact or move when you switch off, there must be time delayed and generally closed after a disconnect operation.
Ladder diagram relay electric owned contact number and electrical components
If PLC from entered following electrical I0.0 corresponding of storage bit in the out has bit data “0”, will of deposit another memory in the of a storage bit, was deposit of storage bit on into has by I0.0 following electrical control of a often open touch head, was deposit of data for “0”; as in out bit data “0” zhihou first for take anti-operation, again deposit a memory of a storage bit, is the bit deposit of data for “1”, the storage bit on into has by following electrical I0.0 control of a often closed touch head.
As long as the PLC internal memory enough, this unlimited data transfer operations, each operation, it can produce a ladder diagram of the relay contact, therefore, ladder diagram relay electric contactors can be infinitely repeated use in principle.
But the PLC internal coils usually can only be referenced once, if you need to reuse the same address number of the coil should be wary. Unlike PLC‘s contacts in the electrical components are limited in number.
Descriptive rules for ladder diagram each row starts from the bus left, through contacts and coils (or feature box), ending on the right bus. Parallel unit to draw each line on the left side, output coils the painting on the right, the remaining series element to draw in the middle.
3. PLC process
PLC after the electricity in the system under program control system periodically according to a certain order, judge, and execute a query a variety of tasks such as
PLC power–on, first to initialize the system, including hardware initialization, I/O module configuration checking, power outages remain range sets and clears the internal relay, reset timer.
2) CPU self diagnosis
During each scan cycle to go through self diagnosis, self diagnosis on power supply, PLC internal circuit, user program‘s grammar check, once found, CPU so that abnormal relay access, exceptions on the PLC panel LEDs LED on, internally deposited in special registers and gives the error code fault display signs. If not fatal error entering the PLC stop (STOP); if it is a fatal error, then the CPU is required to stop, wait until after the error excluded into the STOP State.
3) communicate with external devices
Stage of communication with external devices, PLC and other intelligent devices, programmer, terminal equipment, color graphic display, information exchange with other PLC and PLC working judge.
PLC STOP and RUN two operating States, if the PLC is in the STOP State, you do not execute user programs, by exchanging information with devices such as programmer, edit, modify and debug the completed user tasks if the PLC is RUN, you will enter the scanning process, implementation of the user program.
To scan the deposit status of the external input signal input image, then execute the user program and output the results in the output image area until the transfer to an external device.
PLC power–on cycle to perform the process until power outage.
4. user program loop scans
PLC input to loop scans a user program is divided into three stages of sampling, program execution, and output to refresh
1) input sample stage
CPU for full field of the input signal, such as buttons, limit switches, speed of the switching status of the relay by the PLC inputs reading image register, this process is called the input sample. After entering the program implementation phase after the end of the input sampling, during which changes of the input signal, input image data within the register no longer change until a scanning cycle ends, the next update only when the input sample. This entry is called a set input method.
2) program implementation phase
PLC in program implementation stage, if not appeared interrupted or jump instruction, on according to trapezoidal figure program from first address began by bottom, and from left to right of order for article-by-article scan implementation, scan process in the respectively from entered image left-device, and output image left-device and auxiliary following electrical will be about programming components of State data “0” or “1” read out, and according to trapezoidal figure provides of logic relationship implementation corresponding of operation, operation results writes corresponds to of components image left-device in the Save. Need to signal in the output image of the output register, and save the output latch.
3) output stage
CPU registers of the output image with output latches and PLC output interface to the external drive contactors and indicator light load. Then save the output latch is content to wait for the next scan cycle of the output stage to be refreshed again. This method of output known as a concentrate output.
4) PLC scanning examples
Ladder diagram in the form of directive statements tables stored in the PLC in the user program memory. Table directive statements is a programming language of the PLC, described by a table consisting of a series of instructions of PLC control procedures, statement form different PLC instructions use mnemonics are not the same. SIEMENS S7-300 series PLC instruction statement table prepared by the motor full–voltage starting function of ladder diagram programs are as follows:
O I0.0//I0.0 into operation stack;
O Q0.0//Q0.0 and stack data or operation, results in the stack;
After AN I0.1//I0.1 negated and stack data and calculation results into the stack;
AN I0.2//I0.2 taking a non-stack data after operation, results in the stack;
= Q0.0//to register an image stack data are sent to the output Q0.0;
Q0.0//Q0.0 data out into the stack;
= Q0.1//the data is sent to the output image in the stack register Q0.1;
MEND//end of the main program.
Directive statements are made up of a number of statements program statements is the smallest independent unit of your program. Each operation carried out by one or several statements. PLC statement by the opcode and operand consists of two parts. Opcode mnemonic representation (such as a “take“, o means “or“, and so on) that describes the functions to be performed, that is, tell the CPU what to do. Opcode logical operations are the main features of the and, or, not, the arithmetic operations of addition, subtraction, multiplication, and Division, time or timer and counter in the condition control, movement and other functions.
Operand identifiers and parameters. Represents the types of the operands, such as relays, the output relays, timers, counters, registers, data and parameter that represents the operand address or a predetermined value.
Motor full–voltage starting PLC control system, for example, the input sample stage, CPU, SB1, SB2 and FR contact reading into the corresponding input images register, deposit register when an external contact closure is a binary number “1“, whereas in “0“. Enter sample end enter the program implementation phase, as shown in Figure 11.
When performing a 1th, 2 instructions, registers from the corresponding input I0.0 image information out of “1“ or “0“ and credited to “stack“ in Operations Manager.
When the 3rd instruction is executed, remove the corresponding output Q0.0 image information in the register “1“ or “0“, and with the content of the stack “or“ resulted in the stack (corresponding to the parallel circuit “or“ operation).
At the 4th and 5th instruction is executed, first remove I0.1 non-operational state data, and the data on the stack “and“ back into the stack, and then remove the I0.2 taking a non-operation status data, and data on the stack “and“ back again into the stack (the circuit corresponds to a line in “and“ operation).
When implementing article 6th, stack, binary data into the corresponding output Q0.0 image register.
When the implementation of the 7th directive, remove the output Q0.0 image binary data into a stack of registers.
When implementation of the 8th directive, remove the binary data into Q2.0 in the stack registers the corresponding image.
Implementation of the 9th directive, end user programs in a circular scanning process, beginning the next scanning process.
In the output stage of processing CPU will register each output image‘s binary data to the output latch. If Q0.0, Q0.1 corresponds to the output register contains the image of a binary number is “1“, the KM of external coils, LEDs HL1 power, in turn, will power down.
5) differences between relay control and PLC control
The principle of PLC program can be summarized as from top to bottom, from left to right, cycle, sequential execution. Control mode in parallel with relay control circuit of difference, as shown in Figure 12.
Figure 12A) in control charts, if relay control circuit, due to the parallel control mode, Q0.0 first coil winding Q0.1 powered on, and then since Q0.1 normally closed contacts disconnect, resulting in winding Q0.0 power.
If a ladder diagram control circuits, I0.0 once connected, winding Q0.0 power, Q0.1 power, completion of the 1th scan; 2nd scan, winding Q0.0 Q0.1 normally closed contacts disconnect the power, and the Q0.1 power.
Figure 12b) control charts, if relay control circuit, Q0.0 coil and coil Q0.1 first powered on, and then Q0.1 off.
If a ladder diagram control circuits, contact I0.0 is connected, so winding Q0.1 powered on, then 2nd scan, results for Q0.1 normally closed contacts disconnect winding Q0.0 still will not power on.
Third, the task
PLC elements described; reading PLC external wiring diagram; master basic drawing of PLC ladder diagram rules.
Information: sorted lecture notes
Decision: determine the basic links of electric control line as changing PLC controlled external wiring of CAD
Plan: the full voltage of the motor starting, for example, develop peripheral connection, plans to draw the corresponding PLC ladder diagram
Implementation: after school to complete PLC PLC controlled external wiring diagrams and ladder diagram of
Check: Panel cross assessment panel assessment