Digital pulse signal width measuring circuit and measuring method

文档序号:1183564 发布日期:2020-09-22 浏览:29次 中文

阅读说明:本技术 一种数字脉冲信号宽度测量电路及测量方法 (Digital pulse signal width measuring circuit and measuring method ) 是由 陈虎 许野 万江华 于 2020-05-14 设计创作,主要内容包括:一种数字脉冲信号宽度测量电路及测量方法,该测量电路包括:采样时钟,用于驱动电路中的所有寄存器;边沿检测与中断控制单元,用于检测输入引脚Input上脉冲信号的上升沿、下降沿,进而对信号采集进行控制;整数编码单元,包括计数器和寄存器,用来以采样时钟的1个周期1/f为基准单位,测量输入引脚Input上高或低电平的宽度的整数部分μ;信号捕捉链,用来采样每个延时单元DLL的输出电平值;小数编码单元,用来找出并记录脉冲边沿在信号捕捉链上传播的位置;校准控制单元,用来进行校准。该测量方法基于上述测量电路来实现。本发明具有精度高、结构简单、资源开销小等优点。(A digital pulse signal width measuring circuit and a measuring method thereof are provided, the measuring circuit comprises: the sampling clock is used for driving all registers in the circuit; the edge detection and interruption control unit is used for detecting the rising edge and the falling edge of a pulse signal on an Input pin so as to control signal acquisition; an integer encoding unit including a counter and a register for measuring an integer part mu of a width of a high or low level on an Input pin with 1 cycle 1/f of a sampling clock as a reference unit; a signal capturing chain for sampling the output level value of each delay unit DLL; the decimal coding unit is used for finding and recording the position of the pulse edge propagating on the signal capturing chain; and the calibration control unit is used for performing calibration. The measuring method is realized based on the measuring circuit. The invention has the advantages of high precision, simple structure, low resource overhead and the like.)

1. A digital pulse signal width measurement circuit, comprising:

the sampling clock is used for driving all registers in the circuit;

the edge detection and interruption control unit is used for detecting the rising edge and the falling edge of a pulse signal on an Input pin so as to control signal acquisition;

an integer encoding unit including a counter and a register for measuring an integer part mu of a width of a high or low level on an Input pin with 1 cycle 1/f of a sampling clock as a reference unit;

the signal capturing chain comprises a group of delay units DLL and capturing registers CAP, wherein the number of the delay units and the number of the registers are equal, and the delay units and the registers are set as positive integers i; a certain amount of delay is generated when a signal on an Input pin propagates through one delay unit, and the delay is set as the value; the signal capturing chain is used for sampling the output level value of each delay unit DLL temporarily at the next clock rising edge after the rising edge and the falling edge of the pulse signal on the Input pin Input occur;

the decimal coding unit is used for finding and recording the position of the pulse edge transmitted on the signal capturing chain according to the sampling result of the signal capturing chain;

the calibration control unit generates an internal Input signal and a sampling control signal after detecting the rising edge of a signal on an Input pin, and controls a signal capture chain to sample the output of the delay unit DLL; the sampling result is stored in a calibration register after being coded; the step information is calculated from the calibration register.

2. The digital pulse signal width measuring circuit according to claim 1, wherein the edge detecting and interrupting control unit generates an Interrupt signal Interrupt when detecting a rising edge or a falling edge of the pulse signal on the Input pin when performing Interrupt control to notify the master device to read the pulse signal measurement result; the measurement results are stored in registers in the integer encoding, fractional encoding logic.

3. The digital pulse signal width measurement circuit of claim 1, wherein the integer code logic includes a Counter [ n:1], 4 registers CNTR1[ n:1], CNTR2[ n:1], CNTF1[ n:1], CNTF2[ n:1 ]; the Counter [ n:1] starts counting from 0 after the edge detection logic detects a rising or falling edge of a pulse; upon detection of a rising edge, the Counter [ n:1] is loaded into register CNTR1[ n:1] to record the measurement results just before the rising edge, register CNTR1[ n:1] is loaded into CNTR2[ n:1], register CNTF1[ n:1] is loaded into CNTF2[ n:1 ]; when a falling edge is detected, the Counter [ n:1] is loaded into the register CNTF1[ n:1] to record the measurement results that precede the falling edge.

4. The digital pulse signal width measuring circuit according to claim 1, 2 or 3, wherein the capture register CAP is configured to sample the output level value of each delay cell DLL temporarily in the next rising clock edge after the rising edge and the falling edge of the pulse signal on the Input pin Input occur.

5. The digital pulse signal width measurement circuit according to claim 1, 2 or 3, wherein the fractional encoding unit includes an encoder R, an encoder F, encoding registers ENCR1[ m:1], ENCR1[ m:1], ENCF1[ m:1], ENCF2[ m:1], calibration registers CALR1[ m:1], CALR2[ m:1], STEP registers STEP [ m:1 ]; the relation between the number m of the encoding registers ENCR1[ m:1] and the number i of delay cells DLL in the signal capturing chain is as follows:

m=log2i。

6. the digital pulse signal width measuring circuit according to claim 5, wherein when the edge detection is performed, the output of the capture register CAP is encoded by the encoder R after the rising edge of the pulse signal on the Input pin is detected, and the result is retained in the register ENCR1[ m:1 ]; after the falling edge of the pulse signal is detected to come, the output of the capture register CAP is encoded by an encoder F, and the result is retained in a register ENCF1[ m:1 ]; upon detection of a rising edge, register ENCR1[ m:1] is loaded into ENCR2[ m:1], register ENCF1[ m:1] is loaded into ENCF2[ m:1 ].

7. The digital pulse signal width measurement circuit of claim 5, wherein the calibration registers CALR1[ m:1], CALR2[ m:1] are used to record the position of the pulse edge propagating on the DLL chain under control of the calibration control unit; the value of the STEP register STEP [ m:1] represents the number of delay units which can be propagated and passed by the signal on the Input pin in a sampling clock period 1/f; the STEP [ m:1] is calculated according to calibration registers CALR1[ m:1] and CALR2[ m:1 ].

8. The digital pulse signal width measuring circuit according to claim 1, 2 or 3, wherein the relationship between the frequency f of the sampling clock and the delay of the delay cells, the number i of delay cells is:

1/f < i x, wherein i is a positive integer.

9. A method for measuring a width of a digital pulse signal, comprising:

step S1: detecting edges; after the edge detection logic detects the rising edge or the falling edge of a pulse signal on an Input pin, generating Rise, Fall and Rise _ or _ Fall pulse signals;

step S2: integer coding; upon detection of a pulse rising or falling edge, the Counter [ n:1] starts counting from 0; upon detection of a rising edge, Counter [ n:1] is loaded into register CNTR1[ n:1], register CNTR1[ n:1] is loaded into CNTR2[ n:1], register CNTF1[ n:1] is loaded into CNTF2[ n:1 ]; when a falling edge is detected, Counter [ n:1] is loaded into register CNTF1[ n:1 ];

step S3, decimal coding; after the rising edge or the falling edge of a pulse signal on an Input pin comes, the result sampled in a capture register CAP [ i:1] after the rising edge of the next sampling clock is coded, and the position of the pulse edge propagated on a delay unit DLL chain is found out;

step S4, calibrating step length information; monitoring STEP length information STEP [ m:1], namely the number of delay units which can be propagated and passed by signals on an Input pin in a signal capturing chain within a sampling clock period 1/f;

step S5: generating an interrupt; selecting to generate an interrupt at a rising edge or a falling edge in the interrupt control logic, and informing the main control equipment to read a pulse signal measurement result;

step S6: calculating; the software calculates the width of the high and low level pulses before the interrupt occurs based on the information in registers CNTR1[ n:1], CNTR2[ n:1], CNTF1[ n:1], CNTF2[ n:1], registers ENCR1[ m:1], ENCR2[ m:1], ENCF1[ m:1], ENCF1[ m:1], and STEP register STEP [ m:1 ].

10. The digital pulse signal width measuring method according to claim 9, wherein the step S4 includes:

step S401: generating an internal input signal and a sampling control signal; the calibration control logic generates an internal Input pulse signal and 2 sampling control signals after the edge detection logic detects a period of time interval of the rising edge of the signal on the Input pin; the internal input pulse signal is used as the input of a signal capturing chain; the sampling control signal controls the time for sampling the output level value of each DLL;

step S402: sampling; after the sampling control signal occurs, sampling the output of each DLL at the rising edge of the next sampling clock HRCAPCLK, and storing the result in a capture register; the sampling process is carried out for 2 times;

step S403: coding; the encoder encodes the sampling results of two consecutive times, and the encoded results are respectively stored in a calibration register;

step S404: calculating; if the time interval of 2 times of sampling is a positive integer ω sampling clock periods, the STEP calculation method is:

STEP=(CALR1–CALR2)/ω。

Technical Field

The invention mainly relates to the technical field of high-precision digital pulse signal measurement, in particular to a digital pulse signal width measuring circuit and a measuring method.

Background

In a large number of industrial and consumer devices and instruments, signals such as voltage, current, capacitance, speed, distance and the like generally need to be measured, and the measurement precision directly influences the precision of the devices and the instruments.

High-precision digital pulse signal width measurement is widely applied to pulse sequence period/duty ratio measurement, instantaneous speed measurement, voltage measurement crossing an isolation boundary, distance/sonar measurement and scanning, capacitive touch sensing and the like in equipment such as precision instruments, sonars, robot servo, switching power supplies, power devices, touch screens and the like.

In a digital signal processing device, signal measurement generally involves first converting signals such as voltage, capacitance, speed, and distance into digital pulse signals through analog-to-digital conversion, and then measuring the digital pulse signals. As shown in fig. 1, the digital pulse signal width measurement is to use a sampling clock (frequency f) to represent the width of a pulse signal as a real number including an integer part and a fractional part with a reference unit of one clock cycle. In fig. 1, the integer part is denoted by μ; the fractional part is due to the misalignment of the edges of the pulse signal with the edges of the sampling clock, originating from the head and tail of the pulse, i.e. 1-alpha, 1-beta. In fig. 1, the relationship between the width λ of the high-level pulse signal and f, μ, α, β is:

λ=(μ+1-α-β)×1/f (1)

the measurement precision of the traditional digital signal measurement circuit is 1 sampling clock period 1/f, only an integer part mu of a signal width lambda can be measured, and a decimal part 1-alpha-beta of the signal width can not be measured. If the measurement accuracy is to be improved, only the frequency of the sampling clock can be increased, thereby greatly increasing the power consumption and complexity of the hardware circuit.

The pulse signal width measurement as realized in patent US 8384440B2 has the feature of high accuracy and does not require a high frequency sampling clock. However, this approach limits the operating range of the sampling clock, and at the same time, increases the software and hardware overhead by requiring a separate capture delay chain and periodically executing the software calibration procedure.

Disclosure of Invention

The technical problem to be solved by the invention is as follows: aiming at the technical problems in the prior art, the invention provides the ultra-high precision digital pulse signal width measuring circuit and the measuring method which have the advantages of high precision, simple structure and low resource expenditure.

In order to solve the technical problems, the invention adopts the following technical scheme:

a digital pulse signal width measurement circuit, comprising:

the sampling clock is used for driving all registers in the circuit;

the edge detection and interruption control unit is used for detecting the rising edge and the falling edge of a pulse signal on an Input pin so as to control signal acquisition;

an integer encoding unit including a counter and a register for measuring an integer part mu of a width of a high or low level on an Input pin with 1 cycle 1/f of a sampling clock as a reference unit;

the signal capturing chain comprises a group of delay units DLL and capturing registers CAP, wherein the number of the delay units and the number of the registers are equal, and the delay units and the registers are set as positive integers i; a certain amount of delay is generated when a signal on an Input pin propagates through one delay unit, and the delay is set as the value; the signal capturing chain is used for sampling the output level value of each delay unit DLL temporarily at the next clock rising edge after the rising edge and the falling edge of the pulse signal on the Input pin Input occur;

the decimal coding unit is used for finding and recording the position of the pulse edge transmitted on the signal capturing chain according to the sampling result of the signal capturing chain;

the calibration control unit generates an internal Input signal and a sampling control signal after detecting the rising edge of a signal on an Input pin, and controls a signal capture chain to sample the output of the delay unit DLL; the sampling result is stored in a calibration register after being coded; the step information is calculated from the calibration register.

As a further improvement of the measuring circuit of the invention: when the edge detection and interruption control unit is in interruption control, generating an interruption signal Interrupt when detecting the rising edge or the falling edge of a pulse signal on an Input pin to inform a main control device to read a pulse signal measurement result; the measurement results are stored in registers in the integer encoding, fractional encoding logic.

As a further improvement of the measuring circuit of the invention: the integer encoding logic includes a Counter [ n:1], 4 registers CNTR1[ n:1], CNTR2[ n:1], CNTF1[ n:1], CNTF2[ n:1 ]; the Counter [ n:1] starts counting from 0 after the edge detection logic detects a rising or falling edge of a pulse; upon detection of a rising edge, the Counter [ n:1] is loaded into register CNTR1[ n:1] to record the measurement results just before the rising edge, register CNTR1[ n:1] is loaded into CNTR2[ n:1], register CNTF1[ n:1] is loaded into CNTF2[ n:1 ]; when a falling edge is detected, the Counter [ n:1] is loaded into the register CNTF1[ n:1] to record the measurement results that precede the falling edge.

As a further improvement of the measuring circuit of the invention: the capture register CAP [ i:1] is used for sampling the output level value of each delay unit DLL temporarily at the next clock rising edge after the rising edge and the falling edge of the pulse signal on the Input pin Input occur.

As a further improvement of the measuring circuit of the invention: the decimal encoding unit comprises an encoder R and an encoder F, encoding registers ENCR1[ m:1], ENCR1[ m:1], ENCF1[ m:1] and ENCF2[ m:1], calibration registers CALR1[ m:1] and CALR2[ m:1], and a STEP register STEP [ m:1 ]; the relation between the number m of the encoding registers ENCR1[ m:1] and the number i of delay cells DLL in the signal capturing chain is as follows:

m=log2i。

as a further improvement of the measuring circuit of the invention: when edge detection is carried out, after the rising edge of a pulse signal on an Input pin is detected to come, the output of a capture register CAP is encoded by an encoder R, and the result is kept in a register ENCR1[ m:1 ]; after the falling edge of the pulse signal is detected to come, the output of the capture register CAP is encoded by an encoder F, and the result is retained in a register ENCF1[ m:1 ]; upon detection of a rising edge, register ENCR1[ m:1] is loaded into ENCR2[ m:1], register ENCF1[ m:1] is loaded into ENCF2[ m:1 ].

As a further improvement of the measuring circuit of the invention: the calibration registers CALR1[ m:1] and CALR2[ m:1] are used for recording the positions of the pulse edges propagating on the DLL chain under the control of the calibration control unit; the value of the STEP register STEP [ m:1] represents the number of delay units which can be propagated and passed by the signal on the Input pin in a sampling clock period 1/f; the STEP [ m:1] is calculated according to calibration registers CALR1[ m:1] and CALR2[ m:1 ].

As a further improvement of the measuring circuit of the invention: the relationship between the frequency f of the sampling clock and the delay of the delay units and the number i of the delay units is as follows:

1/f < i x, wherein i is a positive integer.

The invention further provides a digital pulse signal width measuring method, which comprises the following steps:

step S1: detecting edges; that is, after the edge detection logic detects the rising edge or the falling edge of the pulse signal on the Input pin, the edge detection logic generates Rise, Fall, Rise _ or _ Fall pulse signals. Rise, Fall, Rise _ or _ Fall pulse signals are used to: 1) controlling a Counter in the integer coding unit to start counting again from 0, 2) controlling the signal to capture the output level of the chain sampling DLL; 3) controlling an encoder R, F in the fractional encoding unit to encode the result in the capture register CAP;

step S2: integer coding; upon detection of a pulse rising or falling edge, the Counter [ n:1] starts counting from 0; upon detection of a rising edge, Counter [ n:1] is loaded into register CNTR1[ n:1], register CNTR1[ n:1] is loaded into CNTR2[ n:1], register CNTF1[ n:1] is loaded into CNTF2[ n:1 ]; when a falling edge is detected, Counter [ n:1] is loaded into register CNTF1[ n:1 ];

step S3, decimal coding; after the rising edge or the falling edge of a pulse signal on an Input pin comes, the result sampled in a capture register CAP [ i:1] after the rising edge of the next sampling clock is coded, and the position of the pulse edge propagated on a delay unit DLL chain is found out;

step S4, calibrating step length information; STEP information STEP m:1, i.e. the number of delay units that a signal on Input pin can propagate through on the signal capture chain within one sampling clock period 1/f, is monitored.

Step S5: generating an interrupt; selecting to generate an interrupt at a rising edge or a falling edge in the interrupt control logic, and informing the main control equipment to read a pulse signal measurement result;

step S6: calculating; the software calculates the width of the high and low level pulses before the interrupt occurs based on the information in registers CNTR1[ n:1], CNTR2[ n:1], CNTF1[ n:1], CNTF2[ n:1], registers ENCR1[ m:1], ENCR2[ m:1], ENCF1[ m:1], ENCF1[ m:1], and STEP register STEP [ m:1 ].

As a further improvement of the measuring method of the invention: the step S4 includes:

step S401: generating an internal input signal and a sampling control signal; the calibration control logic generates an internal Input pulse signal and 2 sampling control signals after the edge detection logic detects a period of time interval of the rising edge of the signal on the Input pin; the internal input pulse signal is used as the input of a signal capturing chain; the sampling control signal controls the time for sampling the output level value of each DLL;

step S402: sampling; after the sampling control signal occurs, sampling the output of each DLL at the rising edge of the next sampling clock HRCAPCLK, and storing the result in a capture register; the sampling process is carried out for 2 times;

step S403: coding; the encoder encodes the sampling results of two consecutive times, and the encoded results are respectively stored in a calibration register;

step S404: calculating; if the time interval of 2 times of sampling is a positive integer ω sampling clock periods, the STEP calculation method is:

STEP=(CALR1–CALR2)/ω。

compared with the prior art, the invention has the advantages that:

1. the digital pulse signal width measuring circuit and the measuring method have the advantages of high precision, simple structure, low resource overhead and the like, and can accurately measure the digital pulse signal width under the condition of not increasing the sampling clock frequency. If a sampling clock of 100MHz is adopted, the precision can reach 100ps magnitude.

2. The digital pulse signal width measuring circuit and the measuring method can dynamically calibrate the measuring precision in real time according to the change of the actual working environment (such as temperature and working voltage), have wide application range and high measuring precision, and do not bring software overhead in calibration.

Drawings

Fig. 1 is a schematic diagram of the principle of digital pulse signal measurement.

FIG. 2 is a schematic diagram of the structure of the measuring circuit in the specific application example of the present invention.

FIG. 3 is a schematic diagram of the measurement method in a specific application example of the present invention.

Detailed Description

The invention will be described in further detail below with reference to the drawings and specific examples.

Fig. 2 is a schematic diagram of the ultra-high precision digital pulse signal width measuring circuit according to the present invention in a specific application example. For simplicity, the sampling clock and its connection to other circuits are not shown in fig. 2, but this does not hinder the understanding of the technical solution of the present invention by those skilled in the art, and does not affect the actual protection scope of the present invention.

The invention relates to an ultra-high precision digital pulse signal width measuring circuit, which comprises an edge detection and interruption control unit, an integer coding unit, a signal capture chain, a decimal coding unit, a calibration control unit and a sampling clock HRCAPCLK; wherein:

a sampling clock HRCAPCLK used for driving all registers in the circuit;

and the edge detection and interruption control unit is used for detecting the rising edge and the falling edge of the pulse signal on the Input pin, and further controlling the integer coding unit, the decimal coding unit, the calibration control unit and the signal acquisition on the signal capture chain. The rising edge of the pulse signal indicates the start of the high level and the end of the low level, and the falling edge indicates the end of the high level and the start of the low level. The outputs Rise, Fall, Rise _ or _ Fall indicate that a rising edge, a falling edge, a rising or a falling edge is detected;

an integer encoding unit for measuring an integer part mu of the width of the high or low level on the Input pin with 1 cycle 1/f of the sampling clock HRCAPCLK as a reference unit;

the signal capturing chain is used for sampling the output level value of each delay unit DLL (delay locked loop) when the rising edge and the falling edge of a pulse signal on an Input pin occur and the rising edge of the next HRCAPCLK clock comes;

and the decimal coding unit generates a decimal value according to the result of the pulse width measurement when the edge of the pulse signal on the Input pin is not aligned with the edge of the sampling clock HRCAPCLK. As shown in fig. 1, the decimal value consists of 2 parts, i.e., 1- α, 1- β. The decimal coding unit is used for finding and recording the position of the pulse edge propagating on the signal capture chain according to the sampling result of the signal capture chain (capture register CAP);

and the calibration control unit generates an internal Input signal and a sampling control signal after detecting the rising edge of the signal on the Input pin, and controls the signal capturing chain to sample the output of the delay unit DLL for 2 times. The 2-time sampling result of the signal capturing chain is stored in a calibration register after being coded; the step information is calculated according to the calibration register, and the result is stored in the step register.

In a specific application example, the purpose of the Interrupt control of the edge detection and Interrupt control unit is to generate an Interrupt signal Interrupt when a rising edge or a falling edge of a pulse signal on the Input pin is detected, so as to notify the master device to read a measurement result of the pulse signal. The measurement results are stored in registers in the integer encoding, fractional encoding logic.

In a specific embodiment, the integer encoding logic includes a Counter [ n:1], 4 registers CNTR1[ n:1], CNTR2[ n:1], CNTF1[ n:1], CNTF2[ n:1 ]. Where Counter [ n:1] starts counting from 0 after the edge detection logic detects a rising or falling edge of the pulse. Upon detection of a rising edge, the Counter [ n:1] is loaded into register CNTR1[ n:1] to record the measurement results just before the rising edge, register CNTR1[ n:1] is loaded into CNTR2[ n:1], register CNTF1[ n:1] is loaded into CNTF2[ n:1 ]; when a falling edge is detected, the Counter [ n:1] is loaded into the register CNTF1[ n:1] to record the measurement results that precede the falling edge.

In a specific application example, the signal capture chain comprises a group of delay units DLL and a capture register CAP. The number of delay units and registers is equal, and is set as a positive integer i. A certain amount of delay is generated when a signal on the Input pin propagates through one delay unit, and the delay is set to be. Will vary depending on the operating environment of the circuit. Such as temperature rise or operating voltage drop, increase; and decreases when the temperature decreases or the operating voltage increases. The capture register CAP is used for sampling the output level value of each delay unit DLL at the next rising edge of the HRCAPCLK clock after the rising edge and the falling edge of the pulse signal on the Input pin Input occur.

In a specific application example, the decimal coding unit comprises a coder R, a coder F, coding registers ENCR1[ m:1], ENCR1[ m:1], ENCF1[ m:1], ENCF2[ m:1], calibration registers CALR1[ m:1], CALR2[ m:1] and a STEP register STEP [ m:1 ]. The relationship between the number m of code registers ENCR1[ m:1] and the number i of delay cells DLL in the signal capture chain is:

m=log2i (2)

in a specific application example, after the edge detection logic detects that the rising edge of a pulse signal on an Input pin comes, the output of a capture register CAP is encoded by an encoder R, and the result is retained in a register ENCR1[ m:1 ]; after the edge detection logic detects that the falling edge of the pulse signal comes, the output of the capture register CAP is encoded by the encoder F, and the result is retained in the register ENCF1[ m:1 ]. Upon detection of a rising edge, register ENCR1[ m:1] is loaded into ENCR2[ m:1], register ENCF1[ m:1] is loaded into ENCF2[ m:1 ].

In a specific application example, the calibration registers CALR1[ m:1], CALR2[ m:1] function to record the position of the pulse edge propagating on the DLL chain under the control of the calibration controller. The value of the STEP register STEP [ m:1] represents the number of delay cells through which the signal on Input pin Input can propagate on the signal capture chain within one sampling clock cycle 1/f. STEP [ m:1] is calculated from calibration registers CALR1[ m:1], CALR2[ m:1 ].

Since the delay of the delay unit DLL in the signal capture chain varies with the operating environment of the circuit, in order to accurately represent the fractional part of the pulse measurement result, STEP information STEP needs to be dynamically monitored, i.e. the number of delay units through which the signal on the Input pin Input can propagate on the signal capture chain within one sampling clock period 1/f. The calibration control unit is used for generating an internal Input signal and a sampling control signal after detecting the rising edge of a signal on an Input pin, and controlling the capture register CAP to sample the output of the DLL for 2 times. The 2-time sampling results of the capture register CAP are encoded by the encoder R and stored in the calibration registers CALR1[ m:1] and CALR2[ m:1 ]. The STEP information is calculated from calibration registers CALR1[ m:1], CALR2[ m:1], and the result is stored in STEP [ m:1 ].

In a specific application example, the relationship between the frequency f of the sampling clock and the delay of the delay unit and the number i of the delay units is as follows:

1/f < i x, i is a positive integer (3)

As shown in fig. 3, the present invention further provides a method for measuring the width of an ultra-high precision digital pulse signal, comprising:

step S1: detecting edges; that is, after the edge detection logic detects the rising edge or the falling edge of the pulse signal on the Input pin, the edge detection logic generates Rise, Fall, Rise _ or _ Fall pulse signals. Rise, Fall, Rise _ or _ Fall pulse signals are used to: 1) controlling a Counter in the integer coding unit to start counting again from 0, 2) controlling the signal to capture the output level of the chain sampling DLL; 3) controlling an encoder R, F in the fractional encoding unit to encode the result in the capture register CAP;

step S2: integer coding; upon detection of a pulse rising or falling edge, the Counter [ n:1] starts counting from 0; upon detection of a rising edge, Counter [ n:1] is loaded into register CNTR1[ n:1], register CNTR1[ n:1] is loaded into CNTR2[ n:1], register CNTF1[ n:1] is loaded into CNTF2[ n:1 ]; when a falling edge is detected, Counter [ n:1] is loaded into register CNTF1[ n:1 ];

step S3, decimal coding; after the rising edge or the falling edge of a pulse signal on an Input pin comes, the result sampled in a capture register CAP [ i:1] after the rising edge of the next sampling clock is coded, and the position of the pulse edge propagated on a delay unit DLL chain is found out;

step S4, calibrating step length information; STEP information STEP m:1, i.e. the number of delay units that a signal on Input pin can propagate through on the signal capture chain within one sampling clock period 1/f, is monitored.

Step S5: generating an interrupt; selecting to generate an interrupt at a rising edge or a falling edge in the interrupt control logic, and informing the main control equipment to read a pulse signal measurement result;

step S6: calculating; the software calculates the width of the high and low level pulses before the interrupt occurs based on the information in registers CNTR1[ n:1], CNTR2[ n:1], CNTF1[ n:1], CNTF2[ n:1], registers ENCR1[ m:1], ENCR2[ m:1], ENCF1[ m:1], ENCF1[ m:1], and STEP register STEP [ m:1 ].

In a specific application example, the ultra-high precision digital pulse signal width measurement in the present invention can be divided into a rising edge measurement mode and a falling edge measurement mode according to the position of an edge where an interrupt occurs.

1) A rising edge measurement mode;

as shown in fig. 3, at this time, the widths of the high and low level pulses before the interruption are:

PWD_H0=PWD(B)=CNTR2+(ENCF2-ENCR2)/STEP (4)

PWD_L0=PWD(A)=CNTR1+(ENCR1-ENCF2)/STEP (5)

2) a falling edge measurement mode;

as shown in fig. 3, at this time, the widths of the high and low level pulses before the interruption are:

PWD_H1=PWD(C’)=CNTF2+(ENCF2-ENCR2)/STEP (6)

PWD_H0=PWD(A’)=CNTF1+(ENCF1-ENCR1)/STEP (7)

PWD_L0=PWD(B’)=CNTR1+(ENCR1-ENCF2)/STEP (8)

the purpose of the decimal coding is to code the result (stored in a capture register CAPi: 1) sampled by the rising edge of the next sampling clock HRCAPCLK after the rising edge of the pulse signal on the Input pin comes;

that is, as can be seen from the circuit shown in FIG. 2, the encoders R and F are operative to find the positions of the pulse edges propagating on the DLL chain based on the sampling results of the capture registers CAP [ i:1 ]. The encoded position information is stored in registers ENCR1[ m:1] and ENCF1[ m:1 ].

The encoder R encodes the sampling results in the capture registers CAP [ i:1 ].

In a specific application example, the encoding rule is:

if it isSo thatAnd CAP [ i]When the value is 0, then:

ENCR1[m:1]=x (9)

the encoder F encodes the sampling results in the capture registers CAP [ i:1 ].

In a specific application example, the encoding rule is:

Figure BDA0002490926800000111

if it is

Figure BDA0002490926800000112

So thatAnd CAP [ i]When 1, then:

ENCF1[m:1]=x (10)

the process of step information calibration in the invention is as follows:

step S401: an internal input signal and a sampling control signal are generated. The calibration control logic generates an internal Input pulse signal, 2 sampling control signals, after a time interval in which the edge detection logic detects the rising edge of the signal on the Input pin. The internal input pulse signal is used as the input of a signal capturing chain; the sampling control signal controls the timing of sampling the output level value of each DLL.

Step S402: and (6) sampling. After the sampling control signal occurs, the output of each DLL is sampled at the next rising edge of the sampling clock HRCAPCLK and the result is stored in the capture register CAP [ i:1 ]. The sampling process was performed 2 times.

Step S403: and (5) encoding. The encoder R encodes the results of two consecutive sampling, and the encoded results are respectively stored in calibration registers CALR1[ m:1] and CALR2[ m:1 ].

Step S404: and (4) calculating. If the time interval of 2 times of sampling is a positive integer ω sampling clock periods, the STEP calculation method is:

STEP=(CALR1–CALR2)/ω (11)。

the above is only a preferred embodiment of the present invention, and the protection scope of the present invention is not limited to the above-mentioned embodiments, and all technical solutions belonging to the idea of the present invention belong to the protection scope of the present invention. It should be noted that modifications and embellishments within the scope of the invention may be made by those skilled in the art without departing from the principle of the invention.

12页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:用于实时可视化辐射图的系统和方法

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!