| As one of the important foundations of measurement science,flowmeters are of great significance to the improvement of product quality,production efficiency,and the development of science and technology.At present,automated production is the unquestionable development direction of industry and agriculture,and flow meters,as a key step in the measurement process,can have a great impact on production efficiency and product quality.The flowmeter is like a pair of eyes in the production process,collecting the data of each production link to make it run accurately and carefully.The target flowmeter can measure the flow of gas and liquid,and has been widely used because of its high accuracy and low cost.However,most of the current target flowmeters on the market use 51 single-chip or 430 single-chip microcomputers as the main control chip,and use the interrupt nested form for programming,which has weak computing power and poor code readability,which increases the difficulty of system function expansion.,It also limits the improvement of flowmeter accuracy.In this paper,the target flowmeter is applied to natural gas measurement under DN50 pipe diameter.STM32 single-chip microcomputer is selected and equipped with uCOS operating system.The following tasks have been completed:(1)Selecting STM32L073 CBT as the control module,based on the computing power of the 32-bit machine,enhances the system processing capacity;using ADS1248 as the sensor measurement chip,it can be used for strain bridge flow sensor,pressure sensor,Pt100 platinum resistance temperature sensor,battery power The detection of the four-channel voltage signal realizes the accurate measurement of the flow;writes the data calculation and processing program,and realizes the storage of the flow data.(2)The uCOS-Ⅲ operating system is transplanted on the STM32 single-chip microcomputer,and the program of each module is encapsulated into tasks.The module is called through the task priority and task state switching.The logic is clear.Compared with the traditional bare-metal programming method,The code has good standardization,strong readability,and strong equipment scalability,which provides convenient conditions for adding chipsets such as NB-IOT.(3)Two communication modes of RS485 and HART communication are realized,and two signal output methods of 4-20 m A current and pulse output are realized at the same time,which can be verified and used in a variety of situations.The human-computer interaction program is realized,and the input of system parameters and the switch of working mode can be carried out.(4)Two forms of power supply are designed: lithium battery and external 24 V direct current.When powered by lithium battery,the system needs only 1.35 m A current while ensuring accurate measurement,which can run under two lithium battery power supplies.More than three years.Finally,based on the above work,the experimental platform was used to test the relative error and repeatability of the target flowmeter.After linear compensation for each flow point,the target flowmeter reached the level 1.0 measurement in the national standard.Precision requirements. |