A manchester decoding method based on time offset algorithm

By dynamically adjusting the signal acquisition frequency of the Manchester decoding method using a time offset algorithm, the problem of Manchester encoded signals being susceptible to environmental interference is solved, achieving efficient and accurate signal decoding and improving environmental adaptability and user experience.

CN116388765BActive Publication Date: 2026-04-14HUAIYIN INSTITUTE OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUAIYIN INSTITUTE OF TECHNOLOGY
Filing Date
2023-02-28
Publication Date
2026-04-14

AI Technical Summary

Technical Problem

Manchester encoded signals are susceptible to external environmental factors, which can cause variations in signal pulse width, making it difficult for existing technologies to achieve fast and accurate decoding.

Method used

The Manchester decoding method based on the timing offset algorithm is adopted. By utilizing the microprocessor's timer and external interrupt peripherals, the signal acquisition frequency is dynamically adjusted by configuring external interrupt triggering and timer overflow count statistics. The real-time baseband signal pulse width is calculated and the timer initial value is reassigned to achieve dynamic signal acquisition and decoding.

Benefits of technology

It improves environmental adaptability and signal acquisition accuracy, reduces the number of false verifications, improves decoding speed and user experience, and requires no additional equipment, thus reducing structural complexity and cost.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116388765B_ABST
    Figure CN116388765B_ABST
Patent Text Reader

Abstract

A kind of manchester decoding method based on timing offset algorithm, including filtering module, signal waveform conversion module and manchester decoding module, the timing offset algorithm is implemented in manchester decoding module;After input signal passes through filtering module and removes interference signal, signal waveform is converted into baseband signal waveform by signal waveform conversion module, then is sent into manchester decoding module, microprocessor in manchester decoding module starts reading signal by external interrupt, while reading signal, real-time baseband signal pulse width is calculated using timing offset algorithm, according to the calculation result, the timer initial value of the collected baseband signal is revalued, the dynamic adjustment of microprocessor to baseband signal acquisition frequency is realized, finally, according to manchester encoding format, the collected baseband signal is decoded to obtain the final decoding data.The present application improves decoding speed, accuracy and environmental adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of signal processing technology, and more specifically to a Manchester decoding method based on a time-shifting algorithm. Background Technology

[0002] Manchester encoding is a synchronous clock encoding technique, also known as phase encoding (PE). In Ethernet media systems, because Manchester code contains abundant clock signals and the DC component is basically zero, the receiver can easily recover the synchronous clock and demodulate the data synchronously. It has good anti-interference performance. It uses a synchronous bit stream clock and data for encoding, making it more suitable for channel transmission in the physical layer.

[0003] Manchester encoding, a mainstream encoding technique in the physical layer, differs from non-return-to-zero (NRZ) encoding, which uses a single bit level to represent "1" or "0". Manchester encoding uses two bits of voltage level to represent one bit of data; for example, two "10" bits represent "1", and two "01" bits represent "0". The implementation principle uses the transition between the two voltage levels as the basis for judgment: a falling edge indicates "1", and a rising edge indicates "0". This allows for easy determination of the start and end of each bit of data based on the voltage level changes. Furthermore, since a transition occurs between each bit, this transition can also serve as a clock signal, facilitating clock synchronization between the receiver and transmitter. Due to these advantages, Manchester encoding is widely used in smart homes, radio frequency communications, and other industries.

[0004] However, like other physical layer coding techniques, Manchester coding also has a problem: the signal waveform is extremely susceptible to external environmental influences. For example, in smart home access control systems, the door can only be opened successfully when the key card and the access control device are within a fixed distance. This is because the access control device internally uses a fixed signal reading frequency. Therefore, the distance will cause changes in the signal pulse width, and if a fixed signal reading frequency is still used, data reading failures are highly likely.

[0005] Similarly, in addition to distance, factors such as temperature, humidity and magnetic field interference can also cause fluctuations in signal pulse width. Therefore, how to achieve fast and accurate decoding of Manchester code in response to the changes in signal pulse width caused by various adverse factors has become an urgent problem to be solved. Summary of the Invention

[0006] To address the aforementioned technical problems, this technical solution provides a Manchester decoding method based on a timing offset algorithm. This method employs a dynamic timing offset algorithm, primarily utilizing two peripherals: a built-in timer in the microprocessor of the Manchester decoding module and an external interrupt. By configuring the external interrupt triggering mode and statistically analyzing the timer overflow count, two parameters of the timing offset algorithm are obtained. Then, the real-time baseband signal pulse width is calculated. Subsequently, based on the calculation results, the initial value of the timer for acquiring the baseband signal is reassigned, enabling the microprocessor to acquire the baseband signal at a dynamic acquisition frequency. After acquisition, the signal is decoded according to the Manchester encoding format to obtain the decoded data. This effectively solves the aforementioned problems.

[0007] This invention is achieved through the following technical solution:

[0008] A Manchester decoding method based on a timing offset algorithm is disclosed. The application device using this decoding method includes a filtering module, a signal waveform conversion module, and a Manchester decoding module. The timing offset algorithm is implemented in the Manchester decoding module. After the input signal is filtered to remove interference signals, the signal waveform is converted into a baseband signal waveform by the signal waveform conversion module and then sent to the Manchester decoding module. The microprocessor in the Manchester decoding module starts reading the signal through two peripherals: its built-in timer and an external interrupt. By configuring the external interrupt trigger mode and counting the number of timer overflows, two parameters of the timing offset algorithm are obtained. While reading the signal, the timing offset algorithm is used to calculate the real-time baseband signal pulse width. Based on the calculation result, the initial value of the timer for acquiring the baseband signal is reassigned, realizing the dynamic adjustment of the baseband signal acquisition frequency by the microprocessor. This allows the microprocessor to acquire the baseband signal at a dynamic acquisition frequency. After acquisition, the acquired baseband signal is decoded according to the Manchester encoding format to obtain the final decoded data.

[0009] Furthermore, the Manchester decoding module consists of an STM32 microprocessor based on a Cortex-M3 core, which internally runs a timing offset algorithm. The microprocessor is connected to the Output pin of the signal waveform conversion module via the INT0 pin, forming the transmission path for the baseband signal. The external interrupt trigger mode and timer are defined to obtain the corresponding baseband signal pulse width and the number of timer overflows. These two parameters are then called by the timing offset algorithm, which determines the time interval for the next baseband signal acquisition by the microprocessor. Finally, the calculated signal acquisition time interval is reassigned to the timer to complete the dynamic acquisition of the baseband signal.

[0010] Furthermore, the specific steps to obtain the final decoded data are as follows:

[0011] Step 1: Input the signal corresponding to the Manchester code into the filtering module;

[0012] Step 2: The filtering module removes noise and glitches from the signal and transmits them to the signal waveform conversion module;

[0013] Step 3: The signal waveform conversion module transmits the converted baseband signal to the Manchester decoding module;

[0014] Step 4: The microprocessor INT0 pin in the decoding module detects a falling edge and then begins to receive the first signal value;

[0015] Step 5: Calculate the next signal acquisition period using the time offset algorithm, then re-initialize the timer, and then receive the next signal value;

[0016] Step 6: Determine if two-bit signal values ​​have been received;

[0017] Step 7: Decode the signal value according to the Manchester encoding format to obtain the corresponding value, and store the number of data points collected in the variable cnt;

[0018] Step 8: Determine the number of received data items;

[0019] Step 9: If the number of received data is less than or equal to 9, determine whether the value is the initial value 1. If it is, proceed to step 5; otherwise, initialize the configuration and proceed to step 4.

[0020] Step 10: If the number of received data is greater than 9 and less than or equal to 49, follow the rule of four data points per row. After receiving four data points, perform even parity on this row of data and then compare the result with the fifth data point. If the verification is successful, proceed to step 5. If the verification fails, initialize the configuration and proceed to step 4.

[0021] Step 11: If the number of received data is greater than 49, perform column verification on each column and then perform end bit verification. If the verification is successful, output the decoded data. If the verification fails, initialize the configuration and execute step 4.

[0022] Furthermore, the implementation of the timing offset algorithm includes processing of the external interrupt port. The processing method is as follows: the microprocessor's INT0 pin is set to falling edge trigger mode to obtain the start signal of the baseband signal. When the external interrupt handling function is entered for the first time, the external interrupt is first disabled, then the external interrupt is set to rising edge and falling edge dual trigger mode, and finally the external interrupt is re-enabled. This allows for real-time detection of the pulse width of the high-level or low-level baseband signal, providing time parameters for the subsequent timing offset algorithm.

[0023] Furthermore, the implementation of the timing offset algorithm also includes timer processing. The processing method is as follows: the microprocessor needs to define two timers. Timer 0 is set as an 8-bit reload counter for timing acquisition of baseband signals, and the variable count is set in the overflow interrupt function to count the number of overflows. Timer 1 is set as a 16-bit counter for counting the pulse width of the baseband signal.

[0024] Furthermore, the specific operation steps of the aforementioned time-series offset algorithm are as follows:

[0025] Step a: Set Timer 0 to an 8-bit counter, Timer 1 to a 16-bit counter, and external interrupt to falling edge trigger;

[0026] Step b: Program initialization, Timer 0 is initialized to 138, Timer 1 is initialized to 0, but neither is enabled; External interrupt is enabled, and the variable count is defined and initialized to 1.

[0027] Step c: When the program enters the external interrupt function for the first time, enable timers 0 and 1, and set the external interrupt to rising and falling edge dual-trigger mode.

[0028] Step d: When the program re-enters the external interrupt function, turn off timers 0 and 1, retrieve the count value from timer 1, divide it by twice count, set the result as the initial value of timer 0, clear the initial value of timer 1, reset the value of variable count to 1, and finally re-enable timers 0 and 1.

[0029] Step e: When the program enters the overflow interrupt function of Timer 0, it first obtains the level value of the INT0 pin, and then uses the variable count to count the number of overflows. By running steps d and e alternately, the timing offset algorithm is finally implemented.

[0030] Furthermore, the filtering module includes a signal pulse width detection unit. The signal pulse width detection unit defines waveform level interrupts and counters to statistically obtain the time span between two adjacent signal waveform transition interfaces, and compares it with a preset filtering width window range. If it is higher than the preset range, a high level is output by enabling; if it is lower than the preset range, a low level is output by enabling.

[0031] Furthermore, the filtering module also includes a signal pulse width judgment unit. The signal pulse width judgment unit receives high and low level signal values ​​from the signal pulse width detection unit to determine whether the current waveform is a glitch, a messy waveform, or a data waveform. If a low level signal is received, it is a glitch or a messy waveform, and the signal is set low and sent. If a high level signal is received, it is a normal data waveform, and the signal is sent as is.

[0032] Furthermore, the signal pulse width detection unit two of the signal waveform conversion module outputs both a level signal and the signal pulse width counted by the counter. The signal pulse width detection unit two defines a waveform level interrupt and counts the time span between the two signal waveform transition interfaces by the counter, and then outputs it through the data port, while simultaneously outputting high and low level signals through the signal port.

[0033] Furthermore, the signal waveform conversion module also includes a high / low level output unit, which obtains the current level value to be converted by reading the level value signal from the signal output port of the signal pulse width detection unit, and obtains the time interval for maintaining the level value through the data port. Finally, the signal is transmitted to the Manchester decoding module as a baseband signal based on the level value and the maintenance time.

[0034] Beneficial effects

[0035] The Manchester decoding method based on the time offset algorithm proposed in this invention has the following advantages compared with the prior art:

[0036] (1) This invention employs a dynamic timing offset algorithm, primarily utilizing two peripherals: the built-in timer and external interrupt in the Manchester decoding module's microprocessor. By configuring the external interrupt triggering method and statistically analyzing the timer overflow count, two parameters of the timing offset algorithm are obtained. Then, the real-time baseband signal pulse width is calculated. Subsequently, the initial value of the timer for acquiring the baseband signal is reassigned based on the calculation results, enabling the microprocessor to acquire the baseband signal at a dynamic acquisition frequency. After acquisition, the signal is decoded according to the Manchester encoding format to obtain the decoded data. The timing offset algorithm can continuously obtain the previous signal pulse width and dynamically adjust the initial value of the timer, achieving signal acquisition with a dynamic signal acquisition cycle, ultimately improving environmental adaptability and providing better environmental adaptability. This effectively solves the problem in the prior art where the fixed signal acquisition frequency, coupled with adverse factors such as temperature, humidity, and magnetic field interference in the environment, affects the pulse width of the radio frequency signal, making it difficult to correctly complete the decoding of Manchester code using a fixed signal acquisition frequency.

[0037] (2) This invention employs a timing offset algorithm to dynamically adjust the acquisition cycle of the baseband signal by the microprocessor, which can greatly reduce the impact of adverse factors on the accuracy of signal acquisition. This improves the accuracy of the signal acquisition by the microprocessor and greatly reduces the number of verification errors; therefore, it only takes a short time to successfully obtain the decoded data and execute the corresponding operation, thus speeding up the decoding speed of Manchester code and greatly improving the user experience.

[0038] (3) The timing offset algorithm used in this invention is implemented entirely based on the internal components of the microprocessor. It does not require calling other devices, so the amount of code is small and the resource consumption is small, which can greatly reduce the structural complexity and production cost. Attached Figure Description

[0039] Figure 1 This is a structural block diagram of the application device using the decoding method in this invention.

[0040] Figure 2 This is a flowchart illustrating the decoding method in this invention.

[0041] Figure 3 This is a flowchart of the timing offset algorithm in this invention. Detailed Implementation

[0042] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments. The described embodiments are merely some embodiments of the present invention, and not all embodiments. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the design concept of the present invention should fall within the protection scope of the present invention.

[0043] Example 1:

[0044] like Figure 1 As shown, a Manchester decoding method based on a timing offset algorithm is described. The application device using the decoding method includes a filtering module, a signal waveform conversion module, and a Manchester decoding module. The timing offset algorithm is implemented in the Manchester decoding module. Figure 1 A block diagram describing the overall structure of the application device using the decoding method, showing how the various modules are connected.

[0045] The filtering module includes a signal pulse width detection unit and a signal pulse width determination unit.

[0046] The signal pulse width detection unit in the filtering module uses waveform level interrupts and counters to count the time span between two adjacent signal waveform transition interfaces and compares it with the preset filtering width window range. If it is higher than the preset range, it outputs a high level; if it is lower than the preset range, it outputs a low level.

[0047] The signal pulse width judgment unit in the filtering module receives high and low level signal values ​​from the signal pulse width detection unit to determine whether the current waveform is a glitch, a messy waveform, or a data waveform. If a low level signal is received, it is a glitch or a messy waveform, and the signal is set low and sent out. If a high level signal is received, it is a normal data waveform, and the signal is sent out as is.

[0048] The signal waveform conversion module includes a signal pulse width detection unit and a high / low level output unit.

[0049] The signal pulse width detection unit in the signal waveform conversion module outputs both a level signal and the signal pulse width counted by a counter. This unit uses a defined waveform level interrupt and a counter to calculate the time span between two signal waveform transitions, then outputs the result through the data port and simultaneously outputs high and low level signals through the signal port.

[0050] The high and low level output unit in the signal waveform conversion module obtains the current level value to be converted by reading the level value signal from the signal output port of the signal pulse width detection unit. At the same time, it obtains the time interval to be maintained by the level value through the data port. Finally, based on the level value and the maintenance time, the signal is transmitted to the Manchester decoding module as a baseband signal.

[0051] The Manchester decoding module consists of an STM32 microprocessor based on a Cortex-M3 core, which internally runs a timing offset algorithm. This microprocessor is connected to the Output pin of the signal waveform conversion module via the INT0 pin, thus forming the transmission path for the baseband signal. By defining the external interrupt trigger mode and a timer, the corresponding baseband signal pulse width and timer overflow count are obtained. These two parameters are then used by the timing offset algorithm to determine the next time interval for the microprocessor to acquire the baseband signal. Finally, the calculated signal acquisition time interval is reassigned to the timer, completing the dynamic acquisition of the baseband signal.

[0052] The implementation of the timing offset algorithm includes the processing of external interrupt ports and timers.

[0053] When handling external interrupt ports, the common Manchester data transmission format in the market is used: 9 start bits "1", 40 data bits, 10 row parity bits, 4 column parity bits, and 1 end bit "0". Since "1" in Manchester encoding corresponds to a two-bit level value combination of "10", each start bit contains a falling edge, and the same applies to "0" in Manchester encoding. Therefore, the microprocessor's INT0 pin is set to falling edge trigger mode to obtain the start signal of the baseband signal. Then, when the external interrupt handling function is entered for the first time, the external interrupt is first disabled, then the external interrupt is set to rising edge and falling edge dual trigger mode, and finally the external interrupt is re-enabled. This allows for real-time detection of the pulse width of the high or low level baseband signal, providing time parameters for the subsequent timing offset algorithm.

[0054] When handling timers, the microprocessor needs to define two timers. Timer 0 is set as an 8-bit reload counter for timing the acquisition of baseband signals, and a variable `count` is set in the overflow interrupt function to count the number of overflows. According to Manchester encoding rules, two consecutive identical level values ​​may appear in the baseband signal. Therefore, to prevent timer overflow, Timer 1 is set as a 16-bit counter to count the pulse width of the baseband signal. During program initialization, Timer 0 is initialized to 138, and Timer 1 is initialized to 0. Both timers are enabled only when the external interrupt function is entered for the first time. When the external interrupt function is entered again, both timers are disabled. The count value in Timer 1 is retrieved and divided by twice the overflow count (`count`) to obtain half of the pulse width of the most recent baseband signal. This result is then assigned to Timer 0 as its initial value. Finally, both timers are re-enabled, and this process is repeated until the acquisition period of the baseband signal by the microprocessor is determined by the pulse width of the previous baseband signal.

[0055] The Manchester decoding method based on the timing offset algorithm removes interference signals from the input signal through a filtering module, converts the signal waveform into a baseband signal waveform through a signal waveform conversion module, and then sends it to the Manchester decoding module. The microprocessor in the Manchester decoding module starts reading the signal through two peripherals: its built-in timer and an external interrupt. By configuring the external interrupt trigger mode and counting the number of timer overflows, two parameters of the timing offset algorithm are obtained. While reading the signal, the timing offset algorithm is used to calculate the real-time baseband signal pulse width. Based on the calculation result, the initial value of the timer for acquiring the baseband signal is reassigned, realizing the dynamic adjustment of the baseband signal acquisition frequency by the microprocessor. This allows the microprocessor to acquire the baseband signal at a dynamic acquisition frequency. After acquisition, the acquired baseband signal is decoded according to the Manchester encoding format to obtain the final decoded data.

[0056] For example, when the Manchester code signal corresponding to the data "01 00 F7 01 38" is input to the filtering module, the filtering module removes glitches and noise from the signal. The filtered signal is then output to the signal waveform conversion module, which converts the signal into a baseband signal before transmitting it to the Manchester decoding module. At this point, the microprocessor in the Manchester decoding module receives nine start bits (each with a value of 1) instead of the actual data. The actual data and corresponding row and column parity bits are then received. Signal acquisition begins when the microprocessor detects a falling edge from an external interrupt. A timing offset algorithm is used to obtain a dynamic signal acquisition period. The baseband signal is then dynamically acquired based on this calculated period. Finally, the baseband signal is decoded using a frequency doubling method according to the Manchester encoding rules to obtain the specific value. It then checks if the nine start bits have been received. If successfully received, data bit reception begins. While receiving data bits, a row check is performed every four data bits, and the result is compared with the received fifth row check bit. If the check is successful, data reception continues. Once all data has been received, each column of data will be checked, and finally the end bit will be checked. If successful, the decoded data will be output. Any check error during the above process will trigger the initialization configuration and require a re-decoding of the Manchester code.

[0057] like Figure 2 As shown, the Manchester decoding method based on the time offset algorithm mainly includes the following 11 steps:

[0058] Step 1: Input the signal corresponding to the Manchester code into the filtering module.

[0059] Step 2: The filtering module removes noise and glitches from the signal and transmits them to the signal waveform conversion module.

[0060] Step 3: The signal waveform conversion module transmits the converted baseband signal to the Manchester decoding module.

[0061] Step 4: The microprocessor INT0 pin in the decoding module detects a falling edge and then begins to receive the first signal value.

[0062] Step 5: Calculate the next signal acquisition period using the timing offset algorithm, then re-initialize the timer, and then receive the next signal value.

[0063] Step 6: Determine whether two-bit signal values ​​have been received.

[0064] Step 7: Decode the signal value according to the Manchester encoding format to obtain the corresponding value, and use the variable cnt to store the number of data currently collected.

[0065] Step 8: Determine the number of received data items.

[0066] Step 9: If the number of received data is less than or equal to 9, determine if the value is the initial value 1. If it is, proceed to step 5; otherwise, initialize the configuration and proceed to step 4.

[0067] Step 10: If the number of received data is greater than 9 and less than or equal to 49, follow the rule of four data points per row. After receiving four data points, perform even parity on this row and compare the result with the fifth data point. If the parity is successful, proceed to step 5. If the parity fails, initialize the configuration and proceed to step 4.

[0068] Step 11: If the number of received data is greater than 49, perform column verification on each column and then perform end bit verification. If the verification is successful, output the decoded data. If the verification fails, initialize the configuration and execute step 4.

[0069] As can be seen from the above operating steps, the microprocessor must calculate the next signal acquisition cycle using a timing offset algorithm before each signal value acquisition; for example... Figure 3 As shown, the flowchart of the time-series offset algorithm mainly includes the following 5 steps:

[0070] Step a: Set Timer 0 to an 8-bit counter, Timer 1 to a 16-bit counter, and external interrupt to falling edge trigger.

[0071] Step b: Program initialization, Timer 0 is initialized to 138, Timer 1 is initialized to 0, but neither is enabled; External interrupt is enabled, and the variable count is defined and initialized to 1.

[0072] Step c: When the program enters the external interrupt function for the first time, enable timers 0 and 1, and set the external interrupt to rising and falling edge dual-trigger mode.

[0073] Step d: When the program re-enters the external interrupt function, turn off timers 0 and 1, retrieve the count value from timer 1, divide it by twice count, set the result as the initial value of timer 0, clear the initial value of timer 1, reset the value of variable count to 1, and finally re-enable timers 0 and 1.

[0074] Step e: When the program enters the overflow interrupt function of Timer 0, it first obtains the level value of the INT0 pin, and then uses the variable count to count the number of overflows. By running steps d and e alternately, the timing offset algorithm is finally implemented.

[0075] Currently, existing Manchester decoding techniques acquire signals at a fixed frequency, making it difficult to handle the impact of signal pulse width fluctuations. Compared to existing technologies, this method has the advantage of employing a timing offset algorithm, which allows the microprocessor to acquire signals based on the latest signal pulse width. This method reduces the impact of signal pulse width fluctuations on the decoding process, improving the speed and environmental adaptability of the decoding program.

[0076] The above are merely specific embodiments of the present invention, but the scope of protection of the present invention is not limited thereto. Any changes, substitutions and improvements within the technical scope disclosed in the present invention are within the scope of protection of the present invention.

Claims

1. A Manchester decoding method based on a time-shifting algorithm, characterized in that: The application device using the decoding method includes a filtering module, a signal waveform conversion module, and a Manchester decoding module. The timing offset algorithm is implemented in the Manchester decoding module. After the input signal is filtered to remove interference signals, the signal waveform is converted into a baseband signal waveform by the signal waveform conversion module and then sent to the Manchester decoding module. The microprocessor in the Manchester decoding module starts reading the signal through its built-in timer and external interrupt. By configuring the external interrupt trigger mode and counting the number of timer overflows, it obtains two parameters of the timing offset algorithm. While reading the signal, the timing offset algorithm is used to calculate the real-time baseband signal pulse width. Based on the calculation result, the initial value of the timer for acquiring the baseband signal is reassigned, realizing the dynamic adjustment of the baseband signal acquisition frequency by the microprocessor. This allows the microprocessor to acquire the baseband signal at a dynamic acquisition frequency. After acquisition, the acquired baseband signal is decoded according to the Manchester encoding format to obtain the final decoded data. The specific steps to obtain the final decoded data are as follows: Step 1: Input the signal corresponding to the Manchester code into the filtering module; Step 2: The filtering module removes noise and glitches from the signal and transmits them to the signal waveform conversion module; Step 3: The signal waveform conversion module transmits the converted baseband signal to the Manchester decoding module; Step 4: The microprocessor INT0 pin in the decoding module detects a falling edge and then begins to receive the first signal value; Step 5: Calculate the next signal acquisition period using the time offset algorithm, then re-initialize the timer, and then receive the next signal value; Step 6: Determine if two-bit signal values ​​have been received; Step 7: Decode the signal value according to the Manchester encoding format to obtain the corresponding value, and store the number of data points collected in the variable cnt; Step 8: Determine the number of received data items; Step 9: If the number of received data is less than or equal to 9, determine whether the value is the initial value 1. If it is, proceed to step 5; otherwise, initialize the configuration and proceed to step 4. Step 10: If the number of received data is greater than 9 and less than or equal to 49, follow the rule of four data points per row. After receiving four data points, perform even parity on this row of data and then compare the result with the fifth data point. If the verification is successful, proceed to step 5. If the verification fails, initialize the configuration and proceed to step 4. Step 11: If the number of received data is greater than 49, perform column verification on each column and then perform end bit verification. If the verification is successful, output the decoded data. If the verification fails, initialize the configuration and execute step 4.

2. The Manchester decoding method based on the time-shift algorithm according to claim 1, characterized in that: The Manchester decoding module consists of an STM32 microprocessor based on a Cortex-M3 core, which internally runs a timing offset algorithm. The microprocessor is connected to the Output pin of the signal waveform conversion module via the INT0 pin, forming the transmission path for the baseband signal. The external interrupt trigger mode and timer are defined to obtain the corresponding baseband signal pulse width and the number of timer overflows. These two parameters are then called by the timing offset algorithm, which calculates the time interval for the next baseband signal acquisition by the microprocessor. Finally, the calculated signal acquisition time interval is reassigned to the timer to complete the dynamic acquisition of the baseband signal.

3. The Manchester decoding method based on the time-shift algorithm according to claim 1, characterized in that: The timing offset algorithm includes processing the external interrupt port. The processing method is as follows: the microprocessor's INT0 pin is set to falling edge trigger mode to obtain the start signal of the baseband signal. When the external interrupt handling function is entered for the first time, the external interrupt is first disabled, then the external interrupt is set to rising edge and falling edge dual trigger mode, and finally the external interrupt is re-enabled. This allows for real-time detection of the pulse width of the high-level or low-level baseband signal, providing time parameters for the subsequent timing offset algorithm.

4. The Manchester decoding method based on the time-shift algorithm according to claim 1, characterized in that: The implementation of the timing offset algorithm also includes timer processing. The processing method is as follows: the microprocessor needs to define two timers. Timer 0 is set as an 8-bit reload counter for timing acquisition of baseband signals, and the variable count is set in the overflow interrupt function to count the number of overflows. Timer 1 is set as a 16-bit counter for counting the pulse width of the baseband signal.

5. A Manchester decoding method based on a time-off algorithm according to any one of claims 1-4, characterized in that: The specific operation steps of the time-series offset algorithm are as follows: Step a: Set Timer 0 to an 8-bit counter, Timer 1 to a 16-bit counter, and external interrupt to falling edge trigger; Step b: Program initialization, Timer 0 is initialized to 138, Timer 1 is initialized to 0, but neither is enabled; External interrupt is enabled, and the variable count is defined and initialized to 1. Step c: When the program enters the external interrupt function for the first time, enable timers 0 and 1, and set the external interrupt to rising and falling edge dual-trigger mode. Step d: When the program re-enters the external interrupt function, turn off timers 0 and 1, retrieve the count value from timer 1, divide it by twice count, set the result as the initial value of timer 0, clear the initial value of timer 1, reset the value of variable count to 1, and finally re-enable timers 0 and 1. Step e: When the program enters the overflow interrupt function of Timer 0, it first obtains the level value of the INT0 pin, and then uses the variable count to count the number of overflows. By running steps d and e alternately, the timing offset algorithm is finally implemented.

6. The Manchester decoding method based on the time-shift algorithm according to claim 1, characterized in that: The filtering module includes a signal pulse width detection unit. The signal pulse width detection unit defines waveform level interrupts and counters to count the time span between two adjacent signal waveform transition interfaces and compares it with a preset filtering width window range. If it is higher than the preset range, a high level is output by enabling; if it is lower than the preset range, a low level is output by enabling.

7. The Manchester decoding method based on the time-shift algorithm according to claim 6, characterized in that: The filtering module also includes a signal pulse width judgment unit. The signal pulse width judgment unit receives high and low level signal values ​​from the signal pulse width detection unit and determines whether the current waveform is a glitch, a messy waveform, or a data waveform. If a low level signal is received, it is a glitch or a messy waveform, and the signal is set low and sent. If a high level signal is received, it is a normal data waveform, and the signal is sent as is.

8. The Manchester decoding method based on the time-shift algorithm according to claim 1, characterized in that: The signal waveform conversion module signal pulse width detection unit two outputs both a level signal and the signal pulse width counted by a counter. The signal pulse width detection unit two defines a waveform level interrupt and counts the time span between the two signal waveform transition interfaces by a counter. Then, it outputs the data through the data port and simultaneously outputs high and low level signals through the signal port.

9. The Manchester decoding method based on the time-off algorithm according to claim 8, characterized in that: The signal waveform conversion module also includes a high / low level output unit. It obtains the current level value to be converted by reading the level value signal from the signal output port of the signal pulse width detection unit. At the same time, it obtains the time interval for maintaining the level value through the data port. Finally, it transmits the signal to the Manchester decoding module as a baseband signal based on the level value and the maintenance time.

Citation Information

Patent Citations

  • Analytical method and device based on Manchester encoding

    CN105703885A

  • Decoding system and decoding method for Manchester codes

    CN108512552A