The invention provides a pulse
signal frequency adaptive acquisition method and
system based on a KDE
algorithm, and the method comprises the steps: carrying out the isolation protection and
voltage conversion of an external pulse
signal, and obtaining a TTL level
signal; tTL (
transistor-
transistor logic) level signals are accessed to a GPIO (
general purpose input / output) pin with a
timer multiplexing function of the MCU module for
pulse counting; entering a
timer interrupt function after a pulse rising edge of a TTL level signal is triggered, capturing a current
timer capturing register value of two continuous rising edges, calculating a difference value, performing conversion in combination with a timer set frequency to complete primary frequency measurement, and storing
frequency data into a
global variable array;
processing the acquired
frequency data through a KDE
algorithm to obtain frequency distribution of the
current pulse input signal; and determining a sampling frequency and a frequency threshold by using a peak index fast
search algorithm, and performing signal capture according to the sampling frequency. Through the KDE
algorithm, the frequency of the input pulse signal is adaptively acquired, and the interference of the high-frequency signal is inhibited.