Software and hardware design of electronic expansion valve test machine based on single chip microcomputer

Publisher:幸福时光Latest update time:2012-02-11 Source: 仪表技术 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Electronic expansion valve is an expansion valve controlled by electronic circuits. It is a key component in variable frequency air conditioning and refrigeration equipment. Since the electronic expansion valve can quickly adjust the valve opening according to the instructions of the CPU, quickly control the flow of refrigerant, and reduce the temperature difference between rooms, it can not only enhance the comfort of air conditioning, but also maximize energy saving.

The DPF series electronic expansion valve consists of a main valve and a stator coil. The driving component of the electronic expansion valve is a pulse stepper motor. There are many forms of actuators for electronic expansion valves, but there are few test machines specifically used to test the performance of expansion valves. Therefore, it is very meaningful to develop a suitable test machine to test some important performance and parameters of the DPF series electronic expansion valve, such as testing the life of the valve by cyclic opening and closing of the valve, and conducting flow coefficient, flow and valve opening experiments through the valve opening, etc.

1 System Hardware Design

The DPF electronic expansion valve tester is mainly controlled by keyboard operation. The main function keys of the system are divided into two categories: setting display keys and control keys. Setting display keys are mainly used to set and display tester parameters, and control keys are mainly used to control various performance tests of the valve.

The whole system adopts modular design. The system hardware circuit mainly consists of single chip microcomputer, keyboard, display, A/D sampling circuit, stepper motor drive circuit, etc. Its hardware circuit block diagram is shown in Figure 1.


Since the program is relatively large and has many intermediate variables, we use the AT89C52 microcontroller from ATMEL. It has 8KB of flash program storage space and 256 bytes of RAM. Because the test machine needs to protect the commonly used parameters, an EEPROM is connected to the microcontroller. In order to reduce the impact of the digital circuit on the analog drive circuit and the sampling circuit, an optocoupler is added between them for isolation.

In order to achieve the accuracy of the sampled voltage of 0.1%, this system uses the A/D acquisition chip MAX186 with internal sample holder and 12-bit serial output. In order to accurately control the conversion and transmission of data, the control pulse is sent through an I/O port using software. In this system, the interface between MAX186 and the microcontroller has four lines: conversion signal line (ADCS), clock line (CLOCK), data input line (MISO), and data output line (MOSI). The software uses the P1.6 and P1.7 ports of the microcontroller to simulate the ADCS and CLOCK timing, outputs the corresponding control word to MAX186 through the P1.4 port, obtains 12-bit voltage sampling data from P1.5, and stores it in the corresponding data storage area. Since the driving voltage of the stepper motor is generally 12V, and the maximum measurement value of MAX186 is 4.096V, the input voltage must also be reduced; in order to improve the load capacity, a voltage follower is also added in the middle. [page]

The working principle of the test machine is as follows: the single-chip computer controls the light position through 154, outputs the current segment code value through the B port of 8255 to refresh the display regularly, and scans the keyboard regularly through the C port of 8255. When a key is pressed, such as the "position 1" key, the CPU scans the state of the C port of 8255 and delays to remove the key jitter, confirming that the "position 1" key is pressed, so the system enters the "position 1" subroutine in the "control" module. The system calls the single-step rotation subroutine cyclically according to the number of pulses required for the expansion valve to turn to "position 1" and the current number of pulses. In the single-step rotation subroutine, the software writes the motor control byte to 8255, and inputs the stepper motor drive circuit through the A port of 8255, through the isolation of the optical coupler, and controls the forward and reverse rotation of the stepper motor by controlling the opening and closing of the power switch transistor, thereby realizing the opening and closing of the expansion valve. At the same time, the system changes the current "real-time pulse" value and displays it through the LED. In this way, the current valve opening can be known through the full pulse number and the "real-time pulse" value. During the rotation of the motor, the collected driving phase voltage value is sent to the single chip microcomputer through the sampling circuit and displayed in real time through the LED.

2 Software Design

In this program design, the event flags and time-sharing control methods are used to handle events. For example, in the T0 interrupt subroutine, the LED dynamic scan is performed every 1ms, and the keyboard is scanned every 60ms. When a "control" key value is obtained through the EX0 external interrupt subroutine, a corresponding flag is set in the main program. When entering the next T0 interrupt, in addition to processing the LED dynamic scan event, the T0 interrupt subroutine also controls the stepper motor drive pulse width; if the time slice at this time is 60ms, the keyboard scan event is also processed. In addition, in order to improve the real-time response of the event, we hand over the time-consuming part of the interrupt subroutine to the main program (the main program puts the processing results into the corresponding buffer). When the interrupt subroutine processes the corresponding event, it only needs to read the data from the buffer and put the data into the corresponding data area. For example, in this system, the parameter values ​​displayed by the LED need to be changed frequently through the keyboard. Then the system needs to make corresponding changes to the internal data stored in binary form corresponding to the parameters, and convert it into the corresponding seven-segment code and display it on the LED. At this time, the time-consuming data conversion process can be handed over to the main program. The main program puts the corresponding seven-segment code into a buffer. When entering the T0 interrupt subroutine to refresh the LED content, it only needs to write the data in the buffer to the corresponding port of 8255. Using this processing method, the system can handle various events in real time and in an orderly manner.

The whole software is designed by structured programming method. The program is divided into three modules: main program module, EX0 interrupt service subroutine module, T0 interrupt service subroutine module.

The main program module is divided into three subroutines according to its function: initialization subroutine, display setting subroutine, and control subroutine. Since the operation of the test machine is controlled by keyboard interrupts, the corresponding subroutine is entered by querying the key value in the main program. Its flow chart is shown in Figure 2. In the initialization subroutine, the system resources of AT89C52, such as timers and registers, are initialized, and the parameters stored in EEPROM are written to the corresponding RAM, 8255, parameter registers, etc.

In the setting display subroutine, the setting parameters are mainly displayed or changed according to the read key values ​​and saved to the corresponding EEPROM and RAM.

In the control subroutine, the motor is driven to perform corresponding actions, such as cyclic rotation or reset, according to the key values ​​read in and the set parameters. At the same time, the corresponding phase voltage is collected and the voltage value is stored in the corresponding buffer area.

3 Conclusion

At present, the test machine has been successfully used in the electronic expansion valve test system of a certain air-conditioning and refrigeration enterprise. After several months of operation, the situation is good and meets the customer's requirements.

References

[1] Weng Wenbing, Wang Jinzhu. Experimental study on refrigerant flow characteristics of electronic expansion valve[J]. Fluid Machinery. 1998, 26(10): 58~61.
[2] Zhong Hua, Chen Zhijiu. Identification of dynamic characteristics of electronic expansion valve[J]. Journal of Shanghai Jiaotong University, 1999, 33(8): 942~944.
[3] He Limin. Design of MCS51 series single chip microcomputer application system[M]. Beijing: Beijing University of Aeronautics and Astronautics Press,

Reference address:Software and hardware design of electronic expansion valve test machine based on single chip microcomputer

Previous article:Research on Magnetic Ruler Digitalization Technology Based on Single Chip Microcomputer and TDC
Next article:Design and implementation of frequency hopping controller based on 87C51FB single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
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号