A circuit for converting PWM signal into voltage

By using high-speed clock sampling and digitally controlled resistors, the high-speed, low-cost, and stable conversion of PWM signals to voltage is achieved. The output voltage is linearly related to the duty cycle, solving the problems of slow speed, susceptibility to interference, or high cost in existing technologies.

CN109995372BActive Publication Date: 2024-11-01KEYIWEI (SHANGHAI) TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910418013.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-05-20
Publication Date
2024-11-01
Estimated Expiration
2039-05-20

AI Technical Summary

Technical Problem

Existing PWM signal-to-voltage circuits suffer from slow speed, susceptibility to interference, high cost, and reliance on microcontrollers for stability, making it difficult to simultaneously achieve high speed, low cost, and stable operation.

Method used

The PWM signal is sampled at high frequency using a high-speed clock to obtain the number of samplings during the high and low levels. This data is then used to control a digitally controlled resistor to form a proportional circuit, which outputs an analog voltage that is linearly related to the duty cycle.

Benefits of technology

It achieves a high-speed and low-cost PWM signal to voltage conversion process, while also possessing good stability, with the output voltage exhibiting a linear relationship with the duty cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN109995372B_ABST
    Figure CN109995372B_ABST
Patent Text Reader

Abstract

The present invention discloses a circuit for converting PWM signals to voltage, comprising: a PWM sampling circuit, whose input signal is a PWM signal and performs high-frequency clock sampling on the input signal to obtain a high-level sampling number value of the input signal during a high-level period and a low-level sampling number value during a low-level period, or obtain a high-level sampling number value of the input signal during a high-level period and a sampling number value in the entire PWM cycle, or obtain a low-level sampling number value of the input signal during a low-level period and a sampling number value in the entire PWM cycle; a count value to voltage circuit, connected to the PWM sampling circuit, and each input sampling number value controls one or more corresponding digitally controlled resistors in the count value to voltage circuit, and each digitally controlled resistor is connected to form a proportional circuit, so that the output voltage of the count value to voltage circuit is linearly related to the duty cycle of the input signal. The present invention can have both high speed and low cost, and has good stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of integrated circuit signal processing, and in particular to a circuit for converting PWM signals into voltage. Background Art

[0002] PWM signals are very commonly used signals in electronic systems. They have the advantages of digital signal isolation and anti-interference, and can also be easily restored to analog voltage signals. Therefore, electronic information is often transmitted through PWM signals as a carrier.

[0003] When the PWM signal transmits analog quantity, it needs to be restored through the circuit. There are two common methods. The first is to directly filter the PWM signal through the RC low-pass filter circuit, which can filter out the high-frequency component in the PWM signal, thereby obtaining the DC component, that is, the voltage value. The advantage of this method is low cost, and the disadvantage is slow speed and susceptibility to interference. The second method is to perform high-frequency clock sampling on the PWM signal through the microcontroller to obtain the PWM duty cycle information, and then convert it into an analog voltage signal through the DAC (digital-to-analog converter) circuit. The advantage of this method is fast speed, and the disadvantage is high cost, and the system stability depends on the performance of the microcontroller.

[0004] Based on the above reasons, it is necessary to provide a dedicated PWM signal-to-voltage circuit that can achieve high speed, low cost and good stability. Summary of the invention

[0005] The purpose of the present invention is to provide a circuit for converting PWM signals into voltage. First, a high-frequency clock sampling is performed on an input PWM signal through a high-speed clock to obtain a sampling number value DATAH during a high level, a sampling number value DATAL during a low level, or a sampling number value DATAC during a whole cycle. Secondly, a digitally controlled resistor is controlled through DATAH, DATAL, and DATAC to obtain a resistance value proportional to the sampling number value. Thirdly, after interconnecting the digitally controlled resistors proportional to the sampling number value, an analog voltage output proportional to the digitally controlled resistance value is obtained. Finally, the output analog voltage is linearly related to the duty cycle of the PWM signal. The present invention can have both high speed and low cost, and has good stability.

[0006] In order to achieve the above object, the present invention is implemented by the following technical solutions:

[0007] A circuit for converting a PWM signal into a voltage, characterized by comprising:

[0008] A PWM sampling circuit, wherein the input signal is a PWM signal and the input signal is sampled by a high-frequency clock to obtain a high-level sampling number value of the input signal during a high-level period and a low-level sampling number value during a low-level period, or obtain a high-level sampling number value of the input signal during a high-level period and a sampling number value in the entire PWM cycle, or obtain a low-level sampling number value of the input signal during a low-level period and a sampling number value in the entire PWM cycle, or obtain a high-level sampling number value of the input signal during a high-level period, a low-level sampling number value of the input signal during a low-level period and a sampling number value in the entire PWM cycle;

[0009] The count value-to-voltage circuit is connected to the PWM sampling circuit, and controls the corresponding one or more digitally controlled resistors in the count value-to-voltage circuit with each input sampling number value. The digitally controlled resistors are connected to form a proportional circuit so that the output voltage of the count value-to-voltage circuit is linearly related to the duty cycle of the input signal.

[0010] Preferably, the PWM sampling circuit includes a pair of counters and a pair of data latches matching therewith, which are respectively used for counting, refreshing, storing and continuously outputting each sampling number value, and counts in one input PWM cycle, refreshes in one input PWM cycle and completes one PWM sampling through two PWM cycles.

[0011] Preferably, the PWM sampling circuit comprises:

[0012] A first counter, one end of which is connected to the output end of the first NAND gate module, and the other end of which is connected to the input end of the first data latch, wherein the first counter outputs a high-level sampling times buffer value to the first data latch, and outputs the high-level sampling times value;

[0013] An inverter, one end of which is connected to the input signal, and the other end of which is connected to the input end of the second NAND gate module;

[0014] A second counter, one end of which is connected to the output end of the second NAND gate module, and the other end of which is connected to the input end of the second data latch, the second counter outputs a low-level sampling times buffer value to the second data latch, and outputs the low-level sampling times value;

[0015] The high-level sampling times buffer value is a value obtained by enabling the first NAND gate module through the input signal and triggering the first counter to count through the first NAND gate module when the input signal is in the signal counting cycle and the input signal is at a high level. At this time, the input signal turns off the second NAND gate module through the inverter, and the second counter stops counting;

[0016] The low-level sampling times buffer value is a value obtained by closing the first NAND gate module through the input signal to stop counting the first counter, and the input signal enables the second NAND gate module through the inverter, and the sampling clock signal triggers the second counter to count through the second NAND gate module when the signal counting cycle and the input signal is at a low level.

[0017] Preferably, the high level period of the frequency-divided signal PWMX2 of the input signal is the signal counting period, and the low level period of the frequency-divided signal PWMX2 is a signal refresh period, or the low level period of the frequency-divided signal PWMX2 of the input signal is the signal counting period, and the high level period of the frequency-divided signal PWMX2 is a signal refresh period; during the signal refresh period, the falling edge or rising edge of the frequency-divided signal of the input signal generates a refresh reset signal after a certain time delay, the rising edge or falling edge of the refresh reset signal triggers the high level sampling number buffer value and the low level sampling number buffer value to be stored in the first data latch and the second data latch, refreshes the high level sampling number value during the high level period and the low level sampling number value during the low level period, and the falling edge or rising edge of the refresh reset signal triggers the reset of the first counter and the second counter.

[0018] Preferably, the count value to voltage conversion circuit is internally provided with a first digitally controlled resistor and a second digitally controlled resistor which are adjusted corresponding to each sampling number value; the first digitally controlled resistor and the second digitally controlled resistor are connected in series; the first end of the second digitally controlled resistor is grounded, and the second end thereof is connected to the first end of the first digitally controlled resistor, the second end of the first digitally controlled resistor is connected to a reference voltage, and the node connecting the first digitally controlled resistor and the second digitally controlled resistor is used as an output voltage; when the first digitally controlled resistor matches the low-level sampling number value and the second digitally controlled resistor matches the high-level sampling number value, the output voltage is linearly related to the high-level duty cycle of the input signal; or, when the first digitally controlled resistor matches the high-level sampling number value and the second digitally controlled resistor matches the low-level sampling number value, the output voltage is linearly related to the low-level duty cycle of the input signal.

[0019] Preferably, the first digitally controlled resistor and the second digitally controlled resistor are both resistor strings, the resistor strings include a plurality of resistors connected in series, the high-level sampling times and the low-level sampling times are both multi-bit numbers, the number of bits of which is the same as the number of resistors of the corresponding digitally controlled resistors.

[0020] Preferably, each resistor is connected in parallel with a switch circuit, the high-level sampling number value or the low-level sampling number value is connected to a single-bit control signal at the input end of each switch circuit, when the control signal controls the switch circuit to open, the resistance value of the corresponding resistor is included in the resistance value of the resistor string, and when the control signal controls the switch circuit to short, the resistance value of the corresponding resistor is not included in the resistance value of the resistor string;

[0021] The resistance value of each resistor in the resistor string is doubled in sequence. When the total resistance value of the digitally controlled resistor adjusted by the corresponding sampling number value is equal to the product of the smallest resistance value in the resistor string and the sampling number value, the output voltage of the count value to voltage conversion circuit is linearly related to the high level or low level duty cycle of the input signal.

[0022] Preferably, the PWM sampling circuit comprises:

[0023] A first counter, one end of which is connected to the output end of the first NAND gate module, and the other end of which is connected to the input end of the first data latch, wherein the first counter outputs a high-level sampling number buffer value or a low-level sampling number buffer value to the first data latch, and outputs the high-level sampling number value or the low-level sampling number value;

[0024] a second counter, one end of which is connected to the output end of the second NAND gate module, and the other end of which is connected to the input end of the second data latch, the second counter outputs a buffer value of the number of samplings of the entire PWM cycle to the second data latch, and outputs the number of samplings of the entire PWM cycle;

[0025] The high-level sampling times buffer value is a value obtained by enabling the first NAND gate module through the input signal and triggering the first counter to count through the first NAND gate module when the input signal is at a high level during the signal counting cycle; when the input signal is at a low level during the signal counting cycle, the input signal turns off the first NAND gate module, and the first counter stops counting;

[0026] The sampling times buffer value of the entire PWM cycle is a value obtained by enabling the second NAND gate module and triggering the second counter to count through the second NAND gate module by the frequency-divided signal of the input signal when the frequency-divided signal of the input signal is used as another input signal and the frequency-divided signal of the input signal is at a high level or a low level; when the frequency-divided signal of the input signal is at a low level or a high level, the frequency-divided signal turns off the second NAND gate module and the second counter stops counting.

[0027] Preferably, the high level period of the frequency-divided signal PWMX2 of the input signal is the signal counting period, and the low level period of the frequency-divided signal PWMX2 is a signal refresh period, or the low level period of the frequency-divided signal PWMX2 of the input signal is the signal counting period, and the high level period of the frequency-divided signal PWMX2 is a signal refresh period; during the signal refresh period, the falling edge or the rising edge of the frequency-divided signal of the input signal generates a refresh reset signal after a certain time delay, and the rising edge or the falling edge of the refresh reset signal triggers the high level sampling number buffer value or the low level sampling number buffer value and the sampling number buffer value of the entire PWM period to be stored in the first data latch and the second data latch respectively, so as to realize the refresh of the high level sampling number value or the low level sampling number value and the sampling number value of the entire PWM period; the falling edge or the rising edge of the refresh reset signal triggers the reset of the first counter and the second counter, so as to ensure the correct operation of the next signal sampling period.

[0028] Preferably, the count value to voltage circuit is internally provided with a first digitally controlled resistor and a third digitally controlled resistor adjusted by the sampling number value of the entire PWM cycle, and a second digitally controlled resistor and a fourth digitally controlled resistor adjusted by the high level sampling number value or the low level sampling number value; the first end of the first digitally controlled resistor is grounded, and the second end thereof is connected to the negative input end of an operational amplifier; the first end of the second digitally controlled resistor is connected to the output voltage of the operational amplifier, and the second end thereof is connected to the negative input end of the operational amplifier; the first end of the third digitally controlled resistor is connected to the reference voltage, and the second end thereof is connected to the positive input end of the operational amplifier; the first end of the fourth digitally controlled resistor is grounded, and the second end thereof is connected to the positive input end of the operational amplifier; the output voltage is linearly related to the high level duty cycle or the low level duty cycle of the input signal.

[0029] Compared with the prior art, the beneficial effects of the present invention are as follows: there are two groups of timer + latch structures in the PWM sampling circuit of the present invention, which are used for the accumulation, refresh storage and continuous output of high-frequency counts, and counting is performed in one input PWM cycle, and refreshing is performed in one input PWM cycle. One PWM sampling is completed through two PWM cycles, and the sampling number value DATAH during the high level period, the sampling number value DATAL during the low level period, or the sampling number value DATAC during the entire cycle is obtained, and the digitally controlled resistor in the count value conversion voltage circuit is controlled to obtain an analog voltage output proportional to the digitally controlled resistor value. Finally, the output analog voltage is linearly related to the duty cycle of the PWM signal. The present invention can have both high speed and low cost, and has good stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1A circuit diagram of a PWM signal-to-voltage converter according to a first embodiment of the present invention;

[0031] Figure 2 PWM sampling circuit diagram of the first embodiment of the present invention;

[0032] Figure 3 This is a working waveform diagram of the PWM sampling circuit according to the first embodiment of the present invention;

[0033] Figure 4 This is a schematic diagram of a counting value-to-voltage conversion circuit according to Embodiment 1 of the present invention;

[0034] Figure 5 This is a schematic diagram of the digital controlled resistor structure of the first embodiment of the present invention;

[0035] Figure 6 This is a circuit diagram of PWM signal-to-voltage conversion according to Embodiment 2 of the present invention;

[0036] Figure 7 PWM sampling circuit diagram of the second embodiment of the present invention;

[0037] Figure 8 This is a working waveform diagram of the PWM sampling circuit of the second embodiment of the present invention;

[0038] Fig. 9 This is a circuit diagram for converting count value into voltage according to the second embodiment of the present invention. DETAILED DESCRIPTION

[0039] By reading reference Figure 1-Figure 9 The features, objects and advantages of the present invention will become more apparent from the detailed description of the non-limiting embodiments. Figure 1-Figure 9 , the present invention will be described in more detail below. However, the present invention can be implemented in many different forms and should not be construed as being limited to the embodiments set forth herein.

[0040] Embodiment 1:

[0041] Figure 1 The circuit diagram of PWM signal-to-voltage conversion according to the first embodiment of the present invention is shown. The circuit includes a PWM sampling circuit I101 and a count value-to-voltage conversion circuit I102.

[0042] like Figure 1 As shown, the PWM sampling circuit I101 performs high-frequency clock sampling on the input signal PWM_IN, the sampling clock is CLK, the sampling times of the input signal PWM_IN during the high level period is recorded as DATAH, and the sampling times of the input signal PWM_IN during the low level period is recorded as DATAL.

[0043] The count value-to-voltage circuit I102 is connected to the PWM sampling circuit I101. The count value-to-voltage circuit I102 controls a digitally controlled resistor in the count value-to-voltage circuit I102 respectively with the input sampling times DATAH and DATAL. The internal interconnection of the two digitally controlled resistors forms a proportional circuit. The output voltage VOUT of the count value-to-voltage circuit I102 is proportional to the digitally controlled resistor. The output voltage VOUT is linearly related to the duty cycle of the input signal PWM_IN.

[0044] Figure 2 FIG. 1 is a PWM sampling circuit diagram of the first embodiment of the present invention. Figure 3 FIG. 1 is a working waveform diagram of the PWM sampling circuit according to the first embodiment of the present invention.

[0045] like Figure 2 and Figure 3 As shown in the figure, the PWM sampling circuit I101 includes a NAND gate I202, a NAND gate I203, an inverter I201, a first counter I204, a second counter I205, a first data latch 206 and a second data latch I207.

[0046] The acquisition of the input signal PWM_IN is completed in two PWM_IN signal cycles, which are respectively a signal counting cycle and a signal refresh cycle. The two are distinguished by the frequency division signal PWMX2 of PWM_IN, and the period when the frequency division signal PWMX2 is high is the signal counting cycle, and the period when PWMX2 is low is the signal refresh cycle.

[0047] During the signal counting cycle, and when the input signal PWM_IN is at a high level (i.e., the frequency division signal PWMX2 of PWM_IN is at a high level and the input signal PWM_IN is at a high level at this time), the input signal PWM_IN enables the NAND gate I202, and the sampling clock signal CLK triggers the first counter I204 to count through the NAND gate I202, and the first counter I204 outputs a high-level sampling times buffer value DH; the input signal PWM_IN closes the NAND gate I203 through the inverter I201, and the second counter I205 stops counting.

[0048] During the signal counting cycle, and when the input signal PWM_IN is at a low level (i.e., the frequency division signal PWMX2 of PWM_IN is at a high level and the input signal PWM_IN is at a low level at this time), the input signal PWM_IN turns off the NAND gate I202, and the first counter I204 stops counting; the input signal PWM_IN enables the NAND gate I203 through the inverter I201, and the sampling clock signal CLK triggers the second counter I205 to count through the NAND gate I203, and the second counter I205 outputs a low-level sampling times buffer value DL.

[0049] In the signal refresh cycle (i.e., the frequency division signal PWMX2 of PWM_IN is at a low level at this time), the falling edge of PWMX2 generates a refresh reset signal RST after a certain delay, and the rising edge of the refresh reset signal RST triggers the sampling number buffer values ​​DH and DL to be stored in the first data latch I206 and the second data latch I207, thereby refreshing the sampling number values ​​DATAH and DATAL. The falling edge of the refresh reset signal RST triggers the reset of the first counter and the second counter to ensure the correct operation of the next signal sampling cycle.

[0050] In this embodiment, the signal counting period and the signal refresh period are distinguished by the frequency-divided signal PWMX2 of PWM_IN, but it is not limited to the signal counting period during which the frequency-divided signal PWMX2 is at a high level and the signal refresh period during which PWMX2 is at a low level. It can also be the signal counting period during which the frequency-divided signal PWMX2 is at a low level and the signal refresh period during which PWMX2 is at a high level. As long as the PWM sampling circuit counts in one input PWM period, refreshes in one input PWM period and completes one PWM sampling through two PWM periods, correspondingly, in the process during the signal refresh period, it is only necessary to replace the rising edge and falling edge in the above text with the falling edge and rising edge respectively, and other contents will not be repeated here.

[0051] Figure 4 FIG. 1 is a schematic diagram of a counting value-to-voltage conversion circuit according to a first embodiment of the present invention.

[0052] like Figure 4 As shown, the count value to voltage circuit I102 is internally provided with a digitally controlled resistor I401 and a digitally controlled resistor I402, which are interconnected to form a proportional circuit. The sampling number value DATAH adjusts the digitally controlled resistor I402, and the adjusted resistance value is R DH , the sampling number value DATAL adjusts the digital control resistor I401, and the adjusted resistance value is R DL The first end of the digital controlled resistor I402 is grounded, and the second end thereof is connected to the first end of the digital controlled resistor I401, and the second end of the digital controlled resistor I401 is connected to the reference voltage VREF.

[0053] The connection node of the digital control resistor I401 and the digital control resistor I402 is used as the output VOUT. According to the voltage division principle, the output voltage VOUT=VREF*R DH / (R DH +R DL ), that is, the output voltage VOUT and R DH / (R DH +R DL ) are proportional.

[0054] Figure 5 The figure shows a typical embodiment of the digitally controlled resistor structure of the first embodiment of the present invention, wherein resistors I507, I506, I505, I504, I503, I502, I501, I500 and the resistors omitted in the middle form a resistor string (also called digitally controlled resistor).

[0055] like Figure 5 As shown, I509, I510, I511, I512, I513, I514, I515, and I516 are switch circuits with the same circuit structure. For example, the switch circuit I509 includes an N-type field effect transistor I517, a P-type field effect transistor I518, and an inverter I519.

[0056] The resistor I507 is connected in parallel with the switch circuit I509, and the switch circuit controls the signal D <x>Control the on / off of the switch circuit I509: When the switch circuit control signal D <x>When it is high, the switch circuit I509 is open, and the resistance value of the resistor I507 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <x>When it is low, the switch circuit I509 is short-circuited, and the resistance value of the resistor I507 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0057] Similarly, the resistor I506 is connected in parallel with the switch circuit I510, and the switch circuit controls the signal D <x-1>Control the on / off of the switch circuit I510: When the switch circuit control signal D <x-1>When it is high, the switch circuit I510 is open, and the resistance value of the resistor I506 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <x-1>When it is low, the switch circuit I510 is short-circuited, and the resistance value of the resistor I506 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0058] Similarly, the resistor I505 is connected in parallel with the switch circuit I511, and the switch circuit controls the signal D <x-2>Control the on / off of the switch circuit I511. When the switch circuit control signal D <x-2>When it is high, the switch circuit I511 is open, and the resistance value of the resistor I505 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <x-2>When it is low, the switch circuit I511 is short-circuited, and the resistance value of the resistor I505 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0059] Similarly, the resistor I504 is connected in parallel with the switch circuit I512, and the switch circuit controls the signal D <x-3>Control the on / off of the switch circuit I512. When the switch circuit control signal D <x-3>When it is high, the switch circuit I512 is open, and the resistance value of the resistor I504 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <x-3>When it is low, the switch circuit I512 is short-circuited, and the resistance value of the resistor I504 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0060] Similarly, the resistor I503 is connected in parallel with the switch circuit I513, and the switch circuit controls the signal D <3> Control the on / off of the switch circuit I513. When the switch circuit control signal D <3> When it is high, the switch circuit I513 is open, and the resistance value of the resistor I503 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <3> When it is low, the switch circuit I513 is short-circuited, and the resistance value of the resistor I503 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0061] The resistor I502 is connected in parallel with the switch circuit I514, and the switch circuit controls the signal D <2> Control the on / off of the switch circuit I514. When the switch circuit control signal D <2> When it is high, the switch circuit I514 is open, and the resistance value of the resistor I502 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <2> When it is low, the switch circuit I514 is short-circuited, and the resistance value of the resistor I502 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0062] Similarly, the resistor I501 is connected in parallel with the switch circuit I515, and the switch circuit controls the signal D <1> Control the on / off of the switch circuit I515. When the switch circuit control signal D <1> When it is high, the switch circuit I515 is open, and the resistance value of the resistor I501 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <1> When it is low, the switch circuit I515 is short-circuited, and the resistance value of the resistor I501 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0063] Similarly, the resistor I500 is connected in parallel with the switch circuit I516, and the switch circuit controls the signal D <0> Control the on / off of the switch circuit I516. When the switch circuit control signal D <0> When it is high, the switch circuit I516 is open, and the resistance value of the resistor I500 is included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>is a logic signal, which can be recorded as 1; when the switch circuit control signal D <0> When it is low, the switch circuit I516 is short-circuited, and the resistance value of the resistor I500 is not included in the resistance value of the total resistor string. That is, at this time, the switch circuit control signal D <x>Can be recorded as 0.

[0064] In summary, the resistor string includes a plurality of resistors, and the number of resistors is not limited to the above embodiment. The number of resistors in the resistor string is recorded as X+1. The sampling number value DATAH or the sampling number value DATAL controls the resistance value of each digitally controlled resistor through the above-mentioned switch circuit control signal. The sampling number value DATAH and the sampling number value DATAL are both multi-bit numbers, and the number of bits is the same as the number of resistors in the corresponding resistor string, that is, the sampling number value DATAH is the control signal of the digitally controlled resistor I402, and the sampling number value DATAL is the control signal of I401. In the resistor string, each resistor corresponds to a control bit (D <0> , D <1> , D <2> , D <3> ...D <x-3> 、D <x-2> 、D <x-1> 、D <x>, are single bit numbers), when the switch circuit control signal increases by one control bit, the resistance doubles.

[0065] like Figure 5 As shown, if the resistance value of resistor I500 is set to R0, the resistance value of resistor I501 is R0*2, and the resistance value of resistor I502 is R0*2. 2 , the resistance value of resistor I503 is R0*2 3 , the resistance value of resistor I504 is R0*2 X-3 , the resistance value of resistor I505 is R0*2 X-2 , the resistance value of resistor I506 is R0*2 X-1 , the resistance value of resistor I507 is R0*2 X The total resistance of the resistor string of the digital controlled resistor is R TOTAL as follows:

[0066] R TOTAL

[0067] =D <0> *R0+D <1> *R0*2+D <2> *R0*2 2 +D <3> *R0*2 3 +……

[0068] +D <x-3>*R0*2 X-3 +D <x-2>*R0*2 X-2 +D <x-1>*R0*2 X-1+ D <x>*

[0069] R0*2 X

[0070] =R0(D<0>+D<1>*2+D<2>*2 2 +D<3>*2 3 +D<1>*2+

[0071] ……+D <x-3> *2 X-3 +D <x-2> *2 X-2 +D <x-1> *2 X-1+ D <x>*2 X )

[0072] =R0*D <x:0>;

[0073] Where D <0> , D <1> , D <2> , D <3> ...D <x-3> 、D <x-2> 、D <x-1> 、D <x>All are single bit numbers, D <x:0>is a multi-bit number that matches the sampling count value DATAH or DATAL and D <x:0>The number of bits is X+1.

[0074] like Figure 4 As shown, the digitally controlled resistor I401 (also called a resistor string) and the digitally controlled resistor I402 of this embodiment are two digitally controlled resistors with the same total resistance value and the same number of control bits of the resistor string. Since the sampling number value DATAH is the control signal of the digitally controlled resistor I402, and the sampling number value DATAL is the control signal of I401, after being adjusted by the above-mentioned switch circuit control signal, the adjusted resistance value R of the digitally controlled resistor I402 is DH =R0*DATAH and the resistance value R after the digital control resistor I401 is adjusted DL =R0*DATAL, the final output voltage VOUT is as follows:

[0075] VOUT

[0076] = VREF*R DH / (R DH +R DL )

[0077] =VREF*(R0*DATAH) / (R0*DATAH+R0*DATAL)

[0078] =VREF*DATAH / (DATAH+DATAL);

[0079] Among them, since DATAH is the high-level count value of the PWM signal and DATAL is the low-level count value of the PWM signal, DATAH / (DATAH+DATAL) is the high-level count value of the PWM signal divided by the count value of a full cycle of the PWM signal, that is, the high-level duty cycle Duty, and the following formula is obtained:

[0080] VOUT = VREF * Duty;

[0081] Wherein, VOUT is the output voltage of the PWM signal-to-voltage circuit of the present invention, VREF is the reference voltage, and Duty is the high-level duty cycle of the input signal PWM_IN, that is, the output voltage VOUT is linearly related to the high-level duty cycle of the input signal PWM_IN. Therefore, this embodiment realizes the linear conversion of the PWM signal to the voltage signal.

[0082] In addition, when the sampling number value DATAH in the above embodiment 1 is used as the control signal of the digital controlled resistor I401, and the sampling number value DATAL is used as the control signal of the digital controlled resistor I402, the resistance value of the digital controlled resistor I402 is R DH =R0*DATAL, the resistance of digital control resistor I401 is R DL =R0*DATAH, then the output voltage VOUT is as follows:

[0083] VOUT

[0084] = VREF*R DH / (R DH +R DL )

[0085] =VREF*(R0*DATAL) / (R0*DATAH+R0*DATAH)

[0086] =VREF*DATAL / (DATAH+DATAL);

[0087] Among them, since DATAH is the high-level count value of the PWM signal and DATAL is the low-level count value of the PWM signal, DATAL / (DATAH+DATAL) is the low-level count value of the PWM signal divided by the count value of a full cycle of the PWM signal, that is, the low-level duty cycle Duty', and the following formula is obtained:

[0088] VOUT = VREF * Duty';

[0089] Wherein, VOUT is the output voltage of the PWM signal-to-voltage circuit of the present invention, VREF is the reference voltage, and Duty' is the low-level duty cycle of the input signal PWM_IN, that is, the output voltage VOUT is linearly related to the low-level duty cycle of the input signal PWM_IN. Therefore, this embodiment realizes the linear conversion of the PWM signal to the voltage signal.

[0090] Embodiment 2:

[0091] Figure 6 The circuit diagram of PWM signal conversion to voltage according to the second embodiment of the present invention is shown. The circuit includes a PWM sampling circuit 1601 and a count value conversion to voltage circuit 1602.

[0092] like Figure 6 As shown, the PWM sampling circuit I601 performs high-frequency clock sampling on the input signal PWM_IN, the sampling clock is CLK, the sampling times of the input signal PWM_IN during the high level period is recorded as DATAH, and the sampling times of the input signal PWM_IN in a whole PWM cycle is recorded as DATAC.

[0093] The count value-to-voltage circuit I602 is connected to the PWM sampling circuit I601. The count value-to-voltage circuit I602 uses the input sampling times DATAH and DATAC to control multiple digitally controlled resistors in the count value-to-voltage circuit I602, and forms a proportional circuit through the internal interconnection of the multiple digitally controlled resistors. The output voltage VOUT of the count value-to-voltage circuit I602 is proportional to the digitally controlled resistor, that is, this output voltage VOUT is linearly related to the duty cycle of the input signal PWM_IN.

[0094] Figure 7 FIG. 1 is a PWM sampling circuit diagram of the second embodiment of the present invention. Figure 8 The figure shows the working waveform of the PWM sampling circuit according to the second embodiment of the present invention.

[0095] like Figure 7 and Figure 8 As shown in combination, the PWM sampling circuit 1601 includes: a NAND gate 1701, a NAND gate 1702, a first counter 1703, a second counter 1704, a first data latch 1705 and a second data latch 1706.

[0096] The acquisition of the input signal PWM_IN is completed in two PWM_IN signal cycles, which are the signal counting cycle and the signal refresh cycle. The two are distinguished by the PWM_IN frequency division signal PWMX2. The period when PWMX2 is high is the signal counting cycle, and the period when PWMX2 is low is the signal refresh cycle.

[0097] In the signal counting cycle, when the input signal PWM_IN is at a high level (i.e., the frequency division signal PWMX2 of PWM_IN is at a high level and the input signal PWM_IN is at a high level at this time), the input signal PWM_IN enables the NAND gate I701, and the sampling clock signal CLK triggers the first counter I703 to count through the NAND gate I701, and the first counter I703 outputs the high-level sampling times buffer value DH.

[0098] In the signal counting cycle, when the input signal PWM_IN is at a low level (ie, the frequency division signal PWMX2 of PWM_IN is at a high level and the input signal PWM_IN is at a low level), the input signal PWM_IN turns off the NAND gate I701, and the first counter I703 stops counting.

[0099] During the signal counting cycle, PWMX2 serves as another input signal. The input signal PWMX2 is at a high level. The frequency division signal PWMX2 enables the NAND gate I702. The sampling clock signal CLK triggers the second counter I704 to count through the NAND gate I702. The second counter I704 outputs a sampling number buffer value, which is the sampling number value DC of the entire cycle. Because the high level period of PWMX2 (signal counting cycle) includes the two situations of the input signal PWM_IN being at a low level and the input signal PWM_IN being at a high level, when PWMX2 is counted as an input signal, the sum of the count values ​​of PWM_IN being at a low level and at a high level will be obtained, thereby obtaining the sampling number value DC of the entire cycle; when the signal counting cycle ends, PWMX2 becomes a low level, the frequency division signal PWMX2 closes the NAND gate I702, and the second counter I704 stops counting.

[0100] In the signal refresh cycle (i.e., the frequency division signal PWMX2 of PWM_IN is at a low level at this time), the falling edge of the frequency division signal PWMX2 generates a refresh reset signal RST after a certain time delay, and the rising edge of the refresh reset signal RST triggers the sampling number buffer values ​​DH and DC to be stored in the first data latch I705 and the second data latch I706 respectively, so as to realize the refresh of the sampling number values ​​DATAH and DATAC. The falling edge of the refresh reset signal RST triggers the reset of the first counter I703 and the second counter I704 to ensure the correct operation of the next signal sampling cycle.

[0101] In this embodiment, the signal counting period and the signal refresh period are distinguished by the frequency division signal PWMX2 of PWM_IN, but it is not limited to the period when the frequency division signal PWMX2 is at a high level as the signal counting period and the period when PWMX2 is at a low level as the signal refresh period. It can also be the period when the frequency division signal PWMX2 is at a low level as the signal counting period and the period when PWMX2 is at a high level as the signal refresh period, as long as the PWM sampling circuit counts in one input PWM cycle, refreshes in one input PWM cycle and completes one PWM sampling in two PWM cycles.

[0102] Fig. 9 FIG. 2 is a circuit diagram of converting count value to voltage according to the second embodiment of the present invention.

[0103] like Fig. 9 As shown, the count value to voltage circuit I602 is internally provided with digitally controlled resistors I901, I902, I903 and I904, which are interconnected to form a proportional circuit. The sampling number value DATAC of the whole cycle adjusts the digitally controlled resistors I901 and I903, and the adjusted resistance values ​​are both R DC ; The high-level sampling times value DATAH adjusts the digital control resistors I902 and I904, and the adjusted resistance values ​​are both R DH .

[0104] The first end of the digital controlled resistor I901 is grounded, and the second end thereof is connected to the negative input terminal VN of the operational amplifier I905; the first end of the digital controlled resistor I902 is connected to the output voltage VOUT of the operational amplifier I905, and the second end thereof is connected to the negative input terminal VN of the operational amplifier I905; the first end of the digital controlled resistor I903 is connected to the reference voltage VREF, and the second end thereof is connected to the positive input terminal VP of the operational amplifier I905; the first end of the digital controlled resistor I904 is grounded, and the second end thereof is connected to the positive input terminal VP of the operational amplifier I905.

[0105] According to the voltage division principle, the voltage at the positive input terminal VP of the operational amplifier I905 is VREF*R DH / (R DC +R DH ). The voltage at the negative input terminal VN of the operational amplifier I905 is VOUT*R DC / (R DC +R DH ).

[0106] In addition, according to the characteristics of virtual short circuit of positive and negative input terminals of operational amplifier, it can be concluded that:

[0107] VREF*R DH / (R DC +R DH )=VOUT*R DC / (R DC +R DH );

[0108] Thus, VOUT=VREF*R DH / R DC ;

[0109] In this embodiment, the digitally controlled resistors I901, I902, I903, and I904 are four digitally controlled resistors with the same total resistance value and the same number of control bits in the resistor string, and the internal structure is the same as that of the first embodiment. Figure 5 The digitally controlled resistor has the same characteristics as the PWM signal to voltage circuit in the first embodiment, and the principle is not described here. DC =DATAC*R0,R DH =DATAH*R0,R DH / R DC =DATAH / DATAC=Duty, that is:

[0110] VOUT = VREF * Duty;

[0111] Among them, VOUT is the output voltage of the PWM signal to voltage conversion circuit of the present invention, VREF is the reference voltage, the sampling number value during the high level period of PWM_IN is DATAH, the sampling number value of the input signal PWM_IN in one full cycle is DATAC, and Duty is the high level duty cycle of the input signal PWM_IN, that is, the output voltage VOUT is linearly related to the high level duty cycle of the input signal PWM_IN. Therefore, this embodiment realizes the linear conversion of the PWM signal to the voltage signal.

[0112] In addition to the control of each digitally controlled resistor by collecting the sampling number value DATAH during the high level period and the sampling number value DATAL during the low level period in the above-mentioned embodiment 1, thereby realizing the linear conversion of the PWM signal to the voltage signal, and the control of each digitally controlled resistor by collecting the sampling number value DATAH during the high level period and the sampling number value DATAC of the entire PWM cycle in the embodiment 2, thereby realizing the linear conversion of the PWM signal to the voltage signal, the present invention can also control each digitally controlled resistor by collecting the sampling number value DATAL during the low level period and the sampling number value DATAC of the entire PWM cycle, thereby realizing the linear conversion of the PWM signal to the voltage signal. This method is the same as the embodiment 2, as long as the sampling number value DATAH during the high level period is replaced by the sampling number value DATAL during the low level period, and the present invention will not elaborate on this.

[0113] Although the content of the present invention has been described in detail through the above preferred embodiments, it should be appreciated that the above description should not be considered as a limitation of the present invention. After reading the above content, it will be apparent to those skilled in the art that various modifications and substitutions of the present invention will occur. Therefore, the protection scope of the present invention should be limited by the appended claims. < / x> < / x-1> < / x-2> < / x-3> < / x> < / x-1> < / x-2> < / x-3> < / x> < / x> < / x-1> < / x-2> < / x-3> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x> < / x>

Claims

1. A circuit for converting PWM signals into voltage. It is characterized in that Include: A PWM sampling circuit, wherein the input signal is a PWM signal and the input signal is sampled by a high-frequency clock to obtain a high-level sampling number value of the input signal during a high-level period and a low-level sampling number value during a low-level period, or obtain a high-level sampling number value of the input signal during a high-level period and a sampling number value in the entire PWM cycle, or obtain a low-level sampling number value of the input signal during a low-level period and a sampling number value in the entire PWM cycle, or obtain a high-level sampling number value of the input signal during a high-level period, a low-level sampling number value of the input signal during a low-level period and a sampling number value in the entire PWM cycle; A count value-to-voltage circuit is connected to the PWM sampling circuit, and controls one or more corresponding digitally controlled resistors in the count value-to-voltage circuit with each input sampling number value, and each digitally controlled resistor is connected to form a proportional circuit, so that the output voltage of the count value-to-voltage circuit is linearly related to the duty cycle of the input signal; The count value-to-voltage circuit is internally provided with a first digitally controlled resistor and a second digitally controlled resistor adjusted by the corresponding sampling times; the first digitally controlled resistor and the second digitally controlled resistor are connected in series; the first end of the second digitally controlled resistor is grounded, and the second end thereof is connected to the first end of the first digitally controlled resistor, the second end of the first digitally controlled resistor is connected to a reference voltage, and the node connecting the first digitally controlled resistor and the second digitally controlled resistor is used as the output voltage; When the first digitally controlled resistor matches the value of the low-level sampling times and the second digitally controlled resistor matches the value of the high-level sampling times, the output voltage is linearly related to the high-level duty cycle of the input signal; or, when the first digitally controlled resistor matches the value of the high-level sampling times and the second digitally controlled resistor matches the value of the low-level sampling times, the output voltage is linearly related to the low-level duty cycle of the input signal; Wherein, each resistor is connected in parallel with a switch circuit, the high-level sampling number value or the low-level sampling number value is connected to the single-bit control signal at the input end of each switch circuit, when the control signal controls the switch circuit to open, the resistance value of the corresponding resistor is included in the resistance value of the resistor string, and when the control signal controls the switch circuit to short-circuit, the resistance value of the corresponding resistor is not included in the resistance value of the resistor string; The resistance value of each resistor in the resistor string is doubled in sequence. When the total resistance value of the digitally controlled resistor adjusted by the corresponding sampling number value is equal to the product of the smallest resistance value in the resistor string and the sampling number value, the output voltage of the count value to voltage conversion circuit is linearly related to the high level or low level duty cycle of the input signal.

2. The circuit for converting a PWM signal into a voltage as claimed in claim 1, It is characterized in that The PWM sampling circuit includes a pair of counters and a pair of data latches matched therewith, which are respectively used for counting, refreshing, storing and continuously outputting each sampling number value, and counts in one input PWM cycle, refreshes in one input PWM cycle and completes one PWM sampling through two PWM cycles.

3. The circuit for converting a PWM signal into a voltage as claimed in claim 1 or 2, It is characterized in that The PWM sampling circuit comprises: A first counter, one end of which is connected to the output end of the first NAND gate module, and the other end of which is connected to the input end of the first data latch, wherein the first counter outputs a high-level sampling times buffer value to the first data latch, and outputs the high-level sampling times value; An inverter, one end of which is connected to the input signal, and the other end of which is connected to the input end of the second NAND gate module; A second counter, one end of which is connected to the output end of the second NAND gate module, and the other end of which is connected to the input end of the second data latch, the second counter outputs a low-level sampling times buffer value to the second data latch, and outputs the low-level sampling times value; The high-level sampling times buffer value is a value obtained by enabling the first NAND gate module through the input signal and triggering the first counter to count through the first NAND gate module when the input signal is in the signal counting cycle and the input signal is at a high level. At this time, the input signal turns off the second NAND gate module through the inverter, and the second counter stops counting; The low-level sampling times buffer value is a value obtained by closing the first NAND gate module through the input signal to stop counting the first counter, and the input signal enables the second NAND gate module through the inverter, and the sampling clock signal triggers the second counter to count through the second NAND gate module when the signal counting cycle and the input signal is at a low level.

4. The circuit for converting a PWM signal into a voltage as claimed in claim 3, It is characterized in that The high level period of the frequency division signal PWMX2 of the input signal is the signal counting period, and the low level period of the frequency division signal PWMX2 is a signal refresh period, or the low level period of the frequency division signal PWMX2 of the input signal is the signal counting period, and the high level period of the frequency division signal PWMX2 is a signal refresh period; During the signal refresh cycle, the falling edge or rising edge of the divided signal of the input signal generates a refresh reset signal after a certain period of delay, and the rising edge or falling edge of the refresh reset signal triggers the high-level sampling number buffer value and the low-level sampling number buffer value to be stored in the first data latch and the second data latch, refreshing the high-level sampling number value during the high-level period and the low-level sampling number value during the low-level period, and the falling edge or rising edge of the refresh reset signal triggers the reset of the first counter and the second counter.

5. The circuit for converting a PWM signal into a voltage as claimed in claim 1, It is characterized in that The first digitally controlled resistor and the second digitally controlled resistor are both resistor strings, which include a plurality of resistors connected in series. The high-level sampling times and the low-level sampling times are both multi-bit numbers, and the number of bits is the same as the number of resistors of the corresponding digitally controlled resistors.

6. The circuit for converting a PWM signal into a voltage as claimed in claim 1 or 2, It is characterized in that The PWM sampling circuit comprises: A first counter, one end of which is connected to the output end of the first NAND gate module, and the other end of which is connected to the input end of the first data latch, wherein the first counter outputs a high-level sampling number buffer value or a low-level sampling number buffer value to the first data latch, and outputs the high-level sampling number value or the low-level sampling number value; a second counter, one end of which is connected to the output end of the second NAND gate module, and the other end of which is connected to the input end of the second data latch, the second counter outputs a buffer value of the number of samplings of the entire PWM cycle to the second data latch, and outputs the number of samplings of the entire PWM cycle; The high-level sampling times buffer value is a value obtained by enabling the first NAND gate module through the input signal and triggering the first counter to count through the first NAND gate module when the input signal is at a high level during the signal counting cycle; when the input signal is at a low level during the signal counting cycle, the input signal turns off the first NAND gate module, and the first counter stops counting; The sampling times buffer value of the entire PWM cycle is a value obtained by enabling the second NAND gate module and triggering the second counter to count through the second NAND gate module by the frequency-divided signal of the input signal when the frequency-divided signal of the input signal is used as another input signal and the frequency-divided signal of the input signal is at a high level or a low level; when the frequency-divided signal of the input signal is at a low level or a high level, the frequency-divided signal turns off the second NAND gate module and the second counter stops counting.

7. The circuit for converting a PWM signal into a voltage as claimed in claim 6, It is characterized in that The high level period of the frequency division signal PWMX2 of the input signal is the signal counting period, and the low level period of the frequency division signal PWMX2 is a signal refresh period, or the low level period of the frequency division signal PWMX2 of the input signal is the signal counting period, and the high level period of the frequency division signal PWMX2 is a signal refresh period; During the signal refresh cycle, the falling edge or rising edge of the frequency-divided signal of the input signal generates a refresh reset signal after a certain period of delay, and the rising edge or falling edge of the refresh reset signal triggers the high-level sampling number buffer value or the low-level sampling number buffer value and the sampling number buffer value of the entire PWM cycle to be stored in the first data latch and the second data latch respectively, so as to realize the refresh of the high-level sampling number value or the low-level sampling number value and the sampling number value of the entire PWM cycle; the falling edge or rising edge of the refresh reset signal triggers the reset of the first counter and the second counter, so as to ensure the correct operation of the next signal sampling cycle.

8. The circuit for converting a PWM signal into a voltage as claimed in claim 1 or 6, It is characterized in that The count value-to-voltage circuit is internally provided with a first digitally controlled resistor and a third digitally controlled resistor adjusted by the sampling number value of the entire PWM cycle, and a second digitally controlled resistor and a fourth digitally controlled resistor adjusted by the high level sampling number value or the low level sampling number value; The first end of the first digitally controlled resistor is grounded, and the second end thereof is connected to the negative input end of an operational amplifier; the first end of the second digitally controlled resistor is connected to the output voltage of the operational amplifier, and the second end thereof is connected to the negative input end of the operational amplifier; the first end of the third digitally controlled resistor is connected to the reference voltage, and the second end thereof is connected to the positive input end of the operational amplifier; the first end of the fourth digitally controlled resistor is grounded, and the second end thereof is connected to the positive input end of the operational amplifier; The output voltage is linearly related to a high level duty cycle or a low level duty cycle of the input signal.