An upgrading method, device, equipment and storage medium for a PLC device
By receiving and processing updated data in the background during the PLC device operation stage, generating and switching to a new program, the impact of the PLC device on the operating status when modifying the program during operation is solved, and the online upgrade and stable operation of the PLC device is achieved.
Patent Information
- Application Number
- CN202111349573.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-15
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2041-11-15
AI Technical Summary
When modifying programs during operation of PLC equipment, it is difficult to avoid affecting the operating status of the PLC equipment, resulting in the inability to complete the continuous operations normally.
During the PLC device operation stage, the updated data sent by the upper computer is received in the background, new programs and new data corresponding to each program change point, and old programs and old data corresponding to each program change point. Update new data for new programs based on old data, and switch to new programs and updated new data during two adjacent scan weeks to continue running to achieve online upgrades.
By completing the download and compilation of new programs in the background, changing the program during operation interrupts the execution of the original program, the online upgrade of the PLC device is achieved, and the impact of modifying the program on the operating status of the PLC device is avoided.
Smart Images

Figure CN113986321B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of equipment upgrading, and more specifically, to an upgrading method, device, equipment and storage medium for a PLC device. Background Art
[0002] With the development of automation in the industrial control industry, the application of PLC (Programmable Logic Controller) is increasing, and the demand for on-site upgrading and program modification is also increasing. Due to actual production needs in many industrial sites, it is necessary to ensure that the PLC device does not stop during upgrading. PLC programmers also hope to directly see the running results after changing the program during equipment debugging. Currently, the following solutions are mainly included when modifying the program during operation:
[0003] Solution 1: It can operate in the manner of stopping, downloading, and compiling when normally downloading the program, but the output is not disconnected and the data is not cleared during the stop to maintain the continuous operation of the machine. However, in this method, the program actually still goes through a stop process. During the process of downloading the program, the PLC device is in a state where the output is uncontrolled during the stop, which is somewhat dangerous. Moreover, the execution of many program instructions is affected by the state before operation (such as pulse signals), and the re - operation will be inconsistent with continuous operation; and it will interrupt the instructions during continuous operation. These may cause the continuous actions controlled by the PLC to be unable to continue to be completed normally.
[0004] Solution 2: Adopt the scheme of double program storage areas. When downloading, the program is saved in the backup buffer area, and after the download is completed, it is switched to the new program at the end of the cyclic scan. This scheme optimizes the problem that the output is uncontrolled during the download process in Solution 1, but the same as Solution 1, it will still affect the running state of the PLC.
[0005] Solution 3: Divide the program into different program segments (such as sub - programs, interrupt programs, etc.), compile each segment separately, and when downloading during operation, compile and download the modified part of the program code separately. Although this scheme optimizes the scope of the impact on the running state of the PLC in Solution 2, it still does not solve this problem. The part of the program that is recompiled and executed still starts running from the beginning.
[0006] Therefore, how to avoid affecting the running state of the PLC device when modifying the program during the operation of the PLC device is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0007] The purpose of the present invention is to provide an upgrading method, device, equipment and storage medium for a PLC device to avoid affecting the running state of the PLC device when modifying the program during the operation of the PLC device.
[0008] To achieve the above object, the present invention provides an upgrading method for a PLC device, including:
[0009] During the operation stage of the PLC device, receive the update data sent by the host computer in the background;
[0010] Generate new programs and new data corresponding to each program change point according to the update data, and find the old programs and old data corresponding to each program change point;
[0011] Update the new data of the new program according to the old data;
[0012] During two adjacent scan cycles in the operation stage, control the PLC device to switch to the new program and the updated new data to continue running, so as to perform online upgrading on the PLC device.
[0013] Among them, the finding of the old programs and old data corresponding to each program change point includes:
[0014] According to the starting address of the program change point recorded in each update data and the length of the program segment before the change, determine the optimized running program and the running data corresponding to the running program;
[0015] Determine the old program before optimization corresponding to the running program;
[0016] Obtain the old data by using the old program and the running data.
[0017] Among them, the updating of the new data of the new program according to the old data includes:
[0018] Update the running status of the instructions in the new data according to the running status of the instructions in the old data.
[0019] Among them, the receiving of the update data sent by the host computer in the background includes:
[0020] Receive the update data corresponding to each program change point sent by the host computer in the background;
[0021] Verify the program content after the change recorded in the update data;
[0022] If the verification is successful, execute the step of generating new programs and new data corresponding to each program change point according to the update data.
[0023] Among them, before receiving the update data sent by the host computer in the background, it further includes:
[0024] The host computer receives an online programming mode instruction;
[0025] Verify whether the original program stored in the host computer is the same as the original program of the PLC device;
[0026] If so, modify the original program on the host computer to generate update data corresponding to each program change point, and send the update data to the PLC device after successful verification of each update data.
[0027] After controlling the PLC device to switch to the new program and the updated new data to continue running, it further includes:
[0028] Release the old program and old data, and perform memory recycling.
[0029] After controlling the PLC device to switch to the new program and the updated new data to continue running, it further includes:
[0030] After receiving the instruction to exit the online programming mode, write the new program and the updated new data into the Flash memory.
[0031] To achieve the above object, the present invention further provides an upgrading device for a PLC device, including:
[0032] A receiving module, configured to receive update data sent by a host computer in the background during the operation stage of the PLC device;
[0033] A generating module, configured to generate a new program and new data corresponding to each program change point according to the update data;
[0034] A searching module, configured to search for the old program and old data corresponding to each program change point;
[0035] An updating module, configured to update the new data of the new program according to the old data;
[0036] A switching module, configured to control the PLC device to switch to the new program and the updated new data to continue running during two adjacent scan cycles in the operation stage, so as to perform online upgrading on the PLC device.
[0037] To achieve the above object, the present invention further provides an electronic device, including:
[0038] A memory, configured to store a computer program;
[0039] A processor, configured to implement the steps of the above upgrading method for the PLC device when executing the computer program.
[0040] To achieve the above object, the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above-mentioned PLC device upgrade method are implemented.
[0041] As can be seen from the above solution, the present invention provides an upgrade method, device, equipment and storage medium for a PLC device; in this solution, during the operation stage of the PLC device, update data sent by the upper computer is received in the background; new programs and new data corresponding to each program change point are generated according to the update data, and the old programs and old data corresponding to each program change point are searched; the new data of the new program is updated according to the old data; during two adjacent scan cycles in the operation stage, the PLC device is controlled to switch to the new program and the updated new data to continue running, so as to perform online upgrade on the PLC device; it can be seen that in this solution, the download and compilation processes of the new program are both completed in the background. In this way, it is possible to avoid interrupting the execution of the original program when changing the program during operation, and to achieve online upgrade of the PLC device; moreover, when updating the program in this solution, the old data of the old program also needs to be updated to the new data of the new program, so as to avoid the impact of modifying the program on the running state of the PLC device. BRIEF DESCRIPTION OF THE DRAWINGS
[0042] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the following drawings are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0043] Figure 1 It is a schematic flowchart of an upgrade method for a PLC device disclosed in an embodiment of the present invention;
[0044] Figure 2 It is a schematic diagram of data before update disclosed in an embodiment of the present invention;
[0045] Figure 3 It is a schematic diagram of searching for program segments disclosed in an embodiment of the present invention;
[0046] Figure 4 It is a schematic diagram of program update disclosed in an embodiment of the present invention;
[0047] Figure 5 It is a schematic diagram of the memory distribution after online programming is completed disclosed in an embodiment of the present invention;
[0048] Figure 6 It is a schematic structural diagram of an upgrade device for a PLC device disclosed in an embodiment of the present invention;
[0049] Figure 7 Schematic diagram of the structure of an electronic device disclosed in an embodiment of the present invention. Specific embodiments
[0050] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the scope of protection of the present invention.
[0051] See Figure 1 , a schematic flowchart of an upgrade method for a PLC device provided by an embodiment of the present invention, and the method specifically includes the following steps:
[0052] S101. During the operation stage of the PLC device, receive the update data sent by the host computer in the background;
[0053] Among them, before receiving the update data sent by the host computer in the background in this embodiment, it further includes: the host computer receives an online programming mode instruction; verify whether the original program stored in the host computer is the same as the original program of the PLC device; if so, modify the original program on the host computer to generate update data corresponding to each program change point, and after successful verification of each update data, send it to the PLC device.
[0054] Specifically, the operation modes of the PLC device include: stop, fault, and operation status. During the operation stage, it is executed in a cyclic scanning manner, and each scanning cycle is mainly divided into three stages: "input sampling, program execution, and output refreshing". In this solution, the user first triggers an online programming mode instruction on the host computer to select the online programming mode and verify the consistency of the upper and lower computer programs; among them, the consistency of the lower computer program means that the original program of the PLC device stored in the host computer is the same as the original program in the PLC device. Only when the original programs of the upper and lower computers are consistent can the original program of the PLC device be accurately modified through the update data after the original program is modified on the host computer; after verifying the consistency of the upper and lower computer programs, the PLC enters the online programming mode. At this time, the user can modify the original program on the host computer to generate update data for each program update point. After the modification, the user clicks the online download button on the host computer. It should be noted that when downloading the update data, the host computer can first perform a syntax check. If the check passes, multiple update data are output for downloading, and the PLC device receives them in the background until all the update data are downloaded.
[0055] It should be noted that in this solution, each program change point is downloaded in segments, that is, each program change point has corresponding update data. If a program modification involves multiple location changes at one time, multiple update data are downloaded from the host computer. After all the update data are downloaded and compiled, the switch is made uniformly. The content included in the update data includes: the starting step number (starting address) of the changed program segment, the length of the program segment before the change, the length of the program segment after the change, and the content of the program segment after the change. For addition and deletion operations, they can be uniformly represented by writing zero at the corresponding length. For example, the length of the program segment before the addition operation is zero, and the length of the program segment after the deletion operation is zero.
[0056] Furthermore, in this solution, after receiving the update data corresponding to each program change point sent by the host computer in the background, the content of the program segment after the change in the update data will be compiled first before running. The compilation mainly performs the following two parts of work:
[0057] 1) Syntax check of the new program. That is: after this solution receives the update data corresponding to each program change point sent by the host computer in the background, it is first necessary to check the content of the program segment after the change recorded in the update data; if the check is successful, the step of generating a new program and new data corresponding to each program change point according to the update data is executed. Among them, this check includes integrity check and syntax check of the content of the program segment after the change. Only after both checks are successful, can the subsequent operations be continued.
[0058] 2) Comparison between the old and new programs to achieve the switch of the running state. For example: when the trigger instruction changes, the corresponding status record needs to be written from the old program data stack to the new program stack to ensure the unity of the running states of the old and new programs. For instructions that need multiple cycles to complete, if they change or are deleted during operation, it is necessary to decide whether to continue running, pause or force to end according to the instructions and configurations.
[0059] S102. Generate a new program and new data corresponding to each program change point according to the update data, and search for the old program and old data corresponding to each program change point;
[0060] In this embodiment, each program change point has corresponding update data, and the content of the program segment after the change in this upgrade is recorded in the update data. After the content of the program segment after the change is successfully checked, a new program and new data corresponding to each program change point are first generated. Then, according to the starting address of the program change point and the length of the program segment before the change recorded in each update data, the optimized running program and the running data corresponding to the running program are determined, the old program before optimization corresponding to the running program is determined, and the old data is obtained by using the old program and the running data.
[0061] It should be noted that in this solution, dedicated data stacks are generated for the new and old program segments after the change. Specifically, since some instructions are also affected by the previous execution state of the program. For example, the pulse trigger instruction is triggered by the change in the input conditions in the two cycles before and after. And some operations such as communication require multiple cycles to complete. The data records of this part are scattered in different data areas. Operating them individually is not only cumbersome but also unsafe. Therefore, for the part of the program and addresses involved before and after the program change in this solution, a dedicated data stack is generated before compilation to combine the data involved in the change for unified modification. For example, the new program and new data are stored through the new program stack and new data stack, and the old program and old data are stored through the old program stack and old data stack.
[0062] Moreover, since the normal program will be optimized and compiled during operation, the execution of the optimized program may no longer correspond one by one to the specific statement order. Therefore, when the program involved in the online modification of this application is executed, it will first switch back to the unoptimized program. Therefore, this solution first locates the optimized running program and the running data corresponding to the running program according to the starting address of the program change point recorded in each update data and the length of the program segment before the change. Then, it searches for the unoptimized old program corresponding to the optimized running program in the original program of the PLC device, generates an old program stack, and then uses the old program and running data to obtain the old data again.
[0063] S103. Update the new data of the new program according to the old data;
[0064] Specifically, when this application updates the new data of the new program according to the old data, it is specifically to update the running state of the instructions in the new data according to the running state of the instructions in the old data. That is: when this solution modifies the program of the PLC device online, in order to avoid affecting the running state of the PLC device, it first reloads the old program before optimization and generates a visible new program to replace the old program for running. Then, by comparing the new data and the old data, the running state of the instructions in the old data is updated to the running state of the instructions in the new data to ensure the unity of the running states of the new and old programs. Then, it switches to run during the program scan cycle. In this way, the operation states before and after running are maintained unified.
[0065] S104. During the two adjacent scan cycles in the running stage, control the PLC device to switch to the new program and the updated new data to continue running, so as to perform online upgrade on the PLC device.
[0066] In this solution, the program is specifically updated during the scan cycle of program execution to avoid changing the program during operation and interrupting the execution of the original program. The download and compilation of the program are completed in the background without affecting the program execution. Moreover, this solution compares the old and new program stacks and data stacks, updates the running status of the instructions in the new data stack according to the running status of the instructions in the old data stack, and after checking the changed and deleted instructions in the new program, closes the background thread function that controls the operation of the old program, and changes the instructions in the program stack and data stack during the program scan cycle to make the program execution jump to the new program and data stack for execution.
[0067] Furthermore, after this solution controls the PLC device to switch to the new program and the updated new data to continue running, it also includes: releasing the old program and old data, and performing memory recycling. And after receiving the instruction to exit the online programming mode, the new program and the updated new data will be written into the Flash memory. Specifically, after the completion of this online programming modification, data can be returned to notify the host computer of the updated status, and this application can continue to perform multiple programming change operations before exiting the online programming mode. After receiving the instruction to exit the online programming mode, the updated data will be uniformly written into the Flash record, and the online programming is completed.
[0068] See Figure 2 , a schematic diagram of the data before update provided by the embodiment of the present invention; wherein, the running program stack is the stack where the optimized original program of the PLC device is located, and the data stack is the data stack of the original program; Figure 2 The content included in each update data on the right side includes: the starting address of each program change point, the length before change, the length after change, and the program content after change. See Figure 3 , a schematic diagram of the search program segment provided by the embodiment of the present invention, through Figure 3 it can be seen that at each program change point, according to the starting address and the length before change in the update data, the program segment before modification is searched from the running program stack, and this program segment before modification is the optimized running program. Correspondingly, the data searched from the data stack is the running data corresponding to this running program. See Figure 4 , a schematic diagram of program update provided by the embodiment of the invention. After the program content after change is compiled, a new program segment and a new data segment are generated. The unoptimized old program segment is determined according to the program segment before modification and the old data is regenerated, and the new data segment is updated according to the old data. See Figure 5 , a schematic diagram of the memory distribution after the completion of online programming provided by the embodiment of the invention. It can be seen that the memory of the running program in the running program stack and the running data in the data stack have been released, and the program runs and switches to the compiled new program segment and new data segment to continue running at the program change point.
[0069] In summary, in this solution, a method for modifying a program during operation is proposed, which can change the program during program operation and reduce the impact on the program operation state. Specifically, the download and compilation processes of the new program in this solution are both completed in the background. In this way, it is possible to avoid interrupting the execution of the original program when changing the program during operation, and achieve online upgrading of the PLC device. Moreover, when updating the program in this solution, it is also necessary to update the old data of the old program to the new data of the new program together, so as to avoid affecting the operation state of the PLC device when modifying the program.
[0070] Next, the upgrading device, equipment, and storage medium provided by the embodiments of the present invention will be introduced. The upgrading device, equipment, and storage medium described below can be referred to each other with the upgrading method described above.
[0071] See Figure 6 , a schematic structural diagram of an upgrading device for a PLC device provided by an embodiment of the present invention, includes:
[0072] A receiving module 11, configured to receive update data sent by a host computer in the background during the operation stage of the PLC device;
[0073] A generating module 12, configured to generate a new program and new data corresponding to each program change point according to the update data;
[0074] A searching module 13, configured to search for the old program and old data corresponding to each program change point;
[0075] An updating module 14, configured to update the new data of the new program according to the old data;
[0076] A switching module 15, configured to control the PLC device to switch to the new program and the updated new data to continue running during two adjacent scan cycles in the operation stage, so as to perform online upgrading on the PLC device.
[0077] Among them, the searching module is specifically configured to: determine the optimized running program and the running data corresponding to the running program according to the start address of the program change point recorded in each update data and the length of the program segment before the change; determine the old program before optimization corresponding to the running program; and obtain the old data by using the old program and the running data.
[0078] Among them, the updating module is specifically configured to: update the running state of the instructions in the new data according to the running state of the instructions in the old data.
[0079] Among them, the receiving module is specifically configured to: receive in the background the update data corresponding to each program change point sent by the host computer; verify the changed program content recorded in the update data; and trigger the generating module if the verification is successful.
[0080] Among them, the host computer is specifically configured to: receive an in - line programming mode instruction, verify whether the original program stored in the host computer is the same as the original program of the PLC device. If so, modify the original program in the host computer to generate update data corresponding to each program change point, and send the update data to the PLC device after successful verification of each update data.
[0081] Among them, the device further includes:
[0082] A release module, configured to release the old program and old data, and perform memory recovery.
[0083] A writing module, configured to write the new program and the updated new data into the Flash memory after receiving an instruction to exit the in - line programming mode.
[0084] See Figure 7 , a schematic structural diagram of an electronic device provided by an embodiment of the present invention, includes:
[0085] A memory 21, configured to store a computer program;
[0086] A processor 22, configured to implement the steps of the upgrading method of the PLC device as described in any of the above - mentioned method embodiments when executing the computer program.
[0087] In this embodiment, the device is specifically a PLC device. The device may include a memory 21, a processor 22, and a bus 23.
[0088] Among them, the memory 21 includes at least one type of readable storage medium. The readable storage medium includes flash memory, hard disk, multimedia card, card - type memory (for example, SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, storage chip, etc. The memory 21 may be an internal storage unit of the device in some embodiments, such as the hard disk of the device. The memory 21 may also be an external storage device of the device in other embodiments, such as a plug - in hard disk equipped on the device, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. Further, the memory 21 may include both the internal storage unit and the external storage device of the device. The memory 21 can be used not only to store application software installed on the device and various types of data, such as program codes for executing the upgrading method, but also to temporarily store data that has been output or will be output.
[0089] In some embodiments, the processor 22 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips, such as an ARM (Advanced RISC Machines) chip, which is used to run the program code stored in the memory 21 or process data, for example, execute the program code of the upgrade method, etc.
[0090] The bus 23 may be a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or the like. The bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, Figure 7 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.
[0091] Furthermore, the device may further include a network interface 24 and peripheral circuits 25. The network interface 24 may optionally include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the device and other electronic devices.
[0092] Figure 7 Only the device with components 21-25 is shown. Those skilled in the art can understand that Figure 7 the shown structure does not constitute a limitation on the device, and it may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0093] An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the steps of the upgrade method of the PLC device as described in any of the above method embodiments.
[0094] Among them, the storage medium may include: various media that can store program code, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc.
[0095] In this specification, the various embodiments are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the various embodiments can be referred to each other.
[0096] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for upgrading a PLC device, characterized in that, it includes: During the operation stage of the PLC device, receive the update data sent by the host computer in the background; The update data includes: the start step number of the changed program segment, the length of the program segment before the change, the length of the program segment after the change, and the content of the program segment after the change; Generate a new program and new data corresponding to each program change point according to the update data, and find the old program and old data corresponding to each program change point; Update the new data of the new program according to the old data; During the two adjacent scan cycles in the operation stage, control the PLC device to switch to the new program and the updated new data to continue running, so as to perform online upgrade on the PLC device; Among them, the finding of the old program and old data corresponding to each program change point includes: According to the start address of the program change point recorded in each update data and the length of the program segment before the change, determine the optimized running program and the running data corresponding to the running program, including: at each program change point, according to the start address and the length before the change in the update data, find the program segment before modification from the running program stack, and the program segment before modification is the optimized running program, and the data found from the data stack is the running data corresponding to the running program; the running program stack is the stack where the optimized original program of the PLC device is located, and the data stack is the data stack of the original program; Determine the old program before optimization corresponding to the running program; Obtain the old data by using the old program and the running data; Among them, the updating of the new data of the new program according to the old data includes: Update the running status of the instructions in the new data according to the running status of the instructions in the old data.
2. The upgrading method according to claim 1, characterized in that, The receiving of the update data sent by the host computer in the background includes: Receive the update data corresponding to each program change point sent by the host computer in the background; Verify the content of the program segment after the change recorded in the update data; If the verification is successful, execute the step of generating a new program and new data corresponding to each program change point according to the update data.
3. The upgrading method according to claim 1, characterized in that, Before receiving the update data sent by the host computer in the background, it further includes: The host computer receives an online programming mode instruction; Verify whether the original program stored in the host computer is the same as the original program of the PLC device; If so, modify the original program on the host computer to generate update data corresponding to each program change point, and send it to the PLC device after successful verification of each update data.
4. The upgrading method according to claim 1, characterized in that, After controlling the PLC device to switch to the new program and the updated new data to continue running, it further includes: Release the old program and old data, and perform memory recycling.
5. The upgrading method according to any one of claims 1 to 4, characterized in that, After controlling the PLC device to switch to the new program and the updated new data to continue running, it further includes: After receiving the instruction to exit the online programming mode, the new program and the updated new data are written into the Flash memory.
6. An upgrading device for a PLC device, characterized in that, it includes: a receiving module, configured to receive updated data sent by a host computer in the background during the operation stage of the PLC device; the updated data includes: the starting step number of the changed program segment, the length of the program segment before change, the length of the program segment after change, and the content of the program segment after change; a generating module, configured to generate a new program and new data corresponding to each program change point according to the updated data; a searching module, configured to search for the old program and old data corresponding to each program change point; an updating module, configured to update the new data of the new program according to the old data; a switching module, configured to control the PLC device to switch to the new program and the updated new data to continue running during two adjacent scan cycles in the operation stage, so as to perform online upgrading on the PLC device; wherein, the searching module is specifically configured to determine the optimized running program and the running data corresponding to the running program according to the starting address of the program change point recorded in each updated data and the length of the program segment before change, including: at each program change point, according to the starting address and the length before change in the updated data, searching for the program segment before modification from the running program stack, the program segment before modification is the optimized running program, and the data searched from the data stack is the running data corresponding to the running program; determining the old program before optimization corresponding to the running program; obtaining the old data by using the old program and the running data; the running program stack is the stack where the optimized original program of the PLC device is located, and the data stack is the data stack of the original program; wherein, the updating module is specifically configured to update the running status of the instructions in the new data according to the running status of the instructions in the old data.
7. An electronic device, characterized in that, it includes: a memory, configured to store a computer program; a processor, configured to implement the steps of the upgrading method of the PLC device according to any one of claims 1 to 5 when executing the computer program.
8. A computer-readable storage medium, characterized in that, a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the upgrading method of the PLC device according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
An on-line upgrading method, device and system of a single chip microcomputer program
CN109358887A
Device for processing programmable logic controller program
CN110442074A