A data communication method between a host computer and a PLC and a communication system thereof
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- MAXWELL TECH (ZHUHAI) CO LTD
- Filing Date
- 2022-08-16
- Publication Date
- 2026-06-26
Smart Images

Figure CN115328829B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data communication technology, and more specifically to a data communication method and system between a host computer and a PLC. Background Technology
[0002] In certain industrial fields, such as laser processing, data transmission between the host computer and the PLC is time-consuming due to the large volume of processing data. For example, in laser cutting, the amount of processing data is enormous, and frequent data transmission is necessary for data corrections during the cutting process, making data transmission very time-consuming. Currently, conventional solutions include the following two:
[0003] (1) The host computer sends all the data at once, corrects it, and then sends all the corrected data. The disadvantage of this scheme is that the amount of data sent at one time is large and the time is long.
[0004] (2) The host computer sends out multiple sets of data, and sends them out again after cutting them into multiple sets; the disadvantage of this scheme is that the number of times the data is sent out is large, and the total time will be longer.
[0005] However, regardless of the method used, it will consume a lot of time and may cause instability in data transmission, which will affect the efficiency of cutting and processing. Summary of the Invention
[0006] (1) Technical issues
[0007] To address the aforementioned technical problems, this invention provides a data communication method and system between a host computer and a PLC, which enables the transmission of multiple sets of data simultaneously during cutting and processing. This eliminates the need for separate time consumption for transmitting processing data, shortens the transmission time of processing data, and improves the efficiency of processing data transmission, thereby enhancing the efficiency of laser processing.
[0008] (2) Technical solution
[0009] On one hand, the present invention provides a data communication method between a host computer and a PLC, comprising the following steps:
[0010] Step S100: The host computer sends data D11 to pool A; and sends data D21 to pool A1.
[0011] Step S200: The PLC reads data D11 from pool A and sends it to pool B; the host computer sends data D12 to pool A; the PLC reads data D21 from pool A1 and sends it to pool B1; the host computer sends data D22 to pool A1.
[0012] Step S300: When the start-up conditions of pool B are met, the PLC reads data D11 from pool B for processing, and pool B1 is in a waiting state at this time; after the processing is completed by the PLC using data D11 from pool B, the PLC reads data D12 from pool A and sends it to pool B; the host computer sends data D13 to pool A.
[0013] Step S400: When the start-up conditions of pool B1 are met, the PLC reads data D21 from pool B1 for processing, and pool B is in a waiting state at this time; after the processing is completed by the PLC reading data D21 from pool B1, the PLC reads data D22 from pool A1 and sends it to pool B1; the host computer sends data D23 to pool A1.
[0014] Step S500: Repeat steps S300 and S400 to complete the sending of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the host computer, the reading of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the PLC, and the use of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m for processing. n is a positive integer and m is a positive integer.
[0015] Further, steps S100, S200, S300, and S500 include: the host computer determining the status of pool A, sending data D11, D12, ... D1n to pool A, and marking and reading the data in pool A; steps S200, S300, and S500 include: the PLC determining the status of pool B and reading the data from pool A to pool B.
[0016] Further, steps S100, S200, S400, and S500 include: the host computer determining the status of pool A1, sending data D21, D22, ..., D2m to pool A1, and marking and reading the data in pool A1; steps S200, S400, and S500 include: the PLC determining the status of pool B1 and reading the data from pool A1 to pool B1.
[0017] Further, steps S100, S200, S300, and S500 include: after the data D11, D12, ..., D1n sent by the host computer is read from pool A, the data is verified. The verification method is: to determine whether the data D11, D12, ..., D1n read from pool A is consistent with the data D11, D12, ..., D1n sent by the host computer. If they are consistent, the verification passes; otherwise, the data D11, D12, ..., D1n from the host computer is read from pool A again.
[0018] Further, steps S100, S200, S400, and S500 include: after reading the data D21, D22, ..., D2m sent by the host computer to pool A1, the data is verified. The verification method is to determine whether the data D21, D22, ..., D2m read into pool A1 is consistent with the data D21, D22, ..., D2m sent by the host computer. If they are consistent, the verification passes; otherwise, the data D21, D22, ..., D2m from the host computer is reread into pool A1.
[0019] Further, step S300 includes: the start condition of pool B is: pool B1 is in the execution completed state; or; the start condition of pool B is: the host computer gives a start signal; and / or, step S400 includes: determining whether pool B1 is started is: pool B is in the execution completed state.
[0020] Further, steps S200, S300, and S500 include: after the PLC reads the data D11, D12, ... D1n from pool A into pool B, it verifies the data. The verification method is to determine whether the data D11, D12, ... D1n read into pool B is consistent with the data D11, D12, ... D1n from pool A. If they are consistent, the verification passes; otherwise, the data D11, D12, ... D1n from pool A is reread into pool B.
[0021] Further, steps S200, S400, and S500 include: after the PLC reads the data D21, D22, ... D2m from pool A1 into pool B1, it verifies the data. The verification method is to determine whether the data D21, D22, ... D2m read into pool B1 is consistent with the data D21, D22, ... D2m from pool A1. If they are consistent, the verification passes; otherwise, the data D21, D22, ... D2m from pool A1 is reread into pool B1. Specifically, consistency can be obtained through matching degree calculation, etc.
[0022] Further, steps S200, S300, and S500 include: when the PLC reads data D11, D12, ... D1n from pool A to pool B, the state of pool A includes: writable state; the state of pool B includes: non-writable state and executable state; and / or, steps S200, S400, and S500 further include: when the PLC reads data D21, D22, ... D2m from pool A1 to pool B1, the state of pool A1 includes: writable state; the state of pool B1 includes: non-writable state and executable state.
[0023] The present invention also provides a data communication system between a host computer and a PLC, the system employing any of the above-mentioned data communication methods, including a host computer and a PLC;
[0024] The host computer sends data D1n to pool A; and sends data D2m to pool A1.
[0025] The PLC reads data D1n from pool A and sends it to pool B; the host computer sends data D1n+1 to pool A. The PLC reads data D2m from pool A1 and sends it to pool B1; the host computer sends data D2m+1 to pool A1.
[0026] When the start-up conditions of pool B are met, the PLC reads data D1n from pool B for processing. After the processing is completed, the PLC reads data D1n+1 from pool A and sends it to pool B; the host computer sends data D1n+2 to pool A.
[0027] When the start-up conditions of pool B1 are met, the PLC reads data D2n from pool B1 to perform processing. After the processing is completed, the PLC reads data D2m+1 from pool A1 and sends it to pool B1; the host computer then sends data D2m+2 to pool A1.
[0028] After the PLC finishes processing the D1n data from pool B, it can be used to trigger the start of processing the data D2m from pool B1, which meets the start conditions of pool B1.
[0029] After the PLC reads D2m from pool B1 and completes the processing, it can be used to trigger the start-up conditions of pool B. The PLC then reads D1n+1 from pool B and performs the processing.
[0030] The system can complete the transmission of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the host computer, the reading of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the PLC, and the use of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m for processing. n is a positive integer and m is a positive integer.
[0031] (3) Beneficial effects
[0032] 1) The host computer sends data D1n to pool A; it sends data D2m to pool A1; the PLC reads data D1n from pool A and sends it to pool B; the host computer sends data D1n+1 to pool A; the PLC reads data D2m from pool A1 and sends it to pool B1; the host computer sends data D2m+1 to pool A1; when the start condition of pool B is met, the PLC reads data D1n from pool B for processing; after the processing is completed, the PLC reads data D1n+1 from pool A and sends it to pool B; the host computer sends data D1n+2 to pool A; when the start condition of pool B1 is met, the PLC reads data D1n+2 from pool B1. 2n is used for processing. After the PLC finishes processing the data D2n read from pool B1, the PLC reads data D2m+1 from pool A1 and sends it to pool B1. The host computer sends data D2m+2 to pool A1. n is a positive integer and m is a positive integer. That is, after the data in pool B is processed, the data in pool A will be loaded into pool B, and new data will also be loaded into pool A. After the data in pool B1 is processed, the data in pool A1 will be loaded into pool B1, and new data will also be loaded into pool A1. This process continues until the data is sent out, realizing the dynamic transmission of multiple sets of data and improving the stability and flexibility of the data.
[0033] 2) When the host computer sends processing data, it sends multiple data sets D11, D12, ..., D1n and D21, D22, ..., D2m to the PLC. After the host computer finishes sending multiple data sets D11, D12, ..., D1n and D21, D22, ..., D2m, it reads multiple data sets D11, D12, ..., D1n and D21, D22, ..., D2m to check if the data is consistent. Then the PLC reads multiple data sets D11, D12, ..., D1n from pool B for processing, while the host computer starts sending and checking multiple data sets D12, ..., D1n. The same process is repeated when the PLC reads multiple data sets D21, D22, ..., D2m from pool B1 for processing. Therefore, multiple data points D11, D12, ..., D1n and multiple data points D21, D22, ..., D2m have been dynamically updated during the data transmission process, ensuring timely data transmission and fast data communication.
[0034] 3) By using the AB pool data interaction method, multiple sets of processing data can be sent simultaneously during processing, so that the sending of processing data no longer consumes time individually, the transmission time of processing data is short, the data transmission efficiency is improved, the cutting and processing efficiency is improved, and at the same time, the flexibility, reliability and stability of data transmission are guaranteed, and the abnormalities caused by interference in processing data transmission and the loss of processing data can be avoided. Attached Figure Description
[0035] Figure 1This is a flowchart illustrating a data communication method between a host computer and a PLC according to this application;
[0036] Figure 2 A more detailed flowchart of a data communication method between a host computer and a PLC according to this application;
[0037] Figure 3 This is a diagram of a data communication system between a host computer and a PLC according to this application. Detailed Implementation
[0038] To better understand the technical solution of the present invention, the embodiments of the present invention will be described in detail below with reference to the accompanying drawings. The terminology used in the embodiments of the present invention is for the purpose of describing specific embodiments only and is not intended to limit the present invention. The singular forms "a," "the," and "the" used in the embodiments of the present invention and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise. "First," "second," "third," and "fourth" are merely distinguishing designations. It should also be understood that the term "and / or" used herein is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Additionally, the character " / " in this document generally indicates that the preceding and following related objects are in an "or" relationship, with multiple objects including one. It should be clearly stated that the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0039] Figure 1 This application discloses a data communication method between a host computer and a PLC, comprising the following steps:
[0040] Step S100: The host computer sends data D11 to pool A; and sends data D21 to pool A1.
[0041] Step S200: The PLC reads data D11 from pool A and sends it to pool B; the host computer sends data D12 to pool A; the PLC reads data D21 from pool A1 and sends it to pool B1; the host computer sends data D22 to pool A1.
[0042] Step S300: When the start-up conditions of pool B are met, the PLC reads data D11 from pool B for processing, and pool B1 is in a waiting state at this time; after the processing is completed by the PLC using data D11 from pool B, the PLC reads data D12 from pool A and sends it to pool B; the host computer sends data D13 to pool A.
[0043] Step S400: When the start-up conditions of pool B1 are met, the PLC reads data D21 from pool B1 for processing, and pool B is in a waiting state at this time; after the processing is completed by the PLC reading data D21 from pool B1, the PLC reads data D22 from pool A1 and sends it to pool B1; the host computer sends data D23 to pool A1.
[0044] Step S500: Repeat steps S300 and S400 to complete the sending of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the host computer, the reading of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the PLC, and the use of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m for processing. n is a positive integer and m is a positive integer.
[0045] Specifically, m can be equal to n or not equal to n, depending on the actual needs.
[0046] Specifically, initially, step S300 precedes step S400. Data from pool B is used for processing first, followed by data from pool B1, then back to pool B1, and so on, alternating sequentially. Specifically, this allows the host computer to send multiple data sets D11, D12, ..., D1n and D21, D22, ..., D2m; the PLC to read multiple data sets D11, D12, ..., D1n and D21, D22, ..., D2m; and the PLC to use these data sets for processing. Here, n and m are positive integers, meaning that data meeting the conditions in steps S400 and S300 are processed simultaneously. This also needs further explanation.
[0047] Specifically, steps S100, S200, S300, and S500 include: the host computer determining the status of pool A, sending data D11, D12, ... D1n to pool A, and marking and reading the data in pool A; steps S200, S300, and S500 include: the PLC determining the status of pool B and reading data from pool A into pool B. Specifically, the host computer determines whether pool A is writable. Specifically, the host computer sends data D11, D12, ... D1n to pool A sequentially. Once data D11, D12, ... D1n arrives at pool A, it is referred to as data in pool A; once data D11, D12, ... D1n arrives at pool B, it is referred to as data in pool B. In case of any contradiction with the following text, the actual content recorded later shall prevail.
[0048] Specifically, steps S100, S200, S400, and S500 include: the host computer determining the status of pool A1, sending data D21, D22, ..., D2m to pool A1, and marking and reading the data in pool A1; steps S200, S400, and S500 include: the PLC determining the status of pool B1 and reading the data from pool A1 into pool B1. Specifically, the host computer determines whether pool A1 is writable. Specifically, the host computer sends data D22, ..., D2m to pool A1 sequentially; data D22, ..., D2m, once received by pool A1, are referred to as data in pool A1; data D21, D22, ..., D2m, once received by pool B1, are referred to as data in pool B1. In case of any contradiction with the following text, the actual content recorded later shall prevail.
[0049] Specifically, steps S100, S200, S300, and S500 include: after the data D11, D12, ..., D1n sent by the host computer to pool A is read, the data is verified. The verification method is to determine whether the data D11, D12, ..., D1n read from pool A is consistent with the data D11, D12, ..., D1n sent by the host computer. If they are consistent, the verification passes; otherwise, the data D11, D12, ..., D1n from the host computer is read again into pool A. Specifically, the host computer sends the data D11, D12, ..., D1n to pool A sequentially, and consistency can be obtained through matching degree calculation, etc.
[0050] Specifically, steps S100, S200, S400, and S500 further include: after the data D21, D22, ..., D2m sent by the host computer to the A1 pool is read, the data is verified. The verification method is to determine whether the data D21, D22, ..., D2m read into the A1 pool is consistent with the data D21, D22, ..., D2m sent by the host computer. If they are consistent, the verification passes; otherwise, the data D21, D22, ..., D2m from the host computer is read again into the A1 pool. Specifically, the host computer sends the data D22, ..., D2m to the A1 pool sequentially, and consistency can be obtained through matching degree calculation, etc.
[0051] Specifically, step S300 includes: the start condition for pool B is: pool B1 is in the execution completed state; or; the start condition for pool B is: the host computer gives a start signal. Pool B is in a waiting state, that is, the data in pool B is waiting to be processed. Pool B1 is in the execution completed state, that is, the data in pool B1 is in the execution completed state. The following content is interpreted in the same way. In case of any contradiction with the following text, the actual content recorded later shall prevail.
[0052] Specifically, step S400 includes: determining whether pool B1 is started based on the condition that pool B's state is "execution completed". Pool B1 is equal to the state, meaning the data in pool B1 is in a state waiting for processing. Pool B's state is "execution completed", meaning the data in pool B is in a state where processing is completed. The following content is interpreted in the same way. In case of any contradiction with the following text, the actual content recorded later shall prevail.
[0053] Specifically, steps S200, S300, and S500 include: after the PLC reads the data D11, D12, ... D1n from pool A into pool B, it verifies the data. The verification method is to determine whether the data D11, D12, ... D1n read into pool B is consistent with the data D11, D12, ... D1n from pool A. If they are consistent, the verification passes; otherwise, the data D11, D12, ... D1n from pool A is reread into pool B. Specifically, consistency can be determined through matching degree calculation, etc.
[0054] Specifically, steps S200, S400, and S500 include: after the PLC reads the data D21, D22, ... D2m from pool A1 into pool B1, it verifies the data. The verification method is to determine whether the data D21, D22, ... D2m read into pool B1 is consistent with the data D21, D22, ... D2m from pool A1. If they are consistent, the verification passes; otherwise, the data D21, D22, ... D2m from pool A1 is reread into pool B1. Specifically, consistency can be determined through matching degree calculation, etc.
[0055] Specifically, steps S200, S300, and S500 include: when the PLC reads data D11, D12, ... D1n from pool A to pool B, the state of pool A includes: a writable state; the state of pool B includes: a non-writable state and an executable state. Specifically, a writable state in pool A means that pool A is in a data-writable state; a non-writable state in pool B means that data cannot be written to pool B; and an executable state in pool B means that the data can be used for processing. The following content is interpreted in the same way, and in case of any contradiction with the following text, the actual content recorded later shall prevail.
[0056] Specifically, steps S200, S400, and S500 further include: when the PLC reads data D21, D22, ... D2m from pool A1 to pool B1, the state of pool A1 includes: a writable state; the state of pool B1 includes: a non-writable state and an executable state. Specifically, a writable state in pool A1 means that pool A1 is in a data-writable state; a non-writable state in pool B1 means that data cannot be written to pool B1; and an executable state in pool B1 means that it is ready for processing. The following content is interpreted in the same way, and in case of any contradiction with the following text, the actual content recorded later shall prevail.
[0057] Essentially, the basic principle of this application is as follows: After the start, the host computer first sends data D11 and D21 to pool A and pool A1. Then, data D11 from pool A is sent to pool B, and D21 from pool A1 is sent to pool B1. When pool B is executed, the data in pool B1 is cached data. When pool B1 is executed, the data in pool B is cached data. When pool B is completed, pool B1 is executed. When pool B1 is completed, pool B is executed. This process is repeated continuously until the host computer sends multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m, the PLC reads multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m, and the data D11, D12, ... D1n and multiple data D21, D22, ... D2m are used for processing.
[0058] Figure 2 A more detailed flowchart of a data communication method between a host computer and a PLC according to this application is shown, and a detailed description of the data communication method between a host computer and a PLC according to this application is provided.
[0059] Step S111: Initialize pool A and pool B ( Figure 2 In Chinese, this is abbreviated as AB pool initialization;
[0060] Step S112: The host computer determines whether pool A is writable. If yes, proceed to step S113; otherwise, wait.
[0061] Step S113: The host computer marks the data in pool A as not yet written, and proceeds to the next step S114;
[0062] Step S114: The host computer sends data to pool A, and proceeds to the next step S115;
[0063] Step S115: The host computer reads the data from pool A and proceeds to the next step S116; simultaneously, step S211 is executed: the host computer determines whether the data in pool A1 is writable, and proceeds to the next step S212. In other embodiments, the same operations of steps S112-S115 can be performed on pool A1 first, and then the corresponding operations can be performed on pool A; or, the operations can be performed on pools A and A1 simultaneously. In this example, it is only for illustration, and in a specific example, a foolproof mechanism will be set up, so the host computer sends data in the order of pool A and pool A1.
[0064] Step S116: Determine whether the data read from pool A is consistent with the data sent to pool A by the host computer (for the sake of brevity, Figure 2 In the middle, it is abbreviated as A pool reading whether the sent data is consistent. If yes, proceed to step S117; otherwise, return to step S114.
[0065] Step S117: The host computer marks the A pool data as being in the write-complete state and proceeds to the next step S118;
[0066] Step S118: The PLC marks pool A as unwritable and proceeds to the next step S119;
[0067] Step S119: The PLC determines whether the status of pool A is "write complete". If yes, proceed to step S120; otherwise, wait.
[0068] Step S120: The PLC determines whether the status of pool A is writable. If yes, proceed to step S121; otherwise, wait.
[0069] Step S121: The PLC determines whether the status of pool B is writable. If yes, proceed to step S122; otherwise, wait.
[0070] Step S122: The PLC reads data from pool A into pool B and proceeds to the next step S123;
[0071] Step S123: The PLC determines whether the data in pool B is consistent with the data in pool A. If yes, proceed to step S124; otherwise, proceed to step S122.
[0072] Step S124: The PLC marks pool B as non-writable and executable, and proceeds to the next step S125;
[0073] Step S125: The PLC marks pool A as writable, and step S112 is performed simultaneously with the next step S126;
[0074] Step S126: The PLC determines whether the status of pool B is unwritable. If so, proceed to step S127; otherwise, wait.
[0075] Step S127: The PLC determines whether the status of pool B is executable. If yes, proceed to step S128; otherwise, wait.
[0076] Step S128: The PLC determines whether the status of pool B1 is not in progress. If so, proceed to step S129; otherwise, wait.
[0077] Step S129: When the start conditions for pool B are met, start pool B. The start conditions for pool B are: pool B1 is in the execution completed state; or; the start condition for pool B is: the host computer issues a start signal;
[0078] Step S130: The PLC marks the B pool status as executable and proceeds to the next step S131;
[0079] Step S131: The data in pool B is used to perform processing. At the same time, the PLC marks the status of pool B1 as not completed and proceeds to the next step S132.
[0080] Step S132: Determine whether the data in pool B has been processed. If yes, proceed to step S133; otherwise, wait.
[0081] Step S133: The PLC marks the B pool status as the execution completed state and feeds back the above B pool status result to step S228, while proceeding to the next step S134;
[0082] Step S134: The PLC marks the B pool status as writable, and returns to step S121;
[0083] Step S211: The host computer determines whether pool A1 is writable. If yes, proceed to step S212; otherwise, wait. In other embodiments, this step can be performed simultaneously with step S112; alternatively, S211 can be performed first, followed by S112.
[0084] Step S212: The host computer marks the A1 pool data as not yet written and proceeds to the next step S213;
[0085] Step S213: The host computer sends data to pool A1 and proceeds to the next step S214;
[0086] Step S214: The host computer reads the data from pool A1 and proceeds to the next step S215;
[0087] Step S215: Determine whether the data read from pool A1 is consistent with the data sent to pool A1 by the host computer (for the sake of brevity, Figure 2 In the middle, it is abbreviated as A1 pool reading whether the sent data is consistent. If yes, proceed to step S216, otherwise proceed to step S213.
[0088] Step S216: The host computer marks the A1 pool data as written complete and proceeds to the next step S217;
[0089] Step S217: The PLC marks pool A1 as unwritable and proceeds to the next step S218;
[0090] Step S218: The PLC determines whether the status of pool A1 is "write complete". If yes, proceed to step S219; otherwise, wait.
[0091] Step S219: The PLC determines whether the state of pool A1 is unwritable. If so, proceed to step S220; otherwise, wait.
[0092] Step S220: The PLC determines whether the status of pool B1 is writable. If yes, proceed to step S221; otherwise, wait.
[0093] Step S221: The PLC reads the data from pool A1 into pool B1 and proceeds to the next step S222;
[0094] Step S222: The PLC determines whether the data in pool B1 is consistent with the data in pool A1. If yes, proceed to step S223; otherwise, proceed to step S221.
[0095] Step S223: The PLC marks pool B1 as non-writable and executable;
[0096] Step S224: The PLC marks pool A1 as writable, and step S211 is performed simultaneously with the next step S225.
[0097] Step S225: The PLC determines whether the B1 state is unwritable. If so, proceed to step S226; otherwise, wait.
[0098] Step S226: The PLC determines whether the status of pool B1 is executable. If yes, proceed to step S227; otherwise, wait.
[0099] Step S227: The PLC determines whether the status of pool B is not in progress. If so, proceed to step S228; otherwise, wait.
[0100] Step S228: When the start conditions of pool B1 are met, start pool B1. The start conditions of pool B1 are: pool B is in the execution completed state. Proceed to the next step S229.
[0101] Step S229: The PLC marks the B1 pool status as executable and proceeds to the next step S230;
[0102] Step S230: Data from pool B1 is used to perform processing, and the PLC marks pool B as not completed.
[0103] Step S231: Determine whether the data in pool B1 has been processed. If yes, proceed to step S232; otherwise, wait.
[0104] Step S232: The PLC marks the B1 pool status as the execution completed state and feeds back the above B1 pool status result to step S129, while proceeding to the next step S233;
[0105] Step S233: The PLC marks the B1 pool status as writable and returns to step S220.
[0106] Clearly, after the data in pool B is processed, the first set of data from pool A will be loaded into pool B, and a new first set of data will be loaded into pool A. After the data in pool B1 is processed, the second set of data from pool A1 will be loaded into pool B1, and a new first set of data will be loaded into pool A1. The data in pool B will be processed, and then the data in pool B1 will be processed, and so on, until the data distribution is completed. This achieves dynamic transmission of multiple sets of data, improving data stability and flexibility.
[0107] Figure 3 As shown, this application provides a data communication system between a host computer and a PLC, which adopts any of the above-mentioned data communication methods and includes a host computer 100 and a PLC 200;
[0108] The host computer sends data D1n to pool A; and sends data D2m to pool A1.
[0109] The PLC reads data D1n from pool A and sends it to pool B; the host computer sends data D1n+1 to pool A. The PLC reads data D2m from pool A1 and sends it to pool B1; the host computer sends data D2m+1 to pool A1.
[0110] When the start-up conditions of pool B are met, the PLC reads data D1n from pool B for processing. After the processing is completed, the PLC reads data D1n+1 from pool A and sends it to pool B; the host computer sends data D1n+2 to pool A.
[0111] When the start-up conditions of pool B1 are met, the PLC reads data D2n from pool B1 to perform processing. After the processing is completed, the PLC reads data D2m+1 from pool A1 and sends it to pool B1; the host computer then sends data D2m+2 to pool A1.
[0112] After the PLC finishes processing the D1n data from pool B, it can be used to trigger the start of processing the data D2m from pool B1, which meets the start conditions of pool B1.
[0113] After the PLC reads D2m from pool B1 and completes the processing, it can be used to trigger the start-up conditions of pool B. The PLC then reads data D1n+1 from pool B and performs the processing.
[0114] The system can complete the transmission of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the host computer, the reading of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the PLC, and the use of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m for processing. n is a positive integer and m is a positive integer.
[0115] Specifically, m can be equal to n or not equal to n, depending on the actual needs.
[0116] Specifically, the host computer determines the status of pool A, sends data D11, D12, ..., D1n to pool A, and marks and reads the data D11, D12, ..., D1n from pool A; the PLC determines the status of pool A and reads the data D11, D12, ..., D1n from pool A to pool B. In other words, the host computer determines whether pool A is writable. The host computer then determines the status of pool A1, sends data D21, D22, ..., D2m to pool A1, and marks and reads the data D21, D22, ..., D2m from pool A1; the PLC determines the status of pool B1 and reads the data D21, D22, ..., D2m from pool A1 to pool B1. In other words, the host computer determines whether pool A1 is writable.
[0117] Specifically, after the data D11, D12, ..., D1n sent by the host computer are read from pool A, the data is verified. The verification method is as follows: determine whether the data D11, D12, ..., D1n read from pool A are consistent with the data D11, D12, ..., D1n sent by the host computer. If they are consistent, the verification passes; otherwise, the data D11, D12, ..., D1n from the host computer are read again from pool A. After the data D21, D22, ..., D2m sent by the host computer are read from pool A1, the data is verified. The verification method is as follows: determine whether the data D21, D22, ..., D2m read from pool A1 are consistent with the data D21, D22, ..., D2m sent by the host computer. If they are consistent, the verification passes; otherwise, the data D21, D22, ..., D2m from the host computer are read again from pool A1.
[0118] Specifically, the startup conditions for pool B are: pool B1 is in the execution completed state; or; the startup conditions for pool B are: the host computer gives a startup signal; the condition for determining whether pool B1 is started is: pool B is in the execution completed state.
[0119] Specifically, after the PLC reads the data D11, D12, ... D1n from pool A into pool B, it verifies the data. The verification method is as follows: it determines whether the data D11, D12, ... D1n read into pool B is consistent with the data D11, D12, ... D1n from pool A. If they are consistent, the verification passes; otherwise, the data D11, D12, ... D1n from pool A is read again into pool B. Similarly, after the PLC reads the data D21, D22, ... D2n from pool A1 into pool B1, it verifies the data. The verification method is as follows: it determines whether the data D21, D22, ... D2m read into pool B1 is consistent with the data D21, D22, ... D2m from pool A1. If they are consistent, the verification passes; otherwise, the data D21, D22, ... D2m from pool A1 is read again into pool B1.
[0120] Specifically, when the PLC reads data D11, D12, ... D1n from pool A into pool B, the state of pool A includes: writable state; the state of pool B includes: non-writable state and executable state. When the PLC reads data D21, D22, ... D2m from pool A1 into pool B1, the state of pool A1 includes: writable state; the state of pool B1 includes: non-writable state and executable state.
[0121] The embodiments are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make several improvements and equivalent substitutions without departing from the principle of the present invention. All such improvements and equivalent substitutions to the claims of the present invention fall within the protection scope of the present invention.
Claims
1. A data communication method between a host computer and a PLC, characterized in that, Includes the following steps: Step S100: The host computer sends data D11 to pool A; and sends data D21 to pool A1. Step S200: The PLC reads data D11 from pool A and sends it to pool B; the host computer sends data D12 to pool A; the PLC reads data D21 from pool A1 and sends it to pool B1; the host computer sends data D22 to pool A1. Step S300: When the start-up conditions of pool B are met, the PLC reads data D11 from pool B for processing, and pool B1 is in a waiting state at this time; after the processing is completed by the PLC using data D11 from pool B, the PLC reads data D12 from pool A and sends it to pool B; the host computer sends data D13 to pool A. Step S400: When the start-up conditions of pool B1 are met, the PLC reads data D21 from pool B1 for processing, and pool B is in a waiting state at this time; after the processing is completed by the PLC reading data D21 from pool B1, the PLC reads data D22 from pool A1 and sends it to pool B1; the host computer sends data D23 to pool A1. Step S500: Repeat steps S300 and S400 to complete the sending of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the host computer, the reading of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the PLC, and the use of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m for processing. n is a positive integer and m is a positive integer. Step S300 includes: the start condition for pool B is: pool B1 is in the execution completed state; or; the start condition for pool B is: the host computer gives a start signal; Step S400 includes: the B1 pool startup condition is: the B pool status is the execution completion status; Steps S200, S400, and S500 include: After the PLC reads the data D21, D22, ... D2m from pool A1 into pool B1, it verifies the data. The verification method is as follows: it determines whether the data D21, D22, ... D2m read into pool B1 is consistent with the data D21, D22, ... D2m from pool A1. If they are consistent, the verification passes; otherwise, the data D21, D22, ... D2m from pool A1 is reread into pool B1. The consistency is obtained by calculating the matching degree.
2. The data communication method according to claim 1, characterized in that, Steps S100, S200, S300, and S500 include: the host computer determining the status of pool A, sending data D11, D12, ..., D1n to pool A, and marking and reading the data in pool A; Steps S200, S300, and S500 include: the PLC determining the status of pool B and reading the data from pool A to pool B.
3. The data communication method according to claim 1, characterized in that, Steps S100, S200, S400, and S500 include: the host computer determining the status of pool A1, sending data D21, D22, ..., D2m to pool A1, and marking and reading the data in pool A1; Steps S200, S400, and S500 include: the PLC determining the status of pool B1 and reading the data from pool A1 to pool B1.
4. The data communication method according to claim 1, characterized in that, Steps S100, S200, S300, and S500 include: after the data D11, D12, ..., D1n sent by the host computer is read from pool A, the data is verified. The verification method is to determine whether the data D11, D12, ..., D1n read from pool A is consistent with the data D11, D12, ..., D1n sent by the host computer. If they are consistent, the verification passes; otherwise, the data D11, D12, ..., D1n from the host computer is read from pool A again.
5. The data communication method according to claim 1, characterized in that, Steps S100, S200, S400, and S500 include: after the data D21, D22, ..., D2m sent by the host computer is read from pool A1, the data is verified. The verification method is to determine whether the data D21, D22, ..., D2m read from pool A1 is consistent with the data D21, D22, ..., D2m sent by the host computer. If they are consistent, the verification passes; otherwise, the data D21, D22, ..., D2m from the host computer is read from pool A1 again.
6. The data communication method according to claim 1, characterized in that, Steps S200, S300, and S500 include: After the PLC reads the data D11, D12, ... D1n from pool A into pool B, it verifies the data. The verification method is to determine whether the data D11, D12, ... D1n read into pool B is consistent with the data D11, D12, ... D1n from pool A. If they are consistent, the verification passes; otherwise, the data D11, D12, ... D1n from pool A is reread into pool B.
7. The data communication method according to claim 1, characterized in that, Steps S200, S300, and S500 include: when the PLC reads data D11, D12, ... D1n from pool A to pool B, the state of pool A includes: writable state; the state of pool B includes: non-writable state and executable state; and / or, steps S200, S400, and S500 further include: when the PLC reads data D21, D22, ... D2m from pool A1 to pool B1, the state of pool A1 includes: writable state; the state of pool B1 includes: non-writable state and executable state.
8. A data communication system between a host computer and a PLC, characterized in that, The system employs the data communication method described in any one of claims 1-7, including a host computer and a PLC; The host computer sends data D1n to pool A; and sends data D2m to pool A1. The PLC reads data D1n from pool A and sends it to pool B; the host computer sends data D1n+1 to pool A. The PLC reads data D2m from pool A1 and sends it to pool B1; the host computer sends data D2m+1 to pool A1. When the start-up conditions of pool B are met, the PLC reads data D1n from pool B for processing. After the processing is completed, the PLC reads data D1n+1 from pool A and sends it to pool B; the host computer sends data D1n+2 to pool A. When the start-up conditions of pool B1 are met, the PLC reads data D2n from pool B1 to perform processing. After the processing is completed, the PLC reads data D2m+1 from pool A1 and sends it to pool B1; the host computer then sends data D2m+2 to pool A1. After the PLC finishes processing the D1n data from pool B, it can be used to trigger the start of processing the data D2m from pool B1, which meets the start conditions of pool B1. After the PLC reads D2m from pool B1 and completes the processing, it can be used to trigger the start-up conditions of pool B. The PLC then reads D1n+1 from pool B and performs the processing. The system can complete the transmission of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the host computer, the reading of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m by the PLC, and the use of multiple data D11, D12, ... D1n and multiple data D21, D22, ... D2m for processing. n is a positive integer and m is a positive integer.