Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Siemens S7- 1200 high-speed pulse acquisition function and its application
Siemens S7- 1200 high-speed pulse acquisition function and its application
In the data acquisition and processing of industrial field, sensors in the form of high-speed pulse signals such as flow, speed and torque are often encountered. This kind of sensor has high precision and strong anti-interference ability, and is favored by technicians. This paper expounds the function and application of Siemens S7- 1200 high-speed pulse collector with engineering examples.

1 Introduction. 1200 series cup high-speed counting channel

Siemens s7- 1200 series CPU modules generally have 3-6 high-speed pulse acquisition channels, as shown in figure 1. Independent of the CPU's scanning cycle counting, the highest frequency of single pulse can be measured to 100KHz, and the highest frequency of bidirectional or A/B phase is 30KHz. Besides counting, it can also be used for frequency measurement. High-speed counters can also be used to connect incremental rotary encoders.

Siemens 1200 series cup high-speed counting channel

2. Working mode of high-speed counter

The high-speed counter is defined as the following five working modes.

& lt counter, external reverse control.

& lt Single-phase counter, internal direction control.

& lt bidirectional reversible counter, double pulse input.

& ltA/B phase quadrature pulse input.

& lt monitor PTO output.

Each high-speed counter has two working states.

& lt External reset, no startup input.

& lt Internal reset, no startup input.

Note: All technical equipment only needs to directly enable the high-speed counter during configuration, and there is no need to set the startup conditions in the program.

Hardware input definition and working mode of Siemens 1200 series CPU high-speed counter

3. High-speed counter value lookup

As shown in Figure 3, the high-speed counter of Siemens 1200 series CPU is addressed. In high-speed counting measurement, all the measured data are stored in an image area, and the data is a 32-bit double signed number. As long as the high-speed counter is configured in the hardware configuration, it is not allowed to call related instructions and directly read the numbers in the default address.

For example, the default address of HSC 1 channel is ID 1000. If HSC is configured in counting mode, the value of ID 1000 is the current counting value. If HSC is configured in frequency measurement mode, the value of ID 1000 is the current frequency value. When configuring the hardware, you can specify the addressing address manually. Generally, it is best to use the default value without special requirements.

? Addressing of Siemens 1200 series CPU high-speed counter

4. Frequency measurement

Usually, high-speed pulse sensors, such as flow sensors, speed and torque sensors, measure the corresponding flow, speed and torque, and finally get the frequency value first, and then directly process the frequency to get the corresponding physical quantities such as flow, speed and torque. S7 1200 series CPU can directly set the counting channel as frequency measurement through hardware configuration. S7 1200 series CPU has three different evaluation and measurement periods: 1.0 second, 0. 1 second and 0.0 1 second. Under different working conditions, different measurement periods can be selected.

5. High-speed counter instruction

Through this instruction module, its parameters can be changed online. If you don't need to change the parameters, you don't need to call this instruction module, just access the addressing address directly in the program.

High speed counter instruction

6. Application example of high-speed pulse counting

Examples are given to illustrate the use of Siemens S7 1200 series PLC high-speed pulse acquisition.

Speed torque sensor with DC24V pulse signal

Working condition: As shown in the figure, the speed code of the torque speed sensor is 60, and the torque of -50N.m-50 N.m corresponds to 5K- 15K pulse.

The following describes the hardware configuration and data processing process.

◆ 1. Insert PLC 12 14CPU and configure its properties in the properties tab below.

◆ 2. Configure HSC 1 to measure speed and frequency, as shown in the figure, enable the high-speed counter and rename it to measure speed and frequency.

◆ 3. The counting type, frequency and working mode are selected as single phase, the counting direction is controlled by internal direction by default, and the evaluation period is 1 second.

◆ 4. The default input of the clock generator is I0.0, which is usually selected by default. For the default input channel, please refer to the previous description.

5. The default address is 1000, and the organization block can be updated automatically. After the configuration is completed, directly read the value of ID 1000 in the program, that is, the evaluation value of speed pulse.

◆ 6. Like speed measurement, refer to the above steps and configure HSC2 as torque frequency measurement.

7. High-speed pulse counting application data processing

Processing of rotating speed: the evaluation rate is f, which means that F pulses are collected in one second and 60f pulses are collected in one minute. The number of code disks is 60, which means that the speed sensor sends out 60 pulses every revolution. Then, the pulse of 60f per minute is 60f/60 revolutions, and the rotation speed is F revolutions per minute.

And: the formula for processing the rotating speed is: rotating speed =60f/ number of code disks (rpm).

Torque processing: the torque processing is relatively simple, and 5k- 15k linearly corresponds to -50n.m-50n.m ... only the evaluation value needs to be linearly transformed.

Note: The read ID 1000 value is an integer regardless of high-speed counting or frequency measurement. To convert it into the corresponding physical quantity, data conversion is needed first, and then data conversion is carried out.

8. Other matters needing attention in the application of high-speed pulse counting

On the property page of S7 1200CPU, input filters can be configured for digital input channels. If the input filter of the input channel is not configured correctly, it will lead to the failure to collect the results of high-speed pulses.

I didn't notice this when I was working on a specific project. I can collect analog pulses by hand, but not by speed and torque sensors. It was suspected that someone else's sensor was broken, and finally it took a lot of effort to find the reason.

Readers who encounter similar problems can change and configure the filter of the input channel to try.