Disclosure of Invention
The invention aims to avoid the defects in the prior art and provides a direct current power line carrier communication method based on differential Manchester coding, which can improve the utilization rate of a cable.
The purpose of the invention is realized by the following technical scheme:
on one hand, the direct current power line carrier communication method based on differential Manchester coding is provided, and the direct current power line carrier communication and power supply between two communication modules are realized by utilizing the differential Manchester coding technology.
In a first preferred embodiment, the method for implementing the dc power line carrier communication between two communication devices by using the differential manchester coding technology specifically includes: the controller of the first communication module sends an original standard signal, the coding and decoding module of the first communication module reads the original signal, then the original signal is coupled to a direct current power supply line through differential Manchester coding and a bus driver, the digital signal is directly transmitted to the second communication module, the second communication module is used as a receiving end to carry out differential Manchester decoding on the received coding signal in the coding and decoding module of the second communication module, the coding and decoding module is restored into the original standard signal sent by the controller of the first communication module, and the original standard signal is transmitted to the controller of the second communication device.
In a second preferred embodiment, the method for coupling the original signal to the dc power line by the codec module of the first communication module specifically includes:
the serial input data is stored in a designated register through a serial-parallel converter, a clock used by the serial-parallel converter is obtained by frequency division of a clock management module in the module, the data stored in the designated register is subjected to CRC to generate a corresponding CRC check code, then the data added with the check code is coded, a bit low level is taken as a start bit, a bit high level is taken as a stop bit, then a synchronous head is added to the coded data, and finally the coded data is output through the parallel-serial converter and transmitted through a direct current power line after being coupled.
In a third preferred embodiment, the encoding specifically includes: the coding state of the present symbol is determined according to the value of the latter half of the previous symbol.
In a fourth preferred embodiment, the original data is modulated by differential manchester coding, and if the polarity is changed at the beginning of the signal bit, the signal bit is represented as logic "0"; otherwise, if the polarity is not changed, a logic "1" is indicated.
In a fifth preferred embodiment, the differential manchester decoding and restoring to the original standard signal sent by the controller of the first communication module, and transmitting to the controller of the second communication device specifically includes: the carrier signal is continuously sampled, the initial position of the code is determined after the synchronous head is detected, and then the data is received and decoded simultaneously.
In a sixth preferred embodiment, the decoding principle is: and comparing the next bit of the two adjacent pairs of coded former symbols with the previous bit of the next pair of symbols, wherein if the two adjacent pairs of coded former symbols are the same, the decoding result is 1, and otherwise, the decoding result is 0.
In a seventh preferred scheme, after decoding, CRC check is performed on the data, and an exclusive or operation is performed on the data by using a generator polynomial, where if the result is 0, the data transmission is correct, and otherwise, the data transmission is incorrect and needs to be retransmitted.
In another aspect, a computer-readable storage medium is provided that includes a computer program which, when invoked by a processor, implements the differential manchester encoding-based direct current power line carrier communication method described above.
On the other hand, a first coding and decoding module is provided, which is used for implementing the second preferred scheme of the direct current power line carrier communication method based on differential Manchester coding, and comprises a serial-parallel conversion module, a parallel-serial conversion module, a CRC check module, a coding module and a clock frequency division module,
the serial-to-parallel converter: for storing serial input data into a designated register, using a clock divided by a clock management block in the module,
the CRC check module: for performing CRC check on the data stored in the designated register to generate corresponding CRC check code,
the encoding module: for coding the data added with the check code, taking a bit of low level as a start bit and a bit of high level as a stop bit, then adding the coded data into a synchronous head,
the parallel-to-serial converter: for outputting the data added with the sync header.
On the other hand, a first communication module is provided and comprises a first coding and decoding module, a first communication submodule, a second communication submodule, a first coupling circuit and a first power module, wherein the first communication submodule and the second communication submodule are electrically connected with the first coding and decoding module, the first power module supplies power for the first coding and decoding module, the first communication submodule and the second communication submodule respectively, and the second communication submodule is electrically connected with a power line connected with the output end of the first power module through the first coupling circuit.
On the other hand, a second coding and decoding module is provided, which is used for implementing the seventh preferred scheme of the direct current power line carrier communication method based on differential Manchester coding, and comprises a sampling module, a clock management module, a decoding module, a CRC checking module and a parallel-serial conversion module,
the sampling module: for continuously sampling the carrier signal with a clock signal of a high carrier signal frequency,
the clock management module: for providing a clock signal at a high carrier signal frequency,
the decoding module: for decoding the data while receiving when the sampling module detects the sync header and determines the start position of the code,
the parallel-serial conversion module: for serially outputting the decoded data.
On the other hand, a second communication module is provided, which comprises the second coding and decoding module, a third communication sub-module, a fourth communication sub-module, a second coupling circuit and a second power module, wherein the third communication sub-module and the fourth communication sub-module are electrically connected with the second coding and decoding module, the second power module supplies power to the second coding and decoding module, the third communication sub-module and the fourth communication sub-module respectively, and the fourth communication sub-module is electrically connected with a power line connected with the output end of the second power module through the second coupling circuit.
In another aspect, an air conditioner is provided, which includes an indoor unit and an outdoor unit, wherein the indoor unit includes the first communication module and an indoor unit controller electrically connected to the first communication module, and the outdoor unit includes the second communication module and an outdoor unit controller electrically connected to the second communication module.
The invention has the beneficial effects that: according to the invention, the carrier communication and power supply of the direct current power lines between the two communication modules are realized by using a differential Manchester coding technology, a direct current carrier communication mode based on the differential Manchester coding technology is adopted, and power supply and communication are realized by using the two power lines, so that the utilization rate of a cable is improved; the existing communication line is cancelled, the assembly efficiency of the air conditioner is improved, and the cost is saved; the transmission of digital signals on a power line is directly realized by utilizing a differential Manchester coding technology, so that the low-frequency coupling and transmission of more '1' or more '0' in the direct-current transmission process can be carried out at high speed, high digit and high reliability; data are processed in parallel, data are received and transmitted at the same time, timeliness of communication between the indoor unit and the outdoor unit is enhanced, and reliable operation of the air conditioner is guaranteed.
Detailed Description
The invention is further described with reference to the following examples.
In the embodiment, a direct current power line carrier communication method based on differential manchester coding is used for an air conditioner, and electrical schematic diagrams of an indoor unit and an outdoor unit of the air conditioner are shown in fig. 1.
The indoor unit comprises an indoor unit controller and a first communication module (i.e. the communication module 1 in fig. 1), the communication module 1 comprises a first codec module (i.e. the codec module 1 in fig. 1), a first communication sub-module (in this embodiment, specifically, the RS458 module on the left side of the codec module 1 in fig. 1), a second communication sub-module (in this embodiment, specifically, the RS458 module on the right side of the codec module 1 in fig. 1), a first coupling circuit (corresponding to the coupling circuit of the communication module 1 in fig. 1) and a first power module (i.e. the power module 1 in fig. 1), the first communication submodule and the second communication submodule are electrically connected with the first coding and decoding module, the first power supply module supplies power for the first coding and decoding module, the first communication submodule and the second communication submodule respectively, and the second communication submodule is electrically connected with a power line connected with the output end (the side connected with the inductor) of the first power supply module through the first coupling circuit.
The outdoor unit comprises an outdoor unit controller and a second communication module (i.e. the communication module 2 in fig. 1), the communication module 2 comprises a second codec module (i.e. the codec module 2 in fig. 1), a third communication sub-module (in this embodiment, specifically, the RS458 module on the right side of the codec module 2 in fig. 1), a fourth communication sub-module (in this embodiment, specifically, the RS458 module on the left side of the codec module 2 in fig. 1), a second coupling circuit (corresponding to the coupling circuit of the communication module 2 in fig. 1), and a second power module (i.e. the power module 2 in fig. 1), the third communication sub-module and the fourth communication sub-module are electrically connected with the second coding and decoding module, the second power supply module respectively supplies power to the second coding and decoding module, the third communication sub-module and the fourth communication sub-module, and the fourth communication sub-module is electrically connected with a power line connected with the output end (the side connected with the inductor) of the second power supply module through the second coupling circuit.
The direct-current power line carrier communication method based on differential Manchester coding in the embodiment is as follows:
the direct current power supply is carried out between the direct current air conditioner indoor unit and the outdoor unit through two power lines, and meanwhile, the two direct current power lines are also used for transmitting communication data, namely, the multiplexing of power supply and communication of the power lines is realized. According to the power line carrier communication scheme based on the RS485 link standard, an indoor unit controller sends an original standard signal, an encoding module reads the original signal, the original signal is coupled to a direct-current power line through differential Manchester encoding and a bus driver, a digital signal is directly transmitted to an outdoor unit, the outdoor unit serves as a receiving end, the received encoding signal is subjected to differential Manchester decoding in a decoding module and is restored into the original standard signal sent by the indoor unit controller, and the original standard signal is transmitted to the outdoor unit controller.
Because the original data signal may have a large dc component, which may cause the coupling transformer to fail to perform correct signal coupling, the original data is modulated by using differential manchester encoding, and if the polarity is changed at the beginning of the signal bit, it is represented as logic "0"; otherwise, if the polarity is not changed, the logic '1' is represented, and no direct current component exists in the coded data stream, which is beneficial to coupling. The differential Manchester coding not only carries data, but also can transmit synchronous signals, so that the length of a transmitted data frame can break through the limitation of a single byte of RS485, and the transmission speed is accelerated.
The first codec module (i.e. codec module 1 in fig. 1) comprises four major modules as a whole: the system comprises a serial-parallel conversion module, a parallel-serial conversion module, a CRC (cyclic redundancy check) check module, an encoding module and a clock frequency division module, and belongs to an encoder part. The coding module firstly stores serial input data into a designated register through a serial-parallel converter, and a clock frequency division signal used by the coding module is obtained by frequency division of a clock frequency division module in the coding module. And performing CRC on the stored data to generate a corresponding CRC code. And then coding the data added with the check code. The state when the current code element is coded is related to the level of the second half code element after the last code element is coded. Therefore, the coding state of the present symbol needs to be determined based on the value of the latter half of the previous symbol. The encoded data is then added to the sync header. One bit low level is used as the start bit and one bit high level is used as the stop bit. And finally, the output is output through parallel-serial conversion, and the output is transmitted through a direct current power line after being coupled.
The second codec module (i.e., codec module 2 in fig. 1) includes, as a whole, a sampling module, a clock management module, a decoding module, a CRC check module, and a parallel-serial conversion module, which belong to a decoder section. The main structure of the coding device is similar to that of the coder in the first coding module, and the received coded data is restored into original data. However, unlike encoding, the decoder section needs to continuously sample the carrier signal with a clock signal 16 times the carrier signal frequency, determine the start position of the encoding when the sync header is detected, and then decode the data while receiving it. The principle of decoding is to compare the next bit of the two adjacent pairs of coded former symbols with the previous bit of the next pair of symbols, if they are the same, the decoding result is "1", otherwise it is "0". After decoding, performing CRC (cyclic redundancy check) on the data, performing XOR (exclusive OR) operation on the data by using a generating polynomial, if the result is 0, correctly transmitting the data, otherwise, transmitting the data in error, needing retransmission, and finally serially outputting the decoded data according to a clock frequency division signal.
It should be noted that, a decoder having the same function as the decoder of the second codec module is also provided in the first codec module, and an encoder having the same function as the encoder of the first codec module is also provided in the second codec module, so that bidirectional communication between the indoor unit and the outdoor unit can be realized.
Finally, it should be noted that the above embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the protection scope of the present invention, although the present invention is described in detail with reference to the preferred embodiments, it should be understood by those skilled in the art that modifications or equivalent substitutions can be made on the technical solutions of the present invention without departing from the spirit and scope of the technical solutions of the present invention.