+86-182-9191-0663 丨  sales@hiltechgroup.com | support@hiltechgroup.com

About Us

Since 1998 丨 HILTECH®

You are here: Home » News » News » Siemens S7-200 series PLC programming skills

Siemens S7-200 series PLC programming skills

Views: 0     Author: Site Editor     Publish Time: 2022-06-17      Origin: Site

S7-200 Programmable Logic Controller ( PLC )

Siemens S7-200 is a programmable logic controller, which is an electronic system for digital operation, specially designed for application in industrial environment. It uses programmable memory to store instructions for performing logic operations, sequence control, timing, counting and arithmetic operations in it, and controls various types of machinery or machinery through digital or analog inputs and outputs. production process. The programmable logic controller and its related peripheral equipment should be designed according to the principle of being easy to integrate with the industrial control system and easy to expand its functions.

Siemens S7-200 series programmable controllers include CPU21x series, CPU22x series, of which CPU22X programmable controllers provide 4 different basic models, the common ones are CPU221, CPU222, CPU224 and CPU226 four basic models.

Characteristics of Siemens S7-200 series CPU22X four types of PLCs

(1) Integrated 24V power supply. Can be directly connected to sensors and transmitter actuators, CPU221 and CPU222 have 180mA output. CPU224 output 280mA, CPU226, CPU226XM output 400mA can be used as load power.

(2) High-speed pulse output. It has 2 high-speed pulse output terminals, and the output pulse frequency can reach 20KHz, which is used to control the stepper motor or servo motor to realize the positioning task.

(3) Communication port. CPU221, CPU222 and CPU224 have one RS-485 communication port. CPU226 and CPU226XM have 2 RS-485 communication ports. Support PPI, MPI communication protocol, with free port communication capability.

(4) Analog potentiometer. CPU221/222 has 1 analog potentiometer, and CPU224/226/226XM has 2 analog potentiometers. The analog potentiometer is used to change the value in the special register (SMB28, SMB29) to change the parameters when the program is running. Such as the preset value of timer and counter, and the control parameter of process quantity.

(5) The interrupt input allows a faster response to the rising edge of the process signal.

Siemens PLC and S7-200 series have powerful functions and reliable performance, but when performing mathematical operations, they cannot perform automatic conversion of variable types like high-level languages, and often require manual operations.

Transformations like i and itd require dti and other post-calculation time-consuming operations, increase the number of lines of code, reduce the readability of the program, reduce the efficiency of the program, make the code look cleaner, and greatly shorten the scan of the program cycle.

This is a typical idea of exchanging space for time when designing algorithms in computer programming. The programmable logic controller of Siemens PLC agent is essentially a computer dedicated to industrial control, and its hardware structure is basically the same as that of a microcomputer. The power supply is used to convert the AC power to the DC power required by the PLC. Currently, most programmable logic controllers are powered by switching regulated power supplies. For example, a word Variable is often converted into a double-word variable in calculation, then when we define symbols, let the variable occupy the double-word storage space and clear the unused words, then we can access the variable in the form of font or double-word at the same time , without the need for special conversions.Siemens S7-200 for sale -Hiltech

Siemens PLC, S7-200 series (series) memory data format is just the opposite of our country's commonly used PC, it is before the high word and after the low word. Siemens PLC is also widely used in my country, and has different applications in the fields of metallurgy, chemical industry, and production lines of printing enterprises. The PLC products of Siemens subsidiaries mainly include LOGO, S7-200, S7-1200, S7-300, S7-400 and so on. Siemens S7 series PLC is small in size, fast in speed and standardized, with Chinese network information and communication technology capabilities, stronger functions and high reliability. Our teacher can put the last two control bytes in the word variable. When the program is initialized, the system will clear the first two family bytes. The working program does not use and manage these two characteristic bytes.

For example, when we defined the symbol, we defined the word Variable to define VW2 while keeping the value of VW0 at zero.

To avoid confusion, it is best to distinguish between word classes and bigrams by explicit symbol definitions. It is strongly recommended to use prefixes to indicate the type of variables and to capitalize meaningful English words for variable names. I'm used to pasting:

b----byte variable byte

w---- font variable word

d----double word variable double

r----real variable real

f----bit variable flag

btn---self-reset button input (shū) input (shūrù) button

sw---- switch or self-locking (self locking) button input (shū) input (shūrù) switch

sig---sensor, coding and other level signal input (shū) into signal

rly---output (shū) output relay (function: automatic adjustment, conversion circuit, etc.) bit relay

Of course, this is a personal habit, there is no rule, the main thing is to help you differentiate.

There is a type variable named VarName. To use the previous conversion skill (Skill), we can define it like this:

wVarName----VW2

dVarName----VD0

Clearing VW0 during program initialization does not require memorizing a variable, but clearing dVarName directly can also set VW0 to zero in the data block. The programmable logic controller of Siemens PLC agent is essentially a computer dedicated to industrial control, and its hardware structure is basically the same as that of a microcomputer. The power supply is used to convert the AC power to the DC power required by the PLC. Currently, most programmable logic controllers are powered by switching regulated power supplies. WVarName is used when you need to access variables of type word, and dvvarname is used when you need to access variables of double word type. No need for type conversion at all.

This method can greatly reduce the number of working program statements, making the program more concise and more readable. It does not require us to do a time-consuming conversion of different types, and the operation and management efficiency of the program system is also improved. . And the greater the amount of mathematical operations, the more obvious the continuous improvement of efficiency.

The downside is that it takes an extra two bytes of memory and cannot use (use) vw0 in later processes (processes). But the memory space of Siemens s7-200 series is very large, and generally it will not be used up. Taking Siemens plc as an example, cpu226 has up to 10kram, and I have never exceeded 1k.

In the same way, font variables usually need to be converted to each other with font variables, allowing word count variables to waste a font width and avoid type conversion.