A data transmission method, device and storage medium
By processing and decomposing the target data into multiple messages, the problem of excessive data transmission between devices is solved, achieving efficient data transmission within standard communication protocols, avoiding changes to devices and protocols, and reducing costs and debugging cycles.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SAIC GM WULING AUTOMOBILE CO LTD
- Filing Date
- 2023-07-03
- Publication Date
- 2026-04-14
AI Technical Summary
When transmitting excessive data between devices, because one device can only send or read a message once, it cannot perform high and low bit combination operations, resulting in data transmission failure. Existing solutions are costly and time-consuming.
By performing calculations on the target data, non-limited data is generated and divided into a first position message and a second position message, which are then sent. The second position message is the limit-exceeding identifier value. The receiving end performs reverse calculations based on the limit-exceeding identifier value to recover the limit-exceeding data.
Within the limited scope of standard communication protocols, the transmission of data exceeding the limits between devices was achieved, avoiding changes to devices and protocols, improving debugging efficiency, and reducing costs and time.
Smart Images

Figure CN116708602B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data transmission technology, and in particular to a data transmission method. Background Technology
[0002] When transmitting data between devices, data exceeding limits often occurs. A common industry solution is to use a high-low bit combination method to transmit the excess data. This involves sending two messages, one representing the high-order bit and the other the low-order bit, and then performing a bitwise AND operation on the data to transmit the excess data. Since the data volume of a single message is limited, combining two messages and performing a bitwise AND operation increases the upper limit of the transmitted data.
[0003] However, if the message protocol of either the sending or receiving device is to send and read a single message, then even if one device can send or read two messages using high and low bits, it will still be impossible to achieve the transmission of excessive data between the devices.
[0004] Therefore, the only solutions to the problem of excessive data transmission are usually to replace the equipment, the software version, or the communication protocol, but these solutions are costly and take a long time to resolve. Summary of the Invention
[0005] This application provides a data transmission method and apparatus to solve the problem that when transmitting excessive data between devices, the two devices cannot transmit excessive data because one device can only send or read a message once.
[0006] Firstly, this technical solution provides a data transmission method, characterized by comprising:
[0007] If the target data exceeds the limit, the target data is processed to obtain the non-limited data corresponding to the target data.
[0008] Send a data combination message, which includes a first location message and a second location message. If the target data exceeds the limit, the first location message is the data that does not exceed the limit, and the second location message is an over-limit identifier value. The over-limit identifier value is used to indicate that the target data exceeds the limit.
[0009] Optionally, the process of performing calculations on the target data to obtain corresponding non-exceeding data if the target data exceeds the limit includes:
[0010] When the target data exceeds the first data value, the target data is subtracted from the first data value to obtain the non-exceeded data. The first data value is positive, and the exceedance identifier value is the first exceedance identifier value. The first exceedance identifier value is used to indicate that the target data exceeds the limit and is a positive number.
[0011] When the target data is negative and greater than the third data value but less than the second data value, the target data is added to the first data value to obtain the non-exceeded data. The second location message is the second over-limit identifier value, which is used to indicate that the target data exceeds the limit and is negative. The second data value is the negative first data value.
[0012] Optionally, when the target data is less than the first data value and is a positive number, the first location message is the target data, and the second location message is the first non-exceeding limit identifier value;
[0013] When the target data is negative and greater than the second data value, the first location message is the target data, and the second location message is the second non-exceeded limit flag value.
[0014] Secondly, this technical solution provides a data processing method, characterized in that it includes:
[0015] Obtain a combined data message, wherein the combined data message includes a second location message and a first location message;
[0016] If the second location message is an over-limit flag value, then the first location message is processed accordingly to convert the first location message from non-over-limit data to over-limit target data.
[0017] Optionally, the process of performing a corresponding operation on the first location message to convert the first location message from non-exceeding data to exceeding target data if the second location message is an out-of-limit identifier includes:
[0018] When the over-limit identifier value is the first over-limit identifier value and the first location message is a positive value, the first location message and the first data value are added together to obtain the target data;
[0019] When the over-limit identifier value is the first over-limit identifier value and the first location message is negative, the first location message is added to the first data value and then added to the first data value again to obtain the target data;
[0020] When the over-limit identifier value is the second over-limit identifier value, and the first location message is a positive value, the first location message is subtracted from the first data value to obtain the target data;
[0021] When the over-limit identifier value is the second over-limit identifier value, and the first location message is negative, the first location message is subtracted from the first data value, and then subtracted from the first data value again to obtain the target data.
[0022] Optionally, the data processing method in this application embodiment further includes: when the over-limit identifier value is a first non-over-limit identifier value and the first location message is a positive value, the first location message is used as target data;
[0023] When the over-limit flag value is the first non-over-limit flag value and the first location message is negative, the first location message and the first data value are added together to obtain the target data;
[0024] When the value of the over-limit identifier is the second not-over-limit identifier, and the value of the first location message is positive, the first location message is used as the target data;
[0025] When the over-limit flag value is the second non-over-limit flag value and the first location message is negative, the first location message is subtracted from the first data value to obtain the target data.
[0026] Thirdly, this technical solution provides a data transmission device, characterized in that it includes:
[0027] The calculation unit is used to perform calculations on the target data if the target data exceeds the limit, and obtain the non-limited data corresponding to the target data.
[0028] The sending unit is configured to send the data combination message, which includes a first location message and a second location message. If the target data exceeds the limit, the first location message is the data that does not exceed the limit, and the second location message is an over-limit identifier value, which is used to indicate that the target data exceeds the limit.
[0029] Fourthly, this technical solution provides a data processing apparatus, characterized in that it includes:
[0030] A receiving unit is configured to acquire a data composite message, the data composite message including a second location message and a first location message;
[0031] The parsing unit is used to perform corresponding operations on the first location message if the second location message is an out-of-limit identifier value, and convert the first location message from non-out-of-limit data to out-of-limit target data.
[0032] Fifthly, this technical solution provides an electronic device, including: a processor, a memory, a communication interface, and a communication bus, wherein the processor, the memory, and the communication interface communicate with each other through the communication bus;
[0033] The memory is used to store at least one executable instruction that causes the processor to perform the operation corresponding to the method in any possible implementation of the first aspect or the second aspect.
[0034] Sixthly, this technical solution provides a computer storage medium, characterized in that it includes computer instructions, which, when executed on an electronic device, cause the electronic device to perform the method in any possible implementation of the first or second aspect.
[0035] In a seventh aspect, this technical solution provides a computer program product, characterized in that it includes computer-readable instructions that, when the computer program product is run on an electronic device, cause the computer to perform the method in any possible implementation of the first aspect or the second aspect.
[0036] Eighthly, this technical solution provides a chip, characterized in that the chip includes a processor and a data interface, wherein the processor reads instructions stored in a memory through the data interface to execute the method in any possible implementation of the first aspect or the second aspect.
[0037] The method described in this application, when target data exceeds the limit, first processes the excess target data into data within the limit, and then sends the excess flag and the data to be transmitted respectively through the first and second position messages in the data combination message. This allows the excess target data to be transmitted with only one message sent and received. Within the limited scope of standard communication protocols, this solves the problem of data exceeding limits in scenarios where the device cannot perform AND operations on high- and low-bit combination messages. Attached Figure Description
[0038] Figure 1 This is a schematic diagram of the structure of a Modbus standard communication protocol message;
[0039] Figure 2 This is a simplified diagram illustrating the Modbus communication protocol communication process.
[0040] Figure 3 This is a schematic diagram of an existing industry method for transmitting out-of-limit data using a combination of high and low bits under the Modbus protocol.
[0041] Figure 4 This is a flowchart illustrating the sending method of a data transmission method according to an embodiment of the present invention;
[0042] Figure 5 This is a flowchart illustrating a receiving method of a data transmission method according to an embodiment of the present invention;
[0043] Figure 6 This is a schematic diagram illustrating the complete data transmission and data processing process of an embodiment of this application;
[0044] Figure 7This is a schematic diagram illustrating the specific conversion process of the 3D vision camera sending out-of-limit data to the robot.
[0045] Figure 8 This is a schematic diagram of the data transmission device in an embodiment of this application;
[0046] Figure 9 This is a schematic diagram of the data processing device in an embodiment of this application;
[0047] Figure 10 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0048] The technical solution in this application will now be described with reference to the accompanying drawings. First, the Modbus protocol used as an example in this application and the method for transmitting out-of-limit data under the Modbus protocol will be introduced.
[0049] Modbus is a serial communication protocol, a standard protocol in the industrial communication field, and is now a common connection method between industrial electronic devices. The Modbus protocol is essentially the same as any custom protocol we use; it's a data transmission format, also composed of start frames, data frames, check frames, etc.
[0050] Figure 1 This is a schematic diagram of the Modbus standard communication protocol message structure. The following section combines... Figure 1 This section provides a detailed introduction to Modbus standard communication protocol messages, which include the following parts:
[0051] (1) Address field: Address information of child nodes;
[0052] (2) Function code: Indicates the action to be performed by the server. The valid code word range is decimal 1-255 (128-255 is reserved for abnormal response). When a message is sent from the client to the server device, the function code field informs the server which operation to perform (the function code is quite extensive, so it is recommended to consult the Modbus protocol manual, which explains it very clearly).
[0053] (3) Data: The data content transmitted. In some requests, the data may not exist (0 length). In this case, the server does not need any additional information. The function code only describes the operation.
[0054] (4) Error checking: Verify whether the received and sent data is correct.
[0055] Figure 2 This is a simplified diagram illustrating the Modbus communication protocol process, which includes the following:
[0056] R1: The device sends real data.
[0057] R2: Send -2 n ~2 n Signed data within -1.
[0058] R3: Transmits source code data via the Modbus protocol.
[0059] R4: The receiving end of the device receives original code or complement code data.
[0060] Modbus communication protocol is one of the widely used standard communication methods in the field of industrial Internet. However, due to differences in hardware and software, there is an upper limit to the amount of data that can be communicated. For example, with 16-bit binary, the theoretical maximum transmission value is between -65536 and 65535. Values greater than this are considered data exceeding the limit and cannot be transmitted.
[0061] Specifically, in Modbus communication, data frames are binary, typically 16 or 32 bits, with 16-bit binary being more common. The maximum value represented by 16 bits is 65535. However, during communication, it is necessary to distinguish between positive and negative numbers. In computers, binary cannot directly represent negative numbers, so the highest bit is usually a composite bit, where 1 indicates a negative value. Furthermore, negative numbers are encoded using a "twist and add 1" method, transmitting the two's complement representation. That is, the encoding of a negative number is the inversion of its original code followed by the addition of 1, as shown in the table.
[0062] For example:
[0063] Decimal Source code Inverse code Two's complement (invert and add 1) -3 0000 0000 0000 0011 1111 1111 1111 1100 1111 1111 1111 1101
[0064] Therefore, under the Modbus communication protocol, the range of integers that can be transmitted with a 16-bit integer is -2. 15 ~2 15 -1 indicates that the transmitted value exceeds the data limit and cannot be transmitted.
[0065] Figure 3 This diagram illustrates an existing industry method for transmitting out-of-limit data using a combination of high and low bits under the Modbus protocol. Because 16 bits are the maximum transmittable value under the Modbus protocol, the industry primarily uses a combination of high and low bits to transmit out-of-limit data in order to increase the transmitted data size. The specific transmission and reception process is as follows: Figure 3 As shown, it includes the following:
[0066] T1. The sending end splits the excess data into high-order and low-order data.
[0067] T2, the communication module transmits two sets of data, converting high and low bits to obtain the out-of-limit data.
[0068] T3. The receiving end obtains the original data that exceeds the limit.
[0069] The above method of transmitting out-of-limit data using the high-low bit combination method is illustrated with the following data: the sending end sends two sets of hexadecimal messages 0x10 and 0x2e, and the receiving end actually reads the value 0x102e (that is, combining the high and low bits of message 0x10 and message 0x2e); or, for example, the sending end sends two messages 0x10 and 1b2e, and the receiving end actually reads the value 0x101b2e.
[0070] This method requires that the communication protocols of the sending and receiving ends be consistent, and that the communication module has a protocol to convert the high and low bits of the two sets of messages.
[0071] If either the sending or receiving device uses a message protocol that involves sending and reading a message only once, even if one device can read the message twice (high and low bits), it will still be unable to send the data exceeding the limit. For example, if the communication protocols of the sending and receiving devices are inconsistent, and the sending end sends two messages while the receiving end can only receive one, the receiving end cannot combine the two messages to obtain the original target data exceeding the limit. Therefore, data transmission exceeding the limit cannot be achieved (e.g., if the sending end sends messages 0x10 and 0x2e respectively, the receiving end will still recognize 0x10 and 0x2e, not 0x10 and 0x2e). This invention addresses the data exceeding the limit problem in this scenario.
[0072] Figure 4 This is a flowchart illustrating the sending method of a data transmission method according to an embodiment of the present invention, as shown below. Figure 4 As shown, the data transmission method includes the following steps:
[0073] A1. If the target data exceeds the limit, perform calculations on the target data to obtain the non-limited data corresponding to the target data.
[0074] A2. Send a data combination message, which includes a first location message and a second location message. If the target data exceeds the limit, the first location message is the data that does not exceed the limit, and the second location message is the limit-exceeding identifier value. The limit-exceeding identifier value is used to indicate that the target data exceeds the limit.
[0075] Specifically, when the communication protocols of the sending and receiving ends of the device are inconsistent, the communication module cannot combine the two sets of messages, thus preventing the transmission of data exceeding the limit. For example, if the sending end sends messages 0x10 and 0x2e respectively, the receiving end will still recognize the message as 0x10 and 0x2e, not 0x10 and 0x2e. This embodiment of the application reduces the value of the exceeding data by performing a difference calculation beforehand, and then sends two messages, including a first position message and a second position message. The second position message is an exceeding limit identifier value, used to indicate that the target data exceeds the limit, and the first position message represents the value of the data that does not exceed the limit after the reduction.
[0076] pass Figure 4 In the illustrated embodiment, when the target data exceeds the limit, the excess target data is first processed into data that does not exceed the limit. Then, the excess flag and the data to be transmitted are sent respectively through the first and second position messages in the data combination message. This allows the excess target data to be transmitted with only one message sent and received. Within the limited scope of standard communication protocols, this solves the data exceeding the limit problem in scenarios where the device cannot perform AND operations on high and low bit combination messages.
[0077] In one possible embodiment, Figure 5 This is a schematic flowchart of a data transmission method for receiving data according to an embodiment of the present invention, as shown below. Figure 5 As shown, the receiving method of the data transmission method includes:
[0078] B1. Obtain a data combination message, wherein the data combination message includes a second position message and a first position message.
[0079] B2. If the second location message is an over-limit flag value, then perform a corresponding operation on the first location message to convert the first location message from non-over-limit data to over-limit target data.
[0080] pass Figure 5 In the illustrated embodiment, based on the out-of-limit flag value of the second position message in the data combination message, the first position message is determined to be data that has undergone reduction in limits. Based on the out-of-limit flag value of the second position message, a corresponding operation is performed on the first position message, converting it from non-out-of-limit data into the initially out-of-limit target data. The receiving end can then receive the out-of-limit data by performing the reverse operation on the two received messages to restore the out-of-limit target data. Figure 4 and Figure 5 The embodiment shown implements over-limit transmission and parsing of message protocols, avoiding communication failures caused by data over-limit. It eliminates the need for device or protocol modifications, greatly improving debugging efficiency and reducing debugging costs and time.
[0081] In one possible embodiment, in Figure 4 or Figure 5 In the illustrated embodiment, when sending or receiving a combined data message, the second position message and the first position message are sent or received through two registers, respectively. Figure 3 In the illustrated embodiment, two messages are also sent through two registers. This application's embodiment and... Figure 3 In the illustrated embodiment, the difference between the two messages sent through the two registers lies in the following two points: First, the stickiness between the two messages is different. Figure 3 In the illustrated embodiment, the two messages sent by the sending end are a combination of high and low bits. This application, as follows... Figure 4 and Figure 5 In the illustrated embodiment, the two sent messages are independent, and the receiving end reads two independent messages. However, in the second embodiment, the content of the sent messages is different. Figure 3 The two messages sent in the illustrated embodiment are two real data packets. During parsing, the two real data packets are combined using high and low bit operations to obtain the target out-of-limit data. However, as shown... Figure 4 and Figure 5 In the embodiment shown, the two messages sent are the calculation method identifier and the non-real reduction data, respectively. During parsing, one of the messages is used to parse the other message into the original over-limit target data.
[0082] In one possible embodiment, in Figure 4 and Figure 5 Based on the illustrated embodiment, the over-limit flag value of the second location message further indicates not only that the target data exceeds the limit, but also the conversion method between the over-limit target data and the reduced-limit non-over-limit data.
[0083] Specifically, Figure 6 This is a schematic diagram illustrating the complete data transmission and data processing process of an embodiment of this application, as shown below. Figure 6 As shown, it includes the following:
[0084] C1. The sending end performs a reduction process on the over-limit data in advance using a specific calculation method to obtain the reduced non-over-limit data.
[0085] C2. The sending end sends two messages through the communication module. One message, the second position message, represents the conversion method between the target data that exceeds the limit and the data that does not exceed the limit after the limit is reduced. The other message, the first position message, is the data that does not exceed the limit after the limit is reduced.
[0086] C3. The receiving end receives the two messages through the communication module. Based on the conversion method represented by the over-limit identifier value of the second position message, it performs reverse calculation on the non-over-limit data after the limit reduction of the first position message and restores it to the original over-limit target data.
[0087] pass Figure 6 In the illustrated embodiment, when the communication protocols between the sending and receiving ends of the device are inconsistent, the receiving end's communication module cannot combine the two sets of messages and perform conventional high-low bit conversion operations to obtain combined data, thus failing to achieve over-limit data transmission. Instead, two sets of messages are used: a first position message and a second position message. The over-limit flag value in the second position message represents both the target data exceeding the limit and the over-limit flag value representing the conversion method between the over-limit target data and the reduced-limit non-over-limit data. The first position message represents the reduced-limit non-over-limit data, further enabling the transmission and parsing of the over-limit target data.
[0088] In one possible embodiment, the process of performing calculations on the target data to obtain corresponding non-exceeding data if the target data exceeds the limit includes:
[0089] When the target data exceeds the first data value, the target data is subtracted from the first data value to obtain the non-exceeded data. The first data value is positive, and the exceedance identifier value is the first exceedance identifier value. The first exceedance identifier value is used to indicate that the target data exceeds the limit and is a positive number.
[0090] Specifically, when sending data, the data to be sent can be divided into four categories: two categories of positive integers and two categories of negative integers. The first position message is transmitted through register GI1, and the second position message is transmitted through register GI2. Register GI2 transmits the specific value, while the value transmitted by GI1 is used to represent the conversion method between the target data that exceeds the limit and the data that does not exceed the limit after being reduced in size. H is used to represent the actual value of the target data.
[0091] For example, the first data value can be 65536, and the first over-limit flag value can be 0. Register GI1 sends the first position message, and register GI2 sends the second position message.
[0092] When the value of the transmitted data H is 99999 > H > +65536, GI1 is sent as 0; GI2 is sent as the value of H, but to reduce the numerical value, the following calculation is performed: GI2 = GI2 - 65536. Then GI1 and GI2 are sent.
[0093] Example: If the H value sent is 80000, then GI1 = 1; GI2 = 14464 (80000 - 65536).
[0094] When the target data is negative and greater than the third data value but less than the second data value, the target data is added to the first data value to obtain the non-exceeded data. The second location message is the second over-limit identifier value, which is used to indicate that the target data exceeds the limit and is negative. The second data value is the negative first data value.
[0095] Specifically, for example, if the second data value is -65536 and the third data value is -99999, register GI1 sends the first position message and register GI2 sends the second position message.
[0096] When the value of the transmitted data H is -99999 < H < -65536, let GI1 = 0 and GI2 = the value of H. However, at this time, the absolute value of the data needs to be reduced by performing the following operation: let GI2 = GI2 + 65536. Then send GI1 and GI2.
[0097] Example: If the H value sent is -80000, then GI1 = -2; GI2 = 14464.
[0098] In this embodiment, by performing difference calculation on the over-limit target data to reduce the upper limit of the absolute value, intermediate data is obtained. Then, by using two data combination messages, the over-limit target data is represented by the conversion method and the reduced non-over-limit data, respectively, thus realizing the transmission of the over-limit target data.
[0099] In one possible embodiment, the data transmission method of this application is further explained when the target data does not exceed the limit. When the target data does not exceed the limit, the second location message is the first not-exceed-limit identifier value. Specifically,
[0100] When the target data is less than the first data value and is a positive number, the first location message is the target data, and the second location message is the first non-exceeded limit identifier value.
[0101] Specifically, for example, the first data value is 65536, and the first over-limit flag value is 0. Register GI1 sends the first position message, and register GI2 sends the second position message.
[0102] When the value of the transmitted data H is 0 < H < +65536, GI1 = 0, that is, register GI1 sends the first position message with an identifier value of 0; let GI2 = H value, register GI2 sends the second position message.
[0103] Example: If the H value sent is 20000, then GI1 = 0; GI2 = 20000.
[0104] When the target data is negative and greater than the second data value, the first location message is the target data, and the second location message is the second non-exceeded limit flag value.
[0105] Specifically, for example, the second data value is -65536, and the first over-limit flag value is 0. Register GI1 sends the first position message, and register GI2 sends the second position message.
[0106] When the value of the data H to be sent is 0 > H > -65536, send GI1 = -1; send GI2 = the original code of the value H, and send GI1 and GI2 directly.
[0107] Example: If the H value sent is -20000, then GI1 = -1; GI2 = 20000.
[0108] In one possible embodiment, corresponding to the sending method described above, when the receiving end receives the data combination message, the following parsing method is used. The process of performing a corresponding operation on the first location message to convert the first location message from non-exceeding data to exceeding target data if the second location message is an over-limit identifier value includes:
[0109] When the over-limit flag value is the first over-limit flag value and the first location message is positive, the first location message and the first data value are added together to obtain the target data. Specifically, for example, the first over-limit flag value is 1 and the first data value is 65536.
[0110] When register GI1 receives the first data packet GI1=1, according to the transmission rules, the original value range of the second data packet received by register GI2 at this time is 99999>H>+65536. The corresponding conversion process is as follows:
[0111] If GI2 > 0, it means the original code was read, then GI2 = GI2 + 65536; (reverse calculation of the data processing at the sending end).
[0112] When the over-limit identifier value is the first over-limit identifier value and the first location message is negative, the first location message is added to the first data value and then added to the first data value again to obtain the target data.
[0113] Specifically, for example, the first over-limit flag value is 1, and the first data value is 65536.
[0114] When register GI1 receives the first data packet GI1=1, according to the transmission rules, the original value range of the second data packet received by register GI2 at this time is 99999>H>+65536. The corresponding conversion process is as follows:
[0115] If GI2 < 0, it means that the number read is in two's complement (negative number):
[0116] GI2 = GI2 + 65536 (Decompile the two's complement code into its original form)
[0117] GI2 = GI2 + 65536 (Reverse calculation of data processing at the sending end)
[0118] The principle behind two's complement decompilation is as follows: A 16-bit binary value ranges from -32678 to 32677. A value of 1 in the highest bit represents a negative number, and 0 represents a positive number. When the transmitted value is greater than 32677, the highest bit of the 16-bit binary original code will be 1, and the computer will interpret this as two's complement.
[0119] When the over-limit flag value is the second over-limit flag value, and the first location message is positive, the first location message is subtracted from the first data value to obtain the target data. Specifically, for example, the second over-limit flag value is -2, and the first data value is 65536.
[0120] When register GI1 receives the first data packet GI1 = -2, according to the transmission rules, the original value range of the second data packet received by register GI2 at this time is -99999 < H < -65536, and secondary over-limit compensation is required:
[0121] If GI2 > 0, it means the code read is in two's complement form, in which case it needs to be decompiled back to its original code.
[0122] GI2 = GI2 - 65536 (Decompile the two's complement code into its original code)
[0123] GI2 = GI3 - 65536 (reverse calculation of data processing at the sending end).
[0124] When the over-limit flag value is the second over-limit flag value, and the first location message is negative, the first location message is subtracted from the first data value, and then subtracted from the first data value again to obtain the target data. Specifically, for example, the second over-limit flag value is -2, and the first data value is 65536.
[0125] When register GI1 receives the first data packet GI1 = -2, according to the transmission rules, the original value range of the second data packet received by register GI2 at this time is -99999 < H < -65536, and secondary over-limit compensation is required:
[0126] If GI2 < 0, it means the original code is being read, then GI3 = GI2 - 65536; (reverse calculation of the data processing at the sending end).
[0127] In this embodiment, after reading the data combination message, the received data is parsed according to the above method to obtain the target data, which can realize the parsing of out-of-limit data and complete the entire out-of-limit data transmission process.
[0128] In one possible embodiment, when the receiving end parses the data combination message, the following method is also used: When the over-limit identifier value is the first not-over-limit identifier value, and the first location message is a positive value, the first location message is taken as the target data.
[0129] Specifically, for example, the first non-exceeded limit indicator value is 0.
[0130] When register GI1 receives the first data packet GI1=0, according to the transmission rules, the original value range of the second data packet received by register GI2 at this time is 0 < H < +65536.
[0131] If GI2>0, it means that the original code is being read, then GI2=GI2;
[0132] When the over-limit flag value is the first non-over-limit flag value and the first location message is negative, the first location message and the first data value are added together to obtain the target data.
[0133] Specifically, for example, when register GI1 receives the first data message GI1=0, according to the transmission rules, the original value range corresponding to the second data message received by register GI2 at this time is 0<H<+65536;
[0134] If GI2 < 0, then GI3 = GI2 + 65536. (Decompile the two's complement code into its original code)
[0135] Since the number sent is positive and the number read is negative, it means that the value read by the robot is in two's complement (the highest bit of hexadecimal is 1). Therefore, it is necessary to restore the two's complement to the original code and perform the reverse operation to obtain the original code value.
[0136] The principle is as follows: 16-bit binary values range from -32678 to 32677. A value of 1 in the highest bit represents a negative number, and 0 represents a positive number. When the transmitted value is greater than 32677, the highest bit of the 16-bit binary original code will be 1, and the computer will interpret it as a two's complement.
[0137] When the value of the out-of-limit flag is the second not-out-of-limit flag value, and the first location message is positive, the first location message is used as the target data. Specifically, for example, the value of the second not-out-of-limit flag value is -1.
[0138] Specifically, for example, when register GI1 receives the first data packet GI1 = -1, according to the transmission rules, the original value range of the second data packet received by register GI2 at this time is 0 > H > -65536. The corresponding conversion process is as follows:
[0139] If GI2>0, it means that the code read is in two's complement form. In this case, it needs to be decompiled into the original code, so GI2 = GI2 - 65536.
[0140] When the over-limit flag value is the second not-over-limit flag value, and the first location message is negative, the first location message is subtracted from the first data value to obtain the target data. Specifically, for example, the second not-over-limit flag value is -1.
[0141] When register GI1 receives the first data packet GI1 = -1, according to the transmission rules, the original value range of the second data packet received by register GI2 at this time is 0 > H > -65536. The corresponding conversion process is as follows:
[0142] If GI2 < 0, it means that the original code is being read, and GI2 = GI2;
[0143] In this embodiment, after reading the data combination message, the received data is parsed according to the above method to obtain the target data, which can realize the parsing of out-of-limit data and complete the entire out-of-limit data transmission process.
[0144] In one possible embodiment, the following example of communication between a robot and a 3D vision camera illustrates the specific calculation process of a complete inter-device communication in this application. In this embodiment, the robot and the 3D vision camera only support Modbus protocol communication, with data frames being 16 bits in hexadecimal. However, the robot can only read the message once; that is, the maximum transmitted value is the size of the data frame, i.e., the maximum value is 16 bits of binary (i.e., binary 1111 1111 1111 1111). The robot first subtracts from the original data exceeding 16 bits, using a difference algorithm to control the transmitted binary data to within 2 bits. 16 Within (i.e., the maximum absolute value does not exceed 65536, in binary 1111 1111 1111 1111). Then, the robot sends a combined data message to the 3D vision camera via the Modbus communication protocol. The following focuses on the specific conversion process of the 3D vision camera sending out-of-limit data to the robot, such as... Figure 7 As shown, it includes the following:
[0145] After the D1 and 3D vision cameras read the message, they perform visual positioning, requiring the transmission of coordinate values to the robot. These values range from -999.99 to +999.99. However, after being amplified 100 times through computer programming, the actual value to be transmitted is -99999 to +99999, exceeding the data limit. When the obtained positioning data exceeds this limit, a reduction calculation is performed to obtain the reduced, within-limit data. This reduced, within-limit data is then represented and sent to the robot via two messages: one for the second position and one for the first position.
[0146] D2. One segment of the data combination message is the second position segment, used to transmit the identifier number of the threshold calculation method. The other segment is the first position segment, used to transmit the absolute value of the thresholded data, i.e., a positive number is sent.
[0147] D3. After receiving these two messages, the robot obtains two independent data points.
[0148] First, according to the computer's rules, the value returned by the 3D vision is judged. If it is positive, it means that the first position message is in original code, so it is parsed into original code; if it is negative, it means that the first position message is in complement code, so the complement code is also decompiled into original code, and the data with an absolute value greater than 32677 and a value between 0 and 65536 can be obtained.
[0149] Then, in the second step, the robot uses the identifier number of the first position message to determine the operation rules defined by 3D vision, and then performs reverse operation on the data obtained in the first step to obtain the second over-limit data with an absolute value greater than 65536 and a value of -99999 to +99999.
[0150] In one possible embodiment, the communication protocol applicable to the embodiments of this application includes, but is not limited to, the 16-bit binary Modbus protocol described in the example. Other protocols such as 8-bit, 32-bit, or hexadecimal Modbus protocols, or other communication protocols, are all within the scope of this protection.
[0151] The following is combined with Figure 8 The data transmission apparatus in the embodiments of this application will be described in detail. Specifically, Figure 8 This is a schematic diagram of an over-limit data transmission device provided in an embodiment of the present invention, as shown below. Figure 8 As shown, the device includes:
[0152] The calculation unit is used to perform calculations on the target data if the target data exceeds the limit, and obtain the non-limited data corresponding to the target data.
[0153] The sending unit is configured to send the data combination message, which includes a first location message and a second location message. If the target data exceeds the limit, the first location message is the data that does not exceed the limit, and the second location message is an over-limit identifier value. The over-limit identifier value is used to indicate whether the target data exceeds the limit, to indicate the positive or negative value attribute of the target data, and to indicate whether the target data exceeds the limit.
[0154] The data transmission device of this embodiment is used to implement the aforementioned data transmission method and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. Furthermore, the functional implementation of each module in the over-limit data transmission device of this embodiment can be referred to the description of the corresponding part in the aforementioned method embodiments, which will also not be repeated here.
[0155] The following is combined with Figure 9 The data processing apparatus in the embodiments of this application will be described in detail. Specifically, Figure 7 This is a schematic diagram of a receiving device for exceeding data limits provided in an embodiment of the present invention, as shown below. Figure 9 As shown, the device includes:
[0156] A receiving unit is configured to acquire a received data combination message, the data combination message including a second location message and a first location message;
[0157] The parsing unit is used to perform a corresponding operation on the first location message if the second location message is an out-of-limit identifier value, converting the first location message from non-out-of-limit data into out-of-limit target data. The data processing device of this embodiment is used to implement the aforementioned data processing method and has the beneficial effects of the corresponding method embodiments, which will not be repeated here. Furthermore, the functional implementation of each module in the out-of-limit data receiving device of this embodiment can refer to the description of the corresponding parts in the aforementioned method embodiments, which will also not be repeated here.
[0158] Reference Figure 10 This document illustrates a schematic diagram of an electronic device according to an embodiment of this application. The specific embodiments of this application do not limit the specific implementation of the electronic device.
[0159] like Figure 10 As shown, the electronic device may include: a processor 1002, a communications interface 1004, a memory 1005, and a communications bus 1008.
[0160] in:
[0161] The processor 1002, communication interface 1004, and memory 1005 communicate with each other via communication bus 1008.
[0162] Communication interface 1004 is used to communicate with other electronic devices or servers.
[0163] The processor 1002 is used to execute program 1010, specifically to execute the relevant steps in the above-described software development kit update method embodiment.
[0164] Specifically, program 1010 may include program code that includes computer operation instructions.
[0165] The processor 1002 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of this application. The smart device includes one or more processors, which may be processors of the same type, such as one or more CPUs; or they may be processors of different types, such as one or more CPUs and one or more ASICs.
[0166] Memory 1005 is used to store program 1010. Memory 1005 may include high-speed RAM memory, and may also include non-volatile memory, such as at least one disk storage device.
[0167] The specific implementation of each step in program 1010 can be found in the corresponding steps and units described in the above-mentioned software development kit update method embodiment, and will not be repeated here. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the devices and modules described above can be referred to the corresponding process descriptions in the foregoing method embodiments, and will not be repeated here.
[0168] This application also provides a computer-readable storage medium storing instructions that, when executed on a computer, cause the computer to perform the various steps of the above-described data transmission method or data processing method.
[0169] This application also provides a computer program product, including computer instructions that instruct a computing device to perform operations corresponding to the data transmission method or data processing method in the above-described multiple method embodiments.
[0170] It should be noted that, depending on the implementation needs, the various components / steps described in the embodiments of this application can be broken down into more components / steps, or two or more components / steps or parts of the operation of components / steps can be combined into new components / steps to achieve the purpose of the embodiments of this application.
[0171] The methods described in the embodiments of this application can be implemented in hardware, firmware, or as software or computer code that can be stored in a recording medium (such as CD-ROM, RAM, floppy disk, hard disk, or magneto-optical disk), or as computer code downloaded over a network that is originally stored in a remote recording medium or a non-transitory machine-readable medium and will be stored in a local recording medium. Thus, the methods described herein can be stored as software processing on a recording medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware (such as an ASIC or FPGA). It is understood that the computer, processor, microprocessor controller, or programmable hardware includes storage components (e.g., RAM, ROM, flash memory, etc.) capable of storing or receiving software or computer code that, when accessed and executed by the computer, processor, or hardware, implements the checksum generation method described herein. Furthermore, when a general-purpose computer accesses code used to implement the checksum generation method shown herein, the execution of the code transforms the general-purpose computer into a dedicated computer for executing the checksum generation method shown herein.
[0172] Those skilled in the art will recognize that the units and method steps of the various examples 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 implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this application.
[0173] This application also provides a chip, including a processor. The processor is used to read and run a computer program stored in a memory to perform corresponding operations and / or processes performed by the data transmission method or data processing method provided in this application.
[0174] Optionally, the chip further includes a memory connected to the processor via a circuit or wire, the processor being used to read and execute computer programs stored in the memory. Further optionally, the chip includes a communication interface to which the processor is connected. The communication interface is used to receive data and / or information that needs to be processed, the processor obtaining the data and / or information from the communication interface and processing the data and / or information. The communication interface can be an input / output interface.
[0175] In the above embodiments, the processor may include, for example, a central processing unit (CPU), a microprocessor, a microcontroller, or a digital signal processor, and may also include a GPU, an NPU, and an ISP. The processor may further include necessary hardware accelerators or logic processing hardware circuits, such as an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the technical solution of this application. Furthermore, the processor may have the function of operating one or more software programs, which may be stored in memory.
[0176] The memory can be read-only memory (ROM), other types of static storage devices that can store static information and instructions, random access memory (RAM), or other types of dynamic storage devices that can store information and instructions. It can also be electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disk storage media, or other magnetic storage devices. Alternatively, it can be any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer.
[0177] In this application embodiment, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent the existence of A alone, the simultaneous existence of A and B, or the existence of B alone. A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b, and c can represent: a, b, c, ab, ac, bc, or abc, where a, b, and c can be single or multiple.
[0178] Those skilled in the art will recognize that the units and algorithm steps described in the embodiments disclosed herein can be implemented using electronic hardware, computer software, or a combination of electronic hardware and software. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0179] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0180] In the several embodiments provided in this application, any function, if implemented as a software functional unit and sold or used as an independent product, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0181] The above description is merely a specific embodiment of this application. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application. The protection scope of this application should be determined by the protection scope of the claims.
Claims
1. A data transmission method, characterized in that, include: If the target data exceeds the limit, the target data is processed to obtain the non-limited data corresponding to the target data. Send a data combination message, which includes a first location message and a second location message. If the target data exceeds the limit, the first location message is the data that does not exceed the limit, and the second location message is the limit-exceeding identifier value. The limit-exceeding identifier value is used to indicate that the target data exceeds the limit. The limit-exceeding identifier value is also used to indicate the conversion method between the target data that exceeds the limit and the data that does not exceed the limit after the limit is reduced. The process of performing calculations on the target data to obtain corresponding non-exceeding data if the target data exceeds the limit includes: When the target data exceeds the first data value, the target data is subtracted from the first data value to obtain the non-exceeded data. The first data value is positive, and the exceedance identifier value is the first exceedance identifier value. The first exceedance identifier value is used to indicate that the target data exceeds the limit and is a positive number. When the target data is negative and greater than the third data value but less than the second data value, the target data is added to the first data value to obtain the non-exceeded data. The second location message is the second over-limit identifier value, which is used to indicate that the target data exceeds the limit and is negative. The second data value is the negative first data value.
2. The data transmission method according to claim 1, characterized in that, When the target data is less than the first data value and is a positive number, the first location message is the target data, and the second location message is the first non-exceeding flag value; When the target data is negative and greater than the second data value, the first location message is the target data, and the second location message is the second non-exceeded limit flag value.
3. A data processing method, characterized in that, include: Obtain a combined data message, wherein the combined data message includes a second location message and a first location message; If the second location message is an over-limit flag value, then the first location message is calculated according to the conversion method represented by the over-limit flag value of the second location message, and the first location message is converted from non-over-limit data into over-limit target data. The process of performing a corresponding operation on the first location message to convert the first location message from non-exceeding data to exceeding target data if the second location message is an over-limit identifier value includes: When the over-limit identifier value is the first over-limit identifier value and the first location message is a positive value, the first location message and the first data value are added together to obtain the target data; When the over-limit identifier value is the first over-limit identifier value and the first location message is negative, the first location message is added to the first data value and then added to the first data value again to obtain the target data; When the over-limit identifier value is the second over-limit identifier value, and the first location message is a positive value, the first location message is subtracted from the first data value to obtain the target data; When the over-limit identifier value is the second over-limit identifier value, and the first location message is negative, the first location message is subtracted from the first data value, and then subtracted from the first data value again to obtain the target data.
4. The data processing method according to claim 3, characterized in that, Also includes: When the value of the over-limit identifier is the first not-over-limit identifier value, and the value of the first location message is positive, the first location message is used as the target data; When the over-limit flag value is the first non-over-limit flag value and the first location message is negative, the first location message and the first data value are added together to obtain the target data; When the value of the over-limit identifier is the second not-over-limit identifier, and the value of the first location message is positive, the first location message is used as the target data; When the over-limit flag value is the second non-over-limit flag value and the first location message is negative, the first location message is subtracted from the first data value to obtain the target data.
5. A data transmission device, characterized in that, include: The calculation unit is used to perform calculations on the target data if the target data exceeds the limit, and obtain the non-limited data corresponding to the target data. A sending unit is used to send a data combination message, the data combination message including a first position message and a second position message. If the target data exceeds the limit, the first position message is the data that does not exceed the limit, and the second position message is an over-limit identifier value. The over-limit identifier value is used to indicate that the target data exceeds the limit. The over-limit identifier value is also used to indicate the conversion method between the over-limit target data and the reduced-limit data that does not exceed the limit. The process of performing calculations on the target data to obtain corresponding non-exceeding data if the target data exceeds the limit includes: When the target data exceeds the first data value, the target data is subtracted from the first data value to obtain the non-exceeded data. The first data value is positive, and the exceedance identifier value is the first exceedance identifier value. The first exceedance identifier value is used to indicate that the target data exceeds the limit and is a positive number. When the target data is negative and greater than the third data value but less than the second data value, the target data is added to the first data value to obtain the non-exceeded data. The second location message is the second over-limit identifier value, which is used to indicate that the target data exceeds the limit and is negative. The second data value is the negative first data value.
6. A data processing apparatus, characterized in that, include: A receiving unit is configured to acquire a data composite message, the data composite message including a second location message and a first location message; The parsing unit is used to perform corresponding calculations on the first location message according to the conversion method represented by the over-limit identifier value of the second location message if the second location message is an over-limit identifier value, and convert the first location message from non-over-limit data to over-limit target data. The process of performing a corresponding operation on the first location message to convert the first location message from non-exceeding data to exceeding target data if the second location message is an over-limit identifier value includes: When the over-limit identifier value is the first over-limit identifier value and the first location message is a positive value, the first location message and the first data value are added together to obtain the target data; When the over-limit identifier value is the first over-limit identifier value and the first location message is negative, the first location message is added to the first data value and then added to the first data value again to obtain the target data; When the over-limit identifier value is the second over-limit identifier value, and the first location message is a positive value, the first location message is subtracted from the first data value to obtain the target data; When the over-limit identifier value is the second over-limit identifier value, and the first location message is negative, the first location message is subtracted from the first data value, and then subtracted from the first data value again to obtain the target data.
7. An electronic device, comprising: The processor, memory, communication interface, and communication bus are provided, wherein the processor, memory, and communication interface communicate with each other via the communication bus. The memory is used to store at least one executable instruction, which causes the processor to perform the operation corresponding to the data transfer method as described in any one of claims 1 to 4.
8. A computer storage medium, characterized in that, Includes computer instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 4.
9. A computer program product, characterized in that, It includes computer-readable instructions that, when the computer program product is run on an electronic device, cause the computer to perform the method as described in any one of claims 1 to 4.
10. A chip, characterized in that, The chip includes a processor and a data interface. The processor reads instructions stored in the memory through the data interface to execute the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Data processing method and device
CN115529109A
Method for handling an overflow condition in a processor
US5905661A