A microcontroller-based AD acquisition method, circuit, and vehicle

By using a microcontroller-based AD acquisition method, combined with external and internal reference voltage signals, the problem of inaccurate reference voltage in vehicle controllers is solved, enabling accurate detection of analog signals, reducing costs, and making it suitable for AD acquisition in vehicles.

CN115580304BActive Publication Date: 2026-05-26WEICHAI POWER CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEICHAI POWER CO LTD
Filing Date
2022-10-27
Publication Date
2026-05-26

Smart Images

  • Figure CN115580304B_ABST
    Figure CN115580304B_ABST
Patent Text Reader

Abstract

This invention discloses a microcontroller-based analog-to-digital (AD) acquisition method, circuit, and vehicle. The microcontroller includes a reference signal input terminal, a calibration signal input terminal, and an AD acquisition terminal. The reference signal input terminal is electrically connected to an external reference voltage source, the calibration signal input terminal is electrically connected to a calibration source, and the AD acquisition terminal is electrically connected to an analog signal acquisition circuit. The AD acquisition method includes: acquiring a calibration voltage signal through the calibration signal input terminal and acquiring an external reference voltage signal through the reference signal input terminal; determining whether to acquire an analog voltage signal through the AD acquisition terminal based on the calibration voltage signal and the internal reference voltage signal; if so, acquiring the analog voltage signal through the AD acquisition terminal; during the acquisition of the analog voltage signal through the AD acquisition terminal, determining the signal quantity of the analog voltage signal based on the external reference voltage signal, enabling relatively accurate detection of the acquired analog voltage signal value. The process is simple, efficient, low-cost, and suitable for widespread use.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of AD acquisition technology, and in particular to an AD acquisition method, circuit, and vehicle based on a microcontroller. Background Technology

[0002] Vehicle controllers typically need to collect various analog signals about the vehicle, and usually require a reference voltage as a benchmark to determine the signal strength of the analog signals.

[0003] The reference voltage can be provided by an external reference voltage source, or the reference voltage inside the vehicle controller can be used as the reference voltage for AD acquisition. Figure 1 This is a schematic diagram of an AD acquisition circuit for an on-board controller in the prior art, such as... Figure 1 As shown, the microcontroller U1 can be applied to the vehicle controller U0 in a vehicle. In the scheme of using an external reference voltage source to provide a reference voltage for the vehicle controller, the battery E0 is electrically connected to the power supply terminal VDD of the vehicle controller U0 to provide a power supply voltage for the vehicle controller U0, and is also electrically connected to the power supply terminal of the external reference voltage source 10. The output terminal of the external reference voltage source 10 is electrically connected to the reference signal input terminal VREF of the vehicle controller U0. The external reference voltage source 10 can provide an external reference voltage to the vehicle controller U0 according to the output voltage of the battery. Usually, the power supply voltage of the external reference voltage source 10 is greater than the power supply voltage of the vehicle controller U0. During use, the battery E0 undergoes repeated charging and discharging processes. When the vehicle is powered on, the voltage of the battery E0 increases to the power supply voltage required for the normal operation of the vehicle controller U0, but does not increase to the power supply voltage required for the normal operation of the external reference voltage source 10. When the voltage of the vehicle controller U0 increases to the reference voltage provided by the external reference voltage source 10, the vehicle controller U0 starts to measure the collected analog signal (the analog signal collected by the acquisition terminal AVN of the vehicle controller U0) with the reference voltage provided by the external reference voltage source 10. However, at this time, because the power supply voltage of the external reference voltage source 10 does not meet its operating requirements, the reference voltage output by it is inaccurate, which leads to the inaccurate measurement of the analog signal by the vehicle controller U0.

[0004] In schemes that directly use the reference voltage inside the vehicle controller as the reference voltage for measuring analog signals, there is a problem that larger analog signals (typically 0-5V) cannot be measured using a relatively low internal reference voltage (usually around 1.2V). To meet the requirements for measuring larger analog signals, an additional voltage divider circuit is usually required for each AD acquisition channel, thus introducing measurement accuracy errors. Furthermore, the reference voltage source inside the vehicle controller has significant accuracy errors and poor stability, especially in harsh operating environments ranging from -40℃ to 125℃, where temperature drift is pronounced.

[0005] A few solutions can directly use a high-performance, high-precision external reference source, which can output a high-precision reference voltage before the vehicle controller is working properly. However, it is difficult to achieve this with domestic reference voltage chips. If foreign reference voltage chips are used, the cost will be high and it will not be suitable for widespread use, even if the required performance and accuracy are met. Summary of the Invention

[0006] This invention provides a microcontroller-based AD acquisition method, circuit, and vehicle, which can accurately detect the signal quantity of the analog voltage signal after acquisition.

[0007] According to one aspect of the present invention, a microcontroller-based AD acquisition method is provided. The microcontroller includes a reference signal input terminal, a calibration signal input terminal, and an AD acquisition terminal. The reference signal input terminal is electrically connected to an external reference voltage source, the calibration signal input terminal is electrically connected to a calibration source, and the AD acquisition terminal is electrically connected to an analog signal acquisition circuit. The microcontroller-based AD acquisition method includes:

[0008] The calibration voltage signal is obtained through the calibration signal input terminal, and the external reference voltage signal is obtained through the reference signal input terminal.

[0009] Based on the calibration voltage signal and the internal reference voltage signal, determine whether to acquire an analog voltage signal through the AD acquisition terminal;

[0010] If so, then the analog voltage signal is acquired through the AD acquisition terminal;

[0011] During the process of acquiring analog voltage signals through the AD acquisition terminal, the signal quantity of the analog voltage signal is determined based on the external reference voltage signal.

[0012] Optionally, determining whether to acquire an analog voltage signal through the AD acquisition terminal based on the calibration voltage signal and the internal reference voltage signal includes:

[0013] The first signal quantity of the calibration voltage signal is determined based on the internal reference voltage signal;

[0014] The first voltage output by the calibration source is determined based on the first signal quantity of the calibration voltage signal;

[0015] Until it is determined that the first voltage reaches the first preset voltage value, the analog voltage signal is then acquired through the AD acquisition terminal.

[0016] Optionally, determining whether to acquire an analog voltage signal through the AD acquisition terminal based on the calibration voltage signal and the internal reference signal includes:

[0017] The reference flag is determined based on the calibration voltage signal and the internal reference voltage signal;

[0018] The reference flag is used to determine whether to acquire an analog voltage signal through the AD acquisition terminal.

[0019] Optionally, determining the reference flag bit based on the calibration voltage signal and the internal reference voltage signal includes:

[0020] The second signal quantity of the calibration voltage signal is determined based on the internal reference signal;

[0021] The first voltage output by the calibration source is determined based on the second signal quantity of the calibration voltage signal;

[0022] The reference flag is determined as the first flag when the first voltage reaches the first preset voltage value.

[0023] Optionally, controlling the AD acquisition terminal to acquire analog voltage signals according to the reference flag bit further includes:

[0024] When the reference flag is determined to be the first flag, the AD acquisition terminal is controlled to acquire the analog voltage signal.

[0025] Optionally, the microcontroller also includes a power supply terminal;

[0026] Before controlling the calibration signal input terminal to acquire the calibration voltage signal and controlling the reference signal input terminal to acquire the external reference voltage signal, the method further includes:

[0027] The power supply voltage signal is obtained through the power supply terminal;

[0028] Until the power supply voltage signal increases to the second preset voltage value, the reference flag is determined to be the second flag; and the steps of controlling the calibration signal input terminal to acquire the calibration voltage signal and controlling the reference signal input terminal to acquire the external reference voltage signal are executed.

[0029] According to another aspect of the present invention, a microcontroller-based AD acquisition circuit is provided, comprising: a microcontroller, a calibration source, an external reference voltage source, and an analog signal acquisition circuit;

[0030] The microcontroller includes a reference signal input terminal, a calibration signal input terminal, and an AD acquisition terminal;

[0031] The input terminal of the external reference voltage source is electrically connected to the calibration source, and the output terminal of the external reference voltage source is electrically connected to the reference signal input terminal of the microcontroller.

[0032] The calibration signal input terminal is electrically connected to the calibration source;

[0033] The input terminal of the analog signal acquisition circuit is used to acquire the initial analog signal, and the output terminal of the analog signal acquisition circuit is electrically connected to the AD acquisition terminal.

[0034] The microcontroller is used to execute the aforementioned microcontroller-based AD acquisition method.

[0035] Optionally, the microcontroller-based AD acquisition circuit further includes: a voltage divider circuit;

[0036] The input terminal of the voltage divider circuit is electrically connected to the calibration source, and the output terminal of the voltage divider circuit is electrically connected to the calibration signal input terminal of the microcontroller.

[0037] Optionally, the microcontroller-based AD acquisition circuit further includes: a DC-DC converter;

[0038] The microcontroller also includes a power supply terminal;

[0039] The input terminal of the DC-DC converter is electrically connected to the calibration source 20, and the output terminal of the DC-DC converter is electrically connected to the power supply terminal.

[0040] According to another aspect of the present invention, a vehicle is provided, including the above-described microcontroller-based AD acquisition circuit.

[0041] The microcontroller-based AD acquisition method provided in this invention acquires an external reference voltage signal through a reference signal input terminal and a calibration voltage signal through a calibration signal input terminal. This allows the microcontroller to determine whether the acquired external reference voltage signal is standard based on the calibration voltage signal and the internal reference voltage signal. After confirming the standardity of the external reference voltage signal, an analog voltage signal is acquired through the AD acquisition terminal. At this point, the signal strength of the analog voltage signal can be determined based on the external reference voltage signal, enabling relatively accurate detection of the acquired analog voltage signal value. This microcontroller-based AD acquisition method is simple and efficient, and can be implemented with a relatively simple AD acquisition circuit, resulting in low cost and suitability for widespread use.

[0042] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0043] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0044] Figure 1 This is a schematic diagram of an AD acquisition circuit for an on-board controller in the prior art;

[0045] Figure 2 This is a schematic diagram of an AD acquisition circuit based on a microcontroller provided in an embodiment of the present invention;

[0046] Figure 3 This is a flowchart of an AD acquisition method based on a microcontroller provided in an embodiment of the present invention;

[0047] Figure 4 This is a flowchart of another microcontroller-based AD acquisition method provided in an embodiment of the present invention;

[0048] Figure 5 This is a schematic diagram of another microcontroller-based AD acquisition circuit provided in an embodiment of the present invention;

[0049] Figure 6 This is a flowchart of another microcontroller-based AD acquisition method provided in the embodiments of the invention;

[0050] Figure 7 This is a flowchart of another microcontroller-based AD acquisition method provided in the embodiments of the invention. Detailed Implementation

[0051] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0052] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0053] Figure 2 This is a schematic diagram of a microcontroller-based AD acquisition circuit provided in an embodiment of the present invention, as shown below. Figure 2 As shown, the microcontroller U1 includes a reference signal input terminal VREF, a calibration signal input terminal AVN1, and an AD acquisition terminal AVN2. The reference signal input terminal VREF is electrically connected to an external reference voltage source 10, the calibration signal input terminal AVN1 is electrically connected to a calibration source 20, and the AD acquisition terminal AVN2 is electrically connected to an analog signal acquisition circuit 30.

[0054] Based on the above-described AD acquisition circuit, this embodiment of the invention provides an AD acquisition method based on a microcontroller, which can be executed by the microcontroller in the AD acquisition circuit based on a microcontroller provided in this embodiment of the invention.

[0055] Figure 3 A flowchart of a microcontroller-based AD acquisition method provided for an embodiment of the present invention is shown below. Figure 3 As shown, the method includes:

[0056] S110. Obtain the calibration voltage signal through the calibration signal input terminal and obtain the external reference voltage signal through the reference signal input terminal.

[0057] Specifically, calibration source 20 may include a battery E0 capable of providing a DC voltage signal. Battery E0 may also be electrically connected to an external reference voltage source 10 to provide a power supply voltage to the external reference voltage source 10. Calibration source 20 is electrically connected to the calibration signal input terminal AVN1 of microcontroller U1, providing a calibration voltage signal to AVN1. In other feasible embodiments, calibration source 20 may also include a voltage divider circuit. Calibration source 20 is electrically connected to the calibration signal input terminal AVN1 of microcontroller U1 via the voltage divider circuit, in which case the calibration voltage signal is the voltage output by calibration source 20 after being divided by the voltage divider circuit. External reference voltage source 10 is electrically connected to the reference signal input terminal VREF of microcontroller U1, providing an external reference voltage signal to VREF. Thus, after normal operation, microcontroller U1 can obtain the calibration voltage signal in real time through the calibration signal input terminal AVN1 and the external reference voltage signal through the reference signal input terminal VREF.

[0058] S120: Determine whether to acquire the analog voltage signal through the AD acquisition terminal based on the calibration voltage signal and the internal reference voltage signal; if yes, execute S130.

[0059] S130: Acquire analog voltage signals through the AD acquisition terminal.

[0060] Specifically, the microcontroller U1 has an internal reference source that can provide a small internal reference voltage signal (usually around 1.2V). This reference voltage signal cannot be used to measure larger analog signals, especially analog signals larger than this internal reference voltage signal. Therefore, after the microcontroller U1 obtains the calibration voltage signal, it can first determine whether the external reference voltage signal is standard based on the calibration voltage signal and the internal reference signal. After determining that the external reference voltage signal is a standard reference voltage, it controls the AD acquisition terminal to acquire the analog voltage signal.

[0061] S140. During the process of acquiring analog voltage signals through the AD acquisition terminal, the signal quantity of the analog voltage signal is determined based on the external reference voltage signal.

[0062] Specifically, after determining the analog voltage signal to be acquired through the AD acquisition terminal based on the calibration voltage signal and the internal reference voltage signal, the microcontroller U1 starts to acquire the analog voltage signal through the AD acquisition terminal. The external reference voltage signal is preferably set to be greater than the analog voltage signal acquired by the AD acquisition terminal. In this way, the analog voltage signal acquired by the AD acquisition terminal can be measured by the external reference voltage signal to determine the voltage value of the analog voltage signal. That is, the signal quantity of the analog voltage signal can be determined by the external reference voltage signal.

[0063] For example, when it is determined that the analog voltage signal cannot be acquired through the AD acquisition terminal based on the calibration voltage signal and the internal reference voltage signal, the analog voltage signal is not acquired through the AD acquisition terminal, and the process returns to step S110, that is, the step of acquiring the calibration voltage signal through the calibration signal input terminal and acquiring the external reference voltage signal through the reference signal input terminal.

[0064] For ease of explanation, this embodiment of the invention only illustrates the example of a single-chip microcomputer U1 including one AD acquisition terminal. It is understood that the single-chip microcomputer can be configured to include multiple AD acquisition terminals according to design requirements to acquire various analog voltage signals. This embodiment of the invention does not specifically limit this.

[0065] The present invention provides a microcontroller-based AD acquisition method. The microcontroller acquires an external reference voltage signal through a reference signal input terminal and a calibration voltage signal through a calibration signal input terminal. This allows the microcontroller to determine whether the acquired external reference voltage signal is standard based on the calibration voltage signal and the internal reference voltage signal. After confirming the standardity of the external reference voltage signal, an analog voltage signal is acquired through the AD acquisition terminal. At this point, the signal strength of the analog voltage signal can be determined based on the external reference voltage signal, achieving relatively accurate detection of the acquired analog voltage signal value. This microcontroller-based AD acquisition method is simple and efficient, and can be implemented with a relatively simple AD acquisition circuit, resulting in low cost and suitability for widespread use.

[0066] Optional, Figure 4 This is a flowchart of another microcontroller-based AD acquisition method provided in an embodiment of the present invention, such as... Figure 4 As shown, the method includes:

[0067] S210. Obtain the calibration voltage signal through the calibration signal input terminal and obtain the external reference voltage signal through the reference signal input terminal.

[0068] S220. Determine the first signal quantity of the calibration voltage signal based on the internal reference voltage signal.

[0069] Specifically, Figure 5 This is a schematic diagram of another microcontroller-based AD acquisition circuit provided in an embodiment of the present invention, as shown below. Figure 5As shown, the microcontroller-based AD acquisition circuit also includes a voltage divider circuit 40. The input terminal of the voltage divider circuit 40 is electrically connected to the battery E0, and the output terminal of the voltage divider circuit 40 is electrically connected to the calibration signal input terminal AVN1 of the microcontroller U1. Assuming that the internal reference voltage signal of the microcontroller U1 is 1.2V and the maximum voltage that the battery E0 can output is 32V, the voltage divider circuit 40 can be set to provide a calibration voltage signal to the microcontroller U1 that does not exceed 1.2V when the voltage output by the battery E0 is 32V. In this way, the voltage range of the calibration voltage signal is less than or equal to the internal reference voltage signal. The internal reference voltage signal can be used as a standard to measure the calibration voltage signal and to determine the voltage value of the acquired calibration voltage signal, that is, the first signal quantity of the calibration voltage signal.

[0070] S230. Determine the first voltage output by the calibration source based on the first signal quantity of the calibration voltage signal.

[0071] For details, please refer to Figure 5 The voltage divider circuit 40 includes a first resistor R1 and a second resistor R2. The calibration signal input terminal AVN1 of the microcontroller U1 is electrically connected to the battery E0 through the first resistor R1, and the calibration signal input terminal AVN1 is also grounded to GND through the second resistor R2. Assuming that the first voltage output by the battery E0 is V1, the calibration voltage signal provided to the calibration signal input terminal AVN1 of the microcontroller U1 after being divided by the voltage divider circuit 40 is V1*R2 / (R1+R2). Therefore, after determining the first signal quantity of the calibration voltage signal, the first voltage output by the battery E0 can be determined by the above relationship.

[0072] S240. Determine whether the first voltage is greater than or equal to the first preset voltage value; if so, execute S250.

[0073] S250: Acquires analog voltage signals through the AD acquisition terminal.

[0074] Specifically, the first preset voltage value can be the supply voltage required for the external reference voltage source 10 to operate normally. When the first voltage reaches the first preset voltage value, it can be determined that the external reference voltage source 10 is in normal working condition, that is, the external reference voltage source 10 can output an accurate external reference voltage signal. At this time, the analog voltage signal can be acquired by the AD acquisition terminal, and the signal strength of the analog voltage signal can be determined by the external reference voltage signal. For example, the external reference voltage signal output by the external reference voltage source 10 when it is operating normally can be set to be greater than the analog voltage signal acquired by the AD acquisition terminal AVN2. For example, if the voltage value of the analog voltage signal is between 0V and 5V, the external reference voltage signal output by the external reference voltage source 10 when it is operating normally can be set to 5V. In this way, it can be used as a standard to measure the analog voltage signal and to determine the voltage value of the analog voltage signal acquired by the AD acquisition terminal AVN2, that is, the signal strength of the analog voltage signal.

[0075] S260. During the process of acquiring analog voltage signals through the AD acquisition terminal, the signal quantity of the analog voltage signal is determined based on the external reference voltage signal.

[0076] Optional, Figure 6 This is a flowchart of another microcontroller-based AD acquisition method provided in the embodiments of the invention, such as... Figure 6 As shown, the method includes:

[0077] S310: Obtain the calibration voltage signal through the calibration signal input terminal and obtain the external reference voltage signal through the reference signal input terminal.

[0078] S320. Determine the reference flag bit based on the calibration voltage signal and the internal reference voltage signal.

[0079] Specifically, the reference flag may include a first flag and a second flag, and the first flag can be set to "1" and the second flag to "0". In this way, the microcontroller U1 can directly determine whether it can acquire the analog voltage signal through the AD acquisition terminal based on the reference flag, which is simpler and clearer.

[0080] For example, when determining the reference flag bit based on the calibration voltage signal and the internal reference voltage signal, the second signal quantity of the calibration voltage signal can be determined first based on the internal reference signal, and the first voltage output by the calibration source can be determined based on the second signal quantity of the calibration voltage signal until the first voltage reaches the first preset voltage value, at which point the reference flag bit is determined as the first flag bit.

[0081] Specifically, when the first voltage reaches the first preset voltage value, it can be determined that the external reference voltage source 10 is in normal working condition, that is, the external reference voltage source 10 can output an accurate external reference voltage signal at this time, and the first reference flag bit can be determined at this time.

[0082] S330: Determine whether to acquire analog voltage signals through the AD acquisition terminal based on the reference flag bit; if yes, execute S340.

[0083] S340: Acquires analog voltage signals through the AD acquisition terminal.

[0084] For example, when the reference flag is determined to be the first flag, the AD acquisition terminal is controlled to acquire the analog voltage signal.

[0085] Specifically, since the reference flag is the first flag when the first voltage reaches the power supply voltage required for the external reference voltage source 10 to work normally (i.e., the first preset voltage value), when the reference flag is the first flag, it can be determined that the external reference voltage signal is relatively stable and accurate. At this time, the analog voltage signal can be acquired through the AD acquisition terminal.

[0086] S350: During the process of acquiring analog voltage signals through the AD acquisition terminal, the signal quantity of the analog voltage signal is determined based on the external reference voltage signal.

[0087] Optional, see reference Figure 5 The microcontroller U1 also includes a power supply terminal VDD. Figure 7 This is a flowchart of another microcontroller-based AD acquisition method provided in the embodiments of the invention, such as... Figure 7 As shown, the method includes:

[0088] S410: Obtain the power supply voltage signal through the power supply terminal.

[0089] S420. Until the power supply voltage signal increases to the second preset voltage value, the reference flag is determined as the second flag.

[0090] Specifically, the power supply terminal VDD of the microcontroller U1 can be electrically connected to the calibration source 20 through the DC-DC converter 50. The DC-DC converter can provide a power supply voltage signal to the microcontroller U1 according to the first voltage output by the battery E0. The second preset voltage value is preferably the power supply voltage value required for the normal operation of the microcontroller U1. When the power supply voltage signal received by the power supply terminal VDD of the microcontroller U1 does not reach the second preset voltage value, the microcontroller U1 is in the off state and cannot receive any signal. When the power supply voltage signal received by the power supply terminal VDD of the microcontroller U1 increases to the second preset voltage value, the microcontroller U1 starts to work normally. At this time, the reference flag can be set as the second flag so that the microcontroller U1 first determines whether the external reference voltage source 10 is in normal working state according to the calibration voltage signal and the internal reference voltage signal.

[0091] For example, when the microcontroller-based AD acquisition circuit provided in this embodiment of the invention is integrated into a vehicle, the microcontroller U1 can be a vehicle-mounted controller U0, and the battery E0 can be a DC power supply for the vehicle. In this case, when the vehicle is powered on, the first voltage output by the battery E0 may reach a second preset voltage value but not the first preset voltage value. Therefore, it can be configured to directly set the reference flag bit to the second flag bit when the vehicle is powered on, and then set the reference flag bit to the first flag bit when it is determined that the first voltage has reached the first preset voltage value. Furthermore, the calibration voltage signal is continuously acquired during the subsequent process. When it is determined that the first voltage output by the battery is less than the first voltage preset value based on the calibration voltage signal and the internal reference voltage signal, the reference flag is set as the first flag again. This ensures that the analog voltage signal is acquired through the AD acquisition terminal AVN2 only when the external reference voltage signal provided by the external reference voltage source 10 is relatively accurate. The signal quantity of the analog voltage signal is determined based on the external reference voltage signal, thereby ensuring that the signal quantity of the analog voltage signal determined by the vehicle controller U0 is relatively accurate. This enables the vehicle controller U0 to achieve more accurate control of certain functions of the vehicle based on a more accurate analog voltage signal, thus ensuring driving safety.

[0092] S430: Obtain the calibration voltage signal through the calibration signal input terminal and obtain the external reference voltage signal through the reference signal input terminal.

[0093] S440. Determine the reference flag bit based on the calibration voltage signal and the internal reference voltage signal.

[0094] S450: Determine whether to acquire analog voltage signals through the AD acquisition terminal based on the reference flag bit; if yes, execute S460.

[0095] S460: Acquires analog voltage signals via the AD acquisition terminal.

[0096] S470. During the process of acquiring analog voltage signals through the AD acquisition terminal, the signal quantity of the analog voltage signal is determined based on the external reference voltage signal.

[0097] Based on the same inventive concept, embodiments of the present invention also provide an AD acquisition circuit based on a microcontroller, see reference. Figure 2The microcontroller-based AD acquisition circuit includes a microcontroller U1, a calibration source 20, an external reference voltage source 10, and an analog signal acquisition circuit 30. The microcontroller U1 includes a reference signal input terminal VREF, a calibration signal input terminal AVN1, and an AD acquisition terminal AVN2. The input terminal of the external reference voltage source 10 is electrically connected to the calibration source 20, and the output terminal of the external reference voltage source 10 is electrically connected to the reference signal input terminal VREF of the microcontroller U1. The calibration signal input terminal AVN1 is electrically connected to the calibration source 20. The input terminal of the analog signal acquisition circuit 30 is used to acquire an initial analog signal, and the output terminal of the analog signal acquisition circuit 30 is electrically connected to the AD acquisition terminal AVN2. The microcontroller U1 is used to execute the microcontroller-based AD acquisition method provided in any embodiment of the present invention. Therefore, the microcontroller-based AD acquisition circuit provided in the embodiments of the present invention includes the technical features of the microcontroller-based AD acquisition method provided in any embodiment of the present invention, and can achieve the beneficial effects of the microcontroller-based AD acquisition method provided in any embodiment of the present invention. Similarities can be referred to the above description of the microcontroller-based AD acquisition method provided in the embodiments of the present invention, and will not be repeated here.

[0098] Optional, see reference Figure 5 The microcontroller-based AD acquisition circuit also includes a voltage divider circuit 40; the input terminal of the voltage divider circuit 40 is electrically connected to the calibration source 20, and the output terminal of the voltage divider circuit 40 is electrically connected to the calibration signal input terminal AVN1 of the microcontroller U1.

[0099] For example, the voltage divider circuit 40 includes a first resistor R1 and a second resistor R2. The calibration signal input terminal AVN1 of the microcontroller U1 is electrically connected to the battery E0 through the first resistor R1, and the calibration signal input terminal AVN1 is also grounded to GND through the second resistor R2.

[0100] Optional, continue to refer to Figure 5 The microcontroller-based AD acquisition circuit also includes a first capacitor C1. One end of the first capacitor C1 is electrically connected to the input terminal of the voltage divider circuit 40 and the calibration source 20, and the other end of the first capacitor C1 is grounded to GND. The first capacitor C1 is used for filtering.

[0101] Optional, continue to refer to Figure 5The analog signal acquisition circuit 30 includes a third resistor R3, a second capacitor C2, and a sensor MT. The AD acquisition terminal AVN2 of the microcontroller U1 is electrically connected to the sensor MT through the third resistor R3, and the AD acquisition terminal AVN2 of the microcontroller U1 is also grounded through the second capacitor C2. When this microcontroller-based AD acquisition circuit is integrated into a vehicle, the sensor MT can be used as a temperature sensor, pressure sensor, etc. in the vehicle, capable of acquiring initial analog signals such as temperature or pressure signals, and outputting an analog voltage signal based on the initial analog signal. This analog voltage signal is transmitted to the AD acquisition terminal AVN2 of the microcontroller U1 after being current-limited by the third resistor R3 and filtered by the second capacitor C2.

[0102] Optional, continue to refer to Figure 5 The microcontroller-based AD acquisition circuit also includes: a DC-DC converter 50; the microcontroller U1 also includes a power supply terminal VDD; the input terminal of the DC-DC converter 50 is electrically connected to the calibration source 20, and the output terminal of the DC-DC converter is electrically connected to the power supply terminal VDD.

[0103] Based on the same inventive concept, this embodiment of the invention also provides a vehicle, including the microcontroller-based AD acquisition circuit provided in this embodiment of the invention. Therefore, the vehicle provided in this embodiment of the invention includes the technical features of the microcontroller-based AD acquisition circuit provided in any embodiment of the invention, and can achieve the beneficial effects of the microcontroller-based AD acquisition circuit provided in any embodiment of the invention. The similarities can be referred to the above description of the microcontroller-based AD acquisition circuit provided in this embodiment of the invention, and will not be repeated here.

[0104] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0105] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A microcontroller-based analog-to-digital (AD) acquisition method, wherein the microcontroller includes a reference signal input terminal, a calibration signal input terminal, and an AD acquisition terminal, the reference signal input terminal being electrically connected to an external reference voltage source, the calibration signal input terminal being electrically connected to a calibration source, and the AD acquisition terminal being electrically connected to an analog signal acquisition circuit, characterized in that, The microcontroller-based AD acquisition methods include: The calibration voltage signal is obtained through the calibration signal input terminal, and the external reference voltage signal is obtained through the reference signal input terminal. Based on the calibration voltage signal and the internal reference voltage signal, determine whether to acquire an analog voltage signal through the AD acquisition terminal; If so, then the analog voltage signal is acquired through the AD acquisition terminal; During the process of acquiring analog voltage signals through the AD acquisition terminal, the signal quantity of the analog voltage signal is determined based on the external reference voltage signal.

2. The microcontroller-based AD acquisition method according to claim 1, characterized in that, Determining whether to acquire an analog voltage signal through the AD acquisition terminal based on the calibration voltage signal and the internal reference voltage signal includes: The first signal quantity of the calibration voltage signal is determined based on the internal reference voltage signal; The first voltage output by the calibration source is determined based on the first signal quantity of the calibration voltage signal; Until it is determined that the first voltage reaches the first preset voltage value, the analog voltage signal is then acquired through the AD acquisition terminal.

3. The microcontroller-based AD acquisition method according to claim 1, characterized in that, Determining whether to acquire an analog voltage signal through the AD acquisition terminal based on the calibration voltage signal and the internal reference signal includes: The reference flag is determined based on the calibration voltage signal and the internal reference voltage signal; The reference flag is used to determine whether to acquire an analog voltage signal through the AD acquisition terminal.

4. The microcontroller-based AD acquisition method according to claim 3, characterized in that, Determining the reference flag bit based on the calibration voltage signal and the internal reference voltage signal includes: The second signal quantity of the calibration voltage signal is determined based on the internal reference signal; The first voltage output by the calibration source is determined based on the second signal quantity of the calibration voltage signal; The reference flag is determined as the first flag when the first voltage reaches the first preset voltage value.

5. The microcontroller-based AD acquisition method according to claim 4, characterized in that, Based on the reference flag, the AD acquisition terminal is controlled to acquire analog voltage signals, and the method further includes: When the reference flag is determined to be the first flag, the AD acquisition terminal is controlled to acquire the analog voltage signal.

6. The microcontroller-based AD acquisition method according to claim 3, characterized in that, The microcontroller also includes a power supply terminal; Before controlling the calibration signal input terminal to acquire the calibration voltage signal and controlling the reference signal input terminal to acquire the external reference voltage signal, the method further includes: The power supply voltage signal is obtained through the power supply terminal; Until the power supply voltage signal increases to the second preset voltage value, the reference flag is determined to be the second flag; and the steps of controlling the calibration signal input terminal to acquire the calibration voltage signal and controlling the reference signal input terminal to acquire the external reference voltage signal are executed.

7. An AD acquisition circuit based on a microcontroller, characterized in that, include: Microcontroller, calibration source, external reference voltage source, and analog signal acquisition circuit; The microcontroller includes a reference signal input terminal, a calibration signal input terminal, and an AD acquisition terminal; The input terminal of the external reference voltage source is electrically connected to the calibration source, and the output terminal of the external reference voltage source is electrically connected to the reference signal input terminal of the microcontroller. The calibration signal input terminal is electrically connected to the calibration source; The input terminal of the analog signal acquisition circuit is used to acquire the initial analog signal, and the output terminal of the analog signal acquisition circuit is electrically connected to the AD acquisition terminal. The microcontroller is used to execute the microcontroller-based AD acquisition method according to any one of claims 1 to 6.

8. The microcontroller-based AD acquisition circuit according to claim 7, characterized in that, Also includes: Voltage divider circuit; The input terminal of the voltage divider circuit is electrically connected to the calibration source, and the output terminal of the voltage divider circuit is electrically connected to the calibration signal input terminal of the microcontroller.

9. The microcontroller-based AD acquisition circuit according to claim 7, characterized in that, Also includes: DC-DC converter; The microcontroller also includes a power supply terminal; The input terminal of the DC-DC converter is electrically connected to the calibration source, and the output terminal of the DC-DC converter is electrically connected to the power supply terminal.

10. A vehicle, characterized in that, Includes the microcontroller-based AD acquisition circuit described in claims 7 to 9.