A voltage detection method and circuit
By using the reference voltage output module and the comparison module in the voltage detection circuit, the processor determines the specific value of the voltage to be measured, solving the problem of high voltage detection cost and large volume in the prior art, and achieving low cost and high flexibility Voltage detection, suitable for battery-powered voltage monitoring of low-power chips.
Patent Information
- Application Number
- CN202311083296.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-25
- Publication Date
- 2024-12-17
- Estimated Expiration
- 2043-08-25
AI Technical Summary
The existing voltage detection methods have problems such as high cost, large size and insemination in low-cost applications, and cannot obtain the specific value of the battery power supply voltage in real time, which affects the judgment of battery life.
By introducing a reference voltage output module and a comparison module into the voltage detection circuit, the processor determines the first and second reference voltages based on the magnitude relationship between the reference voltage and the voltage to be measured, and then determines the specific value of the voltage to be measured. The circuit structure is simple, The device is small in size and low in cost, and is suitable for integration inside or outside the chip.
The specific value detection of the voltage to be measured is realized, which reduces the circuit cost and volume occupancy, improves the flexibility and versatility of detection, and can monitor the battery supply voltage in real time and extends the battery life.
Smart Images

Figure CN117129746B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of detection, and in particular to a voltage detection method and circuit. Background Art
[0002] With the continuous development of wireless communication, users have higher and higher requirements for transmitter chips and receiver chips for data communication. When low-power chips such as transmitter chips and receiver chips are working, especially when some battery-powered wireless transmitter chips are working, the chip at the receiving end needs to obtain the power supply status of the transmitter battery at any time. This requires the battery-powered party to detect the power supply voltage every time it works, and determine whether an undervoltage alarm is required or directly give a specific voltage value, so that the chip can detect the power supply voltage in real time.
[0003] In the existing technology, the voltage value is usually obtained through the built-in undervoltage comparator of the chip or the additional ADC detection circuit. Traditional chips have their own undervoltage detection circuit, which is usually implemented by an undervoltage comparator, but it will only alarm for the undervoltage state when the battery is undervoltage, and cannot obtain the specific voltage value, and it is impossible to further determine the battery life; if you want to obtain a specific voltage value, you can use the ADC detection method to detect the voltage of the power supply by adding an ADC detection circuit. This method can get a specific voltage value, but the cost of the device used in the ADC detection circuit is high and the volume is large. When it is set inside the chip, it will cause the chip to increase a lot of area, which is unacceptable in some low-cost applications. Summary of the invention
[0004] The purpose of the present invention is to provide a voltage detection method and circuit. The processor can determine the first reference voltage and the second reference voltage according to the size relationship between the reference voltages and the size relationship between the reference voltage and the voltage to be measured. The voltage to be measured is between the first reference voltage and the second reference voltage. Therefore, the voltage values of the first reference voltage and the second reference voltage can be used to determine the specific voltage value of the voltage to be measured. The circuit structure is simple and easy to implement, and the specific value of the voltage to be measured can be detected. In addition, the device used in the entire voltage detection circuit is small in size, low in cost, and easy to integrate. It can be set inside the chip or outside the chip, with high flexibility and strong versatility.
[0005] In order to solve the above technical problems, the present invention provides a voltage detection method, which is applied to a processor of a voltage detection circuit, wherein the voltage detection circuit also includes a reference voltage output module and a comparison module, wherein a first input terminal of the comparison module is connected to an output terminal of the reference voltage output module, a second input terminal is connected to a voltage to be measured, and an output terminal is connected to an input terminal of the processor, and the voltage detection circuit also includes a voltage to be measured output module, an input terminal of which is connected to the voltage to be measured and connected to the output terminal of the processor, and an output terminal of which is connected to the second input terminal of the comparison module, and is used to output a sub-voltage to be measured that is linearly related to the voltage to be measured; the method includes:
[0006] Controlling the reference voltage output module to output a plurality of reference voltages in a preset order, wherein the preset order is obtained by the processor sorting the reference voltages based on the magnitude of the voltage values;
[0007] Receiving a comparison result after the comparison module compares the sub-voltage to be measured with the reference voltage;
[0008] Determine a first reference voltage and a second reference voltage among the reference voltages based on the comparison result, wherein the first reference voltage is less than the voltage to be measured, the second reference voltage is greater than the voltage to be measured, and the first reference voltage is a maximum value of all reference voltages among the reference voltages that are less than the voltage to be measured, and the second reference voltage is a minimum value of all reference voltages among the reference voltages that are greater than the voltage to be measured;
[0009] Determine a value of the voltage to be measured based on the first reference voltage and the second reference voltage;
[0010] The controlling the reference voltage output module to output a plurality of reference voltages in a preset order comprises:
[0011] Determining an intermediate value of the reference voltage output by the reference voltage output module based on the circuit structure of the reference voltage output module;
[0012] Controlling the reference voltage output module to output a plurality of reference voltages smaller than the intermediate value in descending order;
[0013] The reference voltage output module is controlled to output a plurality of reference voltages greater than the intermediate value in order from small to large.
[0014] Optionally, controlling the reference voltage output module to output a plurality of reference voltages in a preset order includes:
[0015] Controlling the reference voltage output module to output a plurality of reference voltages in a descending order;
[0016] or,
[0017] The reference voltage output module is controlled to output a plurality of reference voltages in order from small to large.
[0018] Optionally, after determining the value of the voltage to be measured based on the first reference voltage and the second reference voltage, the method further includes:
[0019] The value of the voltage to be measured is stored in a preset storage register.
[0020] Optionally, the reference voltage output module includes N resistors connected in series and a conversion switch, the control end of the conversion switch is connected to the output end of the processor, the N input ends are connected to the first ends of the N resistors in a one-to-one correspondence, and the output end is connected to the first input end of the comparison module, and N is a positive integer greater than 1;
[0021] The conversion switch is used to switch N input terminals to output N reference voltages based on the instructions of the processor.
[0022] Optionally, the comparison module is a comparator, a non-inverting input terminal of the comparator is connected to the output terminal of the conversion switch, an inverting input terminal is connected to the voltage to be measured, and an output terminal is connected to the input terminal of the processor.
[0023] Optionally, determining the value of the voltage to be measured based on the first reference voltage and the second reference voltage includes:
[0024] The smaller voltage value between the first reference voltage and the second reference voltage is used as the value of the voltage to be measured.
[0025] Optionally, before controlling the reference voltage output module to output a plurality of reference voltages in a preset order, the method further includes:
[0026] Determining a minimum effective value and / or a maximum effective value of the voltage to be measured;
[0027] Correspondingly, determining the value of the voltage to be measured based on the first reference voltage and the second reference voltage includes:
[0028] If the first reference voltage is greater than the maximum effective value of the voltage to be measured, determining that the value of the voltage to be measured is the maximum effective value;
[0029] If the second reference voltage is less than the minimum effective value of the voltage to be measured, it is determined that the value of the voltage to be measured is the minimum effective value.
[0030] In order to solve the above technical problems, the present invention also provides a voltage detection circuit, comprising a reference voltage output module, a comparison module and a processor; the first input terminal of the comparison module is connected to the output terminal of the reference voltage output module, the second input terminal is connected to the voltage to be measured, and the output terminal is connected to the input terminal of the processor;
[0031] The processor is used to implement the steps of the voltage detection method as described above;
[0032] It also includes a voltage output module to be measured, whose input terminal is connected to the voltage to be measured and is connected to the output terminal of the processor, and whose output terminal is connected to the second input terminal of the comparison module, and is used to output a sub-voltage to be measured that is linearly related to the voltage to be measured.
[0033] The present invention provides a voltage detection method, which is applied to a processor of a voltage detection circuit. A reference voltage output module in the voltage detection circuit outputs a plurality of reference voltages based on the control of the processor, and the processor can determine the size relationship between each reference voltage through a preset sequence. Therefore, after receiving the comparison result of the comparison module comparing the voltage to be measured with each reference voltage, the processor can determine a first reference voltage and a second reference voltage according to the size relationship between the reference voltages and the size relationship between the reference voltage and the voltage to be measured. The voltage to be measured is between the first reference voltage and the second reference voltage. Therefore, the voltage values of the first reference voltage and the second reference voltage can be used to determine the specific voltage value of the voltage to be measured. The circuit structure is simple and easy to implement, and the specific value of the voltage to be measured can be detected. Moreover, the device used in the entire voltage detection circuit is small in size, low in cost, and easy to integrate. It can be set inside a chip or outside a chip, and has high flexibility and strong versatility.
[0034] The present invention also provides a voltage detection circuit, which has the same beneficial effects as the above voltage detection method. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the prior art and the drawings required for use in the embodiments are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0036] Figure 1 A schematic flow chart of a voltage detection method provided by the present invention;
[0037] Figure 2 A schematic diagram of the structure of a voltage detection circuit provided by the present invention;
[0038] Figure 3A schematic diagram of the structure of another voltage detection circuit provided by the present invention. DETAILED DESCRIPTION
[0039] The core of the present invention is to provide a voltage detection method and circuit. The processor can determine the first reference voltage and the second reference voltage according to the size relationship between the reference voltages and the size relationship between the reference voltage and the voltage to be measured. The voltage to be measured is between the first reference voltage and the second reference voltage. Therefore, the voltage values of the first reference voltage and the second reference voltage can be used to determine the specific voltage value of the voltage to be measured. The circuit structure is simple and easy to implement, and the specific value of the voltage to be measured can be detected. In addition, the devices used in the entire voltage detection circuit are small in size, low in cost, and easy to integrate. They can be set inside the chip or outside the chip, with high flexibility and strong versatility.
[0040] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] The voltage detection method and voltage detection circuit provided by the present invention are suitable for voltage detection of the power supply of the transmitting chip or the receiving chip. The transmitting chip usually includes modules such as data packet processing and radio frequency modulation; the data packet processing module packages and encodes the information to be transmitted, and then converts it into a serial signal. The radio frequency modulation module uses the serial signal to modulate the radio frequency signal, and then transmits it through the antenna. Therefore, the transmitting chip usually uses a single wireless terminal, and the information can only be transmitted through a wireless signal. Therefore, the transmitting chip needs to obtain the voltage state by receiving and identifying the signal sent by the wireless terminal. The voltage state obtained by the receiving chip can usually be achieved through a wired connection, and the receiving chip can be connected to a host or server through a wired connection. The voltage detection method provided in this application can be implemented by a voltage detection circuit arranged inside the chip, or by a voltage detection circuit arranged outside the chip and independently existing from the chip. The application does not make any special restrictions on the application scenarios and application methods of the voltage detection method and the voltage detection circuit. Specific implementation methods are described below.
[0042] Please refer to Figure 1 , Figure 1 A schematic diagram of a voltage detection method provided by the present invention; please refer to Figure 2 , Figure 2A schematic diagram of a voltage detection circuit provided by the present invention; To solve the above technical problems, the present invention provides a voltage detection method, which is applied to a processor 1 of the voltage detection circuit, wherein the voltage detection circuit further comprises a reference voltage output module 2 and a comparison module 3, wherein a first input terminal of the comparison module 3 is connected to an output terminal of the reference voltage output module 2, a second input terminal is connected to a voltage to be measured VCC, and an output terminal is connected to an input terminal of the processor 1; the voltage detection circuit further comprises a voltage to be measured output module, wherein an input terminal is connected to the voltage to be measured and is connected to an output terminal of the processor 1, and an output terminal is connected to a second input terminal of the comparison module 3, and is used to output a sub-voltage to be measured that is linearly related to the voltage to be measured; the method comprises:
[0043] S11: Control the reference voltage output module 2 to output a plurality of reference voltages in a preset order, where the preset order is obtained by the processor 1 sorting the reference voltages based on the magnitude of the voltage values;
[0044] It is not difficult to understand that in order to determine the specific value of the voltage to be measured VCC, it is necessary to determine the specific value of the voltage to be measured VCC through multiple reference voltages of different values. At the same time, in order to ensure that the voltage value processor 1 of each reference voltage of the reference voltage output module 2 can determine its corresponding accurate value, the reference voltage module needs to output multiple reference voltages in sequence based on the preset order set in the processor 1 when outputting the reference voltage, so as to ensure that the processor 1 can accurately determine the specific values of each reference voltage output by the reference voltage output module 2, thereby ensuring that the subsequent processor 1 can determine the specific value of the voltage to be measured VCC according to the value of the reference voltage. This preset order is not limited to a single descending or ascending order, but can also be a process of sorting the reference voltages using binary search or other methods. The specific implementation method of the preset order set in advance in the processor 1 is not particularly limited in this application.
[0045] Specifically, the specific values of the several reference voltages output by the reference voltage output module 2 and the value intervals between the multiple reference voltages can be determined according to detection accuracy or empirical values, and the values of the various reference voltages can be equally spaced or have different value intervals. The present application does not make any special limitations on the specific values and implementation methods of the several reference voltages output by the reference voltage output module 2; the accuracy of the reference voltage values and the accuracy of the value intervals generally need to be consistent with the detection accuracy of the chip for the voltage to be measured VCC.
[0046] S12: receiving a comparison result after the comparison module 3 compares the sub-voltage to be measured with the reference voltage;
[0047] It is not difficult to understand that the processor 1 mainly determines the specific value of the voltage VCC to be measured by judging the comparison result of the comparison module 3 outputting the voltage VCC to be measured and the reference voltage. If the comparison result output by the comparison module 3 is the first level, it means that the voltage VCC to be measured is greater than the current reference voltage. If the comparison result output by the comparison module 3 is the second level, it means that the voltage VCC to be measured is less than the current reference voltage. The first level and the second level are opposite. Therefore, the processor 1 can determine the value range of the voltage VCC to be measured according to the comparison result of the comparison module 3, and gradually narrow the value range by comparing the voltage VCC to be measured with reference voltages of different values, until the specific value of the final voltage VCC to be measured is determined. The processor 1 obtains multiple comparison results by controlling the reference voltage output module 2 to output different values of the reference voltage to the comparison module 3, thereby determining the specific value of the voltage VCC to be measured. The measured voltage module can output various measured sub-voltages of different values corresponding to the measured voltage, and then compare each measured sub-voltage with the reference voltage. The comparison result between the measured sub-voltage and the reference voltage and the linear relationship between the measured sub-voltage and the measured voltage are used to further detect the measured voltage. The value of the measured voltage can be determined more flexibly and effectively, which expands the scope of application of the entire voltage detection circuit and detection method. At the same time, it also avoids the error of the comparison result caused by the voltage value of the measured voltage itself being too large or too small, thereby further improving the accuracy and reliability of the detection result.
[0048] S13: determining a first reference voltage and a second reference voltage among the reference voltages based on the comparison result, wherein the first reference voltage is less than the voltage to be measured VCC, the second reference voltage is greater than the voltage to be measured VCC, and the first reference voltage is the maximum value of all reference voltages among the reference voltages that are less than the voltage to be measured VCC, and the second reference voltage is the minimum value of all reference voltages among the reference voltages that are greater than the voltage to be measured VCC;
[0049] Specifically, the processor 1 needs to control the reference voltage output module 2 to output reference voltages of different values, and determine the two reference voltages that are closest to the voltage to be measured VCC in voltage value according to the different comparison results output by the comparison module 3. The first reference voltage is less than the voltage to be measured VCC, and the second reference voltage is greater than the voltage to be measured VCC. Therefore, the voltage to be measured VCC must be between the first reference voltage and the second reference voltage, and among all the reference voltages, the voltage value of the first reference voltage is the voltage value that is closest to the voltage to be measured VCC among all the reference voltages that are less than the voltage to be measured VCC, and the voltage value of the second reference voltage is the voltage value that is closest to the voltage to be measured VCC among all the reference voltages that are greater than the voltage to be measured VCC. That is, among the several reference voltages output by the reference voltage output module 2, the voltage that is less than the second reference voltage and greater than the first reference voltage is the minimum value range of the voltage to be measured VCC.
[0050] It should be noted that the present application does not make any special restrictions on the specific implementation method of how the processor 1 determines the first reference voltage and the second reference voltage based on the comparison result. In practical applications, all reference voltages set by the reference voltage output module 2 can be compared with the voltage to be measured VCC to obtain all comparison results, and the processor 1 can determine the first reference voltage and the second reference voltage according to the value of the known reference voltage among all the reference voltages according to the comparison results; or the comparison result of the voltage to be measured VCC and the reference voltage and the reference voltage can be temporarily stored as the first reference voltage and / or the second reference voltage each time a reference voltage is output, and then each reference voltage is received. When comparing the results, compare them with the temporarily stored comparison results and the specific values of the temporarily stored first reference voltage and / or second reference voltage. If, under the same comparison result, the new reference voltage is greater than the temporarily stored first reference voltage or less than the temporarily stored second reference voltage, the new reference voltage is used as the new first reference voltage or second reference voltage, overwriting the previous result, until all reference voltage comparisons are completed in sequence, and the final temporarily stored first reference voltage and second reference voltage are the determined first reference voltage and second reference voltage, that is, after each comparison, the first reference voltage and the second reference voltage are updated according to the comparison results and the specific values of the reference voltages until all comparison processes are completed.
[0051] It can be understood that the process of controlling the reference voltage output module 2 to output several reference voltages and comparing the reference voltages with the voltage to be measured VCC is to scan the reference voltages within a set range to determine the first reference voltage and the second reference voltage that are closest in value to the voltage to be measured VCC, thereby determining the value of the voltage to be measured VCC based on the known voltage value of the reference voltage.
[0052] S14: Determine the value of the voltage to be measured VCC based on the first reference voltage and the second reference voltage.
[0053] It is not difficult to understand that the minimum value range of the measured voltage VCC can be determined between the first reference voltage and the second reference voltage. At this time, the specific voltage value of the measured voltage VCC can be determined according to the specific values of the first reference voltage and the second reference voltage. There are many implementation methods for the specific process of determining the value of the measured voltage VCC, and the present application does not make any special limitation here. The voltage value of the first reference voltage or the second reference voltage can be directly used as the value of the measured voltage VCC, or the value of the measured voltage VCC can be calculated by averaging or weighting.
[0054] Considering that it is necessary to perform an undervoltage prompt when the value of the voltage to be measured VCC is lower than a certain value, an undervoltage prompt module connected to the processor 1 can be additionally provided, and a prompt operation is performed when the voltage value of the voltage to be measured VCC finally determined is lower than a preset threshold value. The specific implementation method of the undervoltage prompt module is not particularly limited in this application, and it can be implemented by an audio-visual prompt module such as a speaker, an indicator light or a buzzer, or other alarm methods can be used. And if the set value of the reference voltage is small, lower than the normal working range of the voltage to be measured VCC, and the comparison result is that the voltage to be measured VCC is less than the reference voltage, the processor 1 can directly determine that the voltage to be measured VCC is in an undervoltage state at this time, and perform operations such as prompting or alarming the undervoltage state of the voltage to be measured VCC.
[0055] It should be noted that the chip can send the detection result of the power supply voltage synchronously when transmitting data, and can also output the final determined value of the voltage to be measured VCC to other devices in other ways, so that other chips or remote devices can monitor the voltage to be measured VCC, especially the voltage to be measured VCC as the power supply, in real time. The voltage detection method can be implemented by a voltage detection circuit set inside the chip, or by a voltage detection circuit set outside the chip and independent of the chip. The voltage detection circuit only needs to be connected to the voltage to be measured VCC. The specific setting method of the voltage detection circuit is not particularly limited in this application.
[0056] It is not difficult to understand that the executors of steps S11-S14 are all processors 1 in the voltage detection circuit. The present application does not make any special restrictions on the specific circuit structures and implementation methods of the processor 1, the reference voltage output module 2 and the comparison module 3 in the voltage detection circuit. The reference voltage output module 2 can be implemented by a simple voltage divider or by a potentiometer or the like; the comparison module 3 can be implemented by various types of comparators, and the processor 1 can be a control system composed of multiple digital circuits or can be directly implemented by a control chip or the like.
[0057] The present invention proposes an implementation method combining a hardware circuit with a processor 1 control method, which can realize the detection of the voltage VCC to be tested by combining an analog circuit and a digital circuit. The processor 1 part can be implemented by digital circuit design such as RTL (Register Transfer Level), or by software. The present invention is easy to implement, has a small circuit area, and provides a reliable, convenient, low-cost, and easy-to-integrate solution for low-power chips, especially battery-powered chips, that need to detect the power supply voltage. It provides a mixed digital-analog circuit solution, which realizes the detection of the chip power supply voltage in a low-cost and easy-to-integrate manner.
[0058] The present invention provides a voltage detection method, which is applied to a processor 1 of a voltage detection circuit. A reference voltage output module 2 in the voltage detection circuit outputs a plurality of reference voltages based on the control of the processor 1, and the processor 1 can determine the size relationship between each reference voltage through a preset sequence. Therefore, after receiving the comparison result of a comparison module 3 comparing a voltage to be measured VCC with each reference voltage, the processor 1 can determine a first reference voltage and a second reference voltage according to the size relationship between the reference voltages and the size relationship between the reference voltage and the voltage to be measured VCC. The voltage to be measured VCC is between the first reference voltage and the second reference voltage. Therefore, the voltage values of the first reference voltage and the second reference voltage can be used to determine the specific voltage value of the voltage to be measured VCC. The circuit structure is simple and easy to implement, and the specific value of the voltage to be measured VCC can be detected. Moreover, the device used in the entire voltage detection circuit is small in size, low in cost, and easy to integrate. It can be set inside a chip or outside a chip, and has high flexibility and strong versatility.
[0059] Based on the above examples, please refer to Figure 3 , Figure 3 A schematic diagram of the structure of another voltage detection circuit provided by the present invention.
[0060] As an optional embodiment, controlling the reference voltage output module 2 to output a plurality of reference voltages in a preset order includes:
[0061] Control the reference voltage output module 2 to output a plurality of reference voltages in a descending order;
[0062] or,
[0063] The reference voltage output module 2 is controlled to output a plurality of reference voltages in order from small to large.
[0064] Specifically, the processor 1 can directly control the reference voltage output module 2 to output a number of reference voltages in descending or ascending order, so that the processor 1 can directly determine the value of the reference voltage according to the sequence number, which is more convenient for the subsequent confirmation of the first reference voltage and the second reference voltage. When the reference voltage is directly output in descending or ascending order, the processor 1 can quickly find the first reference voltage and the second reference voltage when the comparison result of the comparison module 3 changes, and the first reference voltage and the second reference voltage can be determined without having to compare all the reference voltages, which can further improve work efficiency. The present application does not make any special restrictions on the specific implementation method of how to control the reference voltage output module 2 based on descending or ascending order.
[0065] Taking into account that the subsequent processor 1 will determine the voltage to be measured VCC based on the comparison result of the comparison module 3 and the specific value of the reference voltage, in order to facilitate the processor 1 to directly determine the size relationship between the reference voltages according to the output order, several reference voltages can be directly output in a regular order from large to small or from small to large. This situation can also improve work efficiency and save time to a certain extent.
[0066] As an optional embodiment, controlling the reference voltage output module 2 to output a plurality of reference voltages in a preset order includes:
[0067] Determine the middle value of the reference voltage output by the reference voltage output module 2 based on the circuit structure of the reference voltage output module 2;
[0068] Control the reference voltage output module 2 to output a number of reference voltages smaller than the middle value in descending order;
[0069] The reference voltage output module 2 is controlled to output a number of reference voltages greater than the middle value in order from small to large.
[0070] It is not difficult to understand that the voltage value can also be scanned by methods such as binary division. In order to find the first reference voltage and the second reference voltage more quickly, a suitable intermediate value can be selected according to the experience value or the application scenario, and then the intermediate value is used as the division basis to divide the reference voltage into two parts to determine the first reference voltage and the second reference voltage, which can further improve work efficiency and save time. Assuming that when the output is greater than the first reference voltage of the intermediate value, it is found that the output result is that the voltage to be measured VCC is less than the reference voltage, then it can be directly determined that all reference voltages greater than the intermediate value are greater than the voltage to be measured VCC, and the reference voltage can be used as the second reference voltage. A comparison and judgment is made among several reference voltages to determine whether the values of the second reference voltage and the first reference voltage need to be updated; if it is found that the output result is that the voltage to be measured VCC is greater than the reference voltage when the output is less than the first reference voltage of the intermediate value, it is a similar working process; with the intermediate value as the boundary, the approximate situation of the voltage to be measured VCC can be preliminarily judged, which greatly reduces the time required for determining the first reference voltage and the second reference voltage, and improves work efficiency. The intermediate value of the reference voltage can be the median of the values of all reference voltages determined in the strict sense according to the reference voltage output module 2, or it can be a reference voltage whose voltage value is in the middle of several reference voltages.
[0071] Specifically, the reference voltage can also be divided by binary division, thereby further reducing the time required to determine the first reference voltage and the second reference voltage, saving the time required for voltage detection, greatly improving work efficiency, and the intermediate value set in advance can also allow the processor 1 to more clearly understand the size of each reference voltage, which is conducive to the accurate implementation of the subsequent confirmation process of the first reference voltage and the second reference voltage.
[0072] As an optional embodiment, after determining the value of the voltage to be measured VCC based on the first reference voltage and the second reference voltage, the method further includes:
[0073] The value of the voltage VCC to be measured is stored in a preset storage register.
[0074] Considering that the finally determined value of the voltage to be measured VCC needs to be sent to other chips or devices as a voltage detection value, after the value of the voltage to be measured VCC is determined, it can be stored in a preset storage module. The storage module can be implemented using a storage register at a preset position. The specific type and implementation method of the preset storage register are not particularly limited in this application, and other types of storage methods may also be used for implementation.
[0075] Specifically, a process for storing the value of the voltage to be measured VCC is added so that other chips or devices can obtain the status of the voltage to be measured VCC. It is also convenient for users to connect to remote devices to monitor the status of the voltage to be measured VCC in real time, which is convenient for users to use, improves user experience, and expands the applicable scenarios and application scope of the voltage detection method and voltage detection circuit.
[0076] As an optional embodiment, the reference voltage output module 2 includes N resistors connected in series and a conversion switch, the control end of the conversion switch is connected to the output end of the processor 1, the N input ends are connected to the first ends of the N resistors in a one-to-one correspondence, and the output end is connected to the first input end of the comparison module 3, where N is a positive integer greater than 1;
[0077] The conversion switch is used to switch the N input terminals to output N reference voltages based on the instruction of the processor 1 .
[0078] It is not difficult to understand that the reference voltage output module 2 can be implemented by a voltage divider circuit composed of resistors connected in series, and a conversion switch connected to the processor 1 can be set at the same time. The processor 1 outputs different reference voltages by controlling the conduction between different input terminals and output terminals of the conversion switch. The specific value of the reference voltage output is related to the voltage division method in the circuit of the reference voltage output module 2 and depends on the parameters of the voltage divider device used. The detection accuracy of the entire voltage detection circuit can be adjusted by adjusting the structure of the voltage divider circuit and the resistance value of the voltage divider resistor. The specific type and implementation method of the resistor and the conversion switch are not particularly limited in this application.
[0079] Specifically, the reference voltage output module 2 can realize the output of several reference voltages through the cooperation of the voltage divider circuit and the conversion switch. The circuit structure is simple and easy to implement. The devices used are low-cost and small in size, which is conducive to the simple implementation of the voltage detection circuit, saving cost and occupied volume.
[0080] As an optional embodiment, the comparison module 3 is a comparator 14 , the non-inverting input terminal of the comparator 14 is connected to the output terminal of the conversion switch, the inverting input terminal is connected to the voltage to be measured VCC, and the output terminal is connected to the input terminal of the processor 1 .
[0081] It can be understood that the comparison module 3 can be implemented by using a comparator 14, and the detection accuracy of the entire voltage detection circuit can be adjusted by adjusting the type of the comparator 14 used and the accuracy of the comparator 14; if the non-inverting input terminal of the comparator 14 is connected to the output terminal of the conversion switch, then when the comparator 14 outputs a high level, it means that the voltage to be measured VCC is less than the reference voltage currently output, and when the comparator 14 outputs a low level, it means that the voltage to be measured VCC is greater than the reference voltage currently output; the specific type and implementation method of the comparator 14 used are not particularly limited in this application.
[0082] Specifically, a comparator 14 can be used to implement the comparison module 3. The comparator 14 has fast conversion efficiency, small delay, simple circuit structure, easy implementation, low cost, and small size, which is conducive to the simple implementation of the voltage detection circuit, saving cost and occupied volume. The comparator 14 can achieve higher detection accuracy, which is conducive to realizing a higher-precision detection process of the voltage to be measured VCC, and improving the accuracy of the entire voltage detection circuit.
[0083] As an optional embodiment, determining the value of the voltage to be measured VCC based on the first reference voltage and the second reference voltage includes:
[0084] The smaller voltage value between the first reference voltage and the second reference voltage is used as the value of the voltage to be measured VCC.
[0085] Considering that when the voltage to be measured VCC is used as a power supply, it is necessary to ensure that its output voltage can effectively and stably supply power, and at this time the voltage to be measured VCC is less than the second reference voltage and greater than the first reference voltage, the smaller voltage value between the first reference voltage and the second reference voltage is used as the value of the voltage to be measured VCC, that is, the first reference voltage is used as the value of the voltage to be measured VCC. If the voltage to be measured VCC is a power supply, then the power supply is greater than the first reference voltage, and can stably and effectively provide an output voltage of the voltage value corresponding to the first reference voltage, thereby ensuring the stable operation of the power supply system.
[0086] Specifically, in order to ensure stable power supply when the voltage to be tested VCC is used as a power supply system, the smaller voltage value between the first reference voltage and the second reference voltage is used as the value of the voltage to be tested VCC, so as to avoid abnormal situations in which the application is difficult due to the final value of the voltage to be tested VCC being too large, thereby ensuring accurate application of the voltage to be tested VCC.
[0087] As an optional embodiment, before controlling the reference voltage output module 2 to output a plurality of reference voltages in a preset order, the method further includes:
[0088] Determine the minimum effective value and / or the maximum effective value of the voltage VCC to be measured;
[0089] Correspondingly, determining the value of the voltage to be measured VCC based on the first reference voltage and the second reference voltage includes:
[0090] If the first reference voltage is greater than the maximum effective value of the voltage to be measured VCC, then the value of the voltage to be measured VCC is determined to be the maximum effective value;
[0091] If the second reference voltage is less than the minimum effective value of the voltage to be measured VCC, the value of the voltage to be measured VCC is determined to be the minimum effective value.
[0092] It is understandable that the voltage VCC to be tested is usually required to be within a reasonable range when it is applied. When the voltage VCC to be tested is an effective value within a reasonable range, the change of its voltage value will affect the actual application. Assuming that the working system goal is to work normally above 1.8V, 1.8V and below are voltage alarm states. At this time, if the voltage VCC to be tested is lower than 1.8V, the working system cannot work normally. At this time, it is already in a voltage alarm state. At this time, the specific value of the voltage VCC to be tested is meaningless and no further determination process is required. It is generally set at a higher voltage. For example, at 2V, the user should be notified to replace the battery. The voltage VCC to be tested below 1.8V can no longer be normally applied to the working system. Assuming that the voltage VCC to be tested is higher than 3.3V, it is a full-charged state. For example, some batteries are fully charged at 3V, and some are fully charged at 3.7V. The system can work normally. After exceeding this maximum effective value, the voltage VCC to be tested can definitely provide enough voltage required by the working system. The specific voltage value does not need to be further determined. Of course, if you want to detect a voltage higher than 3.3V, you can also increase the reference voltage gear.
[0093] In actual applications, the maximum effective value and / or minimum effective value of the voltage to be measured VCC can be set first according to the application situation. If the first reference voltage finally determined is greater than the maximum effective value of the voltage to be measured VCC, it is directly considered that the voltage to be measured VCC is in a fully charged state of the maximum effective value. If the second reference voltage is less than the minimum effective value of the voltage to be measured VCC, it is directly considered that the voltage to be measured VCC is in a depleted state of the minimum effective value. It is also possible to directly ignore the comparison process of the reference voltage less than the minimum effective value and / or the reference voltage greater than the maximum effective value during the comparison process. Or, when setting the reference voltage output module 2, the value range of the output reference voltage can be determined according to the minimum effective value and / or the maximum effective value. There are multiple options for how the minimum effective value and the maximum effective value are applied to the entire voltage detection process, which can be selected and adjusted according to the actual application situation. The present application does not make any special restrictions here.
[0094] Specifically, the effective value of the voltage to be measured VCC also has a certain degree of influence on the voltage detection process. Determining the minimum effective value and / or maximum effective value of the voltage to be measured VCC in advance can improve work efficiency to a certain extent, and make the final determined value of the voltage to be measured VCC combined with the actual application situation, which is more convenient for users to use and improves user experience. The effective value of the voltage to be measured VCC will have different values according to different actual application situations and can be flexibly adjusted, which improves the flexibility of the entire voltage detection circuit and expands the applicable scenarios and application scope of the voltage detection circuit and the voltage detection method.
[0095] In order to solve the above technical problems, the present invention also provides a voltage detection circuit, comprising a reference voltage output module 2, a comparison module 3 and a processor 1; the first input terminal of the comparison module 3 is connected to the output terminal of the reference voltage output module 2, the second input terminal is connected to the voltage to be measured VCC, and the output terminal is connected to the input terminal of the processor 1;
[0096] The processor 1 is used to implement the steps of the aforementioned voltage detection method.
[0097] Specifically, the present application does not impose any particular limitation on the specific types and implementations of the reference voltage output module 2, the comparison module 3 and the processor 1, and they may be selected and adjusted according to actual application conditions.
[0098] Among them, the processor 1 may include one or more processing cores, such as a 4-core processor 1, an 8-core processor 1, etc. The processor 1 can be implemented in at least one hardware form of DSP (Digital Signal Processor), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 1 may also include a main processor 1 and a coprocessor 1. The main processor 1 is a processor 1 for processing data in the awake state, also known as a central processing unit 1; the coprocessor 1 is a low-power processor 1 for processing data in the standby state. In some embodiments, the processor 1 may integrate a GPU (graphics processing unit 1), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 1 may also include an AI (Artificial Intelligence) processor 1, which is used to process computing operations related to machine learning.
[0099] In some embodiments, the voltage detection circuit may further include a display screen, an input / output interface, a communication interface, a power supply, and a communication bus.
[0100] It can be understood by those skilled in the art that Figure 2 The structure shown in the figure does not constitute a limitation to the voltage detection circuit, and may include more or less components than those shown in the figure.
[0101] As an optional embodiment, it also includes a voltage output module to be measured, whose input terminal is connected to the voltage to be measured VCC and is connected to the output terminal of the processor 1, and whose output terminal is connected to the second input terminal of the comparison module 3, for outputting a sub-voltage to be measured that is linearly related to the voltage to be measured.
[0102] Taking into account the situation that the voltage to be measured VCC may have a large voltage value and is difficult to be directly input into the comparison module 3 for comparison, a voltage to be measured output module is additionally provided, and the voltage to be measured VCC is preliminarily processed and then output to the comparison module 3, and then a subsequent comparison process is performed; the voltage to be measured output module may be a voltage divider circuit, and a plurality of different sub-voltage to be measured outputs are provided similarly to the reference voltage output module 2, and the voltage divider circuit is used to obtain sub-voltages to be measured of different values after voltage division of the voltage to be measured to different degrees, and the comparison between the reference voltage and the sub-voltage to be measured is used to achieve different comparison results of the voltage to be measured VCC under different voltage division conditions, thereby further improving the accuracy and reliability of the value of the voltage to be measured VCC finally determined; the specific type and implementation method of the voltage to be measured output module are not particularly limited in this application, and the following is the explanation of the comparison results ... Figure 3 For example, the voltage output module to be tested is realized by the circuit to be tested control circuit 13.
[0103] For an introduction to a voltage detection circuit provided by the present invention, please refer to the above-mentioned embodiment of the voltage detection method, and the present invention will not be described in detail here.
[0104] As a specific embodiment, Figure 3 For example, the voltage detection circuit contains multiple circuit modules, the processor 1 is partially implemented by digital circuits, and the other modules are implemented by analog circuits. The analog circuit modules include a reference voltage generating circuit 11, a reference voltage control circuit 12, a voltage control circuit to be measured 13, and a comparator 14. The digitally designed circuit consists of a digital control state machine 15, a voltage scanning control 17, and a voltage storage module 16. The reference voltage generating circuit 11 and the reference voltage control circuit 12 together constitute a reference voltage output module 2.
[0105] The reference voltage generating circuit 11 can obtain a certain reference voltage VREF by using a design method such as a bandgap circuit. The VREF voltage is output to the reference voltage control circuit 12. The reference voltage control circuit 12 can use the reference voltage VREF to generate a variety of divided voltages, and then the control of the digital circuit input, that is, the voltage scanning control 17, selects to output a voltage Vf, and Vf is connected to an input terminal of the voltage comparator 14 as the reference voltage in the comparison process. The voltage to be measured VCC is input to the voltage control circuit 13 to be measured. The voltage control circuit 13 to be measured generates a variety of divided voltages of the voltage to be measured VCC, and then the control of the digital circuit input, that is, the voltage scanning control 17, selects to output a voltage Vc, and connects to the other input terminal of the voltage comparator 14. The status signal LBD_ST of the output of the voltage comparator 14 is connected to the digital control state machine 15 in the processor 1. The digital control state machine 15 determines the output of the voltage scanning control 17 according to the status of the LBD_ST signal, so that the voltage scanning control 17 selects a suitable reference voltage of the input comparator 14 for the next comparison process, or after determining the voltage value to be measured, stores the specific value of the voltage VCC to be measured that is finally determined in the voltage storage module 16.
[0106] The digital state machine control in the present invention also has a variety of different control methods. The voltage storage module 16 can be implemented in the form of a storage register, etc. The specific implementation methods of the digital control state machine 15, the voltage scanning control 17 and the voltage storage module 16 are not particularly limited in this application; the processor 1 is not limited to the implementation of the design method of this digital integrated circuit, and can also be implemented in the form of software or control chips. This embodiment proposes an implementation method based on a mixture of digital circuits and analog circuits. The undervoltage state and voltage value of the voltage to be measured VCC can be directly obtained inside the chip. An undervoltage analog detection circuit is designed, and the voltage value can be obtained by combining with a very small digital circuit. The specific types and implementation methods of the reference voltage generating circuit 11, the reference voltage control circuit 12, the voltage control circuit to be measured and the comparator 14 are not particularly limited in this application. The reference voltage generating circuit 11 can be implemented in the form of a bandgap circuit, etc., and the reference voltage control circuit 12 and the voltage control circuit to be measured 13 can be implemented in the form of a simple voltage divider circuit.
[0107] As a specific embodiment, Figure 3 Taking the voltage detection circuit shown in the figure as an example, it is assumed that the normal working range of the voltage VCC to be measured is 1.8V to 3.3V, that is, in practical applications, it is only necessary to detect voltage values between 1.8V and 3.3V, and any voltage below 1.8V is considered to be 1.8V, and the detection accuracy is set to 0.1V.
[0108] Control method 1:
[0109] 1) After receiving the voltage scanning instruction, the digital control state machine 15 allows the voltage scanning control 17 to initialize Vf to an initial voltage of 3.3V, which is the maximum effective value of the voltage VCC to be measured;
[0110] 2) If the voltage at the Vc terminal is lower than the voltage at the Vf terminal, the voltage comparator 14 outputs a high level state signal LBD_ST, otherwise the voltage comparator 14 outputs a low level state signal LBD_ST, and the state signal of LBD_ST is fed back to the digital control state machine 15;
[0111] 3) The digital control state machine 15 determines the state of LBD_ST. If LBD_ST is at a high level, it goes to step 4. If LBD_ST is at a low level, it goes to step 5.
[0112] 4) LBD_ST is high level, indicating that the voltage to be measured VCC is lower than the set reference voltage value. After the voltage scanning control 17 reduces the Vf voltage by 0.1V, if the currently set reference voltage value is already the lowest voltage value of 1.8V, then go to step 6, otherwise return to step 3;
[0113] 5) If LBD_ST is at a low level, it means that the voltage to be measured VCC is no lower than the currently set reference voltage value, and go to step 6;
[0114] 6) The currently set reference voltage value is the voltage value of the voltage to be measured VCC, which is stored in the voltage storage register by the digital control state machine 15.
[0115] Control method 2:
[0116] 1) After receiving the voltage scanning instruction, the digital control state machine 15 allows the voltage scanning control 17 to initialize Vf to an initial voltage of 1.8V, which is the minimum effective value of the voltage VCC to be measured;
[0117] 2) If the voltage at the Vc terminal is lower than the voltage at the Vf terminal, the voltage comparator 14 outputs a high level state signal LBD_ST, otherwise the voltage comparator 14 outputs a low level state signal LBD_ST, and the state signal of LBD_ST is fed back to the digital control state machine 15;
[0118] 3) The digital control state machine 15 determines the state of LBD_ST. If LBD_ST is at a high level, it goes to step 5. If LBD_ST is at a low level, it goes to step 4.
[0119] 4) LBD_ST is low level, indicating that the voltage to be measured VCC is not lower than the set reference voltage value. After the voltage scanning control circuit 17 increases the Vf voltage by 0.1V, if the set reference voltage value is greater than the highest voltage 3.3V, it jumps to step 6, otherwise it returns to step 3;
[0120] 5) If LBD_ST is high, it means that the voltage to be measured VCC is lower than the currently set reference voltage value, and go to step 6;
[0121] 6) The voltage value of the voltage to be measured VCC is obtained by subtracting 0.1V from the currently set reference voltage value, which is stored in the voltage storage register.
[0122] It is not difficult to understand that control method one is the process of outputting multiple reference voltages in a descending order, and control method two is the process of outputting multiple reference voltages in a descending order. The voltage is scanned in ascending or descending order, so as to determine the specific value of the voltage to be measured VCC based on the known voltage value of the reference voltage.
[0123] In order to solve the above technical problem, the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the voltage detection method as described above are implemented.
[0124] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium to execute all or part of the steps of the method described in each embodiment of the present application. Specifically, the computer-readable storage medium may include but is not limited to any type of disk, including a floppy disk, an optical disk, and a mobile hard disk, or any type of medium or device suitable for storing instructions, data, etc., and the present application does not make any special restrictions here.
[0125] For an introduction to a computer-readable storage medium provided by the present invention, please refer to the above-mentioned embodiment of the voltage detection method, and the present invention will not be repeated here.
[0126] In order to solve the above technical problems, the present invention also provides a voltage detection system, which is applied to a processor 1 of a voltage detection circuit. The voltage detection circuit also includes a reference voltage output module 2 and a comparison module 3. The first input terminal of the comparison module 3 is connected to the output terminal of the reference voltage output module 2, the second input terminal is connected to the voltage to be measured VCC, and the output terminal is connected to the input terminal of the processor 1. The system includes:
[0127] A reference voltage output unit, used to control the reference voltage output module 2 to output a plurality of reference voltages in a preset order, where the preset order is obtained by the processor 1 sorting the reference voltages based on the magnitude of the voltage values;
[0128] A comparison result receiving unit, used for receiving a comparison result after the comparison module 3 compares the voltage to be measured VCC with the reference voltage;
[0129] a reference voltage determination unit, configured to determine a first reference voltage and a second reference voltage among the reference voltages based on the comparison result, wherein the first reference voltage is less than the voltage to be measured VCC, the second reference voltage is greater than the voltage to be measured VCC, and the first reference voltage is the maximum value of all reference voltages among the reference voltages that are less than the voltage to be measured VCC, and the second reference voltage is the minimum value of all reference voltages among the reference voltages that are greater than the voltage to be measured VCC;
[0130] The voltage-to-be-tested determining unit is used to determine the value of the voltage to be tested VCC based on the first reference voltage and the second reference voltage.
[0131] As an optional embodiment, the reference voltage output unit includes:
[0132] A descending output unit, used to control the reference voltage output module 2 to output a number of reference voltages in a descending order;
[0133] or,
[0134] The ascending output unit is used to control the reference voltage output module 2 to output a number of reference voltages in order from small to large.
[0135] As an optional embodiment, the reference voltage output unit includes:
[0136] An intermediate value determining unit, used to determine an intermediate value of the reference voltage output by the reference voltage output module 2 based on the circuit structure of the reference voltage output module 2;
[0137] The first two-point output unit is used to control the reference voltage output module 2 to output a number of reference voltages smaller than the middle value in descending order;
[0138] The second two-part output unit is used to control the reference voltage output module 2 to output a number of reference voltages greater than the middle value in order from small to large.
[0139] As an optional embodiment, it also includes:
[0140] The storage unit is used to store the value of the voltage to be measured VCC into a preset storage register.
[0141] As an optional embodiment, the voltage to be measured determining unit includes:
[0142] The voltage-to-be-measured determining subunit is configured to use a smaller voltage value between the first reference voltage and the second reference voltage as the value of the voltage to be measured VCC.
[0143] As an optional embodiment, it also includes:
[0144] An effective value determination unit, used to determine a minimum effective value and / or a maximum effective value of the voltage to be measured VCC;
[0145] Correspondingly, the voltage determination unit to be measured includes:
[0146] A first determination unit, configured to determine that the value of the voltage VCC to be measured is the maximum effective value if the first reference voltage is greater than the maximum effective value of the voltage VCC to be measured;
[0147] The second determination unit is configured to determine that the value of the voltage to be measured VCC is the minimum effective value if the second reference voltage is less than the minimum effective value of the voltage to be measured VCC.
[0148] For an introduction to a voltage detection system provided by the present invention, please refer to the above-mentioned embodiment of the voltage detection method, and the present invention will not be described in detail here.
[0149] In this specification, each embodiment is described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part.
[0150] It should also be noted that, in this specification, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the statement "comprises a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.
[0151] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0152] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A voltage detection method, characterized in that: A processor applied to a voltage detection circuit, wherein the voltage detection circuit further comprises a reference voltage output module and a comparison module, wherein a first input terminal of the comparison module is connected to an output terminal of the reference voltage output module, a second input terminal is connected to a voltage to be measured, and an output terminal is connected to an input terminal of the processor, wherein the voltage detection circuit further comprises a voltage to be measured output module, an input terminal is connected to the voltage to be measured and is connected to an output terminal of the processor, and an output terminal is connected to a second input terminal of the comparison module, and is used to output a sub-voltage to be measured that is linearly related to the voltage to be measured; the method comprises: Controlling the reference voltage output module to output a plurality of reference voltages in a preset order, wherein the preset order is obtained by the processor sorting the reference voltages based on the magnitude of the voltage values; Receiving a comparison result after the comparison module compares the sub-voltage to be measured with the reference voltage; Determine a first reference voltage and a second reference voltage among the reference voltages based on the comparison result, wherein the first reference voltage is less than the voltage to be measured, the second reference voltage is greater than the voltage to be measured, and the first reference voltage is a maximum value of all reference voltages among the reference voltages that are less than the voltage to be measured, and the second reference voltage is a minimum value of all reference voltages among the reference voltages that are greater than the voltage to be measured; Determine a value of the voltage to be measured based on the first reference voltage and the second reference voltage; The controlling the reference voltage output module to output a plurality of reference voltages in a preset order comprises: Determining an intermediate value of the reference voltage output by the reference voltage output module based on the circuit structure of the reference voltage output module; Controlling the reference voltage output module to output a plurality of reference voltages smaller than the intermediate value in descending order; Controlling the reference voltage output module to output a plurality of reference voltages greater than the intermediate value in order from small to large; The reference voltage output module includes N resistors connected in series and a conversion switch, the control end of the conversion switch is connected to the output end of the processor, the N input ends are connected to the first ends of the N resistors in a one-to-one correspondence, and the output end is connected to the first input end of the comparison module, and N is a positive integer greater than 1; The conversion switch is used to switch N input terminals to output N reference voltages based on the instruction of the processor; After determining the value of the voltage to be measured based on the first reference voltage and the second reference voltage, the method further includes: Storing the value of the voltage to be measured in a preset storage register; The comparison module is a comparator, the non-inverting input terminal of the comparator is connected to the output terminal of the conversion switch, the inverting input terminal is connected to the voltage to be measured, and the output terminal is connected to the input terminal of the processor; The determining the value of the voltage to be measured based on the first reference voltage and the second reference voltage includes: Using the smaller voltage value between the first reference voltage and the second reference voltage as the value of the voltage to be measured; Before controlling the reference voltage output module to output a plurality of reference voltages in a preset order, the method further includes: Determining a minimum effective value and / or a maximum effective value of the voltage to be measured; Correspondingly, determining the value of the voltage to be measured based on the first reference voltage and the second reference voltage includes: If the first reference voltage is greater than the maximum effective value of the voltage to be measured, determining that the value of the voltage to be measured is the maximum effective value; If the second reference voltage is less than the minimum effective value of the voltage to be measured, it is determined that the value of the voltage to be measured is the minimum effective value.
2. A voltage detection circuit, characterized in that: It includes a reference voltage output module, a comparison module and a processor; the first input terminal of the comparison module is connected to the output terminal of the reference voltage output module, the second input terminal is connected to the voltage to be measured, and the output terminal is connected to the input terminal of the processor; The processor is used to implement the steps of the voltage detection method according to claim 1; It also includes a voltage output module to be measured, whose input terminal is connected to the voltage to be measured and is connected to the output terminal of the processor, and whose output terminal is connected to the second input terminal of the comparison module, and is used to output a sub-voltage to be measured that is linearly related to the voltage to be measured.
Citation Information
Patent Citations
Method and apparatus for implementing voltage detection
CN101441230A
Switch quantity signal detection method and detection circuit
CN104502683A
Method and apparatus for measuring humidity
CN105527317A
Power failure detection circuit for Internet of Things electric energy meter and Internet of Things electric energy meter
CN114019418A
Detection circuit and chip
CN114355027A
