Communication method, embedded system, host computer and computer readable storage medium
By implementing a communication method in an embedded system, receiving upper computer operation instructions and generating return data packets, the problem of insufficient monitoring and management capabilities of embedded system is solved, and the comprehensiveness and intuitiveness of real-time monitoring and data acquisition are achieved.
Patent Information
- Application Number
- CN202310082414.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-18
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2043-01-18
AI Technical Summary
The existing embedded systems have limited monitoring and management capabilities, good anti-interference performance but high cost, small processing capabilities and unfriendly human-computer interfaces, and are not suitable for on-site monitoring and management.
By implementing a communication method in the embedded system, receiving operation instructions sent by the upper computer, performing corresponding operations according to the instruction type and function code, and generating return data packets, monitoring the status of the embedded system in real time, accurately obtaining monitoring data, and improving monitoring management capabilities.
Real-time monitoring and accurate data acquisition of embedded systems are realized, comprehensiveness and intuitiveness of monitoring management are improved, and data processing delays and packet loss probability are reduced.
Smart Images

Figure CN116126557B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of communications, and in particular to a communication method, an embedded system, a host computer, and a computer-readable storage medium. Background Art
[0002] In the related technologies, when operating embedded systems, since it is a pure hardware operation, the on-site monitoring terminals mostly use industrial computers or single-chip microcomputers. The former has good anti-interference performance but is relatively expensive, while the latter has low processing power and an unfriendly human-machine interface, which is not conducive to the monitoring and management of on-site personnel. How to improve the monitoring and management capabilities of embedded systems is an issue that needs to be discussed and resolved urgently. Summary of the invention
[0003] The embodiments of the present application provide a communication method, an embedded system, a host computer and a computer-readable storage medium, aiming to improve the monitoring and management capabilities of the embedded system.
[0004] In a first aspect, an embodiment of the present application provides a communication method for an embedded system, the method comprising: receiving an operation instruction sent by a host computer, wherein the operation instruction comprises an upload instruction type and a function code; confirming the operation type according to the upload instruction type; confirming the corresponding software terminal page from multiple software terminal pages of the host computer according to the function code; performing a corresponding operation according to the operation type and the function code, and generating a return data packet; sending the return data packet to the host computer, wherein the return data packet comprises the upload instruction type, the function code and monitoring data corresponding to the corresponding software terminal page, so that the host computer writes the monitoring data into the corresponding software terminal page and displays it according to the return data packet.
[0005] According to the communication method of the first aspect of the present application, the operation type and the corresponding software terminal page are indicated to the embedded system through the upload instruction type and function code of the operation instruction of the host computer, and the embedded system is caused to execute the corresponding operation and generate and upload a return data packet. The embedded system generates return data packets corresponding to different software terminal pages according to different function codes; thereby, the status of the embedded system can be monitored in real time, the monitoring data of the embedded system corresponding to different software terminal pages can be accurately obtained, the monitoring display of the embedded system is more comprehensive and intuitive, and the monitoring and management capabilities of the embedded system are improved.
[0006] Among them, the generating of the return data packet includes: obtaining the monitoring data corresponding to the corresponding software terminal page according to the function code; writing the monitoring data corresponding to the corresponding software terminal page into the return data packet according to a preset position, wherein the preset position is obtained according to the function code.
[0007] The upload instruction types include read instructions, write instructions, modify instructions, full data save instructions, batch processing instructions, and activation setting instructions.
[0008] Among them, when the upload instruction type is a modification instruction, the operation instruction also includes address information and a modification value; performing a corresponding operation according to the operation type and the function code, and generating a return data packet includes: modifying the stored data according to the address information and the modification value; generating the return data packet according to the function code, wherein the return data packet includes the latest modified data.
[0009] In a second aspect, an embodiment of the present application provides a communication method, which is applied to a host computer, and the method includes: sending an operation instruction to an embedded system so that the embedded system executes the communication method as described in the first aspect; receiving a return data packet sent by the embedded system; and writing the monitoring data into the corresponding software terminal page and displaying it according to the return data packet.
[0010] Among them, writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet includes: confirming the software terminal page corresponding to the returned data packet according to the function code in the returned data packet; writing the monitoring data in the returned data packet into the corresponding software terminal page and displaying it.
[0011] Among them, writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet includes: obtaining a representative meaning table corresponding to the function code according to the function code in the returned data packet; converting the monitoring data into a displayable language according to the representative meaning table and the position of the monitoring data in the returned data packet; and writing the converted monitoring data into the corresponding software terminal page and displaying it.
[0012] In a third aspect, an embodiment of the present application provides an embedded system, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the communication method described in the first aspect when executing the computer program.
[0013] In a fourth aspect, an embodiment of the present application provides a host computer, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the communication method described in the second aspect when executing the computer program.
[0014] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the communication method described in the first aspect or the second aspect.
[0015] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A schematic diagram of a communication system consisting of an embedded system and a host computer provided in one embodiment of the present application;
[0017] Figure 2 A flow chart of a communication method provided in one embodiment of the present application;
[0018] Figure 3 A schematic diagram of the format of a return data packet provided for an example of this application;
[0019] Figure 4 A flow chart of a communication method provided by another embodiment of the present application;
[0020] Figure 5 A schematic diagram of the structure of an embedded system provided in one embodiment of the present application;
[0021] Figure 6 A schematic diagram of the structure of a host computer provided in one embodiment of the present application. DETAILED DESCRIPTION
[0022] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0023] It should be noted that although the functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described can be performed in a different order than the module division in the system or the order in the flowchart. The terms in the specification, claims and the above drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0024] In the description of this application, "several" means more than one, "more" means more than two, "greater than", "less than", "exceed", etc. are understood to exclude the number itself, and "above", "below", "within", etc. are understood to include the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing technical features, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0025] In the description of this application, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in this application based on the specific content of the technical solution.
[0026] In the description of the present application, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "examples", "specific examples", or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.
[0027] In related technologies, when operating a general embedded system, since it is a pure hardware operation, the on-site monitoring terminal mostly uses an industrial computer or a single-chip microcomputer. The former has good anti-interference performance but is relatively expensive, while the latter has low processing power and an unfriendly human-computer interface, which is not conducive to the monitoring and management of on-site personnel.
[0028] The software runs on the host computer. One end of the embedded system interacts with the sensor end, and the other end is connected to the host computer. When the host computer uses a common serial port or USB to connect to the embedded system, the output end of the embedded system needs to send back sensor data, vibration data spectrum, setting information, etc. in real time according to different needs. When the amount of data is huge, especially when the embedded system has multiple sensors, uploading data from multiple sensors at the same time will also increase the amount of data processing. The upload and processing of embedded system data will be prone to packet loss, delays and other problems, making it impossible for operators to respond and modify operations in a timely manner.
[0029] In order to solve the above problems, the embodiments of the present application provide a communication method, an embedded system, a host computer and a computer-readable storage medium. Through the upload instruction type and function code of the operation instruction of the host computer, the operation type and the corresponding software terminal page are indicated to the embedded system, and the embedded system is caused to execute the corresponding operation and generate and upload a return data packet. The embedded system generates a return data packet corresponding to different software terminal pages according to different function codes; thereby, the status of the embedded system can be monitored in real time, and the monitoring data of the embedded system corresponding to different software terminal pages can be accurately obtained, and the monitoring display of the embedded system is more comprehensive and intuitive, thereby improving the monitoring and management capabilities of the embedded system; because the embedded system generates a return data packet for data upload according to the software terminal page of the host computer, the simultaneous transmission of each sensor data and other data is avoided, which leads to excessive data processing and prone to packet loss and delay problems.
[0030] The embodiments of the present application are further described below in conjunction with the accompanying drawings.
[0031] Figure 1 Schematic diagram of a communication system composed of an embedded system and a host computer provided in an embodiment of the present application. Figure 1 As shown, the communication system includes an embedded system host, a sensor and a software terminal.
[0032] The embedded system host is connected to multiple sensors, and the embedded system host and the software terminal are connected to each other based on the User Datagram Protocol (UDP). It can be understood that the software terminal is a host computer with corresponding software installed.
[0033] The embedded system host sends a data packet carrying a flag bit to the software terminal through the UDP protocol, where the flag bit can be 1, 2, ..., N. The software terminal receives the data packet, confirms the software terminal page corresponding to the data packet according to the flag bit carried by the data packet, parses the content of the data packet, writes the parsed data to the corresponding position of the corresponding software terminal page and displays it, presenting an operation interaction interface. The software terminal issues instructions through the UDP protocol to instruct the embedded system host to change the uploaded data packet or change the internal data settings. It can be understood that the flag bit corresponds to the function code in other embodiments, and is used to indicate the corresponding software terminal page.
[0034] In one embodiment, the embedded system host and the plurality of sensors are electrically connected or communicatively connected.
[0035] In one embodiment, the embedded system host and the software terminal are connected to each other through a network cable. The network cable communication is adopted, and the final communication verification is completed through the data packet returned by the embedded system.
[0036] The communication system of the present application is connected through a network cable and uses the UDP protocol for transmission. Compared with general USB serial port and other connection methods, it can significantly reduce the probability of packet loss and reduce latency. When the network is congested, it gives priority to processing and recovery of real-time and important data, effectively avoiding data loss. The communication system of the present application can also enable the host computer to monitor the status of the embedded system in real time by judging the return form and flag bit of the data packet, accurately reflect the value of the embedded system detector, and directly and effectively monitor the sensor end. It can be used in application fields such as sensor end status monitoring and machine tool protection control.
[0037] Figure 2 1 is a flow chart of a communication method provided by an embodiment of the present application. Figure 2 As shown, the communication method is applied to an embedded system, or an embedded system host in the communication system provided in the above embodiment, and is not specifically limited here. Figure 2 In the embodiment of the present invention, the communication method may include but is not limited to steps S110, S120, S130, S140 and S150.
[0038] Step S110: receiving an operation instruction sent by a host computer, wherein the operation instruction includes an upload instruction type and a function code.
[0039] In one embodiment, the operation instruction is a 16-bit instruction. The host computer sends the 16-bit operation instruction to the embedded system so that the embedded system parses the operation data and transmits response data back or executes corresponding operations.
[0040] Exemplarily, the operation instruction includes bit_0 to bit_15, a total of 16 positions. Among them, bit_0 means the different upload instruction types corresponding to different software terminal pages, which is used to distinguish the instruction types for operations on different software terminal pages; bit_1 means the UDP function code, that is, the function code, which is used to indicate the software terminal page corresponding to the operation instruction; bit_2 means the scene configuration code, which is used to indicate the specific page configuration of the corresponding software terminal page, which is equivalent to the flag check bit; bit_3 means whether the operation instruction is a read instruction or a write instruction; bit_4 to bit_6 mean address information, which is used to indicate the data storage location in the embedded system; bit_7 means the data length of the write data; bit_8 to bit_13 mean the specific written data, and the number of bits of data written is determined according to the size of bit_7; bit_14 and bit_15 mean the CRC check bit.
[0041] It can be understood that the operation instructions of the above examples are only examples of the operation instructions of the present application. In actual applications, the definitions of various positions of the operation instructions can be modified according to actual needs and are not specifically limited here.
[0042] In one embodiment, the upload instruction types include read instructions, write instructions, modify instructions, full data save instructions, batch processing instructions, and activation setting instructions.
[0043] Through the setting of operation instructions, the operation instructions are sent to the embedded system for analysis to return the corresponding data or execute the corresponding operation. The specific processing is accepted and processed by the embedded system program, which can meet the complex instructions while making the embedded system easy to parse and the data volume is small.
[0044] Step S120: confirm the operation type according to the upload instruction type. After receiving the operation instruction sent by the host computer, the embedded system parses the operation instruction, obtains the upload instruction type from the operation instruction, and confirms the operation type according to the upload instruction type, that is, confirms whether the host computer needs to perform a read operation, a write operation, or a modification operation on the embedded system, or a special operation such as full data preservation, batch processing, activation settings, etc.
[0045] Step S130: According to the function code, confirm the corresponding software terminal page from the multiple software terminal pages of the host computer. The host computer is provided with multiple software terminal pages, and different software terminal pages are used to display the monitoring contents of different embedded systems. Different function codes correspond to different software terminal pages of the host computer one by one; it can be understood that the mapping relationship between the function code and the software terminal page of the host computer can be preset or modified according to the needs during the operation. The embedded system receives the operation instruction issued by the host computer, obtains the function code in the operation instruction, and confirms the software terminal page corresponding to the operation instruction according to the function code.
[0046] Step S140: Execute the corresponding operation according to the operation type and function code, and generate a return data packet. The embedded system executes corresponding operations such as data reading, data writing, and data modification according to the operation type obtained from the operation instruction. It can be understood that when the corresponding operation is completed, the sensor data in the embedded system and the status of the corresponding sensor will be updated accordingly according to the operation. The embedded system confirms the software terminal page corresponding to the operation instruction according to the function code, and generates a return data packet according to the data required by the corresponding software terminal page; wherein the return data packet includes the corresponding upload instruction type, function code, and monitoring data corresponding to the corresponding software terminal page. It can be understood that the monitoring data is the relevant data received and stored by the embedded system and each sensor connected to it.
[0047] In one embodiment, the returned data packet is a Byte data packet of 0 to 102 bits. For example, Figure 3 A schematic diagram of the format of a return data packet provided for an example of this application, such as Figure 3 As shown, the 0th bit of the returned data packet is the packet order, the 1st bit is the upload instruction type, the 2nd bit is the function code, and the 3rd to 102nd bits are other data, that is, the monitoring data corresponding to the software terminal page corresponding to the function code.
[0048] In one embodiment, generating a return data packet includes: obtaining monitoring data corresponding to a corresponding software terminal page according to a function code; and writing the monitoring data corresponding to the corresponding software terminal page into a return data packet according to a preset position, wherein the preset position is obtained according to the function code. The embedded system confirms the software terminal page corresponding to the function code according to the function code, thereby confirming the monitoring data required by the software terminal page. The embedded system confirms the corresponding position of each monitoring data in the return data packet according to the corresponding software terminal page, and writes each monitoring data into the corresponding position in the return data packet to generate a return data packet.
[0049] The meaning of each bit of the returned data packet is synchronously defined by the embedded system and the host computer. Different representative meaning tables are set for different software terminal pages. The representative meaning table is used to indicate the meaning of each bit of the returned data packet. It is understandable that the representative meaning table can be added, deleted, or modified according to different actual scene requirements. It can be pre-set or modified according to requirements during the communication process.
[0050] The embedded system has a limited amount of data to transmit at one time and cannot adapt to the complex and diverse sensor-side monitoring environment. Therefore, different data packets are used to display and control different software terminal pages. The return data packets generated according to different function codes contain different data. Different software terminal pages display the data obtained by parsing the return data packets through corresponding different representative meaning tables, which greatly enhances the data operability.
[0051] In one embodiment, when the upload instruction type is modification, the operation instruction also includes address information and modification value; according to the operation type and function code, the corresponding operation is performed, and the return data packet is generated, including: modifying the stored data according to the address information and the modification value; generating a return data packet according to the function code, wherein the return data packet includes the latest modified data. The host computer sends the modification value and high and low address carried by the operation instruction to the embedded system through the operation instruction. After the embedded system modifies the data at the corresponding position to the modification value, it uploads the latest modified value.
[0052] Step S150: Send the return data packet to the host computer, wherein the return data packet includes the upload instruction type, the function code, and the monitoring data corresponding to the corresponding software terminal page, so that the host computer writes the monitoring data into the corresponding software terminal page and displays it according to the return data packet. The embedded system sends the return data packet to the host computer. After receiving the return data packet, the host computer confirms the software terminal page corresponding to the return data packet according to the function code in the return data packet, disassembles the return data packet, parses to obtain the various monitoring data required for the corresponding software terminal page, writes the various monitoring data into the corresponding position of the software terminal page and displays it.
[0053] Through the communication method of the present application, the host computer sends different operation instructions to the embedded system, and different operation instructions cause the embedded system to send back different return data packets. By judging the upload instruction type and function code of the return data packet, the software terminal page and corresponding monitoring data corresponding to the return data packet are confirmed, so that the state of the embedded system can be monitored in real time, the value of the embedded system detector can be accurately reflected, and the sensor end of the embedded system can be directly and effectively monitored.
[0054] In one embodiment, the communication method of the present application can be applied to scenarios with embedded systems such as articulated robots, gantries, and machine tool collision avoidance. It can monitor the spindle movement and processing status throughout the process, reduce the delay in device data transmission, and increase more operability.
[0055] Figure 4 FIG. 1 is a flow chart of a communication method provided by another embodiment of the present application. Figure 4 As shown, the communication method is applied to a host computer, or a host computer / software terminal of the communication system provided in the above embodiment, and is not specifically limited here. Figure 4 In the embodiment of the present invention, the communication method may include but is not limited to steps S210, S220 and S230.
[0056] Step S210: sending an operation instruction to the embedded host so that the embedded host executes the communication method provided by any of the above embodiments.
[0057] Step S220: receiving a return data packet sent by the embedded host.
[0058] Step S230: writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet.
[0059] In one embodiment, writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet includes: confirming the software terminal page corresponding to the returned data packet according to the function code in the returned data packet; writing the monitoring data in the returned data packet into the corresponding software terminal page and displaying it.
[0060] In one embodiment, writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet includes: obtaining a representative meaning table corresponding to the function code according to the function code in the returned data packet; converting the monitoring data into a displayable language according to the representative meaning table and the position of the monitoring data in the returned data packet; and writing the converted monitoring data into the corresponding software terminal page and displaying it.
[0061] It can be understood that the communication method applied to the host computer of the present application and the communication method applied to the embedded system of the present application are corresponding interactive side methods. Therefore, the specific implementation details and work flow of the communication method applied to the host computer and the corresponding beneficial effects of the implementation all correspond to the communication method applied to the embedded system and will not be repeated here.
[0062] Figure 5 Schematic diagram of the structure of an embedded system provided by an embodiment of the present application. Figure 5 As shown, the embedded system 2000 includes a memory 2100 and a processor 2200. The number of the memory 2100 and the processor 2200 can be one or more. Figure 5 In the example, a memory 2101 and a processor 2201 are taken; the memory 2101 and the processor 2201 in the network device can be connected via a bus or other means. Figure 5 The example of connecting through bus is taken in the following.
[0063] The memory 2101 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the method provided in any embodiment of the present application. The processor 2201 implements the communication method provided in any of the above embodiments by running the software programs, instructions and modules stored in the memory 2101.
[0064] The memory 2101 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function. In addition, the memory 2101 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device or other non-volatile solid-state storage device. In some instances, the memory 2101 further includes a memory remotely arranged relative to the processor 2201, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.
[0065] Figure 6 Schematic diagram of the structure of the host computer provided in one embodiment of the present application. Figure 6 As shown, the host computer 3000 includes a memory 3100 and a processor 3300. The number of the memory 3100 and the processor 3300 can be one or more. Figure 6 In the example, a memory 3101 and a processor 3301 are taken; the memory 3101 and the processor 3301 in the network device can be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0066] The memory 3101 is a computer-readable storage medium that can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the method provided in any embodiment of the present application. The processor 3301 implements the communication method provided in any of the above embodiments by running the software programs, instructions and modules stored in the memory 3101.
[0067] The memory 3101 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and an application required for at least one function. In addition, the memory 3101 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device or other non-volatile solid-state storage device. In some instances, the memory 3101 further includes a memory remotely arranged relative to the processor 3301, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0068] An embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute a communication method as provided in any embodiment of the present application.
[0069] The system architecture and application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of the system architecture and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.
[0070] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0071] In hardware implementation, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those of ordinary skill in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and can be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0072] The terms "component", "module", "system", etc. used in this specification are used to represent computer-related entities, hardware, firmware, a combination of hardware and software, software, or software in execution. For example, a component can be, but is not limited to, a process running on a processor, a processor, an object, an executable file, an execution thread, a program, or a computer. By way of illustration, both applications running on a computing device and a computing device can be components. One or more components may reside in a process or an execution thread, and a component may be located on a computer or distributed between two or more computers. In addition, these components may be executed from various computer-readable media having various data structures stored thereon. Components may communicate, for example, through local or remote processes based on signals having one or more data packets (e.g., data from two components interacting with another component between a local system, a distributed system, or a network, such as the Internet interacting with other systems through signals).
[0073] The above describes some embodiments of the present application with reference to the accompanying drawings, but does not limit the scope of the present application. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present application shall be within the scope of the present application.
Claims
1. A communication method, characterized in that: Applied to an embedded system, the method comprises: Receiving an operation instruction sent by a host computer, wherein the operation instruction includes an upload instruction type and a function code; According to the upload instruction type, confirm the operation type; According to the function code, confirm the corresponding software terminal page from a plurality of software terminal pages of the host computer; According to the operation type and the function code, a corresponding operation is performed and a return data packet is generated; Sending the return data packet to the host computer, wherein the return data packet includes the upload instruction type, the function code, and the monitoring data corresponding to the corresponding software terminal page, so that the host computer writes the monitoring data into the corresponding software terminal page and displays it according to the return data packet; The host computer writes the monitoring data into the corresponding software terminal page and displays it according to the returned data packet, including: The host computer obtains a representative meaning table corresponding to the function code according to the function code in the returned data packet; The host computer converts the monitoring data into a displayable language according to the representative meaning table and the position of the monitoring data in the returned data packet; The host computer writes the converted monitoring data into the corresponding software terminal page and displays it.
2. The communication method according to claim 1, characterized in that: The generating of the return data packet comprises: According to the function code, obtaining monitoring data corresponding to the corresponding software terminal page; The monitoring data corresponding to the corresponding software terminal page is written into the return data packet according to a preset position, wherein the preset position is obtained according to the function code.
3. The communication method according to claim 1, characterized in that: The upload instruction types include read instructions, write instructions, modify instructions, full data save instructions, batch processing instructions, and activation setting instructions.
4. The communication method according to claim 3, characterized in that: When the upload instruction type is a modification instruction, the operation instruction further includes address information and a modification value; and performing a corresponding operation according to the operation type and the function code and generating a return data packet includes: Modify the stored data according to the address information and the modification value; The return data packet is generated according to the function code, wherein the return data packet includes the latest modified data.
5. A communication method, characterized in that: Applied to a host computer, the method includes: Sending an operation instruction to the embedded system so that the embedded system executes the communication method according to any one of claims 1 to 4; Receiving a return data packet sent by the embedded system; Writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet; Wherein, writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet comprises: According to the function code in the returned data packet, obtaining a representative meaning table corresponding to the function code; converting the monitoring data into a displayable language according to the representative meaning table and the position of the monitoring data in the returned data packet; The converted monitoring data is written into the corresponding software terminal page and displayed.
6. The communication method according to claim 5, characterized in that: Writing the monitoring data into the corresponding software terminal page and displaying it according to the returned data packet comprises: According to the function code in the returned data packet, confirm the software terminal page corresponding to the returned data packet; The monitoring data in the returned data packet is written into the corresponding software terminal page and displayed.
7. An embedded system, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the communication method as claimed in any one of claims 1 to 4 when executing the computer program.
8. A host computer, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the communication method as claimed in any one of claims 5 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the communication method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Industrial site man-machine interaction terminal and control system
CN113515480A
Method and system compatible with communication interaction of different devices, storage medium and device
CN115482633A