Fuel measurement control system based on 1-wire bus
Patent Information
- Application Number
- CN202611315689.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-10-30
AI Technical Summary
[0005]本发明的目的在于提供一种基于1-Wire总线的燃油测量控制系统,以解决现有燃油测量控制系统存在的上述技术问题
本发明基于1-Wire总线的单片机对A/D转换芯片、FRAM 存储芯片、I/O扩展芯片等外围功能芯片进行读写操作,完成模拟量到信号量的转换、实时参数及其数据保存以及离散信号读取等功能;数据处理模块通过1-Wire总线连接A/D采样模块、数据存取模块、离散量输入识别模块和离散量输出控制模块,极大的简化了硬件电路设计。各器件间的连接简洁明了,简化了测量控制系统的电路结构。
Smart Images

Figure CN123010560A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of fuel measurement technology, specifically relating to a fuel measurement and control system based on a 1-Wire bus. Background Technology
[0002] With the development of digital technology, digital computer technology has been widely adopted in signal processing in modern control, communication and detection fields to improve system performance. Since the actual objects of the system are often analog quantities, most controllers cannot directly process analog signals. Therefore, A / D conversion chips are needed to convert analog signals into digital signals. The general method is to use parallel A / D conversion chips, but their interface circuits are cumbersome and occupy too many I / O pins.
[0003] External data storage can save user program files and user raw data, as well as various status information and intermediate results during system operation. Traditional expansion methods are too cumbersome and consume too many controller resources. Moreover, in the case of power failure data protection, faster data transmission is required, which traditional methods cannot meet.
[0004] In control systems, discrete signals from other devices are often received in response to the occurrence of an event. These signals are typically connected to the controller's I / O ports and identified by reading the I / O port status. However, a system may have anywhere from a few to dozens of switching signals, making it impractical to identify discrete signals through I / O ports. Summary of the Invention
[0005] The purpose of this invention is to provide a fuel measurement and control system based on a 1-Wire bus to solve the above-mentioned technical problems existing in the existing fuel measurement and control systems.
[0006] This invention is achieved through the following technical solution: A measurement and control system based on a 1-Wire bus includes a power supply module, a data processing module with a microprocessor, and an I / O controller. 2 The module includes a C-to-1 Wire converter, an A / D analog-to-digital converter, a data storage and retrieval module, a discrete input identification module, and a discrete output control module. The microcontroller in the data processing module communicates via I 2 The C-to-1-Wire module sends control commands to the A / D analog-to-digital converter to achieve the conversion of analog signals to digital signals, converting them into I / O signals via the 1-Wire bus. 2Data is read and processed after the C interface is used; the discrete input identification module converts the timing output of the microcontroller pins, and after the conversion is completed, serial data is read through the 1-Wire bus; all data generated during the data processing is written to the data access module through the 1-Wire bus.
[0007] In some embodiments, the RESET signal in the data processing module is connected to the reset circuit and the JTAG interface for microcontroller reset; the OSC1 and OSC2 signals are connected to the crystal oscillator circuit to generate the clock signals required by the microcontroller; the SCL and SDA signals are the 1-Wire bus clock and data signals, used to implement I / O. 2 The C module handles data writing and reading operations; the TCK, TMS, TDO, and TDI signals are connected to the JTAG interface for programming and emulating microcontroller programs; the RXD and TXD signals are connected to the communication interface for RS-422 communication with external devices.
[0008] In some embodiments, the communication interface includes a D210 isolated RS-422 interface chip and peripheral circuitry; the peripheral circuitry includes a transient suppression circuit and a current limiting circuit; the current limiting circuit includes current limiting resistors R209, R210, R211, and R213; the transient suppression circuit includes a transient suppression diode V201 connected between current limiting resistors R209 and R210 and a transient suppression diode V202 connected between current limiting resistors R211 and R213.
[0009] In some embodiments, the data access module uses a ferroelectric memory U2, which provides data write protection through the DATAWR_WP signal. Data can only be written to U2 when the signal is set to a low level.
[0010] In some embodiments, the discrete input recognition module includes an I... 2 The C-interface I / O expansion chip U1 and the first opto-isolation circuit; the first opto-isolation circuit uses an opto-isolation device D110 for isolation of external input signals, and the front end of the opto-isolation device is provided with a first current-limiting resistor, and the rear end of the opto-isolation device is connected to U1.
[0011] In some embodiments, the discrete output control module includes an I... 2 The C-interface I / O expansion chip U6 and the second opto-isolation circuit; the second opto-isolation circuit uses a solid-state relay D111, and the front end of the solid-state relay is provided with a second current-limiting resistor.
[0012] In some embodiments, the power module includes a filter circuit, a lightning protection circuit, a reverse connection protection circuit, and a DC-DC conversion circuit; The filtering circuit includes feedthrough capacitor C1, feedthrough capacitor C2 and inductor L1; the lightning protection circuit includes TVS diodes V1 and V2.
[0013] In some embodiments, the I 2 The C-to-1-Wire module includes a 1-Wire master controller N8, a decoupling capacitor C601, and terminating resistors R601, R602, R603, R604, R605, R606, R607, and R608.
[0014] Compared with the prior art, the present invention has the following advantages and beneficial effects: This invention utilizes a 1-Wire bus-based microcontroller to read and write peripheral functional chips such as A / D conversion chips, FRAM storage chips, and I / O expansion chips, performing functions such as analog-to-signal conversion, real-time parameter and data storage, and discrete signal reading. The data processing module connects to the A / D sampling module, data storage module, discrete input identification module, and discrete output control module via the 1-Wire bus, greatly simplifying the hardware circuit design. The connections between the components are concise and clear, simplifying the circuit structure of the measurement and control system.
[0015] The core components in the system all have a 1-Wire interface, using a 1-Wire bus for data reading. The 1-Wire bus requires only one wire for input / output, meeting data acquisition requirements. For processors without a 1-Wire bus, data can be read via I / O. 2 The conversion is achieved through a 1-Wire module; using the 1-Wire bus interface not only simplifies circuit design, saves interface devices and I / O interface lines in conventional circuits, and improves the reliability of the design, but also allows the 1-Wire bus to form various systems under software control, with strong compatibility and good versatility.
[0016] In this invention, a microcontroller in the data processing module sends control commands to the A / D converter via a 1-Wire bus to achieve the conversion of analog to digital quantities. The switch quantity identification module outputs the conversion timing through the pins of the microcontroller and reads serial data through the 1-Wire bus, thereby enhancing the compatibility and versatility of the system.
[0017] The data processing module of this invention connects the A / D sampling module, data access module, discrete input identification module, and discrete output control module through the hardware address lines of each chip via SCL and SDA, thereby increasing the scalability of the system.
[0018] All modules of this invention adopt the 1-Wire bus method. System expansion can be completed simply by selecting a functional chip with a 1-Wire interface and mounting it on the 1-Wire bus, which simplifies the hardware circuit design. By controlling multiple peripheral devices with 1-Wire bus, such as external data memory, A / D conversion chip and shift register, through a microcontroller chip with only one 1-Wire bus, it can provide analog signal acquisition interface, key data access interface and switch signal acquisition interface for systems such as aircraft, automobiles and ships. Attached Figure Description
[0019] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings in the embodiments will be briefly described below. It should be understood that the following drawings only show some embodiments of the present invention and should not be regarded as a limitation on the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0020] Figure 1 This is a block diagram illustrating the principle of the fuel measurement and control system according to an embodiment of the present invention.
[0021] Figure 2 This is a schematic diagram of the circuit principle of the data processing module in an embodiment of the present invention.
[0022] Figure 3 This is a schematic diagram of the crystal oscillator circuit in an embodiment of the present invention.
[0023] Figure 4 This is a schematic diagram of the reset circuit in an embodiment of the present invention.
[0024] Figure 5 This is a schematic diagram of the JTAG interface principle in an embodiment of the present invention.
[0025] Figure 6 This is a schematic diagram of the communication interface principle in an embodiment of the present invention.
[0026] Figure 7 This is a schematic diagram of the A / D analog-to-digital conversion module circuit according to an embodiment of the present invention.
[0027] Figure 8 This is a schematic diagram of the data access module circuit in an embodiment of the present invention.
[0028] Figure 9 and Figure 10 This is a schematic diagram of the discrete input recognition module circuit in an embodiment of the present invention.
[0029] Figure 11 and Figure 12 This is a schematic diagram of the discrete output control module circuit in an embodiment of the present invention.
[0030] Figure 13This is a schematic diagram of the power module circuit in an embodiment of the present invention.
[0031] Figure 14 This is Embodiment I of the present invention. 2 Schematic diagram of the C-to-1-Wire module circuit. Detailed Implementation
[0032] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.
[0033] Currently, more and more chips are adopting the 1-Wire bus interface, which allows MCUs to exchange information with various peripheral devices using only one data line. This technology is widely used in instrumentation, industrial control, and digital home appliances.
[0034] Reference Figure 1 In some embodiments of the present invention, the measurement and control system based on a 1-Wire bus includes a power supply module, a data processing module containing a microprocessor, and an I / O circuit. 2 The system includes a C-to-I-Wire module, an A / D analog-to-digital conversion module, a data storage module, a discrete input identification module, and a discrete output control module. The microcontroller in the data processing module communicates with I / O via I / O. 2 The C-to-1-Wire module sends control commands to the A / D analog-to-digital converter to achieve the conversion of analog signals to digital signals, converting them into I / O signals via the 1-Wire bus. 2 After the C interface is used, data is read and processed; the discrete input identification module converts the timing output of the microcontroller's pins, and after the conversion is completed, serial data is read through the 1-Wire bus; data generated before and after the data processing process can be written to the data access module through the 1-Wire bus.
[0035] like Figure 2The data processing module can use an AVR microcontroller U3 as the data processor, specifically the ATMEGA16 model. The RESET signal is connected to the reset circuit and JTAG interface for microcontroller reset; OSC1 and OSC2 signals are connected to the crystal oscillator circuit to generate the clock signals required by the microcontroller; and SCL and SDA signals are the 1-Wire bus clock and data signals, used to implement I / O. 2 The C module handles data writing and reading operations; the TCK, TMS, TDO, and TDI signals are connected to the JTAG interface for programming and emulating microcontroller programs; the RXD and TXD signals are connected to the communication interface for RS-422 communication with external devices.
[0036] like Figure 3 The crystal oscillator circuit consists of crystal oscillator X1, oscillation capacitors C2 and C3, which provide an 8MHz clock signal for the microprocessor U3 circuit to ensure that the microcontroller executes the predetermined program.
[0037] like Figure 4 The reset circuit mainly consists of resistor R1 and capacitor C1, which provides a reset pulse to the microprocessor U3 when powered on to ensure that the microcontroller is reset normally. The light-emitting diode D1 and resistor R2 are power indicator circuits used to indicate whether the +5V power supply is normal.
[0038] like Figure 5 The JTAG interface is mainly implemented by connecting the J2 socket to the microprocessor U3 for related signal connection, and performs functions such as program simulation and program burning through the emulator.
[0039] like Figure 6 The communication interface is mainly composed of the D210 isolated RS-422 interface chip ADM2687EBRIZ and its peripheral circuits to achieve electrical isolation between the front and back ends. V201 and V202 are transient suppression diodes used to ensure that the signal voltage is within a controllable range. Resistors R209-R211 are current limiting resistors to prevent large currents from appearing on the signal lines.
[0040] like Figure 7 The A / D analog-to-digital converter module can be composed of an I-type converter. 2 The A / D conversion chip U4 with C interface is used. The data processing module writes the corresponding control commands to the A / D conversion chip through the 1-Wire bus to realize the conversion, and sends the results back to the data processing module for processing through the 1-Wire bus.
[0041] like Figure 8The data access module is essentially an external data storage device with a 1-Wire bus interface. Important parameters such as the status and real-time parameters of the fuel measurement and control system can be written to the data access module via the 1-Wire bus, and the data can be read out for analysis via the 1-Wire bus. The data access module can be implemented using a ferroelectric memory U2. The DATAWR_WP signal is for data write protection; data can only be written to U2 when this signal is set to a low level, thus preventing accidental data writes. Data processed by the data processing module can be written to the ferroelectric memory via the 1-Wire bus, and can also be read from the memory via the 1-Wire bus for computation.
[0042] like Figure 9 and Figure 10 The discrete input recognition module mainly consists of I... 2 It consists of a C-interface I / O expansion chip U1 and an opto-isolation circuit. Figure 9 In the U1, 16 channels (DIS_01-DIS_16) of discrete input recognition can be achieved. Figure 10 In this configuration, an opto-isolator D110 is used to isolate the external input signal. A current-limiting resistor is added to the front end of the optocoupler to ensure its normal operation. A 5V pull-up resistor is installed at the rear end of the optocoupler, directly connected to... Figure 9 When the optocoupler is connected to U1, the microprocessor detects a state of 0 when the optocoupler front end receives a ground signal, and vice versa.
[0043] like Figure 11 and Figure 12 The discrete output control module mainly consists of I... 2 It consists of a C-interface I / O expansion chip U6 and an opto-isolation circuit. For example... Figure 11 U1 can achieve 16 discrete outputs (OUT_01-OUT_16). For example... Figure 12 Isolation is achieved using an opto-isolator (solid-state relay) D111. A current-limiting resistor is added to the front end of the solid-state relay to ensure its normal operation. When the control signal (OUT_01-OUT_16) is low, the LED at the front end of the solid-state relay is activated, the output of the solid-state relay is turned on, external devices are connected to 28VGND, and the device starts working. When the control signal is high, the LED at the front end of the solid-state relay is deactivated, the output of the solid-state relay is disconnected, the device is disconnected from 28VGND, and the device stops working.
[0044] like Figure 13The power module includes a filter circuit, a lightning protection circuit, a reverse connection protection circuit, and a DC-DC converter circuit. Feedthrough capacitors C1 and C2, along with L1, filter input power noise to improve electromagnetic compatibility. TVS diodes V1 and V2 protect the power output signal; when the voltage exceeds the expected range, the TVS diodes conduct and clamp to the expected voltage value, thus protecting the subsequent circuits. N1 is the DC-DC converter circuit, converting the external 28V voltage to 5V to power the subsequent circuits. The wire-wound filter inductor Z1 suppresses common-mode interference on the 5V power supply. Filter capacitors C3 and C4 further filter the power supply, ensuring that the output +5V voltage meets the power quality requirements of the subsequent circuits.
[0045] like Figure 14 I 2 The C-to-1-Wire module consists of a 1-Wire main controller N8, a decoupling capacitor C601, and terminating resistors R601 to R608. N8 is an I-Wire main controller. 2 A C-to-1 Wire bridging device that can be directly connected to a standard (100kHz maximum) or fast (400kHz maximum) I-Wire. 2 C host connection, complete I 2 Bidirectional protocol conversion between the C master and any downstream 1-Wire slave device provides eight independent 1-Wire I / O channels. 2 The C slave device address allocation is controlled by three binary address inputs to resolve issues with other I / O operations in the system. 2 C addresses the potential address conflict issues with slave devices, and can be expanded up to [number missing] times. One 1-wire path.
[0046] In 1-Wire bus applications, when switching analog multiplexer (MUX) channels, the newly connected 1-Wire bus branch, due to its large cable parasitic capacitance, can momentarily "pull" the bus level low, causing the master controller to misinterpret it as "slave device not present" or "bus short circuit." This invention introduces "electrical pre-adjustment" into the logic control layer, completing the "capacitor discharge" and "level pre-establishment" of the physical layer before digital communication, completely eliminating switching shocks.
[0047] Specifically, the following steps are included: S01, the microcontroller controls the enable terminal of the analog multiplexer (MUX) to physically disconnect the currently communicating old channel (let's call it channel A); at this time, the bus of channel A is in a high-impedance floating state.
[0048] S02. The microcontroller will force the GPIO pin (not the 1-Wire data pin) connected to the MUX common terminal (COM terminal) to output a low level for 2ms to 5ms. This is used to discharge the residual charge accumulated on the common terminal during the old channel switching, prevent it from being superimposed on the initial level of the new channel, and eliminate the bus "memory effect".
[0049] S03, Microcontroller output channel selection code, switch MUX to target channel B; do not connect the 1-Wire master controller data line first, only connect the pull-up resistor of this channel (an independent weak pull-up provided by the system power module, such as 10kΩ).
[0050] S04. Using the aforementioned independent weak pull-up power supply, precharge the bus cable of channel B for 1ms to 3ms. In this step, the parasitic capacitance of the cable is fully charged to a high level in advance to avoid generating a huge instantaneous sink current when the 1-Wire master controller is connected later.
[0051] S05. The microcontroller detects the bus level of the ADC channel (or comparator); only after confirming that the level has stabilized above Vcc×0.9 is the next step allowed. Otherwise, a "line capacitor overload" fault is reported, and the pre-charging time is automatically extended (adjustable up to 10ms).
[0052] S06, The microcontroller sends a control signal to I 2 The data pins of the C-to-1 Wire module (such as DS2482) are connected to channel B via an analog switch; since the bus level is already high, no level drop will occur when the master controller is connected.
[0053] S07, I 2 The C-to-1-Wire module, according to the standard protocol, sends a 480μs low-level reset pulse followed by a 60μs to 240μs release recovery period. Since pre-charging has been completed, the rising edge of the reset pulse has a steep slope and no hook, allowing the slave device to respond stably to the "present pulse" signal.
[0054] S08. The main controller reads the presence pulse. If the detection is successful, the device ROM address of channel B is registered in the microprocessor's cache; if it fails, an additional "forced pull-up (SPU)" attempt is immediately performed (lasting 100μs) to deal with individual high-impedance devices.
[0055] S09. If the A / D analog-to-digital converter module is mounted on the target channel: I 2 The C-to-1-Wire module sends a conversion command, the microcontroller controls the power module to activate the "strong pull-up (SPU)" to provide a large current, waits for the conversion to complete, and then converts it to I-band via the 1-Wire bus. 2 Read ADC data after using the C interface.
[0056] If it is a discrete input identification module connected to the target channel: the microcontroller pin outputs a specific conversion timing (such as reading the DS2405 status), and after the conversion is completed, serial data is read through the same bus.
[0057] S10. The microprocessor immediately writes the valid data (with the channel B number tag and timestamp) it reads into the data access module (such as the DS2431 EEPROM) via the 1-Wire bus. This step is completed during channel B communication, and no other operations are allowed before the channel is switched to ensure the atomicity of the write transaction.
[0058] S11. After all commands for the current channel have been executed, the microcontroller will I... 2 The C-to-1 Wire module is placed in "idle" mode and disconnected from channel B.
[0059] S12. Instead of immediately switching to the next channel, leave the bus of channel B floating for 200μs. This quiet period is used to allow the 1-Wire slave device on channel B to completely exit the internal transition state, preventing its internal state machine residue from affecting the next round of polling.
[0060] S13. If the system needs to poll the next channel, return to step S02 to start repeating; if it is a single trigger, the microcontroller enters a low-power standby state.
[0061] S14. If any of the above channels still cannot detect a valid presence pulse after precharging, the microcontroller immediately cuts off the power supply to the channel and pulls the bus low for 1 second, forcing all slave devices on that branch to undergo hardware reset, and then re-executes steps S03 to S08 to eliminate the device "deadlock" fault.
[0062] This invention utilizes common GPIO and timers, eliminating the need for external dedicated chips, resulting in low cost and excellent compatibility with the hardware architecture characteristic of "discrete inputs being output timing by MCU pins".
[0063] The above description is merely a preferred embodiment of the present invention and is not intended to limit the present invention in any way. Any simple modifications or equivalent changes made to the above embodiments based on the technical essence of the present invention shall fall within the protection scope of the present invention.
Claims
1. A measurement and control system based on a 1-Wire bus, characterized in that, Includes a power supply module, a data processing module containing a microprocessor, and I... 2 The module includes a C-to-1 Wire converter, an A / D analog-to-digital converter, a data storage and retrieval module, a discrete input identification module, and a discrete output control module. The microcontroller in the data processing module communicates via I 2 The C-to-1-Wire module sends control commands to the A / D analog-to-digital converter to achieve the conversion of analog signals to digital signals, converting them into I / O signals via the 1-Wire bus. 2 Data is read and processed after the C interface is used; the discrete input identification module converts the timing output of the microcontroller pins, and after the conversion is completed, serial data is read through the 1-Wire bus; all data generated during the data processing is written to the data access module through the 1-Wire bus.
2. The measurement and control system based on a 1-Wire bus according to claim 1, characterized in that, In the data processing module, the RESET signal is connected to the reset circuit and the JTAG interface for microcontroller reset; the OSC1 and OSC2 signals are connected to the crystal oscillator circuit to generate the clock signals required by the microcontroller; the SCL and SDA signals are the 1-Wire bus clock and data signals, used to implement I / O. 2 The C module handles data writing and reading operations; the TCK, TMS, TDO, and TDI signals are connected to the JTAG interface for programming and emulating microcontroller programs; the RXD and TXD signals are connected to the communication interface for RS-422 communication with external devices.
3. The measurement and control system based on a 1-Wire bus according to claim 2, characterized in that, The communication interface includes a D210 isolated RS-422 interface chip and peripheral circuitry; the peripheral circuitry includes a transient suppression circuit and a current limiting circuit. The current limiting circuit includes current limiting resistors R209, R210, R211, and R213. The transient suppression circuit includes a transient suppression diode V201 connected between current limiting resistors R209 and R210, and a transient suppression diode V202 connected between current limiting resistors R211 and R213.
4. The measurement and control system based on a 1-Wire bus according to claim 1, characterized in that, The data access module uses a ferroelectric memory U2, which provides data write protection through the DATAWR_WP signal. Data can only be written to U2 when this signal is set to a low level.
5. The measurement and control system based on a 1-Wire bus according to claim 1, characterized in that, The discrete input recognition module includes an I... 2 The C-interface I / O expansion chip U1 and the first opto-isolation circuit; the first opto-isolation circuit uses an opto-isolation device D110 for isolation of external input signals, and the front end of the opto-isolation device is provided with a first current-limiting resistor, and the rear end of the opto-isolation device is connected to U1.
6. The measurement and control system based on a 1-Wire bus according to claim 1, characterized in that, The discrete output control module includes an I... 2 The C-interface I / O expansion chip U6 and the second opto-isolation circuit; the second opto-isolation circuit uses a solid-state relay D111, and the front end of the solid-state relay is provided with a second current-limiting resistor.
7. The measurement and control system based on a 1-Wire bus according to claim 1, characterized in that, The power module includes a filter circuit, a lightning protection circuit, a reverse connection protection circuit, and a DC-DC conversion circuit; The filtering circuit includes feedthrough capacitor C1, feedthrough capacitor C2 and inductor L1; the lightning protection circuit includes TVS diodes V1 and V2.
8. The measurement and control system based on a 1-Wire bus according to claim 1, characterized in that, The I 2 The C-to-1-Wire module includes a 1-Wire master controller N8, a decoupling capacitor C601, and terminating resistors R601, R602, R603, R604, R605, R606, R607, and R608.
