CN117040954A - Data transmission method, electronic equipment and computer readable storage medium - Google Patents

Data transmission method, electronic equipment and computer readable storage medium Download PDF

Info

Publication number
CN117040954A
CN117040954A CN202310412433.7A CN202310412433A CN117040954A CN 117040954 A CN117040954 A CN 117040954A CN 202310412433 A CN202310412433 A CN 202310412433A CN 117040954 A CN117040954 A CN 117040954A
Authority
CN
China
Prior art keywords
data transmission
slave station
station
slave
transmission instruction
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.)
Pending
Application number
CN202310412433.7A
Other languages
Chinese (zh)
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.)
Suzhou Anchi Control System Co ltd
Original Assignee
Suzhou Anchi Control System Co ltd
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 Suzhou Anchi Control System Co ltd filed Critical Suzhou Anchi Control System Co ltd
Priority to CN202310412433.7A priority Critical patent/CN117040954A/en
Publication of CN117040954A publication Critical patent/CN117040954A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L12/40006Architecture of a communication node
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/28Data switching networks characterised by path configuration, e.g. LAN [Local Area Networks] or WAN [Wide Area Networks]
    • H04L12/40Bus networks
    • H04L2012/40208Bus networks characterized by the use of a particular bus standard
    • H04L2012/40215Controller Area Network CAN
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/02Total factory control, e.g. smart factories, flexible manufacturing systems [FMS] or integrated manufacturing systems [IMS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Small-Scale Networks (AREA)

Abstract

The application discloses a data transmission method, an electronic device and a computer readable storage medium, wherein the method is applied to a data transmission system, the system comprises a control device, a gateway and a plurality of slave devices, the control device is integrated with a first master station, the gateway is integrated with a first slave station and a second master station, the first slave station corresponds to the first master station, and each slave device is integrated with a respective second slave station and corresponds to the second master station, and the method comprises the following steps: in response to obtaining at least one data transmission instruction and a corresponding parameter number sent by the first master station, determining a second slave station corresponding to each data transmission instruction based on the parameter number, wherein the parameter number comprises an identification number and an offset address of the second slave station; each data transmission instruction is sent to a second slave station corresponding to the parameter number, and a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction is obtained; and sending the feedback data packet to the control equipment corresponding to the first master station. The method of the application can effectively improve the efficiency of data transmission.

Description

Data transmission method, electronic equipment and computer readable storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a data transmission method, an electronic device, and a computer readable storage medium.
Background
Along with the development of industrial Ethernet technology, multiple industrial buses are derived in the market, different manufacturers can adopt different industrial buses for data transmission, when a plurality of manufacturers commonly design some devices with complex functions, the different industrial buses need to transmit data, in the prior art, a data transmission mode is generally adopted when the data transmission is carried out between the different industrial buses, so that the utilization rate of bus bandwidth is low, and finally, the data transmission efficiency is low. In view of this, how to improve the efficiency of data transmission between industrial buses is a need for solving the problem.
Disclosure of Invention
The application mainly solves the problem of providing a data transmission method, electronic equipment and a computer readable storage medium, which can effectively improve the efficiency of data transmission.
To solve the above-mentioned technical problem, a first aspect of the present application provides a data transmission method applied to a data transmission system, the data transmission system including a control device, a gateway and a plurality of slave devices, the control device being integrated with a first master station, the gateway being integrated with a first slave station and a second master station, the first slave station corresponding to the first master station, each of the slave devices being integrated with a respective second slave station, and the second slave station corresponding to the second master station, the data transmission method comprising: responding to at least one data transmission instruction sent by a first master station and a corresponding parameter number thereof, and determining a second slave station corresponding to each data transmission instruction based on the parameter number; wherein the parameter number includes an identification number and an offset address of the second slave station; each data transmission instruction is sent to a second slave station corresponding to the parameter number, and a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction is obtained; and sending the feedback data packet to the control equipment corresponding to the first master station.
The data transmission instruction includes an input reading instruction, each data transmission instruction is sent to a second slave station corresponding to the parameter number, and a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction is obtained, including: responding to the data transmission instruction as the data reading instruction, and sending the data transmission instruction to a second slave station corresponding to the parameter number, so that the slave equipment corresponding to the second slave station responds to the data reading instruction, and generating a first data packet based on a first parameter corresponding to the offset address; acquiring the first data packet uploaded by the second slave station; the sending the feedback data packet to the control device corresponding to the first master station includes: and taking the first data packet as the feedback data packet and sending the feedback data packet to the control equipment corresponding to the first master station.
The data transmission instruction includes a data writing instruction, the sending each data transmission instruction to a second slave station corresponding to the parameter number, and obtaining a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction includes: responding to the data transmission instruction as the data writing instruction, and sending the data transmission instruction to a second slave station corresponding to the parameter number, so that the slave equipment corresponding to the second slave station responds to the data writing instruction, and writing a second parameter contained in the data writing instruction into the corresponding offset address to obtain a return value; acquiring a second data packet uploaded by the second slave station; wherein the second data packet is generated based on the return value; the sending the feedback data packet to the control device corresponding to the first master station includes: and taking the second data packet as the feedback data packet and sending the feedback data packet to the control equipment corresponding to the first master station.
Wherein, the parameter number corresponding to each second slave station comprises mutually distinguished identification numbers and offset addresses with the same address length; before determining the second slave station corresponding to each data transmission instruction based on the parameter number, the method further comprises: acquiring a first detection result corresponding to the parameter number; responding to the first detection result to be effective, and entering a step of determining a second slave station corresponding to each data transmission instruction based on the parameter number; and generating a first error code and sending the first error code to the control equipment corresponding to the first master station in response to the first detection result being invalid.
Wherein the determining, based on the parameter number, the second slave station corresponding to each data transmission instruction includes: splitting the parameter number based on a preset generation rule of the parameter number to obtain the identification number and the offset address corresponding to the parameter number; and determining the second slave station corresponding to the data transmission instruction based on the identification number obtained through splitting.
The step of sending each data transmission instruction to a second slave station corresponding to the parameter number, and before obtaining the feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction, the step of further comprises: converting the data transmission instruction and the corresponding parameter number thereof from the first slave station to the second master station; splitting the parameter number by using the second master station to obtain the offset address, and sending the offset address to the second slave station corresponding to the split obtained identification number, so as to obtain a second detection result returned by the second slave station; wherein the second detection result comprises valid or invalid, and when the second detection result is invalid, a second error code is corresponding to the second error code; responding to the second detection result to be effective, entering a step of sending each data transmission instruction to a second slave station corresponding to the parameter number, and acquiring a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction; and responding to the second detection result to be invalid, and sending the second error code to the control equipment corresponding to the first master station.
To solve the above-mentioned technical problem, a second aspect of the present application provides a data transmission method applied to a data transmission system, the data transmission system including a control device, a gateway and a plurality of slave devices, the control device being integrated with a first master station, the gateway being integrated with a first slave station and a second master station, the first slave station corresponding to the first master station, each of the slave devices being integrated with a respective second slave station, and the second slave station corresponding to the second master station, the data transmission method comprising: transmitting at least one data transmission instruction and a parameter number corresponding to the data transmission instruction to the gateway, so that the gateway determines a second slave station corresponding to each data transmission instruction based on the parameter number; wherein the parameter number includes an identification number and an offset address of the second slave station; and responding to the feedback data packet uploaded by the gateway after the second slave station responds to the data transmission instruction, and obtaining the feedback data packet.
To solve the above-mentioned technical problem, a third aspect of the present application provides a data transmission method applied to a data transmission system, the data transmission system including a control device, a gateway, and a plurality of slave devices, the control device being integrated with a first master station, the gateway being integrated with a first slave station and a second master station, the first slave station corresponding to the first master station, each of the slave devices being integrated with a respective second slave station, and the second slave station corresponding to the second master station, the data transmission method comprising: and responding to the data transmission instruction sent by the gateway, executing the data transmission instruction, generating a feedback data packet, and sending the feedback data packet to the gateway.
In order to solve the above technical problem, a fourth aspect of the present application provides an electronic device, including: a memory and a processor coupled to each other, wherein the memory stores program data, the processor invoking the program data to perform the method of the first aspect or the second aspect or the third aspect.
In order to solve the technical problems, the application adopts another technical scheme that: there is provided a computer readable storage medium having stored thereon program data which when executed by a processor implements the method of the first or second or third aspect.
The beneficial effects of the application are as follows: the data transmission method is applied to the gateway in the data transmission system, the gateway serves as a transfer station of the system, and data interaction at any time is realized by utilizing the parameter number.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art. Wherein:
FIG. 1 is a flow chart of an embodiment of a data transmission method according to the present application;
FIG. 2 is a schematic diagram of a data transmission system according to an embodiment of the present application;
FIG. 3 is a flow chart of an embodiment of the gateway according to the present application for determining whether the parameter number sent by the control device is valid;
fig. 4 is a flowchart of an embodiment corresponding to step S101 in fig. 1;
FIG. 5 is a flowchart of an embodiment corresponding to the step S102 in FIG. 1;
FIG. 6 is a flow chart of another embodiment of a data transmission method according to the present application;
FIG. 7 is a flow chart of a data transmission method according to another embodiment of the present application;
FIG. 8 is a schematic diagram of an embodiment of an electronic device according to the present application;
fig. 9 is a schematic structural diagram of an embodiment of a computer readable storage medium according to the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present application, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The data transmission method provided by the application is suitable for transmitting data between different buses or different bus protocols, for example, when transmitting data from a PN bus to a CAN bus, the first master station is the PN master station, the first slave station is the PN slave station, the second master station is the CAN master station, and the second slave station is the CAN slave station, so that the application is not particularly limited to buses or bus protocols in practical application. According to the data transmission method provided by the application, data interaction is not needed periodically, and the utilization rate of the bus bandwidth can be improved, so that the data transmission efficiency is effectively improved.
Referring to fig. 1 and 2 together, fig. 1 is a schematic flow chart of an embodiment of a data transmission method according to the present application, fig. 2 is a schematic flow chart of an embodiment of a data transmission system according to the present application, the data transmission method is applied to a data transmission system 10, the data transmission system 10 includes a control device 11, a gateway 12 and a plurality of slave devices 13, the control device 11 is integrated with a first master station 100, the gateway 12 is integrated with a first slave station 102 and a second master station 120, the first slave station 102 corresponds to the first master station 100, each slave device 13 is integrated with a respective second slave station 122, and the second slave station 122 corresponds to the second master station 120, the method uses the gateway 12 as an execution body, and includes:
s101: responding to at least one data transmission instruction and a corresponding parameter number sent by a first master station, and determining a second slave station corresponding to each data transmission instruction based on the parameter number; wherein the parameter number includes an identification number and an offset address of the second secondary station.
Specifically, the method for implementing data transmission in this embodiment uses the parameter number (not identified) to transmit data, because the parameter number includes the identification number and the offset address of the second slave station 122, so that identification is facilitated, when the gateway 12 obtains at least one data transmission instruction and the parameter number corresponding to the at least one data transmission instruction sent by the first master station 100, the second slave station 122 corresponding to each data transmission instruction is determined by the parameter number.
In one embodiment, the first master station 100 sends a data transmission command and at least one parameter number corresponding to the data transmission command to the gateway 12, and when the gateway 12 obtains all parameter numbers corresponding to the data transmission command and the pair of the data transmission command, all the second slave stations 122 corresponding to the data transmission command are determined based on each parameter number.
In another embodiment, the first master station 100 sends a plurality of data transmission instructions and a corresponding one of the parameter numbers to the gateway 12, wherein when the gateway 12 obtains the plurality of data transmission instructions and the corresponding parameter number, the second slave station 122 corresponding to each data transmission instruction is determined based on each of the parameter numbers.
In yet another embodiment, the first master station 100 sends a plurality of data transmission instructions and at least one parameter number corresponding thereto to the gateway 12, wherein when the gateway 12 obtains the plurality of data transmission instructions and all parameter numbers corresponding thereto, for each data transmission instruction, all the second slave stations 122 corresponding to the data transmission instruction are determined based on each parameter number.
In an implementation scenario, the data transmission instructions correspond to different types, the data transmission instructions include a data reading instruction and a data writing instruction, and at least some types of data transmission instructions of all the data transmission instructions received by the gateway 12 are different from each other, so that data writing or data reading can be performed on different second slave stations 122 at the same time, so as to improve the efficiency of data transmission.
S102: and sending each data transmission instruction to a second slave station corresponding to the parameter number, and acquiring a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction.
Specifically, when the gateway 12 sends each data transmission instruction to the second slave station 122 corresponding to the parameter number, a corresponding feedback data packet uploaded by the second slave station 122 after responding to the data transmission instruction is obtained, where the feedback data packet at least includes the width, the symbol, the data value, and the like of the data processed by the second slave station 122 or returned to the first master station 100.
In an embodiment, based on the types of the data transmission instructions, the same type of data transmission instructions are sequentially sent to the corresponding second slave station 122, where the data transmission instructions correspond to different types, and the data transmission instructions include a data reading instruction and a data writing instruction.
In another embodiment, the data transmission instruction corresponding to each parameter number is sequentially sent to the second slave station 122 corresponding to the identification number based on the order of the identification numbers corresponding to the parameter numbers.
S103: and sending the feedback data packet to the control equipment corresponding to the first master station.
Specifically, after obtaining the feedback data packet uploaded by the second slave station 122, the feedback data packet is sent to the control device 11 corresponding to the first master station 100.
Further, the parameter numbers corresponding to the second secondary station 122 include mutually different identification numbers, and offset addresses with the same address length.
Specifically, the identification number of the parameter number corresponding to the second slave station 122 may be any natural number, such as 0 to n, where n is 1, 2 or 3, and the application is not limited thereto. The offset addresses of the parameter numbers corresponding to the second secondary stations 122 have the same address length, that is, each identification number corresponds to the same theoretical range of offset addresses.
Preferably, the theoretical range of the offset address may be 0 to 0x3ff, that is, the theoretical range of the offset address corresponding to the second slave station 122 with the identification number 0 to n is 0 to 0x3ff, the range of the parameter number corresponding to the nth second slave station 122 converted based on the offset address is n×0x400 to n×0x400+0x3ff, where n is any natural number such as 1, 2 or 3, and the theoretical range of the offset address corresponding to each second slave station 122 is not particularly limited, that is, the address length of the offset address is not particularly limited.
Further, referring to fig. 3, fig. 3 is a flowchart of an embodiment of determining whether the parameter number sent by the control device is valid by the gateway according to the present application, before executing the step S101, determining the second slave station 122 corresponding to each data transmission command based on the parameter number, further includes:
s201: and acquiring a first detection result corresponding to the parameter number.
Specifically, the gateway 12 needs to determine whether the parameter number sent by the control device 11 corresponding to the first master station 100 is valid, and if so, executes step S202, and if not, executes step S203.
S202: and responding to the first detection result as valid, and entering a step of determining a second slave station corresponding to each data transmission instruction based on the parameter number.
Specifically, when the gateway 12 determines that the parameter number transmitted by the control device 11 corresponding to the first master station 100 is valid, it proceeds to the step of determining the second slave station 122 corresponding to each data transmission instruction based on the parameter number in the above step 100.
S203: and generating a first error code and transmitting the first error code to control equipment corresponding to the first master station in response to the fact that the first detection result is invalid.
Specifically, when the gateway 12 determines that the parameter number transmitted by the control device 11 corresponding to the first master station 100 is invalid, a first error code is generated and transmitted to the control device 11 corresponding to the first master station 100.
In an implementation scenario, the identification numbers of the three second slave stations 122 are 0, 1 and 2 respectively, and the theoretical range of the offset address of each second slave station 122 is 0 to 0x3ff, so that the maximum value of the available parameter numbers corresponding to all the second slave stations 122 is 0xbff, the control device 11 corresponding to the first master station 100 sends data with a parameter number of 0x400 to the gateway 12, after the gateway 12 obtains the data with the parameter number of 0x400, the gateway 12 determines that the identification number corresponding to the parameter number of 0x400 is 1, and at this time, the gateway 12 determines that the parameter number is valid, and sends the data with the parameter number of 0x400 to the second slave station 122 with the identification number of 1.
In another implementation scenario, the two second secondary stations 122 have the identification numbers of 0 and 1 respectively, and the theoretical range of the offset address of each secondary station 122 is 0 to 0x3ff, so that the maximum value of the available parameter numbers corresponding to all the secondary stations 122 is 0x7ff, the control device 11 corresponding to the first primary station 100 sends data with a parameter number of 0x800 to the gateway 12, after the gateway 12 obtains the data with the parameter number of 0x800, the gateway 12 determines that the identification number corresponding to the parameter number of 0x800 is 2, and exceeds the actual identification numbers 0 and 1 of the parameter numbers corresponding to the secondary stations 122, and at this time, the gateway 12 determines that the parameter number is invalid, generates the first error code and sends the first error code to the control device 11 corresponding to the first primary station 100.
It should be noted that, when the gateway 12 determines the parameter number, only the gateway 12 needs to determine whether the identifier number and the parameter range corresponding to the parameter number are valid, so as to improve the security and stability of data transmission, and when the first determination result is obtained, the determination efficiency is improved, so that the efficiency of data transmission is improved.
In one embodiment, the data transmission command includes a data reading command, and the step S102 specifically includes: in response to the data transmission instruction being a data reading instruction, sending the data transmission instruction to the second slave station 122 corresponding to the parameter number, so that the slave device 13 corresponding to the second slave station 122 responds to the data reading instruction, and generating a first data packet based on the corresponding first parameter in the offset address; the first data packet uploaded by the second secondary station 122 is acquired.
Specifically, when the data transmission instruction is a data reading instruction, the gateway 12 sends the data reading instruction to the second slave station 122 corresponding to the parameter number, and the slave device 13 corresponding to the second slave station 122 generates a first data packet based on the corresponding first parameter in the offset address after responding to the data reading instruction, where the first parameter includes at least a width, a symbol, a data value, and the like of the data, and the first data packet includes at least a width, a symbol, a data value, and the like of the data that the second slave station 122 replies to the first master station 100. Gateway 12 obtains the first data packet uploaded by second slave station 122.
In an implementation scenario, ten slave devices 13 corresponding to the second slave stations 122, where the theoretical range of the offset address in each second slave station 122 is 0-0x3ff, and the identification number of the second slave station 122 is 0-9. After receiving the data reading instruction sent by the first master station 100 and corresponding to the control device 11 and the data with the parameter number of 0x400, the first slave station 102 corresponding to the gateway 12 sends the data reading instruction to the second slave station 122 with the identifier number of 1 and corresponding to the parameter number of 0x400, the slave device 13 corresponding to the second slave station 122 with the identifier number of 1 responds to the data reading instruction and generates a first data packet based on the first parameter of the position with the offset address of 0, and the gateway 12 acquires the first data packet uploaded by the slave device 13 corresponding to the second slave station 122 with the identifier number of 1.
In this embodiment, the step S103 specifically includes: the first data packet is used as a feedback data packet and is sent to the control device 11 corresponding to the first master station 100.
Specifically, the gateway 12 receives the first data packet sent by the second slave station 122, where the first data packet at least includes the width, symbol, data value, etc. of the data that the second slave station 122 replies to the first master station 100, and sends the first data packet to the control device 11 corresponding to the first master station 100, and the control device 11 receives the first data packet sent by the gateway 12, so as to complete the data interaction. Therefore, the data can be read after the data reading instruction is obtained, the data reading is not needed to be periodically performed, and the data reading efficiency is improved.
In another embodiment, the data transmission instruction includes a data writing instruction, and the step S102 specifically includes: in response to the data transmission instruction being a data writing instruction, the data transmission instruction is sent to a second slave station 122 corresponding to the parameter number, so that a slave device 13 corresponding to the second slave station 122 responds to the data writing instruction, and a second parameter contained in the data writing instruction is written into a corresponding offset address to obtain a return value; acquiring a second data packet uploaded by a second secondary station 122; wherein the second data packet is generated based on the return value.
Specifically, when the data transmission instruction is a data writing instruction, the gateway 12 sends the data writing instruction to the second slave station 122 corresponding to the parameter number, and after responding to the data writing instruction, the slave device 13 corresponding to the second slave station 122 writes the second parameter included in the data writing instruction into the corresponding offset address to obtain a return value, where the second parameter at least includes a width of data, a symbol, a data value, and the like, and the return value is the width of data or the symbol of the data or the data value of the first master station 100 processed by the second slave station 122. The gateway 12 obtains a second data packet uploaded by the second slave station 122, wherein the second data packet is generated based on the return value, and the second data packet includes at least the width, symbol, data value, etc. of the data of the first master station 100 processed by the second slave station 122.
In an implementation scenario, ten slave devices 13 corresponding to the second slave stations 122, where the theoretical range of the offset address in each second slave station 122 is 0-0x3ff, and the identification number of the second slave station 122 is 0-9. After receiving the data writing instruction sent by the first master station 100 and corresponding to the control device 11 and the data with the parameter number of 0x400, the first slave station 102 corresponding to the gateway 12 sends the data writing instruction to the second slave station 122 with the identifier number of 1 and corresponding to the parameter number of 0x400, the slave device 13 corresponding to the second slave station 122 with the identifier number of 1 responds to the data writing instruction, writes the second parameter included in the data writing instruction into the position with the corresponding offset address of 0 to obtain a return value, generates a second data packet based on the return value, and the gateway 12 acquires the second data packet uploaded by the slave device 13 corresponding to the second slave station 122 with the identifier number of 1.
In this embodiment, the step S103 specifically includes: the second data packet is used as a feedback data packet and is sent to the control device 11 corresponding to the first master station 100.
Specifically, the gateway 12 receives a second data packet sent by the second slave station 122, where the second data packet includes at least the width, symbol, data value, etc. of the data of the first master station 100 processed by the second slave station 122, and sends the second data packet to the control device 11 corresponding to the first master station 100, and the control device 11 receives the second data packet sent by the gateway 12, so as to complete data interaction. Therefore, the data writing can be performed after the data writing instruction is obtained, the data writing is not needed to be performed periodically, and the data writing efficiency is improved.
Further, referring to fig. 4, fig. 4 is a flow chart of an embodiment corresponding to step S101 in fig. 1, including:
s301: and splitting the parameter number based on a preset generation rule of the parameter number to obtain an identification number and an offset address corresponding to the parameter number.
Specifically, the gateway 12 splits the received valid parameter number based on a preset generation rule of the parameter number, to obtain an identification number and an offset address corresponding to the parameter number.
In one implementation scenario, the parameter numbers corresponding to the second secondary station 122 include mutually distinct identification numbers, and offset addresses with the same address length, that is, each identification number corresponds to an offset address of the same theoretical range. For example, the theoretical range of the offset address may be 0 to 0x3ff, that is, the theoretical range of the offset address corresponding to the second slave station 122 with the identification number 0 to n is 0 to 0x3ff, and the parameter number converted based on the offset address is n×0x400+0x3ff, where n is any natural number such as 1, 2 or 3, so that the identification number n and the offset address after the identification number can be obtained by disassembling after obtaining the parameter number.
S302: and determining the second slave station corresponding to the data transmission instruction based on the identification number obtained by splitting.
Specifically, the gateway 12 sends the parameter number and the data transmission instruction to the corresponding second slave station 122 based on the identification number obtained by splitting, so that the parameter number is split by using the gateway 12, so that the gateway 12 can determine the second slave station 122 corresponding to the data transmission instruction after obtaining the parameter number, and the data transmission efficiency is improved.
Further, referring to fig. 5, fig. 5 is a flow chart of an embodiment corresponding to the step S102 in fig. 1, and before executing the step S102, the method further includes:
s401: and converting the data transmission instruction and the corresponding parameter number from the first slave station to the second master station.
Specifically, the gateway 12 converts the received data transmission instruction sent by the control device 11 and the corresponding parameter number thereof from the first slave station 102 to the second master station 120.
S402: splitting the parameter number by using a second master station to obtain an offset address, and sending the offset address to a second slave station corresponding to the split identification number to obtain a second detection result returned by the second slave station; the second detection result includes valid or invalid, and when the second detection result is invalid, a second error code is corresponding.
Specifically, the second master station 120 on the gateway 12 splits the parameter number to obtain the offset address and the identification number, sends the offset address to the second slave station 122 corresponding to the identification number, obtains the second detection result returned by the second slave station 122, executes step S403 if the second detection result is valid, and executes step S404 if the second detection result is invalid.
S403: and responding to the second detection result as effective, entering a step of sending each data transmission instruction to a second slave station corresponding to the parameter number, and acquiring a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction.
Specifically, when the second detection result returned from the second slave station 122 is valid, the process advances to step S102 described above.
S404: and responding to the second detection result as invalid, and sending a second error code to the control equipment corresponding to the first master station.
Specifically, when the second detection result returned by the second slave station 122 is invalid, the second error code is transmitted to the control device 11 corresponding to the first master station 100.
In an implementation scenario, the total of three second slave stations 122 are respectively identified by numbers 0, 1 and 2, the theoretical range of the offset address of each second slave station 122 is 0-0x3ff, each second slave station 122 is correspondingly preconfigured with an available offset address, wherein all the offset addresses of the second slave stations 122 with the identified number 2 are preconfigured with the second slave stations 122 to be available, when the gateway 12 obtains a data transmission instruction and the data with the corresponding parameter number 0xbff, the data with the data transmission instruction and the corresponding parameter number 0xbff are converted from the first slave station 102 to the second master station 120, the parameter number 0xbff is split by the second master station 120 to obtain the corresponding identification number 2, the offset address is 0x3ff, the second master station 120 sends the offset address 0x3ff to the second slave station 122 with the identification number 2, the second slave station 122 judges that the offset address 0x3ff is valid, the second detection result is valid, the second master station 120 sends the data with the second identification number 2 to the second slave station 122 to the second master station 120, and the second master station 120 sends the offset address with the corresponding parameter number 0xbff to the second slave station 122 to the gateway 12, and the interaction packet is completed, and the data packet is sent to the gateway 12, and the interaction packet is completed.
In another implementation scenario, the three second slave stations 122 have the identification numbers of 0, 1 and 2 respectively, the theoretical range of the offset address of each second slave station 122 is 0 to 0x3ff, each second slave station 122 is correspondingly preconfigured with an available offset address, wherein, if part of the offset addresses in the second slave stations 122 with the identification number of 2 are in an encrypted state, part of the offset addresses in the second slave stations 122 with the identification number of 2 are unavailable, for example, the offset addresses of 0x300 to 0x3ff are unavailable, when the gateway 12 obtains a data transmission instruction and the data with the corresponding parameter number of 0xbff, the data with the parameter number of 0xbff is converted from the first slave station 102 to the second master station 120, the second master station 120 is utilized to split the parameter number of 0xbff, the corresponding identification number of 2 is obtained, the offset address of 0x3 is offset address of 0 ff, the second master station 120 sends the offset address of 0x3 to the second slave station 122 with the identification number of 2, and the second slave station 122 receives an invalid result from the gateway 12, and returns an invalid result to the second master station 120, and the invalid result is returned to the second gateway 12, and the invalid result is returned to the second master station 120.
It should be noted that, by determining whether the offset address is valid by the second slave station 122, the second determination result may be determined only by comparing the received offset address with the offset address actually supported by the second slave station 122, so as to improve the security and stability of data transmission, and improve the determination efficiency when the second determination result is obtained, thereby improving the efficiency of data transmission.
Referring to fig. 6 in conjunction with fig. 2, fig. 6 is a flowchart of another embodiment of a data transmission method according to the present application, where the data transmission method is applied to a data transmission system 10, and the data transmission system 10 includes a control device 11, a gateway 12, and a plurality of slave devices 13, the control device 11 is integrated with a first master station 100, the gateway 12 is integrated with a first slave station 102 and a second master station 120, the first slave station 102 corresponds to the first master station 100, each slave device 13 is integrated with a respective second slave station 122, and the second slave station 122 corresponds to the second master station 120, and the method uses the control device 11 as an execution body and includes:
s501: transmitting at least one data transmission instruction and a parameter number corresponding to the data transmission instruction to a gateway so that the gateway determines a second slave station corresponding to each data transmission instruction based on the parameter number; wherein the parameter number includes an identification number and an offset address of the second secondary station.
Specifically, the control device 11 corresponding to the first master station 100 transmits at least one data transmission instruction and its corresponding parameter number to the gateway 12, and the gateway 12 determines the second slave station 122 corresponding to each data transmission instruction based on the parameter number.
In an embodiment, the control device 11 corresponding to the first master station 100 sends a data transmission instruction and at least one parameter number corresponding to the data transmission instruction to the gateway 12.
In another embodiment, the control device 11 corresponding to the first master station 100 sends a plurality of data transmission instructions and a corresponding parameter number to the gateway 12.
In yet another embodiment, the control device 11 corresponding to the first master station 100 sends a plurality of data transmission instructions and at least one parameter number corresponding thereto to the gateway 12.
S502: and responding to the feedback data packet uploaded by the gateway after the second slave station responds to the data transmission instruction, and obtaining the feedback data packet.
Specifically, after the second slave station 122 generates a feedback data packet in response to the data transmission instruction, and sends the feedback data packet to the gateway 12, the control device 11 corresponding to the first master station 100 receives the feedback data packet uploaded by the gateway 12, so as to complete data interaction, where the feedback data packet at least includes the width, the symbol, the data value, and the like of the data processed by the second slave station 122 or replied to the first master station 100.
Referring to fig. 7 in conjunction with fig. 2, fig. 7 is a flowchart of a data transmission method according to another embodiment of the present application, where the data transmission method is applied to a data transmission system 10, and the data transmission system 10 includes a control device 11, a gateway 12, and a plurality of slave devices 13, the control device 11 is integrated with a first master station 100, the gateway 12 is integrated with a first slave station 102 and a second master station 120, the first slave station 102 corresponds to the first master station 100, each slave device 13 is integrated with a respective second slave station 122, and the second slave station 122 corresponds to the second master station 120, and the method uses the slave device 13 as an execution body, and includes:
s601: responding to the data transmission instruction sent by the gateway, and executing the data transmission instruction;
s602: and generating a feedback data packet and sending the feedback data packet to the gateway.
Specifically, after the second slave station 122 obtains the data transmission instruction sent by the gateway 12, the data transmission instruction is executed, a feedback data packet is generated, and the feedback data packet is sent to the gateway 12.
In an embodiment, after obtaining the data reading instruction sent by the gateway 12, the slave device 13 corresponding to the second slave station 122 executes the data reading instruction to generate a first data packet, and sends the first data packet to the gateway 12.
In another embodiment, after obtaining the data writing instruction sent by the gateway 12, the slave device 13 corresponding to the second slave station 122 executes the data writing instruction to generate a second data packet, and sends the second data packet to the gateway 12.
Referring to fig. 8, fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application, the electronic device includes a memory 20 and a processor 30 coupled to each other, program instructions are stored in the memory 20, and the processor 30 is configured to invoke the program data program instructions to execute the steps of the data transmission method in the above embodiment. Specifically, the electronic device includes, but is not limited to: desktop computers, notebook computers, tablet computers, servers, etc., are not limited herein. Further, the processor 30 may also be referred to as a CPU (Center Processing Unit, central processing unit). The processor 30 may be an integrated circuit chip having signal processing capabilities. The processor 30 may also be a general purpose processor, a digital signal processor (Digital Signal Processor, DSP), an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), a Field programmable gate array (Field-Programmable Gate Array, FPGA), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 30 may be commonly implemented by an integrated circuit chip.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an embodiment of a computer readable storage medium according to the present application, where the computer readable storage medium 40 stores program instructions 50 that can be executed by a processor, and the program instructions 50 are used to implement a data transmission method according to any of the foregoing embodiments.
The units described as separate units may or may not be physically separate, and units displayed as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing description is only of embodiments of the present application, and is not intended to limit the scope of the application, and all equivalent structures or equivalent processes using the descriptions and the drawings of the present application or directly or indirectly applied to other related technical fields are included in the scope of the present application.

Claims (10)

1. A data transmission method, characterized by being applied to a data transmission system including a control device integrated with a first master station, a gateway integrated with a first slave station and a second master station, and the first slave station corresponding to the first master station, each of the slave devices integrated with a respective second slave station, and the second slave station corresponding to the second master station, and a plurality of slave devices, the data transmission method comprising:
responding to at least one data transmission instruction sent by a first master station and a corresponding parameter number thereof, and determining a second slave station corresponding to each data transmission instruction based on the parameter number; wherein the parameter number includes an identification number and an offset address of the second slave station;
each data transmission instruction is sent to a second slave station corresponding to the parameter number, and a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction is obtained;
and sending the feedback data packet to the control equipment corresponding to the first master station.
2. The method according to claim 1, wherein the data transmission instruction includes a data reading instruction, the sending each data transmission instruction to a second slave station corresponding to the parameter number, and obtaining a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction includes:
responding to the data transmission instruction as the data reading instruction, and sending the data transmission instruction to a second slave station corresponding to the parameter number, so that the slave equipment corresponding to the second slave station responds to the data reading instruction, and generating a first data packet based on a first parameter corresponding to the offset address; acquiring the first data packet uploaded by the second slave station;
the sending the feedback data packet to the control device corresponding to the first master station includes:
and taking the first data packet as the feedback data packet and sending the feedback data packet to the control equipment corresponding to the first master station.
3. The method according to claim 1, wherein the data transmission instruction includes a data writing instruction, the sending each data transmission instruction to a second slave station corresponding to the parameter number, and obtaining a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction includes:
responding to the data transmission instruction as the data writing instruction, and sending the data transmission instruction to a second slave station corresponding to the parameter number, so that the slave equipment corresponding to the second slave station responds to the data writing instruction, and writing a second parameter contained in the data writing instruction into the corresponding offset address to obtain a return value; acquiring a second data packet uploaded by the second slave station; wherein the second data packet is generated based on the return value;
the sending the feedback data packet to the control device corresponding to the first master station includes:
and taking the second data packet as the feedback data packet and sending the feedback data packet to the control equipment corresponding to the first master station.
4. The method of claim 1, wherein said parameter number corresponding to each of said second secondary stations includes mutually distinguished identification numbers, and offset addresses having the same address length;
before determining the second slave station corresponding to each data transmission instruction based on the parameter number, the method further comprises:
acquiring a first detection result corresponding to the parameter number;
responding to the first detection result to be effective, and entering a step of determining a second slave station corresponding to each data transmission instruction based on the parameter number;
and generating a first error code and sending the first error code to the control equipment corresponding to the first master station in response to the first detection result being invalid.
5. The method of claim 1, wherein the determining the second secondary station corresponding to each data transmission instruction based on the parameter number comprises:
splitting the parameter number based on a preset generation rule of the parameter number to obtain the identification number and the offset address corresponding to the parameter number;
and determining the second slave station corresponding to the data transmission instruction based on the identification number obtained through splitting.
6. The method of claim 5, wherein the sending each data transmission instruction to the second slave station corresponding to the parameter number, before obtaining the feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction, further comprises:
converting the data transmission instruction and the corresponding parameter number thereof from the first slave station to the second master station;
splitting the parameter number by using the second master station to obtain the offset address, and sending the offset address to the second slave station corresponding to the split obtained identification number, so as to obtain a second detection result returned by the second slave station; wherein the second detection result comprises valid or invalid, and when the second detection result is invalid, a second error code is corresponding to the second error code;
responding to the second detection result to be effective, entering a step of sending each data transmission instruction to a second slave station corresponding to the parameter number, and acquiring a feedback data packet uploaded by the corresponding second slave station after responding to the data transmission instruction;
and responding to the second detection result to be invalid, and sending the second error code to the control equipment corresponding to the first master station.
7. A data transmission method, characterized by being applied to a data transmission system including a control device integrated with a first master station, a gateway integrated with a first slave station and a second master station, and the first slave station corresponding to the first master station, each of the slave devices integrated with a respective second slave station, and the second slave station corresponding to the second master station, and a plurality of slave devices, the data transmission method comprising:
transmitting at least one data transmission instruction and a parameter number corresponding to the data transmission instruction to the gateway, so that the gateway determines a second slave station corresponding to each data transmission instruction based on the parameter number; wherein the parameter number includes an identification number and an offset address of the second slave station;
and responding to the feedback data packet uploaded by the gateway after the second slave station responds to the data transmission instruction, and obtaining the feedback data packet.
8. A data transmission method, characterized by being applied to a data transmission system including a control device integrated with a first master station, a gateway integrated with a first slave station and a second master station, and the first slave station corresponding to the first master station, each of the slave devices integrated with a respective second slave station, and the second slave station corresponding to the second master station, and a plurality of slave devices, the data transmission method comprising:
executing a data transmission instruction in response to the data transmission instruction sent by the gateway;
and generating a feedback data packet, and sending the feedback data packet to the gateway.
9. An electronic device, comprising: a memory and a processor coupled to each other, wherein the memory stores program data that the processor invokes to perform the method of any of claims 1-6 or 7 or 8.
10. A computer readable storage medium having stored thereon program data, which when executed by a processor implements the method of any of claims 1-6 or 7 or 8.
CN202310412433.7A 2023-04-18 2023-04-18 Data transmission method, electronic equipment and computer readable storage medium Pending CN117040954A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310412433.7A CN117040954A (en) 2023-04-18 2023-04-18 Data transmission method, electronic equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310412433.7A CN117040954A (en) 2023-04-18 2023-04-18 Data transmission method, electronic equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN117040954A true CN117040954A (en) 2023-11-10

Family

ID=88601005

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310412433.7A Pending CN117040954A (en) 2023-04-18 2023-04-18 Data transmission method, electronic equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN117040954A (en)

Similar Documents

Publication Publication Date Title
US10116746B2 (en) Data storage method and network interface card
EP3542276B1 (en) Flow control in remote direct memory access data communications with mirroring of ring buffers
CN103092798B (en) The method of the access means under SOC(system on a chip) and bus
EP3817333B1 (en) Method and system for processing requests in a consortium blockchain
US10999357B1 (en) Data transmission system and data transmission method
CN108880972B (en) Information processing method, server and terminal
WO2020038443A1 (en) Bridging communication method and device
CN114244654B (en) URL forwarding method, device, equipment and computer storage medium
CN112422485B (en) Communication method and device of transmission control protocol
CN117040954A (en) Data transmission method, electronic equipment and computer readable storage medium
US8688867B2 (en) System and methods for communicating between serial communications protocol enabled devices
CN112235435A (en) Method and equipment for fast coding
CN110659143B (en) Communication method and device between containers and electronic equipment
CN115390939B (en) Service processing method and system
CN103731424A (en) Network data transmitting method, device and system
CN105281944B (en) Method for setting network protocol address and service management system
JP5162686B2 (en) Method for retrieving object from DM client and device management system related thereto
CN116089124A (en) Communication method, device and medium of simulation system
US10015093B2 (en) Communication transmission system for communication protocol failures
US20040193908A1 (en) Queue pair/window association
CN111241194A (en) Data synchronization method and device
CN115883315B (en) Node joining method, device, electronic equipment and storage medium in blockchain network
CN115225530B (en) Asset state monitoring method, device, equipment and medium
KR102361484B1 (en) Amqp based modbus gateway system and communication method using the same
CN110798540B (en) Data interaction method and device

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