CN111147107B - Data receiving method and device - Google Patents
Data receiving method and device Download PDFInfo
- Publication number
- CN111147107B CN111147107B CN201911355425.3A CN201911355425A CN111147107B CN 111147107 B CN111147107 B CN 111147107B CN 201911355425 A CN201911355425 A CN 201911355425A CN 111147107 B CN111147107 B CN 111147107B
- Authority
- CN
- China
- Prior art keywords
- signal
- level
- receiving
- preset
- state
- 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.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04B—TRANSMISSION
- H04B3/00—Line transmission systems
- H04B3/54—Systems for transmission via power distribution lines
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L1/00—Arrangements for detecting or preventing errors in the information received
- H04L1/0078—Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location
- H04L1/0091—Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location arrangements specific to receivers, e.g. format detection
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Power Engineering (AREA)
- Dc Digital Transmission (AREA)
Abstract
The invention provides a data receiving method and a device, comprising the following steps: continuously receiving transmission signals, and calculating signal duration according to the 1 st to the a-th level signals; judging whether a first signal is received in a first preset level signal receiving range, if not, finishing receiving, if so, judging whether a second signal is received in a second preset level signal receiving range, if not, finishing the process, if so, continuously judging the receiving state, if so, judging that the second signal is in a first preset state, and decoding a transmission signal behind the second signal according to a first decoding rule, wherein the first signal is at a high level, and the second signal is at a low level; if the first signal is at a low level and the second signal is at a high level, judging that the first signal is in a second preset state, and decoding a transmission signal behind the second signal according to a second decoding rule; if the first signal is at high level, the second signal is at high level, or the first signal is at low level, the second signal is at low level, and the reception is finished.
Description
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a data receiving method and apparatus.
Background
The power line carrier communication is a communication method in which a high-frequency carrier signal transmits information through a high-voltage or low-voltage power line, and a modulation method commonly used in the power line carrier communication at present is BPSK (Binary Phase Shift Keying), however, when a power grid passes through different network nodes, the Phase of a carrier may be inverted and inverted, for example, 0 Phase is changed into pi Phase, or pi Phase is changed into 0 Phase, and when BPSK and demodulation are used, digital information obtained may be changed into "0" or "1" into "0", so that a demodulation error is caused.
Therefore, there is a need in the art for a data receiving method and apparatus that can adaptively determine the polarity state to receive valid data.
Disclosure of Invention
The present invention is directed to solving the above problems.
The invention mainly aims to provide a data receiving method, which comprises the following steps: step 1, continuously receiving transmission signals, wherein the transmission signals are level signals in which high level signals and low level signals alternately appear; step 2, calculating the signal duration of the level signal according to the 1 st level signal to the a th level signal; wherein a is a preset positive integer and is more than or equal to 2 and less than or equal to 8; step 3, judging whether a first signal with the duration of two signal durations is received in a first preset level signal receiving range after the 8 th level signal is received, if so, turning to step 4, and if not, turning to step 8; step 4, judging whether a second signal with the duration of two signals is received in a second preset level signal receiving range after the first signal is received, if so, turning to the step 5, and if not, turning to the step 8; step 5, if the first signal is at a high level and the second signal is at a low level, turning to step 6; if the first signal is at low level and the second signal is at high level, go to step 7; if the first signal is at high level and the second signal is at high level, go to step 8; if the first signal is at low level and the second signal is at low level, go to step 8; step 6, judging that the receiving state is a first preset state, and decoding the transmission signal behind the second signal according to a first decoding rule corresponding to the first preset state; step 7, judging that the receiving state is a second preset state, and decoding the transmission signal after the second signal according to a second decoding rule corresponding to the second preset state; and 8, judging the current data receiving error and ending the receiving process.
In addition, the first preset state is a normal phase receiving state, the first decoding rule is that the waveform is a square waveform decoding 1 from which the high level starts and the low level ends, and the square waveform decoding 0 from which the low level starts and the high level ends; the second preset state is an inverted receiving state, and the second decoding rule is that the waveform is a square waveform decoding 1 at which the low level starts and the high level ends, and a square waveform decoding 0 at which the high level starts and the low level ends.
Further, calculating a signal duration of the level signal from the 1 st level signal to the a-th level signal includes: and calculating the average duration T of the level signals from the 1 st level signal to the a th level signal, and taking the average duration T as the signal duration T.
In addition, the first preset level signal receiving range is from the 10 th level signal to the 22 nd level signal; the second predetermined level signal has a receiving range from the N +6 th signal to the N +10 th signal, wherein the nth level signal is the first signal.
Another object of the present invention is to provide a data receiving apparatus, comprising: the device comprises a signal receiving module, a signal duration calculating module, a signal judging module, a receiving state judging module and a decoding module, wherein the signal receiving module is used for continuously receiving transmission signals which are level signals alternately appearing in high level signals and low level signals; the signal duration calculation module is used for calculating the signal duration of the level signal according to the level signal from the 1 st level signal to the a th level signal; wherein a is a preset positive integer and is more than or equal to 2 and less than or equal to 8; the signal judging module is used for judging whether a first signal with the duration of two signals is received in a first preset level signal receiving range after the 8 th level signal is received, if the first signal is not received, the signal receiving module is triggered to end the receiving process, if the first signal is received, whether a second signal with the duration of two signals is received in a second preset level signal receiving range after the first signal is received is judged, if the second signal is not received, the signal receiving module is triggered to end the receiving process, and if the second signal is received, the receiving state judging module is triggered to finish the receiving state judging operation; the receiving state judging module is used for judging that the receiving state is a first preset state if the first signal is at a high level and the second signal is at a low level; if the first signal is at a low level and the second signal is at a high level, judging that the receiving state is a second preset state; if the first signal is at a high level and the second signal is at a high level, the signal receiving module is triggered to end the receiving process; if the first signal is at a low level and the second signal is at a low level, triggering the signal receiving module to end the receiving process; informing the decoding module of the judgment result of the receiving state; the decoding module is used for receiving the judgment result of the receiving state sent by the receiving state judgment module, and if the receiving state is a first preset state, decoding the transmission signal after the second signal according to a first decoding rule corresponding to the first preset state; and if the receiving state is a second preset state, decoding the transmission signal after the second signal according to a second decoding rule corresponding to the second preset state.
In addition, the first preset state is a normal phase receiving state, the first decoding rule is that the waveform is a square waveform decoding 1 from which the high level starts and the low level ends, and the square waveform decoding 0 from which the low level starts and the high level ends; the second preset state is an inverted receiving state, and the second decoding rule is that the waveform is a square waveform decoding 1 at which the low level starts and the high level ends, and a square waveform decoding 0 at which the high level starts and the low level ends.
In addition, the signal duration calculation module is configured to calculate a signal duration of the level signal according to the 1 st level signal to the a-th level signal, and includes: and the signal duration calculation module is used for calculating the average duration T of the level signals from the 1 st level signal to the a th level signal, and taking the average duration T as the signal duration T.
In addition, the first preset level signal receiving range is from the 10 th level signal to the 22 nd level signal; the second predetermined level signal has a receiving range from the N +6 th signal to the N +10 th signal, wherein the nth level signal is the first signal.
According to the technical scheme provided by the invention, the invention provides a data receiving method and a device, through the method, a data receiving end calculates the signal duration after continuously receiving transmission signals, and then judges whether a first signal is received in a first preset signal receiving range or not and a second signal is received in a second preset signal receiving range according to the signal duration, and judges the decoding rule adopted by decoding according to the levels of the first signal and the second signal. By the method, the receiving end judges whether the received transmission signal is a signal transmitted in a normal phase or a signal transmitted in a reverse phase according to the state of the received transmission signal, so that the signal can be further decoded correctly, the situation that the signal is decoded incorrectly or cannot be decoded due to phase inversion in the transmission process is avoided, and the communication efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a flowchart of a data receiving method according to embodiment 1 of the present invention;
fig. 2(a) is a schematic waveform diagram of a transmission signal according to embodiment 1 of the present invention;
fig. 2(b) is a schematic waveform diagram of a transmission signal according to embodiment 1 of the present invention;
fig. 2(c) is a schematic waveform diagram of a transmission signal according to embodiment 1 of the present invention;
fig. 2(d) is a schematic waveform diagram of a transmission signal according to embodiment 1 of the present invention;
fig. 3 is a schematic structural diagram of a data receiving apparatus according to embodiment 2 of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used only for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention. Furthermore, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or quantity or location.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
Example 1
The embodiment provides a data receiving method which can be applied to the field of power line communication. Fig. 1 is a flowchart of an alternative data receiving method according to this embodiment.
As shown in fig. 1, the data receiving method mainly includes the following steps (step 1 to step 8):
step 1, continuously receiving transmission signals, wherein the transmission signals are level signals in which high level signals and low level signals appear alternately.
In this embodiment, the transmission signal is a level signal in which a high level signal and a low level signal appear alternately, for example, the transmission signal may be a level signal as shown in fig. 2(a) to 2(d), wherein the durations of the high level signal and the low level signal may be the same or different. The transmission signal may be a communication data frame sent by a data sending end.
Step 2, calculating the signal duration of the level signal according to the 1 st level signal to the a th level signal; wherein a is a preset positive integer, and a is more than or equal to 2 and less than or equal to 8.
In this embodiment, the level signals from level 1 to level a may be pilot signals, and the data receiving end may calculate a signal duration, i.e., a frequency (baud rate) of signal transmission according to the pilot signals, and further complete subsequent operations according to the calculated signal duration (e.g., complete receiving and sending operations of transmission signals according to the signal duration). The pilot signal may be a part of a data frame header, the data frame header is a waveform sequence agreed by both communication parties, if the data frame header is received, the data receiving end may determine that it is currently starting to receive a data frame, and through the pilot signal in the data frame header, the data receiving end may also calculate the signal duration of the level signal.
In an alternative embodiment of this embodiment, the method is as followsThe signal duration of the level signal is obtained by calculating from the 1 st level signal to the a-th level signal, and the method comprises the following steps: and calculating the average duration T of the level signals from the 1 st level signal to the a th level signal, and taking the average duration T as the signal duration T. For example, as shown in fig. 2(a) to 2(d), a is 8, and the durations of the 1 st level signal to the 8 th level signal are t1=0.01s、t2=0.0097s、t3=0.0095s、t4=0.0103s、t5=0.0105s、t6=0.01s、t7=0.01s、t8The average duration T is 0.01s, and 0.01s is used as the signal duration, i.e., T is 0.01 s. The average duration time of the level signal is used as the signal duration time, so that the influence of errors caused by interference and other reasons of the level signal in the transmission process on the calculation result of the signal duration time is reduced, and the communication efficiency is improved.
And 3, judging whether a first signal with the duration of two signal durations is received in a first preset level signal receiving range after the 8 th level signal is received, if so, turning to the step 4, and if not, turning to the step 8.
In this embodiment, the first preset level signal receiving range is a preset level signal receiving interval, a signal with two signal durations received in the level signal receiving interval is a first signal, if a signal with two signal durations is received before the first preset level signal receiving range, it is considered that a signal loss occurs, the data receiving end may select to end the current receiving process, and if a signal with two signal durations is not received yet when the first preset level signal receiving range is ended, the data receiving end may consider that the currently received content is not a data frame header or data loss, and end the receiving process.
In an optional implementation manner of this embodiment, the first preset level signal receiving range is from the 10 th level signal to the 22 nd level signal. That is, if two signals are received from the 10 th level signal to the 22 nd level signalAnd the signal of the duration is regarded as the first signal. For example, as shown in fig. 2(a) to 2(d), the duration t of the 13 th level signal130.02s, i.e. t13And 2T, judging the 13 th level signal as the first signal. In this optional embodiment, if a signal with a duration of two signal durations is received before the 10 th level signal, or a signal with a duration of two signal durations is not received yet after the 22 th level signal is received, it is determined that the currently received content is not a header of a data frame or data is lost, and the data receiving end may optionally end the current receiving process. The method avoids the continuous detection under the condition that the level signal is lost or the received signal is not the data frame header, and improves the communication efficiency.
And 4, judging whether a second signal with the duration of two signals is received within a second preset level signal receiving range after the first signal is received, if so, turning to the step 5, and if not, turning to the step 8.
In this embodiment, the second preset level signal receiving range is a preset level signal receiving interval, a signal with a duration of two signal durations received in the level signal receiving interval is a second signal, if a signal with a duration of two signal durations is received before the second preset level signal receiving range, it is considered that the data receiving end having the signal loss may select to end the current receiving process, and if a signal with a duration of two signal durations is still not received when the second preset level signal receiving range is ended, the data receiving end may consider that the currently received content is not a data frame header or data loss, and end the receiving process.
In an optional implementation manner of this embodiment, the second predetermined level signal receiving range is from the N +6 th signal to the N +10 th signal, wherein the nth level signal is the first signal, that is, if a signal with a duration of two signal durations is received between the N +6 th level signal and the N +10 th level signal, the signal is considered as the second signal. If a signal with the duration of two signals is received before the N +6 th level signal, or a signal with the duration of two signals is not received when the N +10 th level signal is received, the currently received content is considered not to be a header of a data frame or the data is lost, and the receiving process is ended. The method avoids the situation that the level signal is lost or the received signal is not the head of the data frame, and still detects the level signal, thereby improving the communication efficiency.
For example, in fig. 2(a) to 2(d), if the first signals are all the 13 th level signals, N is 13, if a signal with a duration of two signal durations is received between the 19 th level signal and the 23 th level signal, the signal is considered as the second signal, if a signal with a duration of two signal durations is received before the 19 th level signal, or if a signal with a duration of two signal durations is not received after the 23 th level signal is received, the currently received content is considered as not a data header or a data loss, and the reception flow is ended, and in fig. 2(a) and 2(b), the duration t of the 22 th level signal is t220.02s, i.e. t22When the 22 th level signal is determined to be the second signal, that is, when the transmission signal is fig. 2(a) and 2(b), the second signal is received, and in fig. 2(c) and 2(d), the duration T of the 21 st level signal is determined210.02s, i.e. t21When the 21 st level signal is determined to be the second signal, that is, when the transmission signal is fig. 2(c) and fig. 2(d), the second signal is received.
Step 5, if the first signal is at a high level and the second signal is at a low level, turning to step 6; if the first signal is at low level and the second signal is at high level, go to step 7; if the first signal is at high level and the second signal is at high level, go to step 8; if the first signal is at low level and the second signal is at low level, go to step 8.
And 6, judging that the receiving state is a first preset state, and decoding the transmission signal after the second signal according to a first decoding rule corresponding to the first preset state.
And 7, judging that the receiving state is a second preset state, and decoding the transmission signal after the second signal according to a second decoding rule corresponding to the second preset state.
And 8, judging the current data receiving error and ending the receiving process.
In this embodiment, the levels of the first signal and the second signal may be determined to be compared with the polarities of the first signal and the second signal during data transmission, for example, when the data transmitting end transmits data, the first signal and the second signal are respectively at a high level and a low level, when the data receiving end receives data, if the first signal and the second signal are respectively at a high level and a low level, it is determined that polarity inversion does not occur during data transmission, decoding may be performed according to a first decoding rule, if the first signal and the second signal are respectively at a low level and a high level, it is determined that polarity inversion has occurred during data transmission, decoding should be performed according to a second decoding rule, if the first signal and the second signal are both at a low level or both at a high level, it is determined that an error has occurred during data transmission, and the receiving process is ended. The adopted decoding rule is determined by judging the level of the first signal and the second signal in the received data or whether the data is continuously received is determined, so that the condition that the data receiving end does not find polarity inversion and then decodes errors when the polarity inversion occurs in the data transmission process is avoided, and the problem of low communication efficiency caused by continuous receiving of the data receiving end when the data transmission errors such as loss occur in the data transmission process is also avoided.
For example, when the data receiving end receives the level signal in fig. 2(a), the first signal is at a low level, the second signal is at a high level, and the data receiving end determines that polarity inversion occurs in the data during transmission, and performs decoding according to the second decoding rule; when the level signal in fig. 2(b) is received, the first signal is at a high level, the second signal is at a low level, and the data receiving end determines that the data is not subjected to polarity inversion in the transmission process and performs decoding according to a first decoding rule; when the level signal in fig. 2(c) is received, the first signal is at a low level, the second signal is at a low level, and the data receiving end determines that an error occurs in the data transmission process, and ends the receiving process; when the level signal in fig. 2(d) is received, the first signal is at a high level, the second signal is at a high level, and the data receiving end determines that an error occurs in the data transmission process, and ends the receiving process. When the data receiving end receives the level signal, whether the polarity of the data is reversed in the transmission process can be judged through the levels of the first signal and the second signal, and then a proper decoding rule is selected to complete decoding.
As an optional implementation manner of this embodiment, the first preset state is a normal phase receiving state, the first decoding rule is that the square waveform with the waveform being high level starts and the waveform being low level ends is decoded to 1, and the square waveform with the waveform being low level starts and the waveform being high level ends is decoded to 0; the second preset state is an inverted receiving state, and the second decoding rule is that the waveform is a square waveform decoding 1 at which the low level starts and the high level ends, and a square waveform decoding 0 at which the high level starts and the low level ends. In this optional embodiment, the first preset state is a normal phase receiving state, that is, when the receiving end receives the transmission signal in the first preset state, it is determined that no phase inversion occurs in the transmission process of the signal, the received signal is still a normal phase transmission signal, the square waveform with the high level starting and the low level ending is decoded into 1 according to the decoding rule, and the square waveform with the low level starting and the high level ending is decoded into 0; the second preset state is an inverted receiving state, that is, when the receiving end receives the transmission signal in the second preset state, it is determined that the phase of the signal is inverted during the transmission process, the received signal is an inverted transmission signal, the square waveform with the low level starting and the high level ending is decoded into 1 according to the decoding rule, and the square waveform with the high level starting and the low level ending is decoded into 0. The receiving end judges whether the received transmission signal is a signal transmitted in a normal phase or a signal transmitted in a reverse phase according to the state of the received transmission signal, so that the signal can be further decoded correctly, the situation that the signal is decoded incorrectly or cannot be decoded due to phase inversion in the transmission process is avoided, and the communication efficiency is improved. For example, in fig. 2(a), decoding is performed according to a second decoding rule, and three transmission signals after the second signal are: 1. 1 and 1, in fig. 2(b), decoding is performed according to a first decoding rule, and transmission signals after a second signal are respectively: 1. 1 and 1.
According to the technical scheme of the embodiment, the invention provides a data receiving method, in the method, after a data receiving end continuously receives transmission signals, the signal duration is calculated, whether a first signal is received in a first preset signal receiving range or not and a second signal is received in a second preset signal receiving range are judged according to the signal duration, and a decoding rule adopted by decoding is judged according to the levels of the first signal and the second signal. By the method, the receiving end judges whether the received transmission signal is a signal transmitted in a normal phase or a signal transmitted in a reverse phase according to the state of the received transmission signal, so that the signal can be further decoded correctly, the situation that the signal is decoded incorrectly or cannot be decoded due to phase inversion in the transmission process is avoided, and the communication efficiency is improved.
Example 2
In this embodiment, a data receiving apparatus 200 is provided, which corresponds to the data receiving method in embodiment 1 one to one, and no further description is provided herein, and only brief description is made, and in an optional implementation manner of this embodiment, specific operations performed by each module in the data receiving apparatus 200 may refer to embodiment 1.
In this embodiment, the data receiving apparatus 200 may be included in any communication terminal in power line communication, for example, a camera, a PC, a server, etc., or may be a stand-alone device.
Fig. 3 is an alternative data receiving apparatus 200 of this embodiment, which includes a signal receiving module 201, a signal duration calculating module 202, a signal determining module 203, a receiving state determining module 204 and a decoding module 205, wherein,
the signal receiving module 201 is configured to continuously receive a transmission signal, where the transmission signal is a level signal in which a high level signal and a low level signal appear alternately.
In this embodiment, the transmission signal is a level signal in which a high level signal and a low level signal appear alternately, wherein the durations of the high level signal and the low level signal may be the same or different. The transmission signal may be a communication data frame transmitted by the data transmission apparatus.
A signal duration calculation module 202, configured to calculate a signal duration of the level signal according to the level signal from the 1 st level signal to the a-th level signal; wherein a is a preset positive integer, and a is more than or equal to 2 and less than or equal to 8.
In this embodiment, the level signal 1 to the level signal a may be pilot signals, the signal duration calculation module 202 may calculate signal duration, i.e., the frequency (baud rate) of signal transmission according to the pilot signals, and the data receiving apparatus 200 may complete subsequent operations according to the calculated signal duration (e.g., complete the receiving and sending operations of the transmission signals according to the signal duration). The pilot signal may be a part of a header of the data frame, where the header of the data frame is a waveform sequence agreed by both communication parties, and if the header of the data frame is received, the data receiving apparatus 200 may determine that a data frame is currently started to be received, and through the pilot signal in the header of the data frame, the data receiving apparatus 200 may further calculate a signal duration of the level signal.
In an optional implementation manner of this embodiment, calculating the signal duration of the level signal according to the 1 st level signal to the a-th level signal includes: and calculating the average duration T of the level signals from the 1 st level signal to the a th level signal, and taking the average duration T as the signal duration T. The average duration time of the level signal is used as the signal duration time, so that the influence of errors caused by interference and other reasons of the level signal in the transmission process on the calculation result of the signal duration time is reduced, and the communication efficiency is improved.
The signal determining module 203 is configured to determine whether a first signal with a duration of two signal durations is received within a first preset level signal receiving range after the 8 th level signal is received, if the first signal is not received, trigger the signal receiving module 201 to end the receiving process, if the first signal is received, determine whether a second signal with a duration of two signal durations is received within a second preset level signal receiving range after the first signal is received, if the second signal is not received, trigger the signal receiving module 201 to end the receiving process, and if the second signal is received, trigger the receiving state determining module 204 to complete the receiving state determining operation.
In this embodiment, the first preset level signal receiving range is a preset level signal receiving interval, a signal with two signal durations received in the level signal receiving interval is a first signal, if a signal with two signal durations is received before the first preset level signal receiving range, it is considered that a signal loss occurs, the data receiving apparatus 200 may select to end the current receiving process, and if a signal with two signal durations is still not received when the first preset level signal receiving range is ended, the data receiving apparatus 200 may consider that the currently received content is not a header of a data frame or a loss of data, and end the receiving process.
In an optional implementation manner of this embodiment, the first preset level signal receiving range is from the 10 th level signal to the 22 nd level signal. That is, if a signal having a duration of two signal durations is received between the 10 th level signal and the 22 nd level signal, the signal is considered to be the first signal. In this alternative embodiment, if a signal with a duration of two signals is received before the 10 th level signal, or a signal with a duration of two signals is not received after the 22 nd level signal is received, the data receiving apparatus 200 may select to end the current receiving process if the currently received content is not a header of a data frame or data is lost. The method avoids the continuous detection under the condition that the level signal is lost or the received signal is not the data frame header, and improves the communication efficiency.
In this embodiment, the second predetermined level signal receiving range is a predetermined level signal receiving interval, the signal with two signal durations received in the level signal receiving interval is a second signal, if the signal with two signal durations is received before the second predetermined level signal receiving range, it is considered that the data receiving end having the signal loss may select to end the current receiving process, and if the signal with two signal durations is not received when the second predetermined level signal receiving range is ended, the data receiving apparatus 200 may consider that the currently received content is not a header of a data frame or that the data is lost, and end the receiving process.
In an optional implementation manner of this embodiment, the second predetermined level signal receiving range is from the N +6 th signal to the N +10 th signal, wherein the nth level signal is the first signal, that is, if a signal with a duration of two signal durations is received between the N +6 th level signal and the N +10 th level signal, the signal is considered as the second signal. If a signal with the duration of two signals is received before the N +6 th level signal, or a signal with the duration of two signals is not received when the N +10 th level signal is received, the currently received content is considered not to be a header of a data frame or the data is lost, and the receiving process is ended. The method avoids the situation that the level signal is lost or the received signal is not the head of the data frame, and still detects the level signal, thereby improving the communication efficiency.
A receiving state determining module 204, configured to determine that the receiving state is a first preset state if the first signal is at a high level and the second signal is at a low level; if the first signal is at a low level and the second signal is at a high level, judging that the receiving state is a second preset state; if the first signal is at a high level and the second signal is at a high level, the trigger signal receiving module 201 ends the receiving process; if the first signal is at a low level and the second signal is at a low level, the trigger signal receiving module 201 ends the receiving process; the decoding module 205 is notified of the determination result of the reception state.
A decoding module 205, configured to receive the determination result of the receiving status sent by the receiving status determining module 204, and if the receiving status is a first preset status, decode the transmission signal after the second signal according to a first decoding rule corresponding to the first preset status; and if the receiving state is a second preset state, decoding the transmission signal after the second signal according to a second decoding rule corresponding to the second preset state.
In this embodiment, by determining the levels of the first signal and the second signal, the polarity of the first signal and the second signal at the time of data transmission can be compared, for example, the data transmission apparatus transmits the data while the first signal and the second signal are at a high level and a low level, respectively, when the data receiving apparatus 200 is receiving data, if the first signal and the second signal are at a high level and a low level, respectively, it is determined that the polarity of the data is not reversed during transmission, decoding can be performed according to a first decoding rule, if the first signal and the second signal are respectively at a low level and a high level, it is determined that polarity inversion occurs in the data during transmission, decoding is carried out according to a second decoding rule, if the first signal and the second signal are both low level or both high level, the data is considered to have errors in the transmission process, and the receiving process is ended. The adopted decoding rule is determined by judging the levels of the first signal and the second signal in the received data, or whether the data is continuously received is determined, so that the condition that the data receiving device 200 does not find polarity inversion and then decodes in error when the polarity inversion occurs in the data transmission process is avoided, and the problem of low communication efficiency caused by continuous receiving of the data receiving device 200 when the data transmission errors such as loss occur in the data transmission process is also avoided.
As an optional implementation manner of this embodiment, the first preset state is a normal phase receiving state, the first decoding rule is that the square waveform with the waveform being high level starts and the waveform being low level ends is decoded to 1, and the square waveform with the waveform being low level starts and the waveform being high level ends is decoded to 0; the second preset state is an inverted receiving state, and the second decoding rule is that the waveform is a square waveform decoding 1 at which the low level starts and the high level ends, and a square waveform decoding 0 at which the high level starts and the low level ends. In this optional embodiment, the first preset state is a normal phase receiving state, that is, when the data receiving apparatus 200 receives the transmission signal in the first preset state, it is determined that no phase inversion occurs in the transmission process of the signal, the received signal is still a normal phase transmission signal, the square waveform with the high level starting and the low level ending is decoded to 1 according to the decoding rule, and the square waveform with the low level starting and the high level ending is decoded to 0; the second preset state is an inverted reception state, that is, when the data receiving apparatus 200 receives a transmission signal in the second preset state, it determines that a phase inversion occurs in the transmission process of the signal, the received signal is an inverted transmission signal, and the square waveform with the low level starting and the high level ending is decoded to 1 according to a decoding rule, and the square waveform with the high level starting and the low level ending is decoded to 0. The data receiving apparatus 200 determines whether the received transmission signal is a signal transmitted in a normal phase or a signal transmitted in a reverse phase according to the state of the received transmission signal, so as to facilitate further correct decoding of the signal, avoid a decoding error or a decoding failure of the signal due to phase inversion during transmission, and improve communication efficiency.
According to the technical solution of the embodiment, in the data receiving apparatus 200 provided by the present invention, after the signal receiving module 201 continuously receives the transmission signal, the signal duration calculating module 202 calculates the signal duration, the signal determining module 203 determines whether to receive the first signal within the first preset signal receiving range and the second signal within the second preset signal receiving range according to the signal duration, the receiving state determining module 204 determines the receiving state according to the levels of the first signal and the second signal, and the decoding module 205 selects the decoding rule adopted by the decoding according to the receiving state and completes the decoding. Through the data receiving device 200, the data receiving device 200 determines whether the received transmission signal is a signal transmitted in a normal phase or a signal transmitted in a reverse phase according to the state of the received transmission signal, so that the signal can be further decoded correctly, a decoding error or decoding incapability caused by phase inversion of the signal in the transmission process is avoided, and the communication efficiency is improved.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made in the above embodiments by those of ordinary skill in the art without departing from the principle and spirit of the present invention. The scope of the invention is defined by the appended claims and equivalents thereof.
Claims (2)
1. A data receiving method, comprising the steps of:
step 1, continuously receiving transmission signals, wherein the transmission signals are level signals in which high level signals and low level signals alternately appear;
step 2, calculating to obtain the average duration time T from the 1 st level signal to the a th level signal, and taking the average duration time T as the signal duration time T, wherein a is a preset positive integer and is more than or equal to 2 and less than or equal to 8;
step 3, judging whether a first signal with the duration time of two signal durations is received in a first preset level signal receiving range after the 8 th level signal is received, if so, turning to step 4, and if not, turning to step 8; the first preset level signal receiving range is from a 10 th level signal to a 22 nd level signal;
step 4, judging whether a second signal with the duration of two signal durations is received in a second preset level signal receiving range after the first signal is received, if so, turning to step 5, and if not, turning to step 8; the second preset level signal receiving range is from the (N + 6) th signal to the (N + 10) th signal, wherein the nth level signal is the first signal;
step 5, if the first signal is at a high level and the second signal is at a low level, turning to step 6; if the first signal is at a low level and the second signal is at a high level, go to step 7; if the first signal is at a high level, the second signal is at a high level, and go to step 8; if the first signal is at low level, the second signal is at low level, go to step 8;
step 6, judging that the receiving state is a first preset state, and decoding the transmission signal after the second signal according to a first decoding rule corresponding to the first preset state; the first preset state is a normal-phase receiving state, the first decoding rule is that the waveform is a square waveform decoding rule that the waveform starts from a high level and ends at a low level and is 1, and the square waveform decoding rule that the waveform starts from the low level and ends at the high level and is 0;
step 7, judging that the receiving state is a second preset state, and decoding the transmission signal after the second signal according to a second decoding rule corresponding to the second preset state; the second preset state is an inverted receiving state, the second decoding rule is that the waveform is a square waveform with a low level starting and a high level ending and is decoded into 1, and the square waveform with the high level starting and the low level ending is decoded into 0;
and 8, judging the current data receiving error and ending the receiving process.
2. A data receiving device, comprising: a signal receiving module, a signal duration calculating module, a signal judging module, a receiving state judging module and a decoding module, wherein,
the signal receiving module is used for continuously receiving transmission signals, wherein the transmission signals are level signals in which high level signals and low level signals appear alternately;
the signal duration calculation module is configured to calculate an average duration T of the level signal from the 1 st level signal to the a th level signal, and use the average duration T as the signal duration T; wherein a is a preset positive integer and is more than or equal to 2 and less than or equal to 8;
the signal judging module is configured to judge whether a first signal with a duration of two signal durations is received within a first preset level signal receiving range after an 8 th level signal is received, trigger the signal receiving module to end a receiving process if the first signal is not received, judge whether a second signal with a duration of two signal durations is received within a second preset level signal receiving range after the first signal is received if the first signal is received, trigger the signal receiving module to end the receiving process if the second signal is not received, and trigger the receiving state judging module to complete a receiving state judging operation if the second signal is received; the first preset level signal receiving range is from a 10 th level signal to a 22 nd level signal; the second preset level signal receiving range is from the (N + 6) th signal to the (N + 10) th signal, wherein the nth level signal is the first signal;
the receiving state judging module is used for judging that the receiving state is a first preset state if the first signal is at a high level and the second signal is at a low level; if the first signal is at a low level and the second signal is at a high level, judging that the receiving state is a second preset state; if the first signal is at a high level and the second signal is at a high level, triggering the signal receiving module to end the receiving process; if the first signal is at a low level and the second signal is at a low level, triggering the signal receiving module to end the receiving process; informing the decoding module of the judgment result of the receiving state;
the decoding module is configured to receive a determination result of the receiving state sent by the receiving state determining module, and decode the transmission signal after the second signal according to a first decoding rule corresponding to the first preset state if the receiving state is the first preset state; if the receiving state is the second preset state, decoding the transmission signal after the second signal according to a second decoding rule corresponding to the second preset state; the first preset state is a normal-phase receiving state, the first decoding rule is that the waveform is a square waveform decoding rule that the waveform starts from a high level and ends at a low level and is 1, and the square waveform decoding rule that the waveform starts from the low level and ends at the high level and is 0; the second preset state is an inverted receiving state, and the second decoding rule is that the waveform is a square waveform decoding 1 in which the low level starts and the high level ends, and a square waveform decoding 0 in which the high level starts and the low level ends.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911355425.3A CN111147107B (en) | 2019-12-25 | 2019-12-25 | Data receiving method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911355425.3A CN111147107B (en) | 2019-12-25 | 2019-12-25 | Data receiving method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111147107A CN111147107A (en) | 2020-05-12 |
CN111147107B true CN111147107B (en) | 2021-12-24 |
Family
ID=70519930
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911355425.3A Active CN111147107B (en) | 2019-12-25 | 2019-12-25 | Data receiving method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111147107B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104820812A (en) * | 2015-04-12 | 2015-08-05 | 浙江海康科技有限公司 | Method and device for decoding miller code modulated by subcarrier |
CN105611113A (en) * | 2015-12-21 | 2016-05-25 | 苏州长风航空电子有限公司 | Digital video signal synchronization head polarity adaptive method based on FPGA |
CN106201972A (en) * | 2016-07-01 | 2016-12-07 | 西安交大能源电子技术开发公司 | A kind of high speed serial communication method being applicable to low cost child node |
CN109905199A (en) * | 2017-12-08 | 2019-06-18 | 中国科学院上海高等研究院 | A kind of serial communication data Polarity restoration method of asymmetric K code encoding and decoding |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101729198B (en) * | 2008-10-27 | 2014-04-02 | 华为技术有限公司 | Method, device and system for encoding and decoding |
US8594244B2 (en) * | 2009-04-06 | 2013-11-26 | Mediatek Inc. | Data signal phase reversal correction method and system implementing the same |
US9363068B2 (en) * | 2010-08-03 | 2016-06-07 | Intel Corporation | Vector processor having instruction set with sliding window non-linear convolutional function |
US9253072B2 (en) * | 2012-10-24 | 2016-02-02 | Broadcom Corporation | Polarity detection system |
-
2019
- 2019-12-25 CN CN201911355425.3A patent/CN111147107B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104820812A (en) * | 2015-04-12 | 2015-08-05 | 浙江海康科技有限公司 | Method and device for decoding miller code modulated by subcarrier |
CN105611113A (en) * | 2015-12-21 | 2016-05-25 | 苏州长风航空电子有限公司 | Digital video signal synchronization head polarity adaptive method based on FPGA |
CN106201972A (en) * | 2016-07-01 | 2016-12-07 | 西安交大能源电子技术开发公司 | A kind of high speed serial communication method being applicable to low cost child node |
CN109905199A (en) * | 2017-12-08 | 2019-06-18 | 中国科学院上海高等研究院 | A kind of serial communication data Polarity restoration method of asymmetric K code encoding and decoding |
Also Published As
Publication number | Publication date |
---|---|
CN111147107A (en) | 2020-05-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9654985B2 (en) | Radio link synchronization in a wireless communication device | |
EP3675398B1 (en) | Check code processing method, electronic device, and storage medium | |
WO2015120758A1 (en) | Data communication method, terminal and information security device | |
CN111147107B (en) | Data receiving method and device | |
CN107368446B (en) | Transmission parameter adaptive data transmission method and device | |
CN111147108B (en) | Transmission signal receiving method and equipment | |
US8416717B2 (en) | Signals communication apparatus | |
CN109391569B (en) | Method and apparatus for power optimized adaptive channel estimation for narrowband systems | |
CN113098809B (en) | Software self-adaptive decoding method, device and wireless charging system | |
CN102546137B (en) | Method and device for detecting wireless link | |
CN106877994B (en) | Audio data transmitting and receiving method | |
JP3485248B2 (en) | Power line communication device | |
CN107370565B (en) | Transmission parameter adaptive data transmission method and device | |
CN107346998B (en) | Data frame tail detection method and data transmission device | |
CN112564820B (en) | Signal receiving and transmitting method and device and electric kettle | |
CN112054820B (en) | Method and apparatus for transmitting and receiving data using power line | |
JP3823288B2 (en) | Automatic detection system and method for a network transceiver | |
JP5102572B2 (en) | Communication method | |
CN118381583B (en) | Signal transmission method, apparatus, device, medium and computer program product | |
CN112054819B (en) | Method and apparatus for transmitting and receiving data using power line | |
CN109802761B (en) | Fault identification method and device | |
WO2019218803A1 (en) | Information reporting method, data transmission method, user equipment and network side device | |
CN103026409A (en) | Speech frame decoding method and speech frame decoding device | |
CN117424675A (en) | Passive transmission method and device, electronic equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |