The high-speed counter application training of the PLC programmable training device is an important practical project in the field of automatic control. Through this training, one can master the practical application of high-speed counters in industrial automation. The following is a detailed introduction:
First, practical training objectives
Knowledge objective: Master the basic principles, programming methods and application scenarios of high-speed counters, and understand the differences between them and ordinary counters.
Skill Objective: Be proficient in programming with high-speed counter instructions to achieve the counting and control of high-speed pulse signals, and cultivate the ability to solve practical engineering problems.
Quality objectives: Enhance the awareness of engineering practice, cultivate a rigorous and meticulous working attitude, and improve teamwork and communication skills.
Second, practical training content and steps
(1) Cognition of High-speed Counters and Basic Programming
Cognitive learning: Understand the definition, classification (such as single-phase single-count input, single-phase dual-count input, dual-phase dual-count input, A/B phase orthogonal counter, etc.) and working mode of high-speed counters (the modes of high-speed counters of different brands of PLCS vary; for example, Siemens S7-200SMART offers multiple modes).
Basic programming: Taking the FX series PLC as an example, the address numbers of its high-speed counters are C235-C255, all of which are 32-bit power-off holding type bidirectional counters. Before use, a high-speed counter needs to be defined in the program (such as defining the number and working mode with the HDEF instruction), and then it can be started through the HSC instruction. For example, define the high-speed counter C235 as the increasing count mode. When it reaches the set value K100, output the YO state ON. The system automatically allocates X0 as the input terminal for the count signal, X1 controls the increase or decrease of the count, and X2 is the reset terminal.
(2) High-speed Counter Simulation Control Training
Analog control case: The high-speed counter of the S7-200PLC accumulates pulses from the analog/frequency converter (A/F) to simulate the voltage value. Suppose the frequency converter converts the input voltage (0-10V) into a rectangular pulse signal (0-2000Hz), and sends it to the input terminal of the CPU's high-speed counter to accumulate the number of pulses. When the preset interval time arrives, the measured analog voltage value is calculated by accumulating the number of pulses.
Programming and debugging: In the first scanning cycle of the main program, call the initialization program, set the control byte of the high-speed counter, write the initial value and preset value, define the working mode, connect the interrupt and write the interrupt program, etc. Then execute the HSC instruction to start the high-speed counter. In the timed interrupt program, the value of the high-speed counter is read out for calculation and display.
(3) Practical Training on high-speed Counter Speed measurement control
Speed measurement control case: Utilizing a high-speed counter to measure the motor speed involves the calculation of the number of pulses and the motor speed.
Programming and debugging: During the first scanning cycle of the PLC being powered on and running, execute the initialization subroutine, set the control bytes of the high-speed counter, define the working mode, set the timing interrupt, etc., and start the high-speed counter. In the interrupt program, the current count value of the high-speed counter is accumulated, and the number of accumulative times is recorded. When the number of accumulative times reaches a certain value, the average value of the accumulated pulse numbers is calculated, and then the motor speed is calculated. Data storage and zeroing operations are performed to facilitate the next restart of accumulation.
(4) Practical training on the connection between high-speed counters and encoders
Connection method: In practical engineering, high-speed counters are mostly connected to incremental rotary encoders for detecting displacement, speed, etc. Rotary encoders are generally coaxial with the controlled motor. Each rotation cycle, they can emit a certain number of counting pulses and one reset pulse, which serve as the input for high-speed counters.
Practical training operation: According to the type of encoder (such as single-channel, dual-channel, and three-channel incremental encoders) and the working mode of the PLC high-speed counter, reasonably connect the output signal of the encoder to the input terminals of the PLC high-speed counter. For instance, A dual-channel incremental encoder outputs two independent pulse sequences with a phase difference of 90°. The PLC can identify the rotation direction of the rotating shaft and connect it to the input terminal of a high-speed counter that supports orthogonal counting of A/B phases for programming and debugging, thereby achieving precise measurement of displacement and speed.
Third, key points and precautions of practical training
Hardware connection: Ensure that the input terminal of the high-speed counter is correctly connected to the device that generates high-speed pulse signals. The input points of high-speed counters for different models of PLCS are fixed and need to be wired according to the predetermined number and mode. Meanwhile, note that the same input point cannot be used for two different functions simultaneously, but the input points not used in the current mode of the high-speed counter can be used for other functions.
Programming and debugging: During programming, high-speed counter instructions (such as HDEF and HSC instructions) should be used correctly, and parameters such as control bytes, initial values, and preset values should be set reasonably. During the debugging process, simulation debugging is conducted first to observe whether the changes in the counting values of the high-speed counter are in line with expectations, and then the actual equipment debugging is carried out.
Safety regulations: During the practical training, one must abide by the safety operation procedures and strictly follow the arrangements of the instructor for power-on and debugging operations to ensure personal and equipment safety.