Analog input conversion system and method
The analog input conversion system, which combines a microcontroller and a time base circuit, uses changes in charge to determine the magnitude of the analog signal and achieve signal isolation. This solves the problems of low accuracy in analog signal conversion and incomplete isolation in existing technologies, and improves the accuracy of signal transmission and anti-interference capability.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA PETROLEUM & CHEMICAL CORP
- Filing Date
- 2024-12-09
- Publication Date
- 2026-06-09
AI Technical Summary
In the existing technology, analog signal conversion isolation methods have the disadvantages of high device cost, low accuracy, and large size. Furthermore, linear optocouplers are difficult to accurately convert the intensity of optical signals, which leads to reduced accuracy of analog signal transmission and may even damage the control system.
It combines a microcontroller, a timer circuit, and a charging circuit. The output level of the timer circuit is controlled by a pulse signal, the magnitude of the analog signal is determined by the change in the amount of charge, and signal isolation is achieved through an optocoupler. Interference is eliminated by combining a voltage regulator circuit with inductors and resistors.
It improves the accuracy of analog signal conversion, avoids the influence of interference signals on the control system, and achieves high-precision signal transmission and isolation.
Smart Images

Figure CN122178893A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of electrical and electronic technology, and more specifically to an analog input conversion system and method. Background Technology
[0002] With the increasing level of industrial automation, more and more field analog signals, such as 4-20mA signals output from flow meters, pressure transmitters, and temperature transmitters, need to be connected to control systems. However, these signals are susceptible to various electromagnetic interferences during transmission, which can reduce the accuracy of the transmitted signal and, in severe cases, damage the control system. Therefore, analog signals must be converted and isolated before being input into the control system to ensure signal accuracy and prevent damage to the control system. Conventional analog signal conversion and isolation methods generally employ electromagnetic conversion and linear optocouplers. However, these methods use expensive, low-precision, and bulky components, and they only perform conversion and isolation for each loop in the system. When analog signal conversion is required for multiple loops, these existing methods are insufficient.
[0003] Furthermore, opto-isolation works by using an input electrical signal to drive a light-emitting diode (LED) to emit light of a specific wavelength. This light is then received by a photodetector (such as a photodiode or phototransistor) to generate a photocurrent, which is then amplified and output, achieving an electro-optical-electrical conversion. Existing linear optocouplers convert light intensity into current based on the principle that the magnitude of the photocurrent is proportional to the intensity of the received light signal. However, judging the magnitude of the converted current based on light intensity is not precise enough, and it is difficult to capture small changes in light intensity. Therefore, using linear optocouplers to achieve analog signal conversion has the aforementioned drawbacks. Summary of the Invention
[0004] This disclosure addresses at least one problem in the prior art. To solve the aforementioned technical problem, a first aspect of this disclosure provides an analog input conversion system, the system comprising: a microcontroller; a charging circuit for receiving an analog signal and charging using the analog signal; and a time base circuit for receiving a pulse signal from the microcontroller, controlling the output of the time base circuit to output a first level based on the pulse signal, and controlling the charging circuit to charge using the received analog signal. When the charged amount reaches a predetermined level, the output of the time base circuit outputs a second level, wherein the microcontroller determines the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level.
[0005] In some embodiments, the system further includes optocoupler DG1 and optocoupler DG2. Optocoupler DG2 is connected between the output terminal of the microcontroller and the trigger terminal of the time base circuit, and is used to convert the pulse signal output by the microcontroller into a low potential output to the trigger terminal of the time base circuit, so that the output terminal of the time base circuit outputs a high-level signal. Optocoupler DG1 is connected between the input terminal of the microcontroller and the output terminal of the time base circuit, and is used to receive the level signal output by the output terminal of the time base circuit and transmit it to the input terminal of the microcontroller. When the charging amount of the charging circuit reaches a predetermined amount, the level signal output by the output terminal of the time base circuit changes from a high-level signal to a low-level signal, and optocoupler DG1 changes from being on to being off.
[0006] In some embodiments, the system further includes a voltage regulator circuit connected to the control power supply terminal of the time base circuit, for stabilizing the voltage supplied to the control power supply terminal of the time base circuit at a preset voltage value, and the time base circuit determines whether the charging amount has reached a predetermined size by comparing the voltage generated by the charging amount with the preset voltage value.
[0007] In some embodiments, the voltage regulator circuit includes a voltage regulator integrated circuit TL431.
[0008] In some embodiments, the system further includes a resistor R2 connected in parallel across the charging circuit to consume interference signals that accompany the analog signal input.
[0009] In some embodiments, the system further includes an inductor L1 through which the analog signal is provided to the charging circuit to reduce interference signals that accompany the analog signal input.
[0010] In some embodiments, the system further includes a resistor R1 connected between the discharge terminal of the time base circuit and the charging circuit for discharging the charging circuit.
[0011] In some embodiments, determining the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level includes: calculating the magnitude of the analog signal based on the charging amount of the charging circuit, the voltage of the control power supply terminal of the time base circuit, and the time required for the output of the time base circuit to change from the first level to the second level, using the following formula:
[0012]
[0013] Wherein, I is the magnitude of the analog signal, U is the voltage of the control power supply terminal of the time base circuit, C is the charging amount of the charging circuit, and t is the time required for the output terminal of the time base circuit to change from the first level to the second level.
[0014] On the other hand, the present invention provides a method for multiplexing analog inputs, the method comprising: using a microcontroller to generate a pulse signal; using a time base circuit to receive the pulse signal from the microcontroller, and controlling the output terminal of the time base circuit to output a first level according to the pulse signal, and controlling the charging circuit to charge using the received analog signal, and when the charged amount reaches a predetermined amount, the output terminal of the time base circuit outputs a second level; and determining the magnitude of the analog signal according to the time required for the output terminal of the time base circuit to change from the first level to the second level.
[0015] In some embodiments, determining the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level includes: calculating the magnitude of the input analog signal based on the charging amount of the charging circuit, the voltage of the control power supply terminal of the time base circuit, and the time required for the output of the time base circuit to change from the first level to the second level, using the following formula:
[0016]
[0017] Wherein, I is the magnitude of the analog signal, U is the voltage of the control power supply terminal of the time base circuit, C is the charging amount of the charging circuit, and t is the time required for the output terminal of the time base circuit to change from the first level to the second level.
[0018] Through the above technical solution, this disclosure combines a microcontroller, a time base circuit, and a charging circuit. The microcontroller sends pulse signals to the time base circuit, controlling the time base circuit to output a level signal. Based on these pulse signals, the charging circuit is controlled to charge the analog signal input. This charge provides voltage to the time base circuit. When this voltage reaches a predetermined level, the time base circuit will produce a level change. The microcontroller receives the level signal from the time base circuit and calculates the level change time. Based on this change time, the magnitude of the input analog signal can be calculated, thereby realizing the conversion of the analog signal into a time signal and improving the accuracy of analog signal conversion.
[0019] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description section. Attached Figure Description
[0020] The accompanying drawings are provided to further illustrate embodiments of the present invention and form part of the specification. They are used together with the following detailed description to explain the embodiments of the present invention, but do not constitute a limitation thereof. In the drawings:
[0021] Figure 1 This is a schematic diagram of the structure of an analog input conversion system provided in an embodiment of this disclosure;
[0022] Figure 2 This is a schematic diagram of another analog input conversion system provided in an embodiment of this disclosure;
[0023] Figure 3 This is a schematic diagram of another analog input conversion system provided in an embodiment of this disclosure.
[0024] Explanation of reference numerals in the attached figures
[0025] 1. Timer circuit; 2. Optocoupler DG1; 3. Optocoupler DG2; 4. Capacitor C1; 5. Analog signal input terminal; 6. Resistor R1; 7. Resistor R2; 8. Resistor R3; 9. LED; 10. Inductor L1; 11. Voltage regulator IC TL431; 12. Resistor Rs; 13. Resistor Rw1; 14. Resistor Rw2. Detailed Implementation
[0026] The specific embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are for illustration and explanation only and are not intended to limit the scope of the present invention.
[0027] It should be noted that the acquisition, transmission, storage, use, and processing of data in the technical solution of this application all comply with the relevant provisions of national laws and regulations. In the embodiments of this application, certain existing industry solutions such as software, components, and models may be mentioned. These should be considered exemplary, intended only to illustrate the feasibility of implementing the technical solution of this application, and do not imply that the applicant has already used or necessarily used such solutions.
[0028] Figure 1 This is a schematic diagram of the structure of an analog input conversion system provided in an embodiment of this disclosure. Figure 1As shown, the analog input conversion system includes: a microcontroller; a charging circuit for receiving analog signals and charging using the analog signals; and a time base circuit for receiving pulse signals from the microcontroller, controlling the output of the time base circuit to output a first level according to the pulse signals, and controlling the charging circuit to charge using the received analog signals. When the amount of charge reaches a predetermined level, the output of the time base circuit outputs a second level. The microcontroller determines the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level.
[0029] Specifically, the microcontroller used in this embodiment is an STM32 microcontroller, the time base circuit is an NE555 time base circuit, and capacitor C1 is used to implement the function of the charging circuit. The analog signal mentioned here is a 4-20mA current signal. Among them, pin 1 of the NE555 time base circuit is the ground terminal, pin 2 is the trigger terminal, pin 3 is the output terminal, pin 4 is the reset terminal, pin 5 is the control power terminal, pin 6 is the threshold terminal, pin 7 is the discharge terminal, and pin 8 is the power terminal.
[0030] By connecting the microcontroller's PD port to pin 2 of the timer circuit, pin 3 of the timer circuit is initially at a low level. When the microcontroller generates a 1ms pulse signal and inputs it to pin 2 of the timer circuit, simultaneously, the charging circuit receives the analog signal input and begins charging, providing voltage to pin 6 of the timer circuit. At this time, pin 2 of the timer circuit is at a low level. Therefore, pin 3 of the timer circuit changes from its initial low level to a high level. This continues until the charging circuit reaches a predetermined amount, and the voltage provided to pin 6 of the timer circuit exceeds the threshold voltage. At this point, the level of pin 6 changes from low to high, causing the level of pin 3 of the timer circuit to also change from high to low. Pin 3 of the timer circuit is connected to the microcontroller's PA port, transmitting the output level signal to the microcontroller. The microcontroller records the time it takes for the output level of pin 3 of the timer circuit to change from high to low, and calculates the magnitude of the analog signal based on this time. This method cleverly converts analog signals into time signals that are easily obtained by the microcontroller. The microcontroller has very high accuracy in calculating time signals and avoids interference signals present in analog signals from entering the control system, thus improving the system's safety.
[0031] Figure 2 This is a schematic diagram of another analog input conversion system provided in an embodiment of this disclosure. Figure 2As shown, the system also includes optocouplers DG1 and DG2. Optocoupler DG2 is connected between the output terminal of the microcontroller and the trigger terminal of the time base circuit, and is used to convert the pulse signal output by the microcontroller into a low potential output to the trigger terminal of the time base circuit, so that the output terminal of the time base circuit outputs a high-level signal. Optocoupler DG1 is connected between the input terminal of the microcontroller and the output terminal of the time base circuit, and is used to receive the level signal output by the output terminal of the time base circuit and transmit it to the input terminal of the microcontroller. When the charging amount of the charging circuit reaches a predetermined amount, the level signal output by the output terminal of the time base circuit changes from a high-level signal to a low-level signal, and optocoupler DG1 changes from being on to being off.
[0032] Specifically, the optocoupler used in this embodiment is the P521 optocoupler, which is inexpensive, reliable, and stable in operation. The trigger terminal, threshold terminal, and control power supply terminal of the timer circuit mentioned here correspond to pins 2, 6, and 5 of the NE555, respectively. The optocoupler drives the LED to emit light through the input electrical signal, converting the electrical signal into an optical signal. The optical signal is then transmitted to the photosensitive element at the output terminal. Upon receiving the optical signal, the photosensitive element generates a corresponding photocurrent, completing the electrical signal-optical signal-electrical signal conversion process and achieving isolated signal transmission. In this embodiment, optocoupler DG2 is connected between the microcontroller's output port PD and pin 2 of the timer circuit. The collector of the phototransistor in optocoupler DG2 is connected to pin 2 of the timer circuit, and the emitter is grounded. Because the emitter of the phototransistor is grounded, the collector terminal is at a low potential. The anode of the LED is connected to the microcontroller's output port PD, and the cathode is grounded. This connection method achieves electrical signal isolation between the microcontroller circuit and the timer circuit.
[0033] Understandably, the NE555 timer circuit includes two voltage comparators, three equal-value series resistors, and an RS flip-flop. The NE555 provides two reference voltages, 1 / 3 VCC and 2 / 3 VCC, for the voltage comparators. When pin 5 of the timer circuit is floating, the voltage at the non-inverting input of the first voltage comparator is 2VCC / 3, and the voltage at the inverting input of the second voltage comparator is VCC / 3. When the voltage at pin 2 of the timer circuit is less than 1 / 3 VCC, the output of the second comparator is 0, setting the RS flip-flop to 1, thus causing pin 3 of the timer circuit to output a high level. Therefore, when a pulse signal is output from the microcontroller's PD port and transmitted to pin 2 of the timer circuit via the optocoupler DG2, it is at a low potential, causing pin 2 to be at a low level, and thus pin 3 of the timer circuit to output a high level.
[0034] One end of the optocoupler DG1 is connected to pin 3 of the timer circuit, and the other end is connected to the PA port of the microcontroller. The signal output from pin 3 of the timer circuit is isolated and then input to the microcontroller. When the microcontroller outputs a pulse signal, pin 2 of the timer circuit is low and pin 3 is high. At this time, the optocoupler DG1 receives the high-level signal and is in a conducting state, causing its LED to light up and transmitting the electrical signal to the PA port of the microcontroller. Until the charging circuit reaches a predetermined charge level, the voltage supplied to pin 6 of the timer circuit exceeds 2VCC / 3. Then, the first comparator outputs 1, causing the RS flip-flop to reset to 0. The output of pin 3 of the timer circuit changes from high to low, thus turning the optocoupler DG1 off and extinguishing its LED. Pin 3 of the timer circuit outputs this level change to the PA port of the microcontroller, which records the time of the level change signal output from pin 3 of the timer circuit.
[0035] The output level signal from pin 3 of the time base circuit is generated by comparing the voltages at pins 2 and 6 of the time base circuit with the first and second voltage comparators, respectively. The voltage change at pin 6 of the time base circuit is caused by the voltage provided by the charging circuit, which in turn is charged by the analog signal input. This process converts the analog signal input into a level change. The microcontroller can calculate the magnitude of the analog signal by recording the time of this level change, thus realizing the conversion of the analog signal into a time signal. For analog signals varying from 4-20mA, the converted time signal is approximately controlled within 2-10ms. Since the STM32 microcontroller operates at a frequency of 72MHz, and for ease of counting, it can be set to count once every 1µs, the 2-10ms range can be set between 2000µs and 10000µs, achieving a calculation accuracy of 0.05%, which is very high. By converting analog signals into time signals, microcontrollers can accurately measure the time signals, thereby avoiding the influence of interference signals present in analog signals on the transmitted signals, achieving the purpose of isolating interference in the signal, and improving the anti-interference capability of the transmitted signal.
[0036] Furthermore, existing linear optocouplers calculate the current magnitude by proportionally equating light intensity with current magnitude, but the accuracy of judging light intensity is relatively low. The embodiments disclosed in this disclosure cleverly transform the judgment of the light intensity of the light-emitting diode in the optocoupler into the judgment of whether the light-emitting diode is on or off, and convert the analog signal into a time signal. The microcontroller is then used to calculate the current magnitude from the time signal, which achieves both opto-isolation and improves the conversion accuracy.
[0037] Figure 3 This is a schematic diagram of another analog input conversion system provided in this disclosure embodiment, as shown below. Figure 3As shown, the system also includes a voltage regulator circuit, which is connected to the control power supply terminal of the time base circuit. The voltage regulator circuit is used to stabilize the voltage supplied to the control power supply terminal of the time base circuit at a preset voltage value. The time base circuit determines whether the charging amount has reached a predetermined size by comparing the voltage generated by the charging amount with the preset voltage value.
[0038] Specifically, in this embodiment, the control power supply terminal of the time base circuit is pin 5 of the NE555 time base circuit. A voltage regulator circuit is connected to pin 5 of the time base circuit to control the input voltage of pin 5 to 2.5V. It is understandable that, firstly, since the charging amount of the charging circuit is compared with the voltage at pin 5 of the time base circuit, if pin 5 is directly connected to the power supply voltage, voltage instability may occur. This will affect the judgment of whether the charging amount of the charging circuit has reached the predetermined amount, and thus affect the charging time. By using a voltage regulator circuit to fix the voltage at pin 5 to 2.5V, the charging time remains constant regardless of changes in the power supply voltage, thereby improving the accuracy of the charging time. Secondly, since this embodiment uses a 4-20mA current to charge the charging circuit, the highest voltage value that can be achieved during charging is approximately 12- 24V. When pin 5 is connected to the power supply voltage, if the power supply voltage is high, a current of 4-20mA is insufficient to make the charging circuit reach this high power supply voltage value, thus failing to achieve the level change at the threshold of the time base circuit. In addition, since the time base circuit needs to provide 2 / 3VCC voltage for the comparator as the reference voltage of the voltage comparator, when the power supply voltage is 12V, the time base circuit needs 8V, which will interfere with the voltage required by other devices. At the same time, since the charging circuit used in this disclosure is capacitor C1, when the voltage connected to pin 5 is 2.5V, it is not necessary to select a capacitor with a large capacitance to achieve the above functions, thereby saving costs.
[0039] The voltage regulator circuit includes a voltage regulator integrated circuit TL431 and a resistor Rw1 connected in series. The series resistor achieves the functions of current limiting, voltage division, and improving voltage regulation performance.
[0040] The system also includes a resistor R2, which is connected in parallel across the charging circuit to consume interference signals that accompany the analog signal input.
[0041] Specifically, there may be strong interference in the input analog signal. For example, when the input analog signal is current, there may be a very large current value input instantaneously. Resistor R2 can dissipate this interference signal and protect the equipment.
[0042] The system also includes an inductor L1 through which the analog signal is provided to the charging circuit to reduce interference signals that accompany the analog signal input.
[0043] The system also includes a resistor R1, which is connected between the discharge terminal of the time base circuit and the charging circuit for discharging the charging circuit.
[0044] Specifically, resistor R1 is the discharge resistor, and together with capacitor C1, they form a discharge path. The discharge terminal mentioned here corresponds to pin 7 of the NE555 timer circuit. When pin 2 of the timer circuit is at a low potential, pin 3 outputs a high level, and pin 7 is at a low level, so the discharge path is not open and no discharge occurs. However, when the voltage supplied by the charging circuit to pin 6 of the timer circuit reaches the threshold, pin 6 becomes high, and pin 3 outputs a low level, thus pin 7 becomes high, the discharge path is open, and the charging circuit begins to discharge.
[0045] The system also includes a light-emitting diode LED1 and a resistor R3, which are connected between pin 3 of the time base circuit and the optocoupler DG1. When pin 3 is at a high level, the light-emitting diode LED1 is turned on, indicating that the level is high and serving as a prompt.
[0046] In some embodiments, determining the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level includes: calculating the magnitude of the analog signal based on the charging amount of the charging circuit, the voltage of the control power supply terminal of the time base circuit, and the time required for the output of the time base circuit to change from the first level to the second level, using the following formula:
[0047]
[0048] Wherein, I is the magnitude of the analog signal, U is the voltage of the control power supply terminal of the time base circuit, C is the charging amount of the charging circuit, and t is the time required for the output terminal of the time base circuit to change from the first level to the second level.
[0049] Specifically, in this embodiment, I represents the magnitude of the analog signal, i.e., the input current of 4-20mA. Since the voltage at pin 6 of the time base circuit is provided by capacitor C1 of the charging circuit, and the determination of whether the charging amount meets the requirements is based on a comparison with the voltage value at pin 5, and resistor R2 is used to dissipate interference signals in the analog signal, the relationship between voltage and time needs to be obtained through Laplace transform and solving differential equations. The calculation is very complex and will not be elaborated here. The voltage calculation result is given directly as follows:
[0050]
[0051] Where: I is the input current, i.e., a 4-20mA analog signal; R is the resistance of the power-consuming resistor R2; and C is the capacitance of the charging capacitor C1. When the product of the resistance and capacitance is sufficiently large, it can be obtained through Taylor series decomposition:
[0052] U = I * t / C
[0053] t=U*C / I
[0054] It can be seen that the larger the current, the shorter the charging time. Using this formula, the microcontroller can calculate the current based on the charging time. For more precise calculations, a table can be generated using the formula U = I / R(1 - et / RC), stored in the microcontroller's memory, and the program can then determine the current based on the time values in the table.
[0055] A second aspect of this disclosure provides an analog input conversion method, the method comprising: emitting a pulse signal using a microcontroller; receiving the pulse signal from the microcontroller using a time base circuit, and controlling the output terminal of the time base circuit to output a first level according to the pulse signal, and controlling a charging circuit to charge using the received analog signal; when the charged amount reaches a predetermined level, the output terminal of the time base circuit outputs a second level; and determining the magnitude of the analog signal according to the time required for the output terminal of the time base circuit to change from the first level to the second level.
[0056] In some embodiments, determining the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level includes: calculating the magnitude of the input analog signal based on the charging amount of the charging circuit, the voltage of the control power supply terminal of the time base circuit, and the time required for the output of the time base circuit to change from the first level to the second level, using the following formula:
[0057]
[0058] Wherein, I is the magnitude of the analog signal, U is the voltage of the control power supply terminal of the time base circuit, C is the charging amount of the charging circuit, and t is the time required for the output terminal of the time base circuit to change from the first level to the second level.
[0059] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0060] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0061] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0062] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0063] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0064] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0065] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.
[0066] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0067] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. An analog input conversion system, characterized in that, The system includes: Microcontroller; A charging circuit for receiving an analog signal and using that analog signal for charging; and The time base circuit receives pulse signals from the microcontroller and, based on these pulse signals, controls its output to output a first level and controls the charging circuit to charge using the received analog signal. When the charged amount reaches a predetermined level, the output of the time base circuit outputs a second level. The microcontroller determines the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level.
2. The system according to claim 1, characterized in that, The system also includes optocouplers DG1 and DG2. The optocoupler DG2 is connected between the output terminal of the microcontroller and the trigger terminal of the time base circuit. It is used to convert the pulse signal output by the microcontroller into a low potential output to the trigger terminal of the time base circuit, so that the output terminal of the time base circuit outputs a high level signal. The optocoupler DG1 is connected between the input terminal of the microcontroller and the output terminal of the time base circuit, and is used to receive the level signal output by the output terminal of the time base circuit and transmit it to the input terminal of the microcontroller. When the charging amount of the charging circuit reaches a predetermined level, the output level signal of the time base circuit changes from a high level signal to a low level signal, and the optocoupler DG1 changes from being on to being off.
3. The system according to claim 1, characterized in that, The system also includes a voltage regulator circuit. The voltage regulator circuit is connected to the control power supply terminal of the time base circuit, and is used to stabilize the voltage supplied to the control power supply terminal of the time base circuit at a preset voltage value. The time base circuit determines whether the charging amount has reached the predetermined size by comparing the voltage generated by the charging amount with the preset voltage value.
4. The system according to claim 3, characterized in that, The voltage regulator circuit includes the TL431 voltage regulator integrated circuit.
5. The system according to claim 1, characterized in that, The system also includes a resistor R2, which is connected in parallel across the charging circuit to consume interference signals that accompany the analog signal input.
6. The system according to claim 1, characterized in that, The system also includes an inductor L1 through which the analog signal is provided to the charging circuit to reduce interference signals that accompany the analog signal input.
7. The system according to claim 1, characterized in that, The system also includes a resistor R1, which is connected between the discharge terminal of the time base circuit and the charging circuit for discharging the charging circuit.
8. The system according to claim 1, characterized in that, Determining the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level includes: The magnitude of the analog signal is calculated based on the charging amount of the charging circuit, the voltage at the control power supply terminal of the time base circuit, and the time required for the output terminal of the time base circuit to change from the first level to the second level. The calculation formula is as follows: Wherein, I is the magnitude of the analog signal, U is the voltage of the control power supply terminal of the time base circuit, C is the charging amount of the charging circuit, and t is the time required for the output terminal of the time base circuit to change from the first level to the second level.
9. An analog input conversion method, characterized in that, The method includes: A pulse signal is generated using a microcontroller; The system receives pulse signals from the microcontroller using a time base circuit, and controls the output of the time base circuit to output a first level based on these pulse signals. It also controls the charging circuit to charge using the received analog signal. When the charged amount reaches a predetermined level, the output of the time base circuit outputs a second level. The magnitude of the analog signal is determined based on the time required for the output of the time base circuit to change from the first level to the second level.
10. The method according to claim 9, characterized in that, Determining the magnitude of the analog signal based on the time required for the output of the time base circuit to change from the first level to the second level includes: The magnitude of the input analog signal is calculated based on the charging amount of the charging circuit, the voltage at the control power supply terminal of the time base circuit, and the time required for the output terminal of the time base circuit to change from the first level to the second level. The calculation formula is as follows: Wherein, I is the magnitude of the analog signal, U is the voltage of the control power supply terminal of the time base circuit, C is the charging amount of the charging circuit, and t is the time required for the output terminal of the time base circuit to change from the first level to the second level.