CN109506337B - Communication method, communication device, storage medium and air conditioner - Google Patents

Communication method, communication device, storage medium and air conditioner Download PDF

Info

Publication number
CN109506337B
CN109506337B CN201811386359.1A CN201811386359A CN109506337B CN 109506337 B CN109506337 B CN 109506337B CN 201811386359 A CN201811386359 A CN 201811386359A CN 109506337 B CN109506337 B CN 109506337B
Authority
CN
China
Prior art keywords
data
slave
communication
sent
received
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
Application number
CN201811386359.1A
Other languages
Chinese (zh)
Other versions
CN109506337A (en
Inventor
李秀菲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Gree Electric Appliances Inc of Zhuhai
Original Assignee
Gree Electric Appliances Inc of Zhuhai
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Gree Electric Appliances Inc of Zhuhai filed Critical Gree Electric Appliances Inc of Zhuhai
Priority to CN201811386359.1A priority Critical patent/CN109506337B/en
Publication of CN109506337A publication Critical patent/CN109506337A/en
Application granted granted Critical
Publication of CN109506337B publication Critical patent/CN109506337B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • FMECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
    • F24HEATING; RANGES; VENTILATING
    • F24FAIR-CONDITIONING; AIR-HUMIDIFICATION; VENTILATION; USE OF AIR CURRENTS FOR SCREENING
    • F24F11/00Control or safety arrangements
    • F24F11/62Control or safety arrangements characterised by the type of control or by internal processing, e.g. using fuzzy logic, adaptive control or estimation of values
    • F24F11/63Electronic processing
    • F24F11/64Electronic processing using pre-stored data
    • FMECHANICAL ENGINEERING; LIGHTING; HEATING; WEAPONS; BLASTING
    • F24HEATING; RANGES; VENTILATING
    • F24FAIR-CONDITIONING; AIR-HUMIDIFICATION; VENTILATION; USE OF AIR CURRENTS FOR SCREENING
    • F24F11/00Control or safety arrangements
    • F24F11/50Control or safety arrangements characterised by user interfaces or communication
    • F24F11/61Control or safety arrangements characterised by user interfaces or communication using timers

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Chemical & Material Sciences (AREA)
  • Combustion & Propulsion (AREA)
  • Mechanical Engineering (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Selective Calling Equipment (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention provides a communication method, a communication device, a storage medium and an air conditioner, wherein the method comprises the following steps: the method comprises the following steps: when the device serves as a master, updating data to be sent to a slave before sending the data to the slave; and after the data is sent to the slave, clearing the received data count, the received error flag bit and/or the received data success flag bit of the data returned by the slave. The scheme provided by the invention can automatically recover correct communication after the communication is interfered or a certain condition goes wrong, and has the advantages of simple implementation and wide application range.

Description

Communication method, communication device, storage medium and air conditioner
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a communication method, a communication apparatus, a storage medium, and an air conditioner.
Background
Along with the development of science and technology, the demand of users is more and more diversified, the control of air conditioners is more and more complicated, the control targets are more and more, in order to save cost and control more accurately, a plurality of board communication modes are usually adopted, for example, an inner machine mainboard communicates with an outer machine mainboard, an inner machine display board communicates with the inner machine mainboard, an inner machine display board communicates with a detection board, and the like, and the communication mode adopts a host computer communication mode and a slave computer communication mode, so that high requirements are provided for the reliability of communication. The existing method for improving the reliability of unidirectional communication generally processes the data from the format of a data packet and sends the data according to a certain interval time, and the communication format and the data are simple and are easy to be interfered by the outside world, thereby causing communication abnormity.
Disclosure of Invention
The present invention is directed to overcome the above-mentioned drawbacks of the prior art, and provides a communication method, a communication device, a storage medium, and an air conditioner, so as to solve the problems in the prior art that the communication process is easily interfered and the communication cannot be automatically recovered after the interference.
One aspect of the present invention provides a communication method, including: when the device serves as a master, updating data to be sent to a slave before sending the data to the slave; and after the data is sent to the slave, clearing the received data count, the received error flag bit and/or the received data success flag bit of the data returned by the slave.
Optionally, updating the data to be sent to the slave includes: and setting the value of the data to be sent.
Optionally, the method further comprises: when the device is used as a slave and receives data sent by a host, judging whether the receiving time interval of two adjacent bytes is greater than a first preset time length; and if the receiving time interval of the two adjacent bytes is greater than the first preset time length, clearing the received data count, the receiving error flag bit and/or the receiving success flag bit of the data sent by the host.
Optionally, the method further comprises: when the device is used as a slave and receives data sent by a host, judging whether correct data sent by the host is not received continuously for a second preset time length; and if the correct data sent by the host computer is not received in the continuous second preset time, initializing the communication.
Optionally, the initializing the communication includes: resetting the baud rate of communication; and/or initializing permission to receive and/or transmit data.
Another aspect of the present invention provides a communication device, including: the updating unit is used for updating data to be sent to the slave before sending the data to the slave when the equipment serves as a master; and the first processing unit is used for clearing the received data count, the received error flag bit and/or the received data success flag bit of the data returned by the slave after the data is sent to the slave.
Optionally, the updating unit, configured to update the data to be sent to the slave, includes: and setting the value of the data to be sent.
Optionally, the method further comprises: the first judging unit is used for judging whether the receiving time interval of two adjacent bytes is greater than a first preset time length when the equipment serves as a slave and receives data sent by a host; and the second processing unit is used for clearing the received data count, the receiving error flag bit and/or the receiving success flag bit of the data sent by the host if the receiving time interval of the two adjacent bytes is greater than the first preset time length.
Optionally, the method further comprises: the second judging unit is used for judging whether correct data sent by the host are not received continuously for a second preset time length when the equipment serves as a slave and data sent by the host are received; and the initialization setting unit is used for initializing and setting communication if correct data sent by the host computer are not received for the second preset duration.
Optionally, the initializing unit is configured to perform initializing setting on communication, and includes: resetting the baud rate of communication; and/or initializing permission to receive and/or transmit data.
A further aspect of the invention provides a storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of any of the methods described above.
Yet another aspect of the present invention provides an air conditioner comprising a processor, a memory, and a computer program stored on the memory and operable on the processor, wherein the processor implements the steps of any of the methods described above when executing the program.
In another aspect, the invention provides an air conditioner comprising any one of the communication devices.
According to the technical scheme of the invention, when the master machine sends data to the slave machine, the data are updated only when the data are ready to be sent, the slave machine received data count, the receiving error flag bit and the like are processed when the master machine sends the data, when the interval between two data received by the slave machine is greater than the first preset time, the slave machine received data count, the receiving error flag bit and the like are processed, and when the slave machine does not receive correct data for a period of time, the baud rate and the like of communication are initialized, so that the communication can be recovered even if the communication in one frame of data is lost and the next frame of data is received, and the purpose of improving the reliability of the communication is achieved. The invention processes the communication data, can automatically recover correct communication after being interfered or having errors in certain conditions, has simple implementation and wide application range, and is applied to practical engineering, such as the communication between an air conditioner internal unit and an external unit, the communication between the air conditioner and WIFI, and the communication between a main board and a display board of the air conditioner internal unit, thereby achieving the effect of reliable communication.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the invention and not to limit the invention. In the drawings:
fig. 1 is a schematic method diagram of an embodiment of a communication method according to the present invention;
FIG. 2 is a schematic diagram of the communication between the master and the slave according to the present invention;
FIG. 3 is a schematic diagram of a method of an embodiment of the present invention when the device of the communication method is used as a host;
FIG. 4 is a schematic diagram of a communication method according to another embodiment of the present invention;
FIG. 5 is a schematic diagram of a communication method according to an embodiment of the present invention when the device is a slave device;
FIG. 6 is a schematic diagram of a communication method according to another embodiment of the present invention;
FIG. 7 is a schematic diagram of another embodiment of the communication method according to the present invention when the device is used as a slave;
fig. 8 is a schematic structural diagram of an embodiment of a communication device according to the present invention;
fig. 9 is a schematic structural diagram of an embodiment of a communication device according to the present invention;
fig. 10 is a schematic structural diagram of an embodiment of a communication device provided in the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the technical solutions of the present invention will be clearly and completely described below with reference to the specific embodiments of the present invention and the accompanying drawings. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Fig. 1 is a schematic method diagram of a communication method according to an embodiment of the present invention. The communication method can be used for communication between an air conditioner internal unit and an external unit, between an air conditioner and a terminal (such as a mobile phone and a computer), and between an air conditioner internal unit main board and a display board.
As shown in fig. 1, according to an embodiment of the present invention, the communication method includes steps S110 and S130.
Step S110, when the device is the master, before sending data to the slave, updating the data to be sent to the slave.
The method of the present invention is particularly applicable to a communication mode between a master and a slave, for example, a master and a slave (refer to fig. 2, fig. 2 is a schematic communication diagram of a master and a slave according to the present invention), or a master and a plurality of slaves. When the device to which the communication method belongs is used as a master, the device to which the master belongs sends data to the slave at regular time, the slave sends the data back to the master after a preset time interval, the master updates the data to be sent to the slave before sending the data to the slave, namely when the sending count is 0, specifically, the data to be sent to the slave can be updated in a mode of setting the value of the data to be sent to the slave, and the value of the data to be sent is assigned according to the communication protocol definition, so that errors caused by the fact that the data is changed by an interrupt program in the process of sending the data to the slave can be avoided.
And step S120, after the data is sent to the slave, clearing the received data count, the received error flag bit and/or the received data success flag bit of the data returned by the slave.
Specifically, the host sends data to the slave, and after the sending is finished, the received data count of the host is cleared, the received error flag is cleared, and/or the received data success flag is cleared, so that if the previous frame of data receives incomplete data or error data, the received data count and the received error flag are cleared, that is, the error information of the previous frame of data does not affect the receiving of the current frame of data, thereby improving the reliability of communication.
Fig. 3 is a schematic diagram of a method of an embodiment of the communication method of the present invention when the device is used as a host. As shown in fig. 3, it is determined whether the transmission count of the data transmitted from the master to the slave is 0, if the transmission count is 0, the master updates the data to be transmitted to the slave, and transmits the data to be transmitted to the transmission register to transmit, and if the transmission count is not 0, the data to be transmitted is transmitted to the transmission register to transmit, wherein when the transmission register is idle, the data to be transmitted is transmitted to the transmission register to transmit, and the transmission data count is incremented by 1, and after the transmission is completed, the transmission data count is cleared, the reception error flag is cleared, the reception data count is cleared, and the reception data error flag is cleared.
Fig. 4 is a schematic method diagram of another embodiment of a communication method provided by the present invention. As shown in fig. 4, according to an embodiment of the present invention, the communication method further includes step S130 and step S140.
Step S130, when the device is a slave and receives data sent by the host, determining whether the receiving time interval of two adjacent bytes is greater than a first preset time.
Step S140, if the receiving time interval between two adjacent bytes is greater than the first preset time, clearing the received data count, the receiving error flag bit and/or the receiving success flag bit of the data sent by the host.
The method of the present invention may be applied to a manner of communication between a master and a slave, for example, one master and one slave (see fig. 2), or one master and a plurality of slaves. When the equipment to which the communication method belongs is used as a slave machine, the master machine sends data to the slave machine at regular time, the slave machine sends back the data to the master machine after a preset time interval, when the slave machine receives the data sent by the master machine, the slave machine judges whether the receiving time interval of two adjacent bytes is greater than a first preset time length, and if the length of the receiving time interval of the two bytes is greater than the first preset time length, the receiving data count, the receiving error flag bit and/or the receiving success flag bit of the data sent by the master machine are/is cleared. Specifically, in normal data transmission, the interval between two bytes is one byte length, for example, the baud rate is 2400BPS, the length between two bytes is 4.583ms, if the length of two bytes is greater than a certain period of time (i.e., a first preset time length, where the value of the first preset time length is greater than the length between two bytes, for example, 20ms), it means that data is abnormal, and at this time, the received data count of the slave is cleared 0, the received error flag is cleared 0, and the received data success flag is cleared 0, so as to ensure the correctness of receiving the next frame of data, thereby improving the reliability of communication.
Fig. 5 is a schematic method diagram of a specific embodiment of the communication method provided by the present invention when the device is used as a slave. As shown in fig. 5, in the process of sending data from the master to the slave, time counting is performed for two byte intervals, and when the time counting is greater than the first preset time length, the received data count of the slave is cleared by 0, the received error flag bit is cleared by 0, and the received data success flag bit is cleared by 0.
Fig. 6 is a schematic method diagram of a communication method according to another embodiment of the present invention. The communication method can be used for communication between an air conditioner internal unit and an external unit, between an air conditioner and a terminal (such as a mobile phone and a computer), and between an air conditioner internal unit main board and a display board. As shown in fig. 6, according to an embodiment of the present invention, the communication method further includes step S150 and step S160.
And step S150, when the device is used as a slave and receives the data sent by the host, judging whether correct data sent by the host is not received continuously for a second preset time. The correct data specifically comprises correct data conforming to a communication protocol, and whether the received data sent by the host conforms to the communication protocol or not is judged, and the data conforming to the communication protocol is the correct data.
Step S160, if the correct data sent by the host is not received for the second preset duration, initializing the communication. Specifically, the device to which the slave belongs is initialized for communication.
The method of the present invention may be applied to a manner of communication between a master and a slave, for example, one master and one slave (see fig. 2), or one master and a plurality of slaves. When the equipment to which the communication method belongs is used as a slave machine, the host machine sends data to the slave machine at regular time, the slave machine sends back the data to the host machine after a preset time interval, and when the slave machine receives the data sent by the host machine, the slave machine judges whether correct data sent by the host machine is not received for a second preset time; if the correct data sent by the host is not received for the second preset duration, it indicates that there is interference, for example, a data error or some unknown error occurs, and the correct data is not received after a period of time, the communication is initialized, for example, the communication is reset according to the setting requirements of different chips. Specifically, initializing the communication may specifically include resetting a baud rate (a transmission baud rate and/or a reception baud rate) of the communication; and/or to initialize, i.e. re-enable, the reception and/or transmission of data. Therefore, the communication can be ensured to be self-recovered to normal communication under the abnormal condition.
Fig. 7 is a schematic method diagram of another specific embodiment of the communication method provided by the present invention when the device is used as a slave. As shown in fig. 7, in the process of sending data from the master to the slave, time counting is performed on the time when the slave cannot receive correct data, and if the time counting is greater than a second preset time, the chip is reset according to the communication protocol, for example, the baud rate is set, and data reception is allowed again.
In the long-term application process of the communication modes of the host computer and the slave computer, because of different environments, power supplies and the like, the situation that data are interfered in the communication process can occur, the error and failure of single-frame data communication are corrected by the method, and then the next frame data can be normally communicated, so that the reliability of communication is ensured.
Fig. 8 is a schematic structural diagram of an embodiment of a communication device provided in the present invention. The communication method can be used for communication between an air conditioner internal unit and an external unit, between an air conditioner and a terminal (such as a mobile phone and a computer), and between an air conditioner internal unit main board and a display board. As shown in fig. 8, the communication device 100 includes: an updating unit 110 and a first processing unit 120.
The updating unit 110 is configured to update data to be sent to a slave before sending the data to the slave when the device is a master; the first processing unit 120 is configured to, after the end of sending data to the slave, clear a received data count, a received error flag bit, and/or a received data success flag bit of data returned by the slave.
The device of the present invention may be specifically adapted to the way of communication between the master and the slave, for example, one master and one slave (see fig. 2), or one master and a plurality of slaves. When the device to which the communication method belongs is used as a master, the device to which the master belongs sends data to the slave at regular time, the slave sends the data back to the master after a preset time interval, and when the master sends the data to the slave, namely the sending count is 0, the updating unit 110 updates the data to be sent to the slave, specifically, the data to be sent to the slave can be updated in a mode of setting the value of the data to be sent to the slave, and the value is assigned, namely the data to be sent is assigned according to the communication protocol definition, so that errors caused by the fact that the data is changed by an interrupt program in the process of sending the data to the slave can be avoided.
After the transmission is finished, the first processing unit 120 clears the received data count, the received error flag, and/or the received data success flag of the host, so that if the previous frame of data receives incomplete data or error data, the received data count and the received error flag are cleared, that is, the error information of the previous frame of data does not affect the reception of the current frame of data, thereby improving the reliability of communication.
In the above embodiment, referring to fig. 3, it is determined whether the transmission count of the data transmitted from the master to the slave is 0, if the transmission count is 0, the master updates the data to be transmitted to the slave, and transmits the data to be transmitted to the transmission register to transmit, and if the transmission count is not 0, the data to be transmitted is transmitted to the transmission register to transmit, where when the transmission register is idle, the data to be transmitted is transmitted to the transmission register to transmit, and the transmission data count is incremented by 1, and after the transmission is finished, the transmission data count is cleared, the reception error flag bit is cleared, the reception data count is cleared, and the reception data error flag bit is cleared.
Fig. 9 is a schematic structural diagram of an embodiment of a communication device provided in the present invention. As shown in fig. 9, the communication device 100 further includes: a first judging unit 130 and a second processing unit 140.
The first determining unit 130 is configured to determine whether a receiving time interval between two adjacent bytes is greater than a first preset time length when the device to which the device belongs is used as a slave and receives data sent by a host; the second processing unit 140 is configured to, if the receiving time interval between two adjacent bytes is greater than the first preset time duration, clear a received data count, a receiving error flag bit, and/or a receiving success flag bit of the data sent by the host.
The device of the present invention may be specifically adapted to the way of communication between the master and the slave, for example, one master and one slave (see fig. 2), or one master and a plurality of slaves. When the device to which the communication method belongs is used as a slave, the master sends data to the slave at regular time, the slave sends data back to the master after a preset time interval, when the slave receives the data sent by the master, the first judgment unit 130 judges whether the receiving time interval of two adjacent bytes is greater than a first preset time length, and if the length of the receiving time interval of the two bytes is greater than the first preset time length, the second processing unit 140 clears the receiving data count, the receiving error flag bit and/or the receiving success flag bit of the data sent by the master.
Specifically, in normal data transmission, the interval between two bytes is one byte length, for example, the baud rate is 2400BPS, the length between two bytes is 4.583ms, if the length of two bytes is greater than a certain period of time (i.e., a first preset time length, where the value of the first preset time length is greater than the length between two bytes, for example, 20ms), it means that data is abnormal, and at this time, the received data count of the slave is cleared 0, the received error flag is cleared 0, and the received data success flag is cleared 0, so as to ensure the correctness of receiving the next frame of data, thereby improving the reliability of communication.
In the above embodiment, referring to fig. 5, in the process of sending data from the master to the slave, time counting is performed on two byte intervals, and when the time counting is greater than the first preset time length, the received data count of the slave is cleared by 0 and the reception error flag bit is cleared by 0.
Fig. 10 is a schematic structural diagram of an embodiment of a communication device provided in the present invention. As shown in fig. 10, the communication device 100 further includes: a second judgment unit 150 and an initialization setting unit 160.
The second determining unit 150 is configured to determine whether correct data sent by the host is not received for a second preset duration when the device is used as a slave and data sent by the host is received; the correct data specifically comprises correct data conforming to a communication protocol, and whether the received data sent by the host conforms to the communication protocol or not is judged, and the data conforming to the communication protocol is the correct data. The initialization setting unit 160 is configured to perform initialization setting on communication if correct data sent by the host is not received for a second preset duration. Specifically, the initialization setting unit 160 performs initialization setting for communication of the device belonging as the slave.
The device of the present invention may be specifically adapted to the way of communication between the master and the slave, for example, one master and one slave (see fig. 2), or one master and a plurality of slaves. When the device to which the communication method belongs is used as a slave, the master sends data to the slave at regular time, the slave sends data back to the master after a preset time interval, and when the slave receives the data sent by the master, the second judging unit 150 judges whether correct data sent by the master is not received for a second preset time; if the correct data sent by the host is not received for the second preset duration, which indicates that there is interference, for example, a data error or some unknown error occurs, and the correct data is not received after a certain time interval, the initialization setting unit 160 performs initialization setting on the communication, for example, resetting according to the setting requirements of different chips. Specifically, initializing the communication may specifically include resetting a baud rate (a transmission baud rate and/or a reception baud rate) of the communication; and/or to initialize, i.e. re-enable, the reception and/or transmission of data. Therefore, the communication can be ensured to be self-recovered to normal communication under the abnormal condition.
Fig. 7 is a schematic method diagram of another specific embodiment of the communication method provided by the present invention when the device is used as a slave. As shown in fig. 7, in the process of sending data from the master to the slave, time counting is performed on the time when the slave cannot receive correct data, and if the time counting is greater than a second preset time, the chip is reset according to the communication protocol, for example, the baud rate is set, and data reception is allowed again.
The invention also provides a storage medium corresponding to the communication method, on which a computer program is stored, which program, when being executed by a processor, carries out the steps of any of the methods described above.
The invention also provides an air conditioner corresponding to the communication method, which comprises a processor, a memory and a computer program which is stored on the memory and can run on the processor, wherein the processor executes the program to realize the steps of any one of the methods.
The invention also provides an air conditioner corresponding to the communication device, which comprises any one of the communication devices.
Therefore, the scheme provided by the invention updates the data only when the data is ready to be transmitted when the master transmits the data to the slave, processes the received data count, the receiving error flag bit and the like of the slave when the data transmission of the master is finished, processes the received data count, the receiving error flag and the like of the slave when the interval between two data received by the slave is greater than the first preset time, and initializes the baud rate and the like of communication when the slave does not receive correct data for a period of time, so that the communication can be recovered even if the communication in one frame of data is lost and the next frame of data, and the aim of improving the reliability of the communication is fulfilled. The invention processes the communication data, can automatically recover correct communication after being interfered or having errors in certain conditions, has simple implementation and wide application range, and is applied to practical engineering, such as the communication between an air conditioner internal unit and an external unit, the communication between the air conditioner and WIFI, and the communication between a main board and a display board of the air conditioner internal unit, thereby achieving the effect of reliable communication.
The functions described herein may be implemented in hardware, software executed by a processor, firmware, or any combination thereof. If implemented in software executed by a processor, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Other examples and implementations are within the scope and spirit of the invention and the following claims. For example, due to the nature of software, the functions described above may be implemented using software executed by a processor, hardware, firmware, hardwired, or a combination of any of these. In addition, each functional unit may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units may be a logical division, and in actual implementation, there may be another division, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and the parts serving as the control device may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The above description is only an example of the present invention, and is not intended to limit the present invention, and it is obvious to those skilled in the art that various modifications and variations can be made in the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the claims of the present invention.

Claims (9)

1. A method of communication, comprising:
when the device serves as a master, updating data to be sent to a slave before sending the data to the slave;
after the data is sent to the slave, clearing a received data count, a received error flag bit and/or a received data success flag bit of the data returned by the slave;
when the device is used as a slave and receives data sent by a host, judging whether the receiving time interval of two adjacent bytes is greater than a first preset time length;
if the receiving time interval of two adjacent bytes is greater than the first preset time length, clearing a received data count, a receiving error flag bit and/or a receiving success flag bit of the data sent by the host;
when the device is used as a slave and receives data sent by a host, judging whether correct data sent by the host is not received continuously for a second preset time length;
and if the correct data sent by the host computer is not received in the continuous second preset time, initializing the communication.
2. The method of claim 1, wherein updating the data to be sent to the slave comprises:
and setting the data of the slave to be sent to a value.
3. The method of claim 1, wherein initializing a communication comprises:
resetting the baud rate of communication; and/or the presence of a gas in the gas,
the permission to receive and/or transmit data is initialized.
4. A communication device, comprising:
the updating unit is used for updating data to be sent to the slave before sending the data to the slave when the equipment serves as a master;
the first processing unit is used for counting the received data, receiving an error flag bit and/or clearing a received data success flag bit of the data returned by the slave after the data is sent to the slave;
the first judging unit is used for judging whether the receiving time interval of two adjacent bytes is greater than a first preset time length when the equipment serves as a slave and receives data sent by a host;
a second processing unit, configured to, if the receiving time interval between two adjacent bytes is greater than the first preset duration, zero-clear a received data count, a receiving error flag and/or a receiving success flag of the data sent by the host
The second judging unit is used for judging whether correct data sent by the host are not received continuously for a second preset time length when the equipment serves as a slave and data sent by the host are received;
and the initialization setting unit is used for initializing and setting communication if correct data sent by the host computer are not received for the second preset duration.
5. The apparatus of claim 4, wherein the updating unit updates the data to be sent to the slave, and comprises:
and setting the data of the slave to be sent to a value.
6. The apparatus of claim 4, wherein the initialization setting unit performs initialization setting on communication, and comprises:
resetting the baud rate of communication; and/or the presence of a gas in the gas,
the permission to receive and/or transmit data is initialized.
7. A storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 3.
8. An air conditioner comprising a processor, a memory, and a computer program stored on the memory and operable on the processor, the processor implementing the steps of the method of any one of claims 1-3 when executing the program.
9. An air conditioner characterized by comprising the communication device according to any one of claims 4 to 6.
CN201811386359.1A 2018-11-20 2018-11-20 Communication method, communication device, storage medium and air conditioner Active CN109506337B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811386359.1A CN109506337B (en) 2018-11-20 2018-11-20 Communication method, communication device, storage medium and air conditioner

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811386359.1A CN109506337B (en) 2018-11-20 2018-11-20 Communication method, communication device, storage medium and air conditioner

Publications (2)

Publication Number Publication Date
CN109506337A CN109506337A (en) 2019-03-22
CN109506337B true CN109506337B (en) 2020-06-30

Family

ID=65749325

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811386359.1A Active CN109506337B (en) 2018-11-20 2018-11-20 Communication method, communication device, storage medium and air conditioner

Country Status (1)

Country Link
CN (1) CN109506337B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102005034944B3 (en) * 2005-07-22 2006-11-09 Siemens Ag Field bus system e.g. LIN bus system, configuration method for use in e.g. motor vehicle, involves checking whether bus subscriber still has standard address, and identifying subscriber and assigning clear subscriber address to subscriber
FR2900009B1 (en) * 2006-04-14 2008-06-20 Thales Sa METHOD AND DEVICE FOR ANTI-INTERFERENCE CONTROL IN A TELECOMMUNICATIONS SYSTEM
CN202455033U (en) * 2011-12-24 2012-09-26 天津光电通信技术有限公司 System for controlling power supplies by digital means
CN105718396B (en) * 2016-01-21 2018-05-29 哈尔滨理工大学 A kind of I of big data master transmissions2C bus units and its means of communication
CN106209496A (en) * 2016-06-23 2016-12-07 珠海格力电器股份有限公司 Communication abnormity detection device and method

Also Published As

Publication number Publication date
CN109506337A (en) 2019-03-22

Similar Documents

Publication Publication Date Title
CN102546784B (en) Method for conducting batch upgrading for device firmware based on controller area network (CAN) bus
EP3675398B1 (en) Check code processing method, electronic device, and storage medium
CN100365994C (en) Method and system for regulating ethernet
CN105916100B (en) Method, device and communication system for acting heartbeat packet
US10932159B2 (en) Data transmission method, data receiving device, and data sending device
CN111200811A (en) TWS earphone, upgrading method and device thereof and readable storage medium
CN106850241A (en) A kind of vehicle-mounted OBD terminals and its remote upgrade method
CN101593119A (en) A kind of aerial firmware upgrade method of flash memory unit equipment and device monopolized
CN105450469A (en) Method for detecting faults of rapid communication bus in industrial equipment
CN102185754A (en) Method for upgrading board card in switch system
US20170280410A1 (en) Method, device and system for implementing information self-registration, and computer storage medium
CN101022473B (en) Method for automatic, identifying plate card configration and generating local data in exchanger
KR20200134236A (en) Data transmission method and device
CN103401956A (en) Address assigning method, data transmission method, indoor unit, outdoor unit and air-conditioning system
CN108958781B (en) Remote embedded firmware online upgrading method
CN109506337B (en) Communication method, communication device, storage medium and air conditioner
CN112615700B (en) Data sending method, gateway, system, electronic equipment and readable storage medium
WO2017049557A1 (en) Adapter upgrade method, mobile terminal, and adapter
CN108933706B (en) Method, device and system for monitoring data traffic
CN101136756B (en) Electric self-checking method, system and BMC chip on network long-range control host machine
CN103746842A (en) Method and system for detecting fault restarting of line card
EP2515601B1 (en) Dial-up connection method and device of mobile data terminal
WO2009147066A4 (en) Synchronizing device error information among nodes
CN101594674B (en) Information interaction method used for wireless access network information management
CN111654451A (en) Message anti-replay method and electronic equipment

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