Tag Archives: plc courses

Siemens S7-200 PLC high-speed counter instruction Initialization

High speed counter instruction is initialized as follows:

(1) first scans through a special internal memory scanning cycle SM0.1 to call a subroutine to complete initialization. Because the use of subroutines, in subsequent scans, no need to call this subroutine, to reduce the scanning time, make the program better.

(2) in initial of of child program in the, according to hope of control set control word (SMB37, and SMB47, and SMB137, and SMB147, and SMB157), as set SMB47=16#F8, is for: allows count, writes new current value, writes new pre reset value, update count direction for added count, if for orthogonal count set for 4x, reset and up moving set for high level effective.

(3) execute HDEF instructions, sets the number of HSC (0-5), set the work mode (0-11). HSC‘s number is set to 1, enter work mode is set to 11, are both orthogonal count reset and start mode.

(4) the new current value current value write 32 bit registers (SMD38,SMD48,SMD58, SMD138, SMD148, SMD158). Write 0, clears the current value realized by MOVD instructions 0,SMD48.

(5) with a new preset value preset value write 32 bit registers (SMD42, SMD52, SMD62, SMD142, SMD152, SMD162). If execution of the MOVD instructions 1000,SMD52, set the preset value is 1000. If written to the preset value is 16#00, then high speed counter in the off position.

(6) in order to capture the current value equal to the preset value of events, conditional CV=PV interrupt events (event 13) associated with a break.

(7) in order to capture the change counting direction will change interrupt event (event 14) associated with a break.

(8) in order to capture the external reset, reset the external interrupt event (event 15) associated with a break.

(9) perform a global interrupt enable directive (ENI) allow HSC interrupted.

(10) S7-200 programming for the high speed counter HSC instruction is executed.

(11) the end subroutine.

Siemens S7 200 PLC high-speed counter (HC)

        High-speed counter for frequencies above scan cycle external signals are counted, using a dedicated high-speed counter terminals of the host to receive these high-speed signals. High-speed counter is a high-speed event counting, it is independent of the CPU scan, the data for the current value of high-speed 32-bit signed calculator.


HC [high-speed counter number] For example: HC1

S7-200 series PLC compare instruction

      SIEMENS S7-200 programming software in the STEP-7, a special compare instruction: IN1 and IN2 to compare the two data types can be B, I (W), D, R, that is, byte, word, integer, double word integers and real numbers; you can also have other comparative:>, <, ≥, ≤, , and so on. When the comparison satisfies the equation, then the contact is closed.

     LMODSOFT control and instruction: in LMODSOFT, there is no direct comparison of the number of instructions, but SUB instruction can be achieved by an integer comparison function three state output of the subtraction function after it.
If corresponds LMODSOFT the SUB instruction, should be in the STEP-7 instruction in three comparisons:> =, <, respectively corresponding to the three output SUB instruction; even if the corresponding ≥, ≤, or <>, according to different combinations of three outputs SUB instruction, may find the corresponding comparison instruction.

                                 For example: ① (30007)> (40030)
② (30007) = (40030)
③ (30007) <(40030)
① + ② (30007) ≥
② + ③ (30007) ≤ (40030)
① + ③ (30007) (40030)

S7-200 PLC high speed counter instructions

(1) each counter has a 32-bit high-speed current values of preset and a 32-bit value, current value, and default value for the signed integer values. To set the new high speed counter current and new preset values, you must set the control byte (table 6-7), making it the fifth and sixth bit is 1, allow update the preset value and the current value, the new current value and writes a new preset value special flag store. And then do the HSC instruction, set the new value to the high speed counter
Besides control bytes as well as the new preset value and the current value of bytes, but can also use data type HC (high-speed counter current value) and counter number (0, 1, 2, 3, 4, or 5) read each high speed counter‘s current value. Therefore, the read operation can be directly read the current value, but only with the HSC directives to perform write operations.
(2) before performing a HDEF instructions, high speed counter control byte bit must be set into the State, or else will use the default settings. Default settings: reset and start input active high, quadrature counting rate selection 4x mode. After performing a HDEF instruction, you can no longer change the counter sets, unless the CPU enters the stop mode.
(3) when you perform a HSC instruction, related to the CPU and check the control bytes current and preset values.

S7-200 PLC type of interrupt sources

S7-200 sets the interrupt function for real-time control, high-speed processing, communications and control of complex and special tasks such as network. Disruption is to terminate the currently running program, to carry out immediate interrupt service program has been developed in response to signals, is complete and then return terminated the program and continue to run.
Interrupt sources of interrupt request is issued, also known as interrupt event. For ease of identification, the system gives each interrupt source is assigned a number, known as an interrupt event. S7-200 series programmable controllers up to 34 interrupt sources, divided into three categories: loss of communication, time base and input/output interrupt interrupts.

(1) communications
In the free port mode, users can programmatically set the baud rate, parity, and the communication protocol and other parameters. User programmatic control of communication port event for loss of communication.

(2) the I/O interrupts
I/O interrupt include external input rising/falling edge interrupt, high speed and high speed pulse output interruption of their counter. S7-200 input (I0.0, I0.1, I0.2, or I0.3) rising/falling edge interrupts. These entry points are used to capture events that occur must be dealt with immediately. High-speed digital high speed counter in the counter running events that occur when the real-time response, including the current interrupts that occur when the value is equal to the default value, change counting direction when interrupted or counter external reset interrupt. Pulse output interrupt is scheduled to be completed number of pulse output and disruption.

(3) the time base break
Includes timer interrupt and timer T32/T96 interruption of their timing. A periodic timer interrupt is used to support activities. From 1 MS to 255 Ms cycle time, the time base is 1 Ms. Using the timer interrupt 0, must write a cycle time SMB34; using the timer interrupt 1, must be written in SMB35 cycle time. On the timer interrupt event will break the connection, if the timer interrupt allowed, you set start time, whenever the time value is reached, the interrupt programs. Timer interrupt can be used for analog input is sampled or regular PID loop. T32/T96 finger allows to set the time interval of the timer interrupts. Such disruption can only use timebase as 1ms timer T32/T96 component. When interrupts are enabled, current value equal to the preset value, the normal 1 millisecond timer S7-200 perform in the process of updating, the interrupt program execution.

S7-200PLC structure

1. Status indicator (LED) displays the CPU‘s job status.
SF–System Fault (System error)
2. Memory cards can be inserted memory card
3. Communication interface can be connected RS-485 communications cable
_ EMBED PBrush ___
4. Top cover bottom for output terminals and the PLC power supply terminal. Running from the top of the output terminal terminal block cover beneath a row of led displays, ON state of indicator lights.
_ EMBED PBrush ___
5. Below the bottom terminal cover for input and sensor power supply terminals. Running from the bottom terminal of input terminal cover above a row of led displays, ON state of indicator lights.
6. Front cover the following run, stop switch and interface module socket. Will switch to the stop position, the PLC is stopped, you can write the program. Will switch to the run position, PLC is running, you cannot write the program. To switch to the monitor (Term), you can run the program, and can also monitor the status of programs run. Interface socket for connecting expansion modules, implement I/O extension.

Siemens PLC interface module

S7-200 digital I/O module interface module, analog I/O modules and communication modules. These modules are introduced below.
(A) the digital I/O module
Digital I/O module is native integration to solve digital input/output points can not meet the need to use extension modules. S7-200PLC currently offers 3 categories in total, total 9 digital I/O module.
1. EM221 digital input extension module
8DI,DC24V (DC input)
2. EM222 digital output expansion module
8DO,DC24V (DC)
8DO,Relay (DC24V/AC24~230V) (relay output)
3. EM223 digital mix module
4DI(DC24V),4DO(Relay 2A)
8DI(DC24V),8DO(Relay 2A)
16DI(DC24V),16DO(Relay 2A)
(B) the analog I/O modules
Analog I/O module provides analog input and analog output extension. S7-200 analog expansion module with greater fitness and can be directly connected to the sensor, and a great deal of flexibility, and ease of installation.
1. EM231 analog input module
4AI (voltage or current) input signal ranges set by the SW1, SW2 and SW3.
2. EM232 analog output module
2AO (voltage or current)
3. EM235 analog mixed modules
4AI (voltage or current), the range set by the SW1~SW6
1AO (voltage or current)
(C) communication module
S7-200 series PLC in addition to CPU226 native has two communication ports other than, the other is in the integrated communications, communications with the RS-485 bus. In addition, the PLC can also access communication module in order to expand the number of its interface and the networking capabilities.
1. EM277 module
EM277 module PROFIBUS-DP Slave module also supports MPI from outbound traffic;
2. EM241: modem (Modem) communications module
3. CP243-1: industrial Ethernet communication module;
4. CP243-1 IT: industrial Ethernet communication module, while providing IT application such as Web/E-mail;
5. CP243-2:AS-master module can be connected to up to 62 as-I slave station.
S7-200PLC configuration is made up of S7-200CPU and the extension modules.

Structure of the Siemens S7 PLC timer

S7 clock time by time and time value is composed of two parts, time is equal to the product of time and timing values. When the timer runs, the timing values continue to lose 1, until reduced to 0, down to 0 means that the time to. Time after time to cause the timer contacts.

Timer No. 0 on the 11th store timing values in BCD code format, three-bit BCD code range is 0~999. 12th, 13 storage time base in binary format.

As can be seen from the following table: small time base timer resolution high but narrow time range; base at low resolution, wide timing range.
Time base binary base resolution timing range
10 s 00 0.01 s 10ms to 9s_990ms
100ms 0l 0.1 s 100ms to 1m_39s_900ms
1 s to 10 1S 1S 16m_39s
10 s 11 10 s 10s to 2h_46m_30s

When the timer starts, the accumulator 1 lowWord content is loaded by as time timing. The process is controlled automatically by the operating system, the user simply accumulators mount a different number, you can set the time you want.
Recommend the following intuitive syntax:
L W#16# txyz
Where: t,x,y,z is a decimal number;
T = time base, values of 0,1,2,3 to represent the time base for 10ms, 100ms, 1s, 10s.
XYZ= timing values, value range: 1 to 999.
Can also be used directly in S5, mounted timing values time notation, for example:
L S5T# aH_bbM_ccS_dddMS
Where: a= hours, BB= minutes, CC= seconds, DDD= milliseconds.
Range: 1MS to 2H_46M_30S; at this point, the time base is automatically selected, the principle is: according to the scheduled time can meet the requirements of timing range minimum time base.
S7-300 offers a variety of forms of timer: pulse timer (SP), extended timer (SE), ondelay timer (SD), connected with keep delay timer (SS) and power off delay timer (SF).

Siemens S7 series PLC types And application software

Germany Siemens (SIEMENS) produced by application of programmable logic controller in China is quite extensive, in the fields of metallurgy, chemical industry, printing production line are used. Siemens (SIEMENS) PLC of company products including LOGO,S7-200,S7-300,S7-400, industrial network, HMI HMI, industrial control software.
PLC Siemens S7 series of small size, speed, standardization, network communication capabilities, more powerful, more reliable. S7 PLC products can be divided into micro-PLC (S7-200), PLC small-scale performance requirements (such as S7-300) and PLC, high performance requirements (such as S7-400).

S7-200 PLC is the ultra small PLC, it applies to all walks of life, on various occasions in the detection, measurement and control. Power of S7-200 PLC to run stand-alone or connected network can achieve complex control functions.
S7-200 PLC offers 4 different basic models and 8 types of CPU available.

S7-300 is a modular mini PLC system, with moderate performance requirements of the application. Various combinations of separate modules for a wide range of different requirements of the system. Compared with the S7-200 PLC, S7-300 PLC has a modular structure with high-speed (0.6-0.1US) speed of instructions using floating point arithmetic more effectively to achieve a more complex arithmetic; a user-friendly software tool with a standard user interface for all modules for parameter assignment; within a convenient way of human-machine interface has been integrated in the S7-300 operating system, interactive programming requirements significantly reduced. SIMATIC human machine interface (HMI) getting data from S7-300, S7-300 according to the refresh rate of the data specified by the user. S7-300 operating system automatically to processing data of transfer; CPU of intelligent of of diagnosis system continuous monitoring system of function whether normal, and records errors and special system event (for example: timeout, module replaced, and so on); multilevel password protection can using user height, and effective to protection its technology confidential, prevent without allows of copy and modified; S7-300 PLC has operation way select switch, operation way select switch like key as can pulled out, dang key pulled out Shi, You can’t change mode of operation, thus preventing illegal delete or overwrite the user program.

With powerful communication capabilities, S7-300 PLC programming software Step7 user interface provides communication configuration feature, which makes configuration easy and simple. S7-300 PLC has a variety of different communication interfaces, and through a variety of communications processors to connect the as-I bus interface bus and industrial Ethernet system serial communications processor is used to connect to a point-to-point communication system multi-point interface (MPI) integrated in the CPU, used to connect a programming device, PC, human machine interface systems and other automated control systems such as SIMATIC S7/M7/C7.

S7-400 PLC is used in high-end performance range of programmable controllers.
S7-300 modular PLC fanless design, durable and reliable, while a variety of levels (functional escalation) of the CPU, and is equipped with a variety of templates for common functionality, which enables the user to combine different dedicated systems as needed. When expansion or upgrade of control system, as long as appropriate to add the template, will be able to upgrade the system to fully meet your needs.

4. Industrial communication networks
Communications network is the backbone of automation systems, Siemens totally integrated automation platform provides the network from the control level to the field-level consistency newsletters SIMATIC NET” is the General term for all network series, they can be in different parts of the plant, different station and Exchange data through different levels of automation, standard interfaces and are fully compatible with each other.

5. Human-machine interface (HMI) hardware
Use with PLC HMI hardware, provide data, graphics and event displays for users, mainly text operator panel TD200 (Chinese), PO3,OP7,OP17; OP27,OP37 graphics/text operator panel, touchscreen operator panel TP7,TP27/37,TP17A/B; PC670 SIMATIC Panel. Personal computer (PC) can also be used as HMI hardware. HMI Hardware require software (such as a ProTool) configuration to use with PLC.

6.SIMATIC, S7 software
Siemens industrial software is divided into three different categories:
(1) programming and engineering tools include all programming and engineering tools based on PLC or PC for programming, configuration, simulation and the tools required to maintain control. STEP 7 SIMATIC S7 standard package is for S7-300/400,C7 PLC SIMATIC WinAC and product configuration based on PC control programming and maintaining project management tools, STEP 7-Micro/WIN S7-200 series is running on a Windows platform of PLC programming, online simulation software.

(2) PC based control software based on WinAC PC control system allows you to use a personal computer as a programmable logic controller (PLC), the user running the program, running on Windows NT4.0 operating systems are installed the SIMATIC IPC or any other commercial aircraft. WinAC provides two PLC, is a softPLC, running on the user‘s computer as a Windows task. The other is slot PLC (a PC card that is installed on the user‘s computer), it has all functions of PLC hardware. WinAC and SIMATIC S7 series processors are fully compatible, uniform SIMATIC programming tools programming (STEP 7), the program can be run on WinAC, can also run on the S7 series processors.

(3) the HMI software automation project for the user interface software provides human-machine interface (HMI) or SCADA system, supports a wide range of platforms. Human-machine interface software, there are two, one is applied to the machine-level winccflexible, and the other is used to monitor levels of WinCC.

Winccflexible applies to the majority of HMI hardware configuration from the operator‘s Panel to a standard PC can be integrated in the winccflexible effectively complete configuration in STEP 7. Winccflexible for standard PC configuration and all Siemens HMI product, winccflexible not only the configuration software, its monitoring system running version for the Windows platform.

WinCC is a truly open, for the supervisory control and data acquisition SCADA (Supervisory Control and Date Acquisition) software that can run on any standard PC. WinCC simple operation, high reliability, integration with STEP 7 features, hardware failures can be directly into the PLC system, project development time savings. Its design is suitable for a wide range of applications, can be connected to the already existing automation environments, there is a lot of communication interfaces and comprehensive information and data processing capabilities, the latest WinCC5.0 support via IE browser dynamic monitoring of production processes in the Office.

S7-300 PLC CPU Panel features

1, load power supply module

Load power supply module is used to convert AC 220V power supply DC 24V, for use by the CPU and I/O module and other modules.

2, backup battery

Backup battery in the PLC is the role of power, to ensure the normal operation of the real-time CPU clock, and you can save a user‘s programs and data (in RAM). Some lower-end CPU because there is no real time clock, there is no backup battery.

3, DC 24V terminals

CPU outputs a DC 24V,L+ DC 24V anode and cathode respectively and m. Can be used as a CPU switch signal input or external power components.

4, mode selector switch

Mode selector switch used to select the operation mode of the CPU. The switch is a key switch, altering the way it needs to insert the key to prevent unauthorized people from changing the CPU operation mode.

Mode selector switch position as follows:

(1) RUN-P (runprogram) location: CPU not only execution of the program can also read and modify procedures and altering the way;

(2) RUN (run) position: CPU execution of the program can read the program, but you cannot modify the program;

(3) STOP (stop) position: CPU does not perform procedures, can read and modify procedures;

(4) the MERS (MEMORY CLEARED) location: can reset the memory, the CPU back to the initial state. This position cannot be maintained, when after the release and return to the STOP position.

5, status and fault led

(1) SF (system fault indicator, red): CPU hardware failure or a software error occurred frequently;

(2) the BATF (battery, red): low battery voltage or no batteries are often lit;

(3) DC 5V (+5V power supply, green): CPU and S7-300 bus +5V power supply normal bright at times;

(4) FRCE (mandatory instructions, yellow): at least one I/O is often by force;

(5) RUN (running instructions, green): CPU in RUN run as often, when booting with the 2Hz frequency of shiny, shiny HOLD State of 0.5Hz frequency;

(6) STOP (stop instructions, yellow): CPU at a STOP, HOLD the State often; request a memory reset blinking at a frequency of 0.5Hz being reset to 2Hz frequency flicker;

(7) the BUSF (bus fault indication, red): Profibud-DP interface to hardware or software failure is often light.

6, memory card

Memory card when the electricity was used to save user programs and data, you can extend the storage capacity of the CPU.

7, MPI interface

MPI interface for CPU and other PLC, PG/PC (PG/PC), OP (operator interface) via MPI network communications.

8, front connector

Front connector is used to connect sensors and actuators to the signal module, front cover (9).