CN111078615A - Compatible control system and method for serial port communication - Google Patents
Compatible control system and method for serial port communication Download PDFInfo
- Publication number
- CN111078615A CN111078615A CN201911333265.2A CN201911333265A CN111078615A CN 111078615 A CN111078615 A CN 111078615A CN 201911333265 A CN201911333265 A CN 201911333265A CN 111078615 A CN111078615 A CN 111078615A
- Authority
- CN
- China
- Prior art keywords
- communication
- software
- compatible
- serial port
- communication quality
- 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.)
- Granted
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/42—Bus transfer protocol, e.g. handshake; Synchronisation
- G06F13/4282—Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F13/00—Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
- G06F13/38—Information transfer, e.g. on bus
- G06F13/382—Information transfer, e.g. on bus using universal interface adapter
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Communication Control (AREA)
Abstract
The invention discloses a compatible control system and a method for serial communication. The method comprises the following steps: firstly, writing codes and packaging the codes into a complete software module; and then the software module is embedded into the communication process of the computer software by using a software development method to call and run. The interface of the module of the invention is completely compatible with the serial communication interface of the computer operating system, can be quickly added into computer software, does not need to modify the communication code of user software too much, effectively reduces the complexity of the system and improves the development efficiency, simply and efficiently improves the communication quality of the software in a severe environment through the communication quality monitoring unit and the compatible communication control unit, and reliably and efficiently improves the communication quality of the software by utilizing the error frequency and retry mechanism of software communication and the serial communication interface of the computer operating system.
Description
Technical Field
The invention relates to the technical field of computers, in particular to a compatible control system and a compatible control method for serial port communication.
Background
Serial communication refers to a communication mode in which data is transmitted bit by bit on a signal line by bit using a serial communication protocol.
In serial communication, data is transmitted over a single line having a bit width of 1, and data of one byte is divided into 8 times and sequentially transmitted one bit by one bit from a lower bit to a higher bit. The data communicated serially is transmitted bit by bit, and each bit sent by a sending party has a fixed time interval, so that the receiving party is required to receive each bit according to the same time interval of the sending party. Furthermore, the receiver must be able to determine the start and end of a group of messages.
In serial communication, limited by internal software and hardware of a sender, one or more bytes of a message group containing a plurality of bytes may be interrupted, and in a serial communication interface of a computer operating system, the message group is interrupted and identified as two or more message groups, so that communication errors are caused.
Disclosure of Invention
The invention aims to provide a compatible control system and a compatible control method for serial communication, which can efficiently and accurately identify abnormal intervals in an information group by using a software control method so as to solve the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme: a compatible control system for serial communication comprises a communication quality monitoring unit, a compatible communication control unit and a universal serial communication unit, wherein the three units are packaged into a complete software module for being called by other computer software.
The communication quality monitoring unit generates a communication quality index by monitoring the number of errors of software communication;
the compatible communication control unit carries out serial communication by calling the universal serial communication unit, and improves the communication reliability by using a receiving retry mechanism when the communication quality index is lower, thereby ensuring that data can be correctly and completely received in the serial communication;
and the universal serial port communication unit is used for carrying out data communication by calling a serial port communication interface of the computer operating system.
A control method of a compatible control system adopting the serial port communication comprises the following steps:
step 1: starting, judging whether the communication error frequency is changed, if so, recalculating the communication quality index, and continuing; if not, continuing;
step 2: judging whether the communication quality index is lower, if so, starting a retry mechanism, and continuing, and if not, continuing;
step 3, executing standard serial port communication, then finishing, writing into codes and packaging into a complete software module;
and 4, embedding the packaged software module into the communication process of the computer software by using a software development method to call and operate.
Preferably, the key of writing the code of the software module in the step 3 is to monitor the number of communication errors during the software communication to generate a communication quality index, and add a reception retry mechanism when the communication quality index is low, if the reception retry mechanism retries the reception of the data, add the data to the buffer and continue to attempt the reception of the communication, and if the reception fails, return the received data.
Compared with the prior art, the invention has the beneficial effects that:
1. the invention generates the communication quality index by monitoring the error times of communication, and the compatible communication control unit adds a receiving retry mechanism when the communication quality index is lower, and retries the receiving within the appointed time to be compatible with the possible abnormal interval in the information group, thereby efficiently and accurately ensuring the normal data receiving. The interface of the module is completely compatible with the serial port communication interface of the computer operating system, can be quickly added into computer software, does not need to modify the communication code of user software too much, effectively reduces the complexity of the system and improves the development efficiency, and simply and efficiently improves the communication quality of the software in severe environment through the communication quality monitoring unit and the compatible communication control unit;
2. the invention utilizes the error times and retry mechanism of software communication and the serial port communication interface of the computer operating system to reliably and efficiently improve the software communication quality.
Drawings
FIG. 1 is a system block diagram of a compatible control system for serial communication according to the present invention;
fig. 2 is a flowchart of a compatible control method for serial communication according to the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be 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 of the embodiments. 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.
Referring to fig. 1, the present invention provides a technical solution: a compatible control system for serial communication comprises a communication quality monitoring unit (1), a compatible communication control unit (2) and a universal serial communication unit (3), wherein the three units are packaged into a complete software module for being called by other computer software.
The communication quality monitoring unit (1) generates a communication quality index by monitoring the number of errors of software communication;
the compatible communication control unit (2) carries out serial communication by calling the universal serial communication unit, and improves the communication reliability by using a receiving retry mechanism when the communication quality index is lower, thereby ensuring that data can be correctly and completely received in the serial communication;
and the universal serial port communication unit (3) is used for carrying out data communication by calling a serial port communication interface of a computer operating system.
Referring to fig. 2, a control method of a compatible control system using the serial port communication includes the following steps:
step 1: starting, judging whether the communication error frequency is changed, if so, recalculating the communication quality index, and continuing; if not, continuing;
step 2: judging whether the communication quality index is lower, if so, starting a retry mechanism, and continuing, and if not, continuing;
step 3, executing standard serial port communication, then finishing, writing into codes and packaging into a complete software module; the key point of writing the code is that the number of communication errors is monitored in the software communication process to generate a communication quality index, a receiving retry mechanism is added when the communication quality index is low, if the data is retried to be received, the data is added into a cache and the communication is continuously tried to be received, and if the data is not received, the received data is returned;
and 4, embedding the packaged software module into the communication process of the computer software by using a software development method to call and operate. The communication quality of the software under severe environment is simply and efficiently improved through the communication quality monitoring unit and the universal serial port communication unit, the software can be quickly added into computer software, excessive modification on communication codes of user software is not needed, the system complexity is effectively reduced, and the development efficiency is improved.
The working principle of the invention is as follows: three units are packaged into a module and are embedded into the communication process of computer software to be called and run; a communication quality monitoring unit (1) that generates a communication quality index by monitoring the number of errors in software communication; the compatible communication control unit (2) is used for carrying out serial communication by calling the universal serial communication unit, and a receiving retry mechanism is used when the communication quality index is low so as to improve the communication reliability and ensure that data can be correctly and completely received in the serial communication; and the universal serial port communication unit (3) is used for carrying out data communication by calling a serial port communication interface of the computer operating system.
The invention generates the communication quality index by monitoring the error times of communication, and the compatible communication control unit adds a receiving retry mechanism when the communication quality index is lower, and retries the receiving within the appointed time to be compatible with the possible abnormal interval in the information group, thereby efficiently and accurately ensuring the normal data receiving. The interface of the module is completely compatible with the serial port communication interface of the computer operating system, can be quickly added into computer software, does not need to modify the communication code of user software too much, effectively reduces the complexity of the system and improves the development efficiency, and simply and efficiently improves the communication quality of the software in severe environment through the communication quality monitoring unit and the compatible communication control unit; the invention utilizes the error times and retry mechanism of software communication and the serial port communication interface of the computer operating system to reliably and efficiently improve the software communication quality.
In the description of the present invention, it is to be understood that the terms "coaxial", "bottom", "one end", "top", "middle", "other end", "upper", "one side", "top", "inner", "front", "center", "both ends", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are only for convenience of description and simplicity of description, and do not indicate or imply that the referenced device or element 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.
In the present invention, unless otherwise expressly specified or limited, the terms "mounted," "disposed," "connected," "secured," "screwed" and the like are to be construed broadly, e.g., as meaning fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; the terms may be directly connected or indirectly connected through an intermediate, and may be communication between two elements or interaction relationship between two elements, unless otherwise specifically limited, and the specific meaning of the terms in the present invention will be understood by those skilled in the art according to specific situations.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.
Claims (3)
1. A compatible control system of serial port communication is characterized in that: the system comprises a communication quality monitoring unit (1), a compatible communication control unit (2) and a universal serial port communication unit (3), wherein the three units are packaged into a complete software module for being called by other computer software.
The communication quality monitoring unit (1) generates a communication quality index by monitoring the number of errors of software communication;
the compatible communication control unit (2) carries out serial communication by calling the universal serial communication unit, and improves the communication reliability by using a receiving retry mechanism when the communication quality index is lower, thereby ensuring that data can be correctly and completely received in the serial communication;
and the universal serial port communication unit (3) is used for carrying out data communication by calling a serial port communication interface of a computer operating system.
2. A control method of a compatible control system adopting the serial port communication of claim 1, characterized in that: the method comprises the following steps:
step 1: starting, judging whether the communication error frequency is changed, if so, recalculating the communication quality index, and continuing; if not, continuing;
step 2: judging whether the communication quality index is lower, if so, starting a retry mechanism, and continuing, and if not, continuing;
step 3, executing standard serial port communication, then finishing, writing into codes and packaging into a complete software module;
and 4, embedding the packaged software module into the communication process of the computer software by using a software development method to call and operate.
3. The compatible control method for serial port communication according to claim 1, characterized in that: the key point of writing the code of the software module in the step 3 is to monitor the number of communication errors in the software communication process to generate a communication quality index, and add a receiving retry mechanism when the communication quality index is low, if the data is retried to be received, add the data into a cache and continue to try to receive the communication, and if the data is not received, return the received data.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911333265.2A CN111078615B (en) | 2019-12-23 | 2019-12-23 | Compatible control system and method for serial port communication |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911333265.2A CN111078615B (en) | 2019-12-23 | 2019-12-23 | Compatible control system and method for serial port communication |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111078615A true CN111078615A (en) | 2020-04-28 |
CN111078615B CN111078615B (en) | 2023-04-14 |
Family
ID=70316685
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911333265.2A Active CN111078615B (en) | 2019-12-23 | 2019-12-23 | Compatible control system and method for serial port communication |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111078615B (en) |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1791103A (en) * | 2005-10-20 | 2006-06-21 | 上海电器科学研究所(集团)有限公司 | Field bus communication adapter with configurable characteristic |
JP2009009211A (en) * | 2007-06-26 | 2009-01-15 | Sony Corp | Communication system, communication apparatus, its control method and computer program |
CN102571292A (en) * | 2012-02-29 | 2012-07-11 | 浙江中控研究院有限公司 | Communication maintenance scheme matching method, link monitor and wireless sensor network |
EP2544097A1 (en) * | 2011-07-06 | 2013-01-09 | Vetco Gray Controls Limited | Interfacing communications |
CN107273327A (en) * | 2017-05-11 | 2017-10-20 | 建荣半导体(深圳)有限公司 | Variable bit rate serial communication method, device, communication chip, storage device and system |
CN110008167A (en) * | 2019-03-26 | 2019-07-12 | 山东超越数控电子股份有限公司 | A kind of method of adjust automatically serial ports output mode |
CN110502467A (en) * | 2019-07-25 | 2019-11-26 | 江苏诺蓝翌新能源科技有限公司 | A kind of general acquisition interface software systems based on serial ports modbus communication protocol |
-
2019
- 2019-12-23 CN CN201911333265.2A patent/CN111078615B/en active Active
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1791103A (en) * | 2005-10-20 | 2006-06-21 | 上海电器科学研究所(集团)有限公司 | Field bus communication adapter with configurable characteristic |
JP2009009211A (en) * | 2007-06-26 | 2009-01-15 | Sony Corp | Communication system, communication apparatus, its control method and computer program |
EP2544097A1 (en) * | 2011-07-06 | 2013-01-09 | Vetco Gray Controls Limited | Interfacing communications |
CN102571292A (en) * | 2012-02-29 | 2012-07-11 | 浙江中控研究院有限公司 | Communication maintenance scheme matching method, link monitor and wireless sensor network |
CN107273327A (en) * | 2017-05-11 | 2017-10-20 | 建荣半导体(深圳)有限公司 | Variable bit rate serial communication method, device, communication chip, storage device and system |
CN110008167A (en) * | 2019-03-26 | 2019-07-12 | 山东超越数控电子股份有限公司 | A kind of method of adjust automatically serial ports output mode |
CN110502467A (en) * | 2019-07-25 | 2019-11-26 | 江苏诺蓝翌新能源科技有限公司 | A kind of general acquisition interface software systems based on serial ports modbus communication protocol |
Also Published As
Publication number | Publication date |
---|---|
CN111078615B (en) | 2023-04-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CA1243730A (en) | Wireless computer modem | |
US6687766B1 (en) | Method and apparatus for a fibre channel control unit to execute search commands locally | |
CN100366029C (en) | Communication controller, host-side controller, communication equipment, communication system and method | |
EP3675398B1 (en) | Check code processing method, electronic device, and storage medium | |
EP0464014A2 (en) | Communications systems using a fault tolerant protocol | |
US6240446B1 (en) | Multiplexing of multiple data packets for multiple input/output operations between multiple input/output devices and a channel subsystem having multiple channels | |
CN101022473B (en) | Method for automatic, identifying plate card configration and generating local data in exchanger | |
CN103229444A (en) | Coding/decoding method, device and system | |
US7436777B2 (en) | Failed link training | |
CN113645600A (en) | Data transmission method, device, terminal and storage medium | |
CN102998994B (en) | Embedded blood analyzer control system and control method thereof | |
CN111078615B (en) | Compatible control system and method for serial port communication | |
US20050160328A1 (en) | Corrupt data | |
US20050152435A1 (en) | Encoded data | |
CN105634894A (en) | Enhanced type CAN bus data resending method and device | |
US20050152386A1 (en) | Successful transactions | |
CN115567368A (en) | SerDes problem detection method, device and medium | |
JPS6072351A (en) | Method for supervising operating condition of packet communication system | |
EP3319249A1 (en) | Transmission checking method, node, system and computer storage medium | |
US7613958B2 (en) | Error detection in a system having coupled channels | |
US7334040B2 (en) | Method of transmission between two processors of a radio communication unit | |
US20050152268A1 (en) | Link failures | |
JP2001043324A (en) | Ic card connection device | |
CN1770132A (en) | Connector between processor and user recognition card | |
US7620871B2 (en) | Method and measuring device for determining an error rate without incremental redundancy |
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 |