Development of high-performance paperless recorders
2026-04-06 03:31:39··#1
1. Overview In industry, it is often necessary to record information such as temperature, pressure, and flow rate. Conventional analog recorders, due to their limited functionality, simple display, and the need for a recording pen, are being replaced by paperless recorders. As an intelligent instrument with a microprocessor as its core, integrating LCD Chinese character and graphic display, and featuring paperless recording, good real-time performance, good versatility, high accuracy, and communication capabilities, it has a broad market. Currently, many manufacturers are focusing on features such as color screens, large-capacity storage, and ultra-large LCD displays; however, for users, the most important factors are the instrument's overall performance, including accuracy, reliability, and cost-effectiveness. Therefore, researching these issues is particularly crucial. 2. Design Scheme As shown in Figure 1, analog signals (pressure, temperature, flow rate, etc.) from external sensors are processed by the front end and then converted from analog to digital (A/D). After signal isolation, the data is sent to the microcontroller for processing. The LCD displays current pressure, temperature, instantaneous flow rate, cumulative flow rate, and other information. Keyboard operation allows switching between interfaces to display real-time and historical data and curves for each channel, alarm status, power failure status, and monthly, daily, and annual cumulative flow rates. In addition, it provides communication functions, and can read and write parameters and running data with the host computer through the serial port to realize information interaction such as printing. 3. Hardware composition As shown in Figure 1, it consists of signal acquisition, MSP430F149 (hereinafter referred to as 430), LCD display and keyboard, data storage, real-time clock, communication and other modules. 3.1 MSP430F149 microcontroller [1] MSP430F149 is a highly integrated microcontroller with 60K flash ROM, 2K RAM, 6 ports, 2 16-bit counters, two UART communication ports, multiple interrupt modes such as port and counter, and 5 power saving modes. It is particularly suitable for the development of complex instrument systems. 3.2 Signal acquisition module External signals include standard current, resistance, mV voltage, frequency signal, etc. When it is an analog quantity, in order to improve the measurement accuracy, a CS5523 AD chip with 4-channel differential input, built-in instrument amplifier, filter with 16-bit precision, and SPI interface is used. It communicates with 430 after optical isolation. Figures 2(a), (b), and (c) show the processing circuits for current, thermocouple mV voltage, and RTD signal inputs, respectively. When the RTD input is used, a high-precision dual-channel precision current source REF200 is employed, ultimately connecting to the AD sampling terminal with the signal U=UAN+-UAN-=(Rt+2r)I0-(R0+2r)I0=(Rt-R0)I0. This eliminates the influence of the RTD wire resistance r, ensuring high measurement accuracy. When the frequency input (such as the output of a vortex flowmeter) is used, it is optically isolated and input to the TIMERA counting module of the 430 for pulse counting. 3.3 The LCD display and keyboard module uses a 3V, parallel input 128*64 dot matrix LCD module JM12864 to achieve comprehensive graphic and text display. It uses a 2*3 wire interface with six buttons: forward/backward recall, channel, time stamp, confirmation, and page turning. These buttons are connected to the P2 port of the 430 via a weak pull-up, and an interrupt notification is generated by the rising edge triggering method for processing by the 430. 3.4 Data Storage Module To facilitate the storage of instrument parameters and understanding of historical process parameters, two 24C512 EEPROM memories are used. One is used to store channel operation data, and the other is used for partitioned storage of density, Chinese characters and character font data, system parameters, recording time, power failure information, etc. The two memories are connected in parallel on the same bus through weak pull-up resistors. 3.5 Real-Time Clock Module To record system power failures and the current daily, monthly, and yearly cumulative flow, a real-time clock signal is required. A general-purpose DS1302 chip is used as the clock signal, with a farad capacitor as backup power. 4. Software Design 4.1 System Main Program and Interrupts As shown in Figure 3, the main program uses the detection time interval as the main thread, performing operations such as flow calculation and real-time information recording, while simultaneously handling various external events. As shown in Figure 4, the interrupt program detects various interrupts (0.5s acquisition timing provided by TIMERB continuous counting, keyboard interrupts, communication interrupts, etc.), performs necessary processing, records this information, and sends a flag to the main program for further processing. 4.2 Data Acquisition After resetting the chip, detecting and setting the Configuration register (including conversion mode, reset flag, amplifier cutoff frequency and other parameters), CSR (Channel-Setup register, including internal amplifier gain, data transmission rate, channel, input voltage polarity and other settings), send the start conversion command and wait for the conversion to complete (after completion, the SDO line will automatically become 0). It should be noted that the system reads the data when it is high level and latches the data when it is low level. The system timing must be strictly guaranteed, otherwise it will cause read and write errors. 4.3 Flow Calculation First, the volumetric flow rate of the flow meter under industrial conditions is obtained according to the flow model (square root, linear, etc.). Generally, it needs to be converted to the flow rate under industrial standard conditions. Here, according to the flow compensation mode in the instrument settings (general gas, temperature/pressure compensation, superheated steam, saturated steam, etc.), the density is obtained by looking up the table, and the standard flow rate is calculated to improve the accuracy [2][3]. 4.4 LCD Display Includes data and curve display, which is achieved by writing the corresponding LCD points as 1 or 0 (bright or dark). The 128-column * 64-row dot matrix LCD operates in byte mode during display, writing 1 column and 8 rows (a total of 8 dots) at a time. Therefore, when displaying data, the character pattern data corresponding to the character must first be written into the table in the order of left to right and top to bottom (column order). When displaying, the character pattern data can be written into the LCD by looking up the table in sequence. When displaying curves, the curves are displayed by connecting two points with a broken line, as shown in Figures 5 and 6. 4.5 Keyboard processing is responsible for interface switching (flow display, real-time/historical curve, setting mode, etc.), menu selection, parameter settings (including channel type, range, cut-off, alarm settings, flow model and coefficient K settings, flow compensation mode and formula parameter value settings, communication parameter settings, password settings, time settings, etc.). 5. Design key 5.1 Reasonable program flow (1) Message mechanism: The system needs to handle many events and various interruptions. If the interrupt handling time is too long, the system will not be able to perform other processing in time, resulting in system errors. If the flow calculation program is placed in the data acquisition timer interrupt handler, it may sometimes make it difficult for the system to complete normal serial communication. Here, the message processing mechanism of the WINDOWS system is referenced, as described in 4.1. That is, when the system has an external interrupt, only a few necessary operations are performed, and then the interrupt is marked. The main program checks this flag when it is idle. (2) Menu processing: The menu is positioned according to depth. The system has three levels of menus, represented by Step[3]. The current menu position is determined according to the Step[i] value to enhance the organization of the software. 5.2 Data storage efficiency The historical data of the channel to be recorded by the instrument is relatively long. In the limited storage space, all storage areas should be used efficiently. Here, the data is compressed by recording the proportion of each channel data to the channel range. The proportion is limited to 0-65535 (2 bytes, corresponding to 0-100%). For situations where the data requirements are not high, 1 byte is used to represent it. After multiple experiments, it is known that the recording length can be effectively extended. 5.3 Speed and accuracy of data operation (1) Although the 430 can perform floating-point operations, the operation will consume a lot of resources, and floating-point numbers can generally only retain 7 significant digits. Therefore, when performing large and small number operations, many significant digits will be lost, making the results extremely inaccurate. The author uses a combination of long integers to record significant digits and character integers to record the decimal point position to express the data, which effectively improves the speed and accuracy. (2) When the external signal is a frequency input, TIMERA should be configured to the maximum continuous counting mode. The overflow flag should only be cleared after the count overflows. Then, the pulse count should be obtained based on the difference between two pulses within 1 second (considering whether there is an overflow). Otherwise, pulses may be lost. (3) The accuracy of the acquired data is the main factor affecting the accuracy. The accuracy of the CS5523 reference voltage must be guaranteed, and sampling is required after the power supply is stable. After channel switching, the first conversion result should be discarded. Otherwise, it will cause a large interference error. Even so, due to the influence of circuit noise, standard resistor usage environment and wiring, sampling may sometimes be inaccurate. In this case, the CS5523’s own verification method is required to remove the offset voltage and enter the verification mode through software, and use the standard input signal for calibration. 5.4 The following practical measures are taken to ensure the reliability of the system: (1) Interference is mainly introduced through power supply and external input. In order to prevent the system from restarting or crashing unexpectedly, power supply filter and optocoupler isolation are used. (2) A watchdog is used to ensure that the system can automatically resume operation in case of failure [4]. (3) After writing data to LCD and EEPROM, the written data is read out immediately for verification to ensure that the data transmission is correct. (4) An internal backup power supply is used. After power failure, all data is automatically saved and the system enters a hibernation state. (5) The program structure is clarified and the modular method is used to improve portability. 5.5 The adaptability of the system Due to the diversity of industrial measurement media, the standard density tables of media are not the same. Moreover, with the continuous progress of sensor technology, new thermocouples or resistance thermometers may appear. To enhance system flexibility, special input types are reserved in the software. As long as the settings are in manufacturer mode, density or indexing table data can be written to the internal EEPROM via serial port. 6. Conclusion The author's innovations: The core design focuses on improving system accuracy, reliability, and ease of use. A high-precision self-calibrating acquisition scheme is adopted. The software borrows from the WINDOWS message mechanism, proposing solutions such as using integer data instead of floating-point arithmetic to improve speed and efficiency. Opening internal tables enhances system flexibility. Experiments show that the overall accuracy can reach over 0.2%, and it has good human-machine interface, adaptability, and reliability, thus showing broad application prospects. References: 1. Hu Dake. MSP430 Series FLASH Ultra-Low Power 16-bit Microcontroller [M]. Beijing: Beijing University of Aeronautics and Astronautics Press, 2001. 2. Zhu Zheng. Eliminating obstacles to the use of vortex flowmeters. Computer Measurement & Control, 2002, 10(7): 448-490 3 Wang Limai, Ji Gang. Implementation plan for temperature and pressure compensation in steam flow measurement. Petrochemical Automation, 1998, 3: 39-42 4 Zhang Jun, Peng Yige. Anti-interference technology of embedded system [J]. Microcomputer Information, 2006, 05-2: 17-18