CN116908536A - Self-adjustment-based equal-precision frequency measurement system and method - Google Patents
Self-adjustment-based equal-precision frequency measurement system and method Download PDFInfo
- Publication number
- CN116908536A CN116908536A CN202310871088.3A CN202310871088A CN116908536A CN 116908536 A CN116908536 A CN 116908536A CN 202310871088 A CN202310871088 A CN 202310871088A CN 116908536 A CN116908536 A CN 116908536A
- Authority
- CN
- China
- Prior art keywords
- pulse
- frequency
- cpld
- measured
- data
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01R—MEASURING ELECTRIC VARIABLES; MEASURING MAGNETIC VARIABLES
- G01R23/00—Arrangements for measuring frequencies; Arrangements for analysing frequency spectra
- G01R23/02—Arrangements for measuring frequency, e.g. pulse repetition rate; Arrangements for measuring period of current or voltage
Landscapes
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Measuring Frequencies, Analyzing Spectra (AREA)
Abstract
Description
技术领域Technical field
本发明涉及测频系统及方法领域,尤其涉及一种基于自调整等精度测频系统及方法。The invention relates to the field of frequency measurement systems and methods, and in particular to a frequency measurement system and method based on self-adjustment and other precision.
背景技术Background technique
随着现代工业的发展,对于需要对电机或者其它旋转机械结构进行调速控制等场合,不仅要求转速频率的测量精度高,测量范围广,同时也要求响应时间快。而现有的转速测频方案难以覆盖所有的控制需求,测频精度和响应时间难以达到很好的平衡。现有的转速测频方案主要有两种,第一种频率测量法,主要采集设定时间内待测脉冲信号的计数值N,通过计数值N与设定时间T,计算出待测脉冲频率F,但待测脉冲计数值N只可能存在整数,且有±1的误差,因此该测频方案在高频段测频,可实现较高的测频精度,低频段测频误差则较大,而测频响应时间受设定时间T限制,设定时间T即为最小响应时间,需要根据实际测频需求,平衡测频响应时间与测频精度之间的矛盾。第二种周期测量法,主要采集待测脉冲M个周期内基准脉冲的计数值N,通过基准脉冲周期M和基准脉冲计数值N计算出待测脉冲的周期长度,从而得到待测脉冲频率F,由于是采集待测脉冲M个周期长度的基准脉冲计数值N,因此在高频段由于高频单周期时间较短,固定M个周期长度的测频精度误差偏差变大,同时低频段测频响应时间受待测脉冲脉冲限制,测频响应时间最小为一个待测脉冲周期,当待测频率较低时,可能存在数据刷新不及时,影响动态控制性能。With the development of modern industry, occasions such as speed regulation and control of motors or other rotating mechanical structures require not only high measurement accuracy and wide measurement range of rotational speed and frequency, but also fast response time. However, the existing speed frequency measurement solution cannot cover all control requirements, and it is difficult to achieve a good balance between frequency measurement accuracy and response time. There are two main existing speed frequency measurement solutions. The first frequency measurement method mainly collects the count value N of the pulse signal to be measured within a set time, and calculates the pulse frequency to be measured through the count value N and the set time T. F, but the pulse count value N to be measured can only exist in integers, and has an error of ±1. Therefore, this frequency measurement scheme can achieve higher frequency measurement accuracy by measuring frequency in the high frequency band, while the frequency measurement error in the low frequency band is larger. The frequency measurement response time is limited by the set time T, which is the minimum response time. It is necessary to balance the contradiction between the frequency measurement response time and the frequency measurement accuracy according to the actual frequency measurement requirements. The second period measurement method mainly collects the count value N of the reference pulse within M periods of the pulse to be measured, and calculates the period length of the pulse to be measured through the reference pulse period M and the reference pulse count value N, thereby obtaining the pulse frequency F to be measured. , since the reference pulse count value N of the M period length of the pulse to be measured is collected, so in the high frequency band, due to the short high frequency single cycle time, the frequency measurement accuracy error deviation of the fixed M period length becomes larger, and at the same time, the low frequency band frequency measurement The response time is limited by the pulse pulse to be measured, and the frequency measurement response time is at least one pulse period to be measured. When the frequency to be measured is low, the data refresh may not be timely, affecting the dynamic control performance.
为解决上述问题,本申请中提出一种基于自调整等精度测频系统及方法。In order to solve the above problems, this application proposes a frequency measurement system and method based on self-adjustment and equal precision.
发明内容Contents of the invention
(一)发明目的(1) Purpose of invention
为解决背景技术中存在的技术问题,本发明提出一种基于自调整等精度测频系统及方法,本发明采用双边沿采集自调整和采集窗口自调整两种设计方法,在保证测频精度的同时提高了测频的响应时间,较传统测频方式,最快能够提高一倍的测频响应时间,满足工业现场对于转速设备具有更高的控制需求,提高了动态控制性能。In order to solve the technical problems existing in the background technology, the present invention proposes a frequency measurement system and method based on self-adjustment and equal accuracy. The present invention adopts two design methods of double-edge acquisition self-adjustment and acquisition window self-adjustment, while ensuring frequency measurement accuracy. At the same time, the frequency measurement response time is improved. Compared with the traditional frequency measurement method, the frequency measurement response time can be doubled at the fastest, meeting the higher control requirements for speed equipment in industrial sites and improving the dynamic control performance.
(二)技术方案(2) Technical solutions
为解决上述问题,本发明提供了一种基于自调整等精度测频系统,包括:In order to solve the above problems, the present invention provides a frequency measurement system based on self-adjustment and equal precision, including:
CPLD和MCU;CPLD and MCU;
CPLD包括PLL锁相环模块,PLL锁相环模块生成所需的时钟,包括基准时钟、多等级滤波时钟;CPLD includes a PLL phase-locked loop module, which generates the required clocks, including a reference clock and a multi-level filter clock;
并口通讯模块,并口通讯模块模拟Flash读写时序,简化MCU侧与CPLD的数据读写交互,同时保证了数据交互的及时性;Parallel port communication module, the parallel port communication module simulates the Flash read and write timing, simplifying the data read and write interaction between the MCU side and the CPLD, while ensuring the timeliness of data interaction;
脉冲滤波模块,脉冲滤波模块根据设置的滤波等级进行滤波操作,避免高频干扰引起的脉冲信号采集错误;Pulse filter module, the pulse filter module performs filtering operations according to the set filtering level to avoid pulse signal acquisition errors caused by high-frequency interference;
计数采集模块,数采集模块为该设计方案的核心部分,根据待测脉冲的周期,自动调整脉冲边沿信号的采集和采集窗口的长度;Counting acquisition module, the core part of the design scheme, automatically adjusts the acquisition of pulse edge signals and the length of the acquisition window according to the period of the pulse to be measured;
脉冲采集模块;Pulse acquisition module;
MCU包括CPLD通讯及数据处理单元、PLC控制器通讯处理单元和辅助单元;MCU includes CPLD communication and data processing unit, PLC controller communication processing unit and auxiliary unit;
MCU用于对CPLD的命令控制、数据读写、数据处理和通讯处理;CPLD用于接收MCU的控制操作及外部待测脉冲信号的采集滤波操作;MCU is used for command control, data reading and writing, data processing and communication processing of CPLD; CPLD is used for receiving control operations of MCU and collection and filtering operations of external pulse signals to be measured;
MCU与CPLD之间通过并行通讯接口进行数据交互。Data interaction occurs between MCU and CPLD through a parallel communication interface.
优选的,辅助单元包括硬件故障复位、模块实时状态显示;Preferably, the auxiliary unit includes hardware fault reset and module real-time status display;
硬件故障复位保证模块由于硬件干扰或原因导致的死机状态,自动复位,恢复正常;Hardware fault reset ensures that if the module crashes due to hardware interference or reasons, it will automatically reset and return to normal;
模块实时状态显示方便用户实时观察模块运行状态,通过模块运行、通讯、错误等LED的不同显示状态,确认模块当前状态或者出现了什么故障。The real-time status display of the module facilitates users to observe the running status of the module in real time. Through the different display status of module operation, communication, error and other LEDs, the current status of the module or any faults can be confirmed.
一种基于自调整等精度测频系统的方法,脉冲滤波模块的使用方法:A method based on self-adjusting equal-precision frequency measurement system, how to use the pulse filter module:
滤除高频干扰信号,脉冲滤波模块通过高于待测脉冲信号的采样频率f,在出现脉冲跳变沿之后,连续采集m次电平信号,在连续m次的脉冲电平信号都一致时,判定该脉冲信号有效;To filter out high-frequency interference signals, the pulse filter module uses a sampling frequency f higher than the pulse signal to be measured. After the pulse edge appears, it continuously collects level signals m times. When the pulse level signals for m times are consistent, , determine that the pulse signal is valid;
电平信号持续时间长度t小于(f*m)时,该脉冲信号将被丢弃,判定为高频干扰信号;When the level signal duration t is less than (f*m), the pulse signal will be discarded and determined to be a high-frequency interference signal;
脉冲滤波原理:设采集阈值m=4,外部脉冲在脉冲2处,整个高电平持续时间内,连续采样2次为高电平,第3次采样电平为低电平,因而脉冲2将被认为是干扰信号将被滤除。Pulse filtering principle: Assume the acquisition threshold m=4, the external pulse is at pulse 2, and during the entire high level duration, two consecutive samples are high level, and the third sampling level is low level, so pulse 2 will Signals considered to be interference will be filtered out.
优选的,脉冲采集模块使用方法如下:Preferably, the pulse acquisition module is used as follows:
当外部脉冲频率较低时,窗口调节器以一个待测脉冲周期为窗口时间,上边沿和下边沿捕获器同时参与脉冲边沿捕获,在上边沿捕获的窗口时间和下边沿捕获的窗口时间内,基准时钟脉冲计数器分别单独计数;When the external pulse frequency is low, the window regulator uses one pulse period to be measured as the window time, and the upper edge and lower edge capturers participate in pulse edge capture at the same time. Within the window time of the upper edge capture and the window time of the lower edge capture, The reference clock pulse counter counts separately;
在待测脉冲连续输入的过程中,脉冲采集模块交替将上下边沿脉冲计数器采集到的脉冲计数值传输给并口通讯模块,从而将脉冲计数值的刷新速度最快提高到待测脉冲周期的一半;During the continuous input of pulses to be measured, the pulse acquisition module alternately transmits the pulse count values collected by the upper and lower edge pulse counters to the parallel port communication module, thereby increasing the refresh speed of the pulse count value to half of the pulse period to be measured at the fastest;
在上边沿窗口时间T0=t2-t0内基准脉冲计数值为N0,下边沿窗口时间T1=t3-t1内基准脉冲计数值为N1,上边沿窗口时间T2=t4-t2窗口时间内基准脉冲计数值为N2,依次类推,从t0到t2,N0的刷新时间为t2-t0,从t2到t3,N1的刷新时间为t3-t2,从t3到t4,N2的刷新时间为t4-t3,由此从第一个采集窗口T0之后,若待测脉冲为占空比为50%的矩形脉冲信号,则数据刷新时间t=(t3-t2)=(t4-t3)为待测脉冲周期的一半,这对于待测脉冲频率在工频50Hz左右的调速设备具有重要意义,能够保证在10ms左右就能进行一次速度采集,完成一次闭环控制,较传统单边沿采集的方式,数据的刷新周期提高一倍;In the upper edge window time T 0 =t 2 -t 0 , the reference pulse count value is N 0 , in the lower edge window time T 1 =t 3 -t 1 , the reference pulse count value is N 1 , and the upper edge window time T 2 = The reference pulse count value within the t 4 -t 2 window time is N 2 , and so on, from t 0 to t 2 , the refresh time of N 0 is t 2 -t 0 , from t 2 to t 3 , the refresh time of N 1 is t 3 -t 2 , from t 3 to t 4 , the refresh time of N 2 is t 4 -t 3 , therefore after the first acquisition window T 0 , if the pulse to be measured is a pulse with a duty cycle of 50% For rectangular pulse signals, the data refresh time t = (t 3 - t 2 ) = (t 4 - t 3 ) is half of the pulse period to be measured, which is important for speed control equipment with a pulse frequency of about 50Hz. Meaning, it can ensure that a speed acquisition can be carried out in about 10ms and a closed-loop control can be completed. Compared with the traditional single-edge acquisition method, the data refresh cycle is doubled;
若待测脉冲占空比不是为50%的矩形脉冲信号,即(t3-t2)≠(t4-t3),双边沿采集自调整方案仍然适用,数据刷新时间t交替等于tn-tn-1和tn+1-tn(n>2),以工频50Hz为例,数据刷新周期t=10ms~20ms;If the pulse duty cycle to be measured is not a rectangular pulse signal with a duty cycle of 50%, that is, (t 3 -t 2 ) ≠ (t 4 -t 3 ), the double-edge acquisition self-adjustment scheme is still applicable, and the data refresh time t is alternately equal to t n -t n-1 and t n+1 -t n (n>2), taking the power frequency of 50Hz as an example, the data refresh period t=10ms~20ms;
当外部脉冲频率高时,窗口调节器将以m个待测脉冲周期为窗口时间,m的选取将根据待测脉冲频率动态自调整,同时只有上边沿捕获器参与脉冲边沿捕获,m=3,基频计数值为N,窗口时间的起始点也是结束点即待测脉冲的上边沿信号,窗口时间长度为待测脉冲信号周期的整数倍,则测量误差为基频脉冲信号的±1,即1/25M,保证整个范围测频为等精度测频,N的刷新时间tn则为3倍的待测脉冲周期,同时m的值跟随待测脉冲信号自动调整,m的选取主要根据上一周期基频脉冲计数值N的刷新周期tn选取,在保证刷新周期tn=5ms-10ms范围内,m*1/F≈tn,F为待测脉冲频率通过N计算得出,且m的值为整数,当待测脉冲信号频率高时,m的值增大,当待测脉冲频率低时,m的值减小;When the external pulse frequency is high, the window regulator will use m pulse periods to be measured as the window time. The selection of m will be dynamically self-adjusted according to the pulse frequency to be measured. At the same time, only the upper edge capturer participates in pulse edge capture, m=3, The fundamental frequency count value is N, the starting point of the window time is also the end point, that is, the upper edge signal of the pulse to be measured, and the length of the window time is an integer multiple of the period of the pulse signal to be measured, then the measurement error is ±1 of the fundamental frequency pulse signal, that is 1/25M, ensuring that the frequency measurement in the entire range is equal-precision frequency measurement. The refresh time t n of N is 3 times the pulse period to be measured. At the same time, the value of m is automatically adjusted following the pulse signal to be measured. The selection of m is mainly based on the previous The refresh period t n of the periodic fundamental frequency pulse count value N is selected, and within the guaranteed refresh period t n =5ms-10ms, m*1/F≈t n , F is the pulse frequency to be measured calculated from N, and m The value of is an integer. When the frequency of the pulse signal to be measured is high, the value of m increases. When the frequency of the pulse signal to be measured is low, the value of m decreases;
通过上述m值的选取原则,m为整数,保证了窗口时间的起始结束均以待测脉冲的上边沿为触发信号,测频误差为基准脉冲正负一个码值,实现等精度测频,同时计数值N的刷新时间tn通过调整m而始终保持在5ms-10ms之间,在保证精度的同时也保证了数据采集的实时性。Through the above selection principle of m value, m is an integer, which ensures that the start and end of the window time are all triggered by the upper edge of the pulse to be measured, and the frequency measurement error is plus or minus one code value of the reference pulse, achieving equal-precision frequency measurement. At the same time, the refresh time t n of the count value N is always maintained between 5ms and 10ms by adjusting m, which not only ensures accuracy but also ensures the real-time nature of data collection.
优选的,CPLD通讯及数据处理单元使用方法:Preferably, how to use the CPLD communication and data processing unit:
CPLD通讯及数据处理单元用于读写CPLD相关寄存器,并处理各通道采集数据,将CPLD采集的数据转换为实际频率值,MCU通过FSMC接口读写CPLD,操作CPLD的控制、数据等寄存器;The CPLD communication and data processing unit is used to read and write CPLD related registers, process the collected data from each channel, and convert the data collected by the CPLD into actual frequency values. The MCU reads and writes the CPLD through the FSMC interface, and operates the control and data registers of the CPLD;
当外部脉冲频率较低时,窗口调节器以一个待测脉冲周期为窗口时间,采集的基准脉冲计数值为N,则待测脉冲频率当外部脉冲频率较高时,窗口调节器将以m个待测脉冲周期为窗口时间,采集的基准脉冲计数值为N,则待测脉冲频率/> When the external pulse frequency is low, the window regulator uses one pulse period to be measured as the window time, and the collected reference pulse count value is N, then the pulse frequency to be measured When the external pulse frequency is high, the window regulator will use m pulse periods to be measured as the window time, and the collected reference pulse count value is N, then the pulse frequency to be measured/>
通过MCU计算出的待测脉冲频率F将传递给PLC控制器通讯处理单元。The pulse frequency F to be measured calculated by the MCU will be passed to the PLC controller communication processing unit.
优选的,PLC控制器通讯处理单元的使用方法:Preferably, the method of using the PLC controller communication processing unit is:
接收PLC CPU模块的控制命令,并将采集的各通道待测频率数据上传给CPU;Receive control commands from the PLC CPU module and upload the collected frequency data of each channel to be measured to the CPU;
PLC CPU上电根据用户配置信息组织配置信文,通过内部总线将配置信息下发给MCU,MCU解析配置信息,并将配置写入CPLD,实现PLC对CPLD的初始配置,配置完成之后,PLCCPU通过数据信文获取各通道频率值和各通道实际状态信息等,存储在本地供用户使用。When the PLC CPU is powered on, it organizes configuration messages according to the user configuration information, and sends the configuration information to the MCU through the internal bus. The MCU parses the configuration information and writes the configuration to the CPLD to realize the initial configuration of the PLC to the CPLD. After the configuration is completed, the PLCCPU The data message obtains the frequency value of each channel and the actual status information of each channel, etc., and stores them locally for users to use.
优选的,MCU通过FSMC接口读写CPLD,操作CPLD的控制、数据等寄存器,包括初始参数设置、通道采集滤波等级设置、基准脉冲数据、待测脉冲数据读取。Preferably, the MCU reads and writes the CPLD through the FSMC interface, and operates the control and data registers of the CPLD, including initial parameter settings, channel acquisition filter level settings, reference pulse data, and reading of pulse data to be measured.
本发明的上述技术方案具有如下有益的技术效果:The above technical solution of the present invention has the following beneficial technical effects:
采用双边沿采集自调整和采集窗口自调整两种设计方法,在保证测频精度的同时提高了测频的响应时间,较传统测频方式,最快能够提高一倍的测频响应时间,满足工业现场对于转速设备具有更高的控制需求,提高了动态控制性能。The two design methods of double-edge acquisition self-adjustment and acquisition window self-adjustment are used to ensure the frequency measurement accuracy while improving the frequency measurement response time. Compared with the traditional frequency measurement method, the frequency measurement response time can be doubled at the fastest, meeting the requirements Industrial sites have higher control requirements for speed equipment, which improves dynamic control performance.
附图说明Description of the drawings
图1为本发明中CPLD的结构示意图。Figure 1 is a schematic structural diagram of a CPLD in the present invention.
图2为本发明中脉冲滤波的结构示意图。Figure 2 is a schematic structural diagram of pulse filtering in the present invention.
图3为本发明中双边沿采集自调整的结构示意图。Figure 3 is a schematic structural diagram of double-edge acquisition and self-adjustment in the present invention.
图4为本发明中采集窗口自调整的结构示意图。Figure 4 is a schematic structural diagram of the self-adjusting collection window in the present invention.
图5为本发明中MCU结构示意图。Figure 5 is a schematic structural diagram of the MCU in the present invention.
具体实施方式Detailed ways
为使本发明的目的、技术方案和优点更加清楚明了,下面结合具体实施方式并参照附图,对本发明进一步详细说明。应该理解,这些描述只是示例性的,而并非要限制本发明的范围。此外,在以下说明中,省略了对公知结构和技术的描述,以避免不必要地混淆本发明的概念。In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the specific embodiments and the accompanying drawings. It should be understood that these descriptions are exemplary only and are not intended to limit the scope of the invention. Furthermore, in the following description, descriptions of well-known structures and techniques are omitted to avoid unnecessarily confusing the concepts of the present invention.
如图1-5所示,本发明提出的一种基于自调整等精度测频系统,包括:As shown in Figures 1-5, the invention proposes a frequency measurement system based on self-adjustment and equal precision, including:
CPLD和MCU;CPLD and MCU;
CPLD包括PLL锁相环模块,PLL锁相环模块生成所需的时钟,包括基准时钟、多等级滤波时钟;CPLD includes a PLL phase-locked loop module, which generates the required clocks, including a reference clock and a multi-level filter clock;
并口通讯模块,并口通讯模块模拟Flash读写时序,简化MCU侧与CPLD的数据读写交互,同时保证了数据交互的及时性;Parallel port communication module, the parallel port communication module simulates the Flash read and write timing, simplifying the data read and write interaction between the MCU side and the CPLD, while ensuring the timeliness of data interaction;
脉冲滤波模块,脉冲滤波模块根据设置的滤波等级进行滤波操作,避免高频干扰引起的脉冲信号采集错误;Pulse filter module, the pulse filter module performs filtering operations according to the set filtering level to avoid pulse signal acquisition errors caused by high-frequency interference;
计数采集模块,数采集模块为该设计方案的核心部分,根据待测脉冲的周期,自动调整脉冲边沿信号的采集和采集窗口的长度;Counting acquisition module, the core part of the design scheme, automatically adjusts the acquisition of pulse edge signals and the length of the acquisition window according to the period of the pulse to be measured;
脉冲采集模块;脉冲采集模块采用采集窗口自调整+双边沿采集自调整的方案设计,在保证测频精度的同时,提高测频响应速度。脉冲采集模块由边沿捕获器、窗口调节器、基准时钟脉冲计数器等功能模块组成,边沿捕获器包括上升沿捕获器和下降沿捕获器;Pulse acquisition module; the pulse acquisition module adopts the scheme design of acquisition window self-adjustment + double-edge acquisition self-adjustment, which not only ensures the frequency measurement accuracy, but also improves the frequency measurement response speed. The pulse acquisition module is composed of functional modules such as edge capturer, window regulator, and reference clock pulse counter. The edge capturer includes a rising edge capturer and a falling edge capturer;
MCU包括CPLD通讯及数据处理单元、PLC控制器通讯处理单元和辅助单元;MCU includes CPLD communication and data processing unit, PLC controller communication processing unit and auxiliary unit;
MCU用于对CPLD的命令控制、数据读写、数据处理和通讯处理;CPLD用于接收MCU的控制操作及外部待测脉冲信号的采集滤波操作;MCU is used for command control, data reading and writing, data processing and communication processing of CPLD; CPLD is used for receiving control operations of MCU and collection and filtering operations of external pulse signals to be measured;
MCU与CPLD之间通过并行通讯接口进行数据交互。Data interaction occurs between MCU and CPLD through a parallel communication interface.
PLL锁相环模块输入50M的外部晶振时钟,通过内部PLL输出25M基准时钟、其它多等级滤波时钟等,25M基准时钟作为基准脉冲计数信号,同时晶振使用温补晶振BT0507C/D,-40℃-85摄氏度精度可达±1.5ppm,能够有效保证基准时钟在不同温度环境的准确性和一致性。其它滤波时钟提供不同等级的滤波器驱动信号,根据软件配置,可滤除不同等级的高频信号干扰,保证脉冲采集的准确性。The PLL phase-locked loop module inputs a 50M external crystal oscillator clock, and outputs a 25M reference clock, other multi-level filter clocks, etc. through the internal PLL. The 25M reference clock is used as the reference pulse counting signal. At the same time, the crystal oscillator uses a temperature-compensated crystal oscillator BT0507C/D, -40℃- The accuracy can reach ±1.5ppm at 85 degrees Celsius, which can effectively ensure the accuracy and consistency of the reference clock in different temperature environments. Other filter clocks provide different levels of filter drive signals. Depending on the software configuration, they can filter out different levels of high-frequency signal interference to ensure the accuracy of pulse collection.
并口通讯模块通过模拟一块存储区域,利用MCU的FSMC可变静态存储控制器可直接操作CPLD相关寄存器,可以简化MCU侧软件编程,同时并口的通讯方式,使得数据的交互更加的快速。The parallel port communication module simulates a storage area and uses the MCU's FSMC variable static storage controller to directly operate CPLD related registers, which can simplify MCU side software programming. At the same time, the parallel port communication method makes data interaction faster.
优选的,辅助单元包括硬件故障复位、模块实时状态显示;Preferably, the auxiliary unit includes hardware fault reset and module real-time status display;
硬件故障复位保证模块由于硬件干扰或原因导致的死机状态,自动复位,恢复正常;Hardware fault reset ensures that if the module crashes due to hardware interference or reasons, it will automatically reset and return to normal;
模块实时状态显示方便用户实时观察模块运行状态,通过模块运行、通讯、错误等LED的不同显示状态,确认模块当前状态或者出现了什么故障。The real-time status display of the module facilitates users to observe the running status of the module in real time. Through the different display status of module operation, communication, error and other LEDs, the current status of the module or any faults can be confirmed.
一种基于自调整等精度测频系统的方法,脉冲滤波模块的使用方法:A method based on self-adjusting equal-precision frequency measurement system, how to use the pulse filter module:
滤除高频干扰信号,脉冲滤波模块通过高于待测脉冲信号的采样频率f,在出现脉冲跳变沿之后,连续采集m次电平信号,在连续m次的脉冲电平信号都一致时,判定该脉冲信号有效;To filter out high-frequency interference signals, the pulse filter module uses a sampling frequency f higher than the pulse signal to be measured. After the pulse edge appears, it continuously collects level signals m times. When the pulse level signals for m times are consistent, , determine that the pulse signal is valid;
电平信号持续时间长度t小于(f*m)时,该脉冲信号将被丢弃,判定为高频干扰信号;When the level signal duration t is less than (f*m), the pulse signal will be discarded and determined to be a high-frequency interference signal;
脉冲滤波原理:设采集阈值m=4,外部脉冲在脉冲2处,整个高电平持续时间内,连续采样2次为高电平,第3次采样电平为低电平,因而脉冲2将被认为是干扰信号将被滤除。Pulse filtering principle: Assume the acquisition threshold m=4, the external pulse is at pulse 2, and during the entire high level duration, two consecutive samples are high level, and the third sampling level is low level, so pulse 2 will Signals considered to be interference will be filtered out.
在一个可选的实施例中,脉冲采集模块使用方法如下:In an optional embodiment, the pulse acquisition module is used as follows:
当外部脉冲频率较低时,窗口调节器以一个待测脉冲周期为窗口时间,上边沿和下边沿捕获器同时参与脉冲边沿捕获,在上边沿捕获的窗口时间和下边沿捕获的窗口时间内,基准时钟脉冲计数器分别单独计数;When the external pulse frequency is low, the window regulator uses one pulse period to be measured as the window time, and the upper edge and lower edge capturers participate in pulse edge capture at the same time. Within the window time of the upper edge capture and the window time of the lower edge capture, The reference clock pulse counter counts separately;
在待测脉冲连续输入的过程中,脉冲采集模块交替将上下边沿脉冲计数器采集到的脉冲计数值传输给并口通讯模块,从而将脉冲计数值的刷新速度最快提高到待测脉冲周期的一半;During the continuous input of pulses to be measured, the pulse acquisition module alternately transmits the pulse count values collected by the upper and lower edge pulse counters to the parallel port communication module, thereby increasing the refresh speed of the pulse count value to half of the pulse period to be measured at the fastest;
图3所示,在上边沿窗口时间T0=t2-t0内基准脉冲计数值为N0,下边沿窗口时间T1=t3-t1内基准脉冲计数值为N1,上边沿窗口时间T2=t4-t2窗口时间内基准脉冲计数值为N2,依次类推,从t0到t2,N0的刷新时间为t2-t0,从t2到t3,N1的刷新时间为t3-t2,从t3到t4,N2的刷新时间为t4-t3,由此从第一个采集窗口T0之后,若待测脉冲为占空比为50%的矩形脉冲信号,则数据刷新时间t=(t3-t2)=(t4-t3)为待测脉冲周期的一半,这对于待测脉冲频率在工频50Hz左右的调速设备具有重要意义,能够保证在10ms左右就能进行一次速度采集,完成一次闭环控制,较传统单边沿采集的方式,数据的刷新周期提高一倍;As shown in Figure 3, the reference pulse count value is N 0 within the upper edge window time T 0 =t 2 -t 0 , and the reference pulse count value is N 1 within the lower edge window time T 1 =t 3 -t 1 . Window time T 2 =t 4 -t 2 The reference pulse count value within the window time is N 2 , and so on, from t 0 to t 2 , the refresh time of N 0 is t 2 -t 0 , from t 2 to t 3 , The refresh time of N 1 is t 3 -t 2. From t 3 to t 4 , the refresh time of N 2 is t 4 -t 3. Therefore, after the first acquisition window T 0 , if the pulse to be measured is duty For a rectangular pulse signal with a ratio of 50%, the data refresh time t = (t 3 - t 2 ) = (t 4 - t 3 ) is half of the pulse period to be measured. This is for a pulse frequency to be measured around the power frequency of 50Hz. The speed control equipment is of great significance, as it can ensure that a speed collection can be carried out in about 10ms and a closed-loop control can be completed. Compared with the traditional single-edge collection method, the data refresh cycle is doubled;
若待测脉冲占空比不是为50%的矩形脉冲信号,即(t3-t2)≠(t4-t3),双边沿采集自调整方案仍然适用,数据刷新时间t交替等于tn-tn-1和tn+1-tn(n>2),以工频50Hz为例,数据刷新周期t=10ms~20ms;If the pulse duty cycle to be measured is not a rectangular pulse signal with a duty cycle of 50%, that is, (t 3 -t 2 ) ≠ (t 4 -t 3 ), the double-edge acquisition self-adjustment scheme is still applicable, and the data refresh time t is alternately equal to t n -t n-1 and t n+1 -t n (n>2), taking the power frequency of 50Hz as an example, the data refresh period t=10ms~20ms;
当外部脉冲频率高时,窗口调节器将以m个待测脉冲周期为窗口时间,m的选取将根据待测脉冲频率动态自调整,同时只有上边沿捕获器参与脉冲边沿捕获,图4所示,m=3,基频计数值为N,窗口时间的起始点也是结束点即待测脉冲的上边沿信号,窗口时间长度为待测脉冲信号周期的整数倍,则测量误差为基频脉冲信号的±1,即1/25M,保证整个范围测频为等精度测频,N的刷新时间tn则为3倍的待测脉冲周期,同时m的值跟随待测脉冲信号自动调整,m的选取主要根据上一周期基频脉冲计数值N的刷新周期tn选取,在保证刷新周期tn=5ms-10ms范围内,m*1/F≈tn,F为待测脉冲频率通过N计算得出,且m的值为整数,当待测脉冲信号频率高时,m的值增大,当待测脉冲频率低时,m的值减小;When the external pulse frequency is high, the window regulator will use m pulse periods to be measured as the window time. The selection of m will be dynamically self-adjusted according to the pulse frequency to be measured. At the same time, only the upper edge capturer participates in pulse edge capture, as shown in Figure 4 , m=3, the fundamental frequency count value is N, the starting point of the window time is also the end point, that is, the upper edge signal of the pulse to be measured, the length of the window time is an integer multiple of the period of the pulse signal to be measured, then the measurement error is the fundamental frequency pulse signal ±1, that is, 1/25M, to ensure that the frequency measurement in the entire range is the same precision frequency measurement. The refresh time t of N is 3 times the pulse period to be measured. At the same time, the value of m is automatically adjusted following the pulse signal to be measured. The selection is mainly based on the refresh period t n of the base frequency pulse count value N of the previous period. Within the guaranteed refresh period t n =5ms-10ms, m*1/F≈t n , F is the pulse frequency to be measured and is calculated by N It is concluded that, and the value of m is an integer, when the frequency of the pulse signal to be measured is high, the value of m increases, and when the frequency of the pulse signal to be measured is low, the value of m decreases;
通过上述m值的选取原则,m为整数,保证了窗口时间的起始结束均以待测脉冲的上边沿为触发信号,测频误差为基准脉冲正负一个码值,实现等精度测频,同时计数值N的刷新时间tn通过调整m而始终保持在5ms-10ms之间,在保证精度的同时也保证了数据采集的实时性。Through the above selection principle of m value, m is an integer, which ensures that the start and end of the window time are all triggered by the upper edge of the pulse to be measured, and the frequency measurement error is plus or minus one code value of the reference pulse, achieving equal-precision frequency measurement. At the same time, the refresh time t n of the count value N is always maintained between 5ms and 10ms by adjusting m, which not only ensures accuracy but also ensures the real-time nature of data collection.
在一个可选的实施例中,CPLD通讯及数据处理单元使用方法:In an optional embodiment, the CPLD communication and data processing unit is used as follows:
CPLD通讯及数据处理单元用于读写CPLD相关寄存器,并处理各通道采集数据,将CPLD采集的数据转换为实际频率值,MCU通过FSMC接口读写CPLD,操作CPLD的控制、数据等寄存器;The CPLD communication and data processing unit is used to read and write CPLD related registers, process the collected data from each channel, and convert the data collected by the CPLD into actual frequency values. The MCU reads and writes the CPLD through the FSMC interface, and operates the control and data registers of the CPLD;
当外部脉冲频率较低时,窗口调节器以一个待测脉冲周期为窗口时间,采集的基准脉冲计数值为N,则待测脉冲频率当外部脉冲频率较高时,窗口调节器将以m个待测脉冲周期为窗口时间,采集的基准脉冲计数值为N,则待测脉冲频率/> When the external pulse frequency is low, the window regulator uses one pulse period to be measured as the window time, and the collected reference pulse count value is N, then the pulse frequency to be measured When the external pulse frequency is high, the window regulator will use m pulse periods to be measured as the window time, and the collected reference pulse count value is N, then the pulse frequency to be measured/>
通过MCU计算出的待测脉冲频率F将传递给PLC控制器通讯处理单元。The pulse frequency F to be measured calculated by the MCU will be passed to the PLC controller communication processing unit.
优选的,PLC控制器通讯处理单元的使用方法:Preferably, the method of using the PLC controller communication processing unit is:
接收PLC CPU模块的控制命令,并将采集的各通道待测频率数据上传给CPU;Receive control commands from the PLC CPU module and upload the collected frequency data of each channel to be measured to the CPU;
PLC CPU上电根据用户配置信息组织配置信文,通过内部总线将配置信息下发给MCU,MCU解析配置信息,并将配置写入CPLD,实现PLC对CPLD的初始配置,配置完成之后,PLCCPU通过数据信文获取各通道频率值和各通道实际状态信息等,存储在本地供用户使用。When the PLC CPU is powered on, it organizes configuration messages according to the user configuration information, and sends the configuration information to the MCU through the internal bus. The MCU parses the configuration information and writes the configuration to the CPLD to realize the initial configuration of the PLC to the CPLD. After the configuration is completed, the PLCCPU The data message obtains the frequency value of each channel and the actual status information of each channel, etc., and stores them locally for users to use.
在一个可选的实施例中,MCU通过FSMC接口读写CPLD,操作CPLD的控制、数据等寄存器,包括初始参数设置、通道采集滤波等级设置、基准脉冲数据、待测脉冲数据读取。In an optional embodiment, the MCU reads and writes the CPLD through the FSMC interface, and operates the control and data registers of the CPLD, including initial parameter settings, channel acquisition filter level settings, reference pulse data, and reading of pulse data to be measured.
应当理解的是,本发明的上述具体实施方式仅仅用于示例性说明或解释本发明的原理,而不构成对本发明的限制。因此,在不偏离本发明的精神和范围的情况下所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。此外,本发明所附权利要求旨在涵盖落入所附权利要求范围和边界、或者这种范围和边界的等同形式内的全部变化和修改例。It should be understood that the above-described specific embodiments of the present invention are only used to illustrate or explain the principles of the present invention, and do not constitute a limitation of the present invention. Therefore, any modifications, equivalent substitutions, improvements, etc. made without departing from the spirit and scope of the present invention shall be included in the protection scope of the present invention. Furthermore, it is intended that the appended claims of the present invention cover all changes and modifications that fall within the scope and boundaries of the appended claims, or equivalents of such scopes and boundaries.
Claims (7)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310871088.3A CN116908536A (en) | 2023-07-17 | 2023-07-17 | Self-adjustment-based equal-precision frequency measurement system and method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202310871088.3A CN116908536A (en) | 2023-07-17 | 2023-07-17 | Self-adjustment-based equal-precision frequency measurement system and method |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN116908536A true CN116908536A (en) | 2023-10-20 |
Family
ID=88355980
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202310871088.3A Pending CN116908536A (en) | 2023-07-17 | 2023-07-17 | Self-adjustment-based equal-precision frequency measurement system and method |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN116908536A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119883215A (en) * | 2025-03-24 | 2025-04-25 | 北京开源芯片研究院 | Program control method, program control device, electronic equipment and storage medium |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH07307727A (en) * | 1994-05-13 | 1995-11-21 | Nippon Motorola Ltd | Data signal sampling method and circuit thereof |
| US20170249744A1 (en) * | 2014-12-02 | 2017-08-31 | Shanghai United Imaging Healthcare Co., Ltd. | A Method and System for Image Processing |
| CN107765084A (en) * | 2017-09-26 | 2018-03-06 | 云南电网有限责任公司保山供电局 | A kind of power frequency component frequency measuring system of common voltage input |
| CN108872702A (en) * | 2018-05-25 | 2018-11-23 | 中国科学院电子学研究所 | The frequency measuring system and method in adaptive period |
| CN215641733U (en) * | 2021-08-25 | 2022-01-25 | 广州网控通信科技有限公司 | Self-adjusting circuit for modulation and demodulation frequency of storage battery internal resistance measuring device |
-
2023
- 2023-07-17 CN CN202310871088.3A patent/CN116908536A/en active Pending
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPH07307727A (en) * | 1994-05-13 | 1995-11-21 | Nippon Motorola Ltd | Data signal sampling method and circuit thereof |
| US20170249744A1 (en) * | 2014-12-02 | 2017-08-31 | Shanghai United Imaging Healthcare Co., Ltd. | A Method and System for Image Processing |
| CN107765084A (en) * | 2017-09-26 | 2018-03-06 | 云南电网有限责任公司保山供电局 | A kind of power frequency component frequency measuring system of common voltage input |
| CN108872702A (en) * | 2018-05-25 | 2018-11-23 | 中国科学院电子学研究所 | The frequency measuring system and method in adaptive period |
| CN215641733U (en) * | 2021-08-25 | 2022-01-25 | 广州网控通信科技有限公司 | Self-adjusting circuit for modulation and demodulation frequency of storage battery internal resistance measuring device |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN119883215A (en) * | 2025-03-24 | 2025-04-25 | 北京开源芯片研究院 | Program control method, program control device, electronic equipment and storage medium |
| CN119883215B (en) * | 2025-03-24 | 2025-07-25 | 北京开源芯片研究院 | Program control method, device, electronic device and storage medium |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102035455B (en) | M/T speed measuring method for frequency converter | |
| CN105044420B (en) | A kind of waveform searching method of digital oscilloscope | |
| CN110836992B (en) | The acquisition system of oscilloscope power meter based on FPGA | |
| CN103605062B (en) | Partial discharge signal trigger phase synchronous clock source | |
| CN103234627A (en) | Complete alternation synchronous sampling and analyzing method for rotating machinery vibration signals | |
| CN116908536A (en) | Self-adjustment-based equal-precision frequency measurement system and method | |
| CN103383412A (en) | Adaptive software and hardware frequency tracking and sampling method | |
| CN102175286B (en) | Signal processing method for turbine flow meter | |
| CN105675953A (en) | Quasi-synchronization measuring method based on zero-crossing detection for power transmission line both-end voltage instantaneous voltage | |
| CN103605028B (en) | A kind of PWM test macro based on monocycle multi-point sampling | |
| CN104181391A (en) | Harmonic detection method of digital power meter | |
| CN1159589C (en) | AC signal measurement and control device for power system | |
| CN106707034A (en) | Pulse signal detection method based on Windows system function and multi-thread technology | |
| CN112730979A (en) | STM 32-based equal-precision frequency measurement method | |
| CN106990286A (en) | Four-quadrant metering device for harmonic electric energy and method based on Euler's method | |
| CN203572896U (en) | PWM test system based on single-period multipoint sampling | |
| CN101339442A (en) | Automatic Tracking and Controlling Method of Power Cable Conductor Temperature | |
| CN204536795U (en) | A kind of low power consumption data acquisition system based on RTC | |
| CN102497199B (en) | A 1/2 Period Frequency Measurement Method | |
| CN109256998A (en) | Control the method and system and servo motor of current of electric sampling with high precision | |
| CN101136627B (en) | Method for automatically setting high-stability constant temperature crystal oscillator parameter | |
| CN111830429B (en) | A ground fault detection method and device for a power system | |
| CN200979669Y (en) | Integrated clock generation circuit inside the USB device chip | |
| CN103558454A (en) | Measurement method for pulse input frequency | |
| CN207556704U (en) | A kind of temperature sensor circuit |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination |