Pulse counting frequency measurement method and device

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

阅读说明:本技术 一种脉冲计数测频方法及装置 (Pulse counting frequency measurement method and device ) 是由 李忠柱 徐卫峰 臧峰 牛洪海 于 2019-03-22 设计创作,主要内容包括:本发明公开了一种脉冲计数测频方法及装置,使用FPGA对经过过滤和整形的脉冲进行过滤非法脉冲处理获取正常脉冲,并对正常脉冲进行脉冲累加,将累加的脉冲量信号打上时标送入MCU,使用移动时间窗法进行脉冲测频;采用FPGA和MCU的硬件组合方案,根据移动时间窗法计算脉冲频率,有效保证脉冲计数和测频的精度,测量装置简单,具有广泛的应用价值。(The invention discloses a pulse counting and frequency measuring method and a device, wherein an FPGA is used for filtering illegal pulses of filtered and shaped pulses to obtain normal pulses, the normal pulses are accumulated, accumulated pulse quantity signals are marked with time marks and sent to an MCU, and a moving time window method is used for pulse frequency measurement; the pulse frequency is calculated according to a moving time window method by adopting a hardware combination scheme of the FPGA and the MCU, the precision of pulse counting and frequency measurement is effectively ensured, and the measuring device is simple and has wide application value.)

1. A method of pulse counting frequency measurement, the method comprising the steps of:

accumulating the pulses to obtain an accumulated pulse quantity, and marking a time scale on an accumulated pulse quantity signal;

the frequency of the pulses is calculated from the moving time window method and the time-stamped pulse quantity signal.

2. The method of pulse counting frequency measurement according to claim 1, further comprising: the pulse signal is isolated and shaped.

3. The method of pulse counting frequency measurement according to claim 1, further comprising: and filtering illegal pulses with pulse widths beyond a set measurement range.

4. A method of pulse counting frequency measurement according to claim 1, wherein the method of calculating the pulse frequency according to a moving time windowing method comprises establishing a time window and a step size according to a frequency measurement range.

5. The pulse counting frequency measurement method according to claim 1, further comprising clearing the pulse count value when the change of the pulse amount is zero and the state time for keeping the change amount zero exceeds a set time.

6. A pulse counting frequency measurement apparatus, characterized in that the apparatus comprises:

a pulse processing module: the pulse generator is used for accumulating pulses to obtain accumulated pulse quantity and marking time marks on accumulated pulse quantity signals;

a data processing module: for calculating the frequency of the pulses from the moving time window method and the time-stamped pulse quantity signal.

7. The pulse counting and frequency measuring device according to claim 6, wherein the pulse processing module is implemented by FPGA.

8. The pulse count measurement device of claim 6, wherein said data processing module is implemented by a microprocessor, said microprocessor comprising an MCU.

9. The pulse count measurement device of claim 6, further comprising a pulse isolation module for isolating the pulse signal and a pulse shaping module for shaping the pulse signal.

10. The pulse count measuring device of claim 6, further comprising a filtering module for filtering illegal pulses with pulse widths outside a set measurement range.

Technical Field

The invention relates to a pulse counting frequency measurement method and a device, belonging to the technical field of industrial process control automation.

Background

The pulse counting and frequency measuring method has the advantages that the pulse counting and frequency measuring are needed in the motor rotating speed, encoder displacement detection and the like widely existing in the technical field of industrial process control automation, and the defects of poor real-time performance and low calculation accuracy exist in the prior art for the pulse counting and the frequency measuring.

Disclosure of Invention

The present invention is directed to a pulse counting and frequency measuring method and apparatus, which are used to solve one of the above drawbacks or defects in the prior art.

In order to achieve the purpose, the invention is realized by adopting the following technical scheme:

in a first aspect, the present invention provides a pulse counting and frequency measuring method, which includes the following steps:

isolating and shaping the pulse signal;

filtering illegal pulses with pulse widths beyond a set measurement range;

accumulating the pulses to obtain an accumulated pulse quantity, and marking a time scale on an accumulated pulse quantity signal;

the frequency of the pulses is calculated from the moving time window method and the time-stamped pulse quantity signal.

Further, the method for calculating the pulse frequency according to the moving time window method comprises the steps of establishing a time window and a step length according to a frequency measurement range;

when the change of the pulse amount is zero and the state time for keeping the change amount zero exceeds the set time, the pulse count value is cleared.

On the other hand, the invention also provides a pulse counting and frequency measuring device, which comprises:

a pulse processing module: the pulse generator is used for accumulating pulses to obtain accumulated pulse quantity and marking time marks on accumulated pulse quantity signals;

a data processing module: for calculating the frequency of the pulses from the moving time window method and the time-stamped pulse quantity signal.

Preferably, the pulse processing module is implemented by an FPGA.

Preferably, the data processing module is implemented by a microprocessor, and the microprocessor comprises an MCU.

Further, the device also comprises a pulse isolation module used for isolating the pulse signal and a pulse shaping module used for shaping the pulse signal.

Furthermore, the device also comprises a filtering module for filtering illegal pulses with the pulse width exceeding the set measuring range.

The invention provides a pulse counting and frequency measuring method and a device, wherein a pulse processing module is used for filtering illegal pulses with pulse widths beyond a measuring range, normal pulses are obtained and accumulated, accumulated pulse quantity signals are marked with time marks and sent to a data processing module, a moving time window method is used for pulse frequency measurement, a hardware combination scheme of the pulse processing module and the data processing module is adopted, the pulse frequency is calculated by using the moving time window method, the precision of pulse counting and frequency measurement is effectively ensured, and the frequency range of pulse frequency measurement is ensured.

Drawings

Fig. 1 is a schematic connection diagram of a pulse counting frequency measuring device according to an embodiment of the present invention.

Detailed Description

The invention is further described below with reference to the accompanying drawings. The following examples are only for illustrating the technical solutions of the present invention more clearly, and the protection scope of the present invention is not limited thereby.

The pulse signal is sent into the high-speed optical coupler isolator by using the encoder, referring to fig. 1, the pulse is subjected to signal isolation through the high-speed optical coupler isolator, the pulse signal subjected to signal isolation sequentially passes through the voltage follower, the hysteresis comparator and the MOS to be subjected to pulse signal following, comparison and shaping, the pulse signal is converted into a high level and a low level to enter the FPGA, and the pulse signal is isolated and shaped through the steps.

The pulse signals subjected to pulse isolation and shaping are transmitted into the FPGA for pulse processing:

the FPGA captures the pulse signals after isolation and shaping, filters the illegal pulse with the pulse width exceeding the set measurement range, and obtains the normal pulse: in one embodiment, the set pulse frequency measurement range is 0-100KHz, the pulse frequency measurement range is determined by the FPGA performance, the duty ratio is 50%, therefore, the pulse with the pulse width less than 2 mus exceeds the set measurement range, and the pulse with the pulse width less than 2 mus is considered as illegal pulse; filtering the pulse with the pulse width less than 2 mu s by the FPGA to obtain a normal pulse; according to the parameter setting of the FPGA used in the embodiment, the highest deflection high level threshold of the pulse quantity is 15V, the return low level threshold is about 5.2V, and the illegal pulse is filtered through the steps to complete the screening of the pulse signal;

and the FPGA accumulates the screened normal pulses to obtain an accumulated pulse amount, and a time mark is marked on an accumulated pulse amount signal, wherein the time mark takes the clock of the FPGA as a reference, so that the unification and the matching of a counting and time data interface are ensured.

And simultaneously transmitting the accumulated pulse quantity and the corresponding clock to the MCU for data processing:

the MCU receives a pulse quantity signal which is transmitted by the FPGA and is marked with a time mark, and directly takes the pulse number obtained by accumulating the pulses through the FPGA as a counting value of the pulses in a counting mode;

the MCU calculates the frequency of the pulse according to a moving time window method in a frequency measurement mode:

when the pulse frequency is calculated by using the moving time window method, a time window and a step length are designated by an improved method of frequency measurement precision of mode matching, it should be clear that the step length corresponds to the interval time of the moving time window, the frequency is divided into a high frequency band section, a middle frequency band section and a low frequency band section according to a frequency measurement range, the time window and the step length are respectively designated according to different frequency bands, and the relationship between the time window and the step length conforms to the following requirements: the time window is larger than the step length, the low-frequency time window is larger than the medium-frequency time window and larger than the high-frequency time window, and the low-frequency step length is larger than the medium-frequency step length and larger than the high-frequency step length;

acquiring the number of pulses in a certain time window according to a moving time window method, and calculating the pulse frequency according to the time window and the number of pulses in the time window;

and when the MCU detects that the pulse quantity changes to zero and the state time for keeping the change quantity to be zero exceeds 2s, the pulse count value is cleared, and the fact that no pulse quantity is input currently is indicated.

And transmitting the pulse number and the frequency calculated by the MCU into a data receiving device for storage.

By using the pulse counting and frequency measuring device and the pulse counting and frequency measuring method provided by the embodiment of the invention, 8 paths of pulse signals can be counted and measured simultaneously, so that the hardware cost is saved; the measuring range of the pulse frequency reaches 0-100KHz, and the measuring precision is less than 0.1 percent.

According to the pulse counting and frequency measuring method and device provided by the embodiment of the invention, the FPGA is used for filtering illegal pulses of the filtered and shaped pulses to obtain normal pulses, the normal pulses are subjected to pulse accumulation to obtain accumulated pulse quantity, accumulated pulse quantity signals are clocked and sent to the MCU, and a moving time window method is used for pulse frequency measurement; the pulse frequency is calculated by adopting a hardware combination scheme of the FPGA and the MCU and using a moving time window method, so that the pulse counting and frequency measuring precision is effectively ensured, the frequency range of the pulse frequency measurement is ensured, and the measuring device is simple and has wide application value.

The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, without departing from the technical principle of the present invention, several modifications and variations can be made, for example, using the pulse counting frequency measurement method and apparatus provided by the present invention to perform pulse counting and frequency measurement, multiple pulse signals including but not limited to 8 paths can be simultaneously measured, the apparatus for processing pulse signals includes but not limited to FPGA, and the apparatus for processing data includes but not limited to MCU; such modifications and variations are considered to be within the scope of the invention.

6页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:一种用于25hz相敏轨道电路信号检测的方法及系统

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!