Data transmission method and device
By identifying the serial communication protocol type and automatically configuring parameters, the problem of complex serial communication configuration is solved, improving the efficiency and stability of data transmission and simplifying user operation.
Patent Information
- Application Number
- CN202410880518.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-02
- Publication Date
- 2024-11-26
AI Technical Summary
The configuration of serial communication for different devices and application systems is complex and cumbersome, making it difficult to quickly adapt to different devices and application systems.
By identifying the serial communication protocol type, the system automatically configures serial communication parameters, including parity bit, data bits, baud rate, etc., to enable data transmission between devices.
It simplifies the user configuration process, improves the efficiency and stability of data transmission, lowers the barrier to entry, and reduces data transmission latency and packet loss rate.
Smart Images

Figure CN119025459A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of serial communication technology, and in particular, relates to a data transmission method and device. Background Art
[0002] Serial communication refers to a communication method between peripherals and computers that transmits data bit by bit through data signal lines, ground lines, control lines, etc. This communication method uses fewer data lines and can save communication costs in long-distance communications. With the development of industrial automation and communication technology, serial communication is required in many application scenarios. However, different devices and application systems may require different parameter configurations, which makes the configuration of serial communication complicated and cumbersome. Therefore, how to quickly configure serial communication parameters to adapt to different devices and application systems has become a technical problem that needs to be solved urgently. Summary of the invention
[0003] The embodiments of the present application provide a data transmission method and apparatus, which can solve the problem of how to quickly configure serial port communication parameters to adapt to different devices and application systems.
[0004] In a first aspect, an embodiment of the present application provides a data transmission method, including:
[0005] Identify the serial communication protocol type of the current device;
[0006] According to the serial port protocol type, configure serial port communication parameters;
[0007] Data transmission between devices is performed according to the serial port communication parameters.
[0008] In a possible implementation, identifying the serial port communication protocol type of the current device includes:
[0009] Identify the serial communication protocol type of the current device based on the interface signal level value.
[0010] In a possible implementation, the serial port communication parameter includes a check bit, and configuring the serial port communication parameter according to the serial port protocol type includes configuring the check bit according to the serial port protocol type.
[0011] In a possible implementation manner, the serial port communication parameter includes: a data bit, and configuring the serial port communication parameter according to the serial port protocol type includes: configuring the data bit according to the serial port protocol type.
[0012] In a possible implementation, the serial port communication parameters include: baud rate, and configuring the serial port communication parameters according to the serial port protocol type includes: configuring the baud rate according to the serial port protocol type.
[0013] In a second aspect, an embodiment of the present application provides a data transmission device, including:
[0014] Protocol identification module, used to identify the serial communication protocol type of the current device;
[0015] A configuration module, used to configure serial port communication parameters according to the serial port protocol type;
[0016] The data transmission module is used to perform data transmission between devices according to the serial port communication parameters.
[0017] In a possible implementation, the data transmission device further includes:
[0018] The user interface module is used to manage the serial communication protocol type of the current device, the serial communication parameter configuration results, and the control instructions for adding parameter configuration.
[0019] In a possible implementation, the data transmission device further includes:
[0020] The remote control module configures the serial port communication parameters and data transmission of the remote control device according to the control instructions added by the user interface module.
[0021] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described above when executing the computer program.
[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method as described above is implemented.
[0023] Beneficial effects of this application
[0024] The present application provides a data transmission method, apparatus, terminal device and storage medium, which can automatically configure serial communication parameters and perform data transmission between devices by identifying the serial port protocol type. The data transmission method provided by the present application can automatically identify and adapt to different serial port communication protocol types, automatically configure corresponding serial port communication parameters, and improve the efficiency and stability of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0026] Figure 1 It is a flowchart of a data transmission method provided by an embodiment of the present application;
[0027] Figure 2 is a schematic diagram of the structure of a data transmission device provided in an embodiment of the present application;
[0028] Figure 3 It is a structural diagram of the terminal device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0030] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0031] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0032] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0033] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0034] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0035] Serial communication refers to a communication method between peripherals and computers that transmits data bit by bit through data signal lines, ground lines, control lines, etc. This communication method uses fewer data lines and can save communication costs in long-distance communications. With the development of industrial automation and communication technology, serial communication is required in many application scenarios. However, different devices and application systems may require different parameter configurations, which makes the configuration of serial communication complicated and cumbersome. Therefore, how to quickly configure serial communication parameters to adapt to different devices and application systems has become a technical problem that needs to be solved urgently.
[0036] The present application provides a data transmission method, apparatus, terminal device and storage medium, which can automatically configure serial communication parameters and perform data transmission between devices by identifying the serial port protocol type. The data transmission method provided by the present application can automatically identify and adapt to different serial port communication protocol types, automatically configure corresponding serial port communication parameters, and improve the efficiency and stability of data transmission.
[0037] In order to illustrate the technical solution of the present application, specific embodiments are provided below.
[0038] See also Figure 1 The process of an embodiment of the data transmission method shown, as an example but not a limitation, includes the following steps:
[0039] Step S100: Identify the serial port communication protocol type of the current device;
[0040] Step S200: configuring serial port communication parameters according to the serial port protocol type;
[0041] Step S300: performing data transmission between devices according to the serial port communication parameters.
[0042] It should be noted that there are many serial communication protocols, such as RS-232, RS-422, RS-485, etc. Each protocol has its own specific electrical characteristics and data transmission methods. Before starting data transmission, the system needs to identify the type of serial communication protocol used by the current device to ensure the correctness of subsequent configuration.
[0043] Furthermore, it is necessary to configure the serial communication parameters according to the serial protocol type determined in step S100. The serial communication parameters generally include baud rate (data transmission rate), data bits (number of bits per character), stop bits (idle time between characters), check bits (used to detect errors in data transmission), etc. The above parameters need to be configured according to the identified serial communication protocol type to ensure that the sender and receiver can correctly parse and transmit data.
[0044] Once the serial communication parameters are configured, the sender can convert the data into a specific electrical signal according to these parameters and send it to the receiver through the serial port. The receiver will parse the received electrical signal according to the same parameter configuration and restore it to the original data.
[0045] By using the data transmission method provided by the present application, by configuring the communication parameters according to a specific serial communication protocol type, it is possible to ensure that the data transmission format between the sender and the receiver is consistent, thereby reducing errors in data transmission and improving the accuracy of data transmission. In addition, by automatically identifying the serial communication protocol type and automatically configuring the communication parameters, the present application can greatly simplify the user's configuration process and lower the threshold for use. In addition, the present application can configure appropriate parameters such as baud rate according to actual needs, which can optimize data transmission efficiency, reduce data transmission delays and packet loss rates, and improve the stability and reliability of data transmission.
[0046] In a possible implementation, identifying the serial port communication protocol type of the current device includes:
[0047] Identify the serial communication protocol type of the current device based on the interface signal level value.
[0048] It should be noted that different serial communication protocols specify different interface level values. In the RS-232 protocol, the level range of logic "1" is usually -15V to -3V, and the level range of logic "0" is usually +3V to +15V. In the RS-485 protocol, the level range of logic "1" is usually +2V to +6V, and the level range of logic "0" is usually -6V to -2V. Therefore, the type of serial communication protocol of the current device can be determined based on the level value of the interface.
[0049] In some embodiments, in addition to the level value, the physical form of the interface (such as a D-type 9-pin plug, a 4-pin DuPont plug, etc.), pin configuration (such as RXD, TXD, GND, etc.) and other specification information of the device can also be considered to assist in identifying the serial port communication protocol type.
[0050] In a possible implementation, the serial port communication parameter includes a check bit, and configuring the serial port communication parameter according to the serial port protocol type includes configuring the check bit according to the serial port protocol type.
[0051] It should be noted that the check bit is a component of the data frame and is used to verify the integrity of the data. Through the check bit, the receiving end can detect whether an error occurs during the data transmission process. Different check bits need to be configured for different serial port protocol types.
[0052] Exemplarily, for the RS-232 protocol, the parity bit can be selected as even parity, odd parity, space, etc., or no parity can be used. Odd parity requires that the total number of 1s in the data bits and parity bits is an odd number, while even parity requires that the total number of 1s is an even number. During configuration, it is necessary to specify whether to use the parity bit, and to select odd parity or even parity. Specifically, if you want to set it to even parity, you must first set the PARENB flag in c_cflag in the termios structure and clear the PARODD flag. If you want to set odd parity, you must also set the PARENB flag and the PARODD flag in c_cflag in the termios structure. If you do not want to use any parity, clear the PARENB bit in c_cflag in the termios structure.
[0053] The RS-485 protocol does not directly specify the use of the check bit, but relies on its upper-layer communication protocol (such as Modbus) to define the data format and check method. Therefore, it is necessary to refer to the specific upper-layer protocol document to determine how to configure the check bit.
[0054] Specifically, the Modbus protocol has two main transmission modes - ASCII and RTU. These two modes differ in data encoding and transmission methods. Modbus ASCII uses ASCII characters for data transmission, and each byte is represented by two ASCII characters. Modbus RTU uses binary encoding for data transmission, and each byte is represented by 8 binary bits. The Modbus frame usually includes a start character, a device address, a function code, a data field, a checksum (or CRC check), and an end character (in RTU mode).
[0055] Although RS-485 does not directly support parity checking, the upper layer Modbus protocol or other protocols may choose to use parity checking as an additional verification mechanism. The more commonly used verification mechanism is CRC (cyclic redundancy check code). In Modbus RTU mode, the data frame usually contains a CRC check field to verify the integrity of the frame data. CRC check is the most commonly used error checking code in the field of data communication. A check value is generated by polynomial calculation and appended to the end of the data frame. The receiver also performs a similar calculation to verify whether the received data matches the sent data. In addition, a checksum may be used as a means of verifying data integrity. The checksum is generated by adding the values of all bytes in the frame (or performing other mathematical operations) and verified at the receiving end.
[0056] It is understandable that the RS-485 protocol itself does not specify the data format and verification method, but relies on its upper-layer communication protocol (such as Modbus) to define these details. When using RS-485 for communication, it is necessary to understand and follow the specifications and requirements of the upper-layer communication protocol used.
[0057] In a possible implementation manner, the serial port communication parameter includes: a data bit, and configuring the serial port communication parameter according to the serial port protocol type includes: configuring the data bit according to the serial port protocol type.
[0058] It should be noted that data bits are an important parameter that determines the number of bits actually transmitted in each data byte. When configuring the data bits in the serial communication parameters, different serial communication protocols and application scenarios require different data bit settings.
[0059] For the RS-232 protocol, there are usually 5, 6, 7, and 8 data bits. 5-bit data bits provide lower data transmission accuracy and are suitable for some specific scenarios. 6-bit data bits are usually less used and have relatively low data transmission capacity. 7-bit data bits are suitable for some special application scenarios and have higher transmission efficiency. 8-bit data bits are the most commonly used data bit setting, providing higher transmission accuracy and stability. The RS-485 protocol is a physical layer and data link layer standard that does not directly specify the number of data bits. However, commonly used RS-485 devices support common data bit settings, such as 7 or 8 bits. The specific settings depend on the upper-layer communication protocol (such as Modbus) or application requirements.
[0060] It should be noted that when configuring the data bit, you also need to consider other serial communication parameters, such as parity (odd, even or no parity), stop bit (1 bit, 1.5 bits or 2 bits) and baud rate (data transmission rate). Make sure that the serial communication parameters of the sender and receiver are set to be consistent to ensure correct data transmission.
[0061] For example, in a system using RS-232 protocol for communication, if data transmission is required to have higher accuracy and stability, the data bits can be set to 8 bits, the check bit can be set to even check or no check, and the stop bit can be set to 1 bit.
[0062] In a possible implementation, the serial port communication parameters include: baud rate, and configuring the serial port communication parameters according to the serial port protocol type includes: configuring the baud rate according to the serial port protocol type.
[0063] It should be noted that when configuring the baud rate of serial communication, it is necessary to determine it according to the serial communication protocol type of the current device. Different serial communication protocols may support different baud rate ranges. For RS-232 protocol, common baud rates include 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200, etc. Among them, 1200 and 2400 baud rates are usually used for modems, while higher baud rates are often used for serial communication. For RS-485 protocol, it does not directly specify the baud rate itself, but generally the baud rate range it supports is similar to RS-232.
[0064] In addition, when configuring the baud rate, factors such as data transmission speed, device compatibility, and communication quality need to be considered. Specifically, if high-speed transmission is required, a higher baud rate can be selected; conversely, if low-speed transmission is required, a lower baud rate can be selected. In addition, for some devices, there may be restrictions on a specific baud rate range. Therefore, when selecting the baud rate, it is necessary to consult the device's specification manual or contact the manufacturer to confirm whether the device supports the required baud rate range. In addition, the choice of baud rate will also affect the communication quality. Too high a baud rate may cause unstable data transmission or increase the error rate. Therefore, when selecting the baud rate, it is necessary to comprehensively consider the balance between data transmission speed and communication quality.
[0065] The present application also provides a data transmission device 400. Figure 2 ,include:
[0066] The protocol identification module 401 is used to identify the serial communication protocol type of the current device;
[0067] Configuration module 402, configured to configure serial port communication parameters according to the serial port protocol type;
[0068] The data transmission module 403 is used to perform data transmission between devices according to the serial port communication parameters.
[0069] It should be noted that there are many serial communication protocols, such as RS-232, RS-422, RS-485, etc. Each protocol has its own specific electrical characteristics and data transmission mode. Before starting data transmission, the protocol identification module 401 needs to identify the type of serial communication protocol used by the current device to ensure the correctness of subsequent configuration.
[0070] Further, according to the serial port protocol type determined by the protocol identification module 401, the configuration module 402 configures the serial port communication parameters. The serial port communication parameters generally include baud rate (data transmission rate), data bits (number of bits per character), stop bits (idle time between characters), check bits (used to detect errors in data transmission), etc. The above parameters need to be configured according to the identified serial port communication protocol type to ensure that the sender and receiver can correctly parse and transmit data.
[0071] Once the serial communication parameters are configured, the data transmission module 403 can convert the data into specific electrical signals according to these parameters and transmit the data through the serial port. In some possible embodiments, the data transmission module 403 can also monitor the state and abnormal conditions of data transmission in real time and handle them in time.
[0072] By using the data transmission device 400 provided by the present application, by configuring the communication parameters according to a specific serial communication protocol type, it is possible to ensure that the data transmission format between the sender and the receiver is consistent, thereby reducing errors in data transmission and improving the accuracy of data transmission. In addition, the present application can greatly simplify the user's configuration process and lower the threshold for use by automatically identifying the serial communication protocol type and automatically configuring the communication parameters. In addition, the present application can configure appropriate parameters such as baud rate according to actual needs, which can optimize data transmission efficiency, reduce data transmission delays and packet loss rates, and improve the stability and reliability of data transmission.
[0073] In a possible implementation, the data transmission device 400 further includes:
[0074] The user interface module 404 is used to manage the serial communication protocol type of the current device, the serial communication parameter configuration results, and the control instructions for adding parameter configuration.
[0075] It should be noted that the user interface module 404 can intuitively display the serial port communication protocol type and the result of the serial port communication parameter configuration of the current device. It can be known that the configuration module 402 will configure the corresponding communication parameters, such as baud rate, data bit, stop bit, etc., according to the serial port protocol type identified by the protocol identification module 401, and the display function of the user interface module 404 can ensure that the user understands whether these parameters have been correctly configured, thereby avoiding communication failures caused by configuration errors. In addition, the serial port communication parameter configuration results can also be manually adjusted through the user interface module 404 to flexibly adapt to various different needs. In addition, the user interface module 404 also allows the user to send control commands through interface input, such as remote power-on commands, remote power-off commands, and test commands.
[0076] Through the user interface module 404, the user can easily configure the communication parameters without having to deeply understand the complex serial communication protocol and parameter setting details, which greatly reduces the user's operating difficulty and learning cost and improves the efficiency and convenience of data transmission.
[0077] In a possible implementation, the data transmission device 400 further includes:
[0078] The remote control module 405 is used to remotely control the serial port communication parameter configuration and data transmission of the device according to the control instructions added by the user interface module.
[0079] The remote control module 405 can remotely configure and manage the serial port communication parameters of the device according to the instructions received by the user interface module 404. In this way, the manageability and flexibility of the device are improved, and the remote control function is particularly important for devices distributed in multiple locations or difficult to access directly.
[0080] Furthermore, the remote control module 405 can receive user instructions in real time and dynamically adjust the serial port communication parameters and data transmission settings of the device. This real-time and dynamic nature enables the device to adapt to different working environments and requirements, and improves the adaptability and flexibility of the device.
[0081] In addition, the remote control module 405 can be used as an expandable component and customized according to different application scenarios and requirements. For example, new control instructions can be added, new communication protocols can be supported, or new security features can be added. This expandability and customizability makes the data transmission device 400 more flexible and adaptable.
[0082] Figure 3 The terminal device 1000 is a schematic diagram of a terminal device provided in an embodiment of the present application. The terminal device 1000 includes: at least one processor 1001 ( Figure 3Only one processor is shown in the figure), a memory 1002, and a computer program 1003 stored in the memory 1002 and executable on the at least one processor 1001, wherein the processor 1001 implements the steps in the above three method embodiments when executing the computer program 1003.
[0083] The terminal device 1000 may be a computing device such as a desktop computer, a notebook, a PDA, or a cloud server. The terminal device may include, but is not limited to, a processor 1001 and a memory 1002. Those skilled in the art will appreciate that Figure 3 It is only an example of the terminal device 1000 and does not constitute a limitation on the terminal device 1000 , and may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.
[0084] The processor 1001 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.
[0085] In some embodiments, the memory 1002 may be an internal storage unit of the terminal device 1000, such as a hard disk or memory of the terminal device 1000. In other embodiments, the memory 1002 may also be an external storage device of the terminal device 1000, such as a plug-in hard disk, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device 1000. Further, the memory 1002 may also include both an internal storage unit of the terminal device 1000 and an external storage device. The memory 1002 is used to store an operating system, an application program, a boot loader (BootLoader), data and other programs, such as the program code of the computer program, etc. The memory 1002 may also be used to temporarily store data that has been output or is to be output.
[0086] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0087] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned method embodiments can be implemented.
[0088] An embodiment of the present application provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.
[0089] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0090] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0091] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0092] In the embodiments provided in the present application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0093] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0094] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. A data transmission method, It is characterized in that include: Identify the serial communication protocol type of the current device; According to the serial port protocol type, configure serial port communication parameters; Data transmission between devices is performed according to the serial port communication parameters.
2. The data transmission method according to claim 1, It is characterized in that The identification of the serial communication protocol type of the current device includes: Identify the serial communication protocol type of the current device based on the interface signal level value.
3. The data transmission method according to claim 1, It is characterized in that The serial port communication parameters include: a check bit, and configuring the serial port communication parameters according to the serial port protocol type includes: configuring the check bit according to the serial port protocol type.
4. The data transmission method according to claim 1, It is characterized in that The serial port communication parameters include: data bits, and configuring the serial port communication parameters according to the serial port protocol type includes: configuring the data bits according to the serial port protocol type.
5. The data transmission method according to claim 1, It is characterized in that The serial port communication parameters include: baud rate, and configuring the serial port communication parameters according to the serial port protocol type includes: configuring the baud rate according to the serial port protocol type.
6. A data transmission device, It is characterized in that include: Protocol identification module, used to identify the serial communication protocol type of the current device; A configuration module, used to configure serial port communication parameters according to the serial port protocol type; The data transmission module is used to perform data transmission between devices according to the serial port communication parameters.
7. The data transmission device according to claim 6, It is characterized in that Also includes: The user interface module is used to manage the serial communication protocol type of the current device, the serial communication parameter configuration results, and the control instructions for adding parameter configuration.
8. The data transmission device according to claim 6, It is characterized in that Also includes: The remote control module configures the serial port communication parameters and data transmission of the remote control device according to the control instructions added by the user interface module.
9. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, It is characterized in that When the processor executes the computer program, the data transmission method according to any one of claims 1 to 5 is implemented.
10. A computer-readable storage medium storing a computer program. It is characterized in that When the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 5 are implemented.
Citation Information
Cited By
Flow meter communication method and device, computer equipment and storage medium
CN119854390A
