Programming example of Siemens S7-1200 and encoder

Publisher:fnfeecjknqucLatest update time:2024-01-12 Source: elecfansKeywords:Siemens Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Connection between Siemens S7-1200 and incremental encoder

The digital input switch points of Siemens S7-1200 all provide a fast counter function for incremental encoder pulse signals. The single-phase signal reaches 200KHz, and the two-phase signal (which can be quadrupled and direction determined) reaches 80KHz. For the commonly used 2500PPR (resolution pulses per revolution), the fastest speed reaches 1920RPM (revolutions per minute).


The signal of the incremental encoder is a PNP unidirectional open-circuit signal. The recommended incremental encoder is a 10-30V push-pull output type, such as the GI58N incremental encoder.


2. Connection between S7-1200 and absolute encoder

The signal of the absolute encoder is not afraid of interference, and the data will not be lost during power outages. The PLC does not need to count the absolute encoder all the time, and does not need to calculate the interruption time for the CPU scan, thus saving CPU resources. Especially now that the market price of the absolute encoder has dropped significantly, and due to the improvement of data reliability, the use of the absolute encoder can save debugging time and reduce after-sales service costs. The actual use effect and cost performance are far better than those of the incremental encoder. More and more users tend to use absolute encoders in PLC position positioning.

Due to the economy of S7-1200, the more economical and convenient 4-20mA signal interface is preferred for connection with absolute encoders. Siemens S7-1200 plus SM1231 analog module can directly connect 2 absolute encoders with 4-20mA output interface.

Absolute encoders are divided into single-turn absolute encoders and multi-turn absolute encoders. Single-turn absolute encoders refer to encoders that rotate within 360 degrees or work within 0-180 degrees. For such encoders, 4mA corresponds to 0 degrees, 360 degrees (or 180 degrees) corresponds to 20mA, and the data in the PLC linearly corresponds to the angle value. Each value corresponds to a unique angle value. The data does not need to rely on counting, is not afraid of interference and power failure, and can be directly programmed and used. Single-turn absolute encoders are recommended to use GMS412.LB (code 9400S). This encoder can set the angle value and rotation direction corresponding to 20mA, and the zero offset. For example, 20mA can be set to correspond to 180 degrees, and the encoder works within 0-180 degrees.

In the PLC positioning control of length or height, the encoder is often required to rotate over a working range of 360 degrees, so a multi-turn absolute encoder is needed. There are two types of 4-20mA outputs of multi-turn absolute encoders. One type is a fixed-range multi-turn absolute value, such as 16 turns, 64 turns, and 256 turns, that is, the corresponding value of 20mA is the end point of 16 turns, 64 turns, or 256 turns. This type of encoder is more economical, and the recommended model is GEX60.LB.

The other type is an intelligent multi-turn absolute encoder. The 20mA can be set at any position between 1 and 4096 turns, and the zero offset can be set. The recommended model is GAX60.LB (code 9600). This encoder is widely used and has been successfully applied in many fields such as lifting, water conservancy, military industry, petroleum, chemical industry, and various industrial machinery.


3. Connection between S7-1200 and Modbus RTU signal

Siemens S7-1200 can be configured with the communication interface RS485, which can be connected to the RS485 signal of the absolute encoder, including single-turn absolute value and multi-turn absolute value. The RS485 signal of the absolute encoder has various forms, the more commonly used ones are simple RS485 broadcast mode (active broadcast transmission in master mode), free protocol with address sent by instruction (slave passive mode), Modbus RTU mode, etc. If only one absolute encoder is connected, the encoder active mode can be used, the protocol is simple and the signal is reliable, and if multiple encoders are to be connected (bus mode), the Modbus RTU mode can be selected, but this mode requires polling, and the data returned by each encoder is refreshed slowly, which is not suitable for fast-moving control.

Recommended active mode RS485 encoder, single-turn absolute value model is GES38.RDB, or GES60.RDB, or GMS412.LB (code 9400S); multi-turn absolute value model is GEX60.LB (64 turns), or GAX60.LB (code 9600) (4096 turns)

The recommended passive command mode RS485 encoder (can connect 1-9 encoders, including addresses) is GMS412.LB (code 9400S) for single-turn absolute value; GEX60.LB (64 turns) or GAX60.LB (code 9600) (4096 turns) for multi-turn absolute value.

The recommended encoder for Modbus RTU mode is GMS412.RMB for single-turn absolute encoders and GAX60.RMB for multi-turn absolute encoders (4096 turns).


4. Connection between S7-1200 and Profibus-DP signal

Siemens S7-1200 can be configured with Profibus-DP bus communication interface, which is the most commonly used output mode for European absolute encoders. Various European imported brand encoders can be selected, including domestic brand absolute encoders. This interface is a commonly used interface for Siemens, but the cost of the encoder with this interface is high, including the cost of configuring cable wiring. It is no longer suitable for the economy of 1200 and is not recommended here.


5. Practical cases

The connection between Siemens S7-1200 and the absolute encoder 4-20mA signal is used for simple positioning control;

Practical application introduction 1:

Single-machine and multi-machine control of water conservancy gate height, the lifting height of flood control, storage, water supply, sewage and other sluice gates across the country are lifted and closed by winch cranes (hoisting machines), and each gate station has 1-6 gate hoists. Siemens S7-1200PLC is connected to the 4-20mA interface of the absolute multi-turn encoder and configured with HMI, which can effectively complete such simple positioning control.

The encoder can be installed on the winch drum shaft or the reduction gear shaft. The number of revolutions required by the encoder is calculated in advance, and the 20mA output of the encoder is set to be greater than the number of revolutions, for example, 16 revolutions. In this way, each 1mA change in the 4-20mA output of the encoder corresponds to one revolution of the drum, and the height change of the gate lifting is calculated to control the opening and closing height of the sluice gate. The encoder model selected is the GAX60.LB (code 9600) recommended above, and the project application location: multiple sluices in Harbin, Northeast China, Changzhou, Jiangsu, etc.

Practical application introduction 2:

The hydraulic double cylinder lifting is controlled synchronously. Larger sluice gates need to be lifted by two hydraulic cylinders on the left and right to keep the positions synchronized to ensure smooth lifting and lowering of the gate. The original gate opening instrument of a sluice in Guangdong was only used for display. Because the reliability of the original display instrument was low and it could not complete the synchronous deviation correction and lifting control of the hydraulic cylinder, the user hoped to use a small and economical PLC plus HMI to replace the original instrument for display only, to improve the control reliability and programmability. The PLC selected Siemens S7-1200, and the encoder selected an absolute multi-turn encoder with a 4-20mA signal interface. Two GAX60.LB (code 9600) were installed with mechanical devices to correspond to the lifting heights of the left and right cylinders. The corresponding cylinder height of 6 meters corresponds to 20mA. The two 4-20mA signals were connected to the analog interface of S7-1200 and entered into the PLC to compare the two sets of data. The solenoid valves of the hydraulic systems of the left and right cylinders were controlled according to the height difference, and the flow of the left and right hydraulic oil circuits was adjusted to adjust the lifting or lowering speed and position difference of the cylinders to maintain the synchronous deviation correction and lifting control of the two cylinders. Siemens S7-1200 is equipped with two absolute encoder 4-20mA interfaces, which can well complete such synchronous deviation correction and lifting control source.

6. How to use PLC to connect the encoder and program

The hardware required is:

1. PLC: Siemens S7-1200-CPU1214C/DC/DC/DC, V4.1.

2. Encoder: E6B2-CWZ5B, PNP, incremental, 1000P/R

3. Encoder and PLC wiring

Brown: DC24V+

Blue: COM

Black: A, connected to I0.0

White: B, connected to I0.1

Orange: Z, connected to I0.3

The access points of AB can be defined by yourself, and do not have to be I0.0 and I0.1. Z cannot be changed.

4. Configure the high-speed counter; as shown below:

da37a320-82d5-11ee-939d-92fbcf53809c.jpg

da4ca0e0-82d5-11ee-939d-92fbcf53809c.jpg

da58e2b0-82d5-11ee-939d-92fbcf53809c.jpg

Here, select HSC1, select Enable high-speed counter, Count, A/B count, and Up count. Use the default address ID1000 as the counter address, or select others, which occupy four bytes.

5. Pay attention to the filter problem of the IO channel used; as shown below:

da64a140-82d5-11ee-939d-92fbcf53809c.jpg

The old version of CPU shields the filter when using the high-speed counter, so there is no need to consider it. However, the V4.1 version of the CPU does not shield it, so you must pay attention to this filter and the encoder's pulse frequency. If it is not appropriate, it will be filtered out.

6. Monitor the test results; as shown below:

da70385c-82d5-11ee-939d-92fbcf53809c.jpg

You can read it without writing a program. You only need some programs when you need some special functions, which are not introduced here.

7. Filter time and maximum frequency that can be detected; as shown below:

da773fbc-82d5-11ee-939d-92fbcf53809c.jpg


Keywords:Siemens Reference address:Programming example of Siemens S7-1200 and encoder

Previous article:Detailed steps of S7-1200 project download procedure
Next article:Features and differences of each series of Siemens PLC

Recommended ReadingLatest update time:2024-11-16 15:01

Siemens PLC inverter and touch screen control program
The control requirements for this task are as follows: 1. The motor speed control system consists of PLC, analog expansion module, touch screen and frequency converter, which requires strong control function and convenient operation. 2. The motor speed can be controlled by modifying and setting the m
[Embedded]
Siemens PLC inverter and touch screen control program
An article analyzing Siemens warm start/hot start/cold start
Siemens' OB100, OB101, and OB102 represent warm start, hot start, and cold start respectively. Let's explain these methods. ① Warm start (complete restart): Complete restart startup type, when starting, the process image and non-retentive flag memory, timer and counter are cleared, the retentive flag
[Embedded]
Denso deploys Siemens software portfolio to drive digitalization of automotive product design
Denso deploys Siemens software portfolio to drive digital transformation of automotive product design • Denso Corporation adopts Siemens Simcenter solution to build the technical foundation of model-based development (MBD/MBSE) • Model-based development processes and systems are widel
[Automotive Electronics]
Siemens Realize LIVE User Conference: Exploring the power of enterprise transformation under new infrastructure
From November 11th to 12th, Siemens Digital Industrial Software's "2020 Greater China Realize LIVE User Conference" was held online for the first time. As an annual event in the field of industrial software, this conference, with the theme of "Digital Intelligence Today, Shaping the Future Together", connects industry
[Internet of Things]
Siemens Realize LIVE User Conference: Exploring the power of enterprise transformation under new infrastructure
Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号