Programmable controller having automatic control of interlock process

Abstract: A system is provided comprising a master station (1) and one or more slave stations (3A) connected in sequence. The master station (1) utilizes a data processing module having an operation processor (7) for cyclically executing a sequence program comprising a plurality of data link instructions (202). The execution of an individual data link instruction (202) is protected by an interlock which remains in effect between the start of an instruction and its end. A macro instruction executable by the operating system is operative to automatically process the interlock and thereby to avoid the necessity of including interlock processing in the sequence program itself.

Description: The present invention relates to a system and a process of controlling a programmable controller acting as a master station for transferring data to and from a slave station. The European Patent Application EP-A-0 187 677 discloses a linking system for a programmable controller. A plurality of slave programmable controllers are connected to one master controller, the slave controllers having inner relays for linking their operation with one another according to link tables. The master controller collects the link tables from the respective slaves. At the link starting time, the master controller prepares an edit link table for subsequent program control making use of the slaves. Fig. 8A shows an example of another configuration of a programmable controller having a slave station 3A, to which a programmable controller controlling process of the background art is applied. A master station 1 is connected via a link cable 2 to slave station 3A. A central data processing module 4 provided in the master station 1 utilizes a program memory 5 for storing sequence programs. An internal device memory 6 is also provided in the central data processing module 4, and includes a link register 6a for holding information identical to that transmitted on the link cable 2, a register for storing PROCESSING EXECUTING flag 6b for indicating that data transfer to and from a slave station, e.g. 3A, is being conducted, a register for storing a PROCESSING COMPLETE flag 6c that is set when the data transfer to and from the slave station 3A, is complete and is automatically reset after a sequence program has been run twice, and registers for storing flags 6d and 6e that are required to execute a data link instruction. The processing module 4 further includes an operation processor 7 for running the sequence program sequentially and a system program memory 9 for storing an operating system and other programs for operating the central data processing module 4. A link module 8 is provided in the master station 1 between the link cable 2 and the central data processing module 4 for converting information transmitted by the link cable 2 into information acceptable by the central data processing module 4 as well as converting information in the central data processing module 4 into information transmittable by the link cable 2. An I/O module 10 is for controlling a unit to be controlled (not illustrated) that is connected to the master station 1. In the slave station is at least one processing module 11 for transferring data to and from the central data processing module 4 in the master station 1. A link module 12 is provided between the processing module 11 and the link cable 2 for converting information transmitted by the link cable 2 into information acceptable by the processing module 11 as well as converting information in the processing module 11 into information transmittable by the link cable 2. A memory 13 is provided in the processing module 11, as well as an I/O module 14 for controlling a unit to be controlled (not illustrated) that is connected to the slave station 3A. Fig. 9 shows a conventional program in ladder form for executing an RFRP instruction. The RFRP instruction causes data to be received by the master station via the link cable from a slave station. A corresponding instruction is RTOP, which causes data to be transmitted by the master to a slave station. The RFRP instruction in Figure 9 is an example of a conventional program for transferring data between the master station 1 and slave station 3A. In the ladder notation, the state symbol ∥ indicates a "contact A" state condition and the state symbol ∦ indicates a "contact B" state condition for the execution of an identified function. Referring to Fig. 9, in a first program step S901 the state symbol 901 shows an active state condition for the START flag 6e that is provided in the internal device memory 6. The flag is set in the active state in order to initiate execution of the RFRP instruction in accordance with a program in the processing module 11. The inactive state condition of the PROCESSING EXECUTING flag 6b, and the inactive state condition of the PROCESSING COMPLETE flag 6c are shown by symbols 902 and 903, respectively. Thus, when the START flag 6e is reset, the PROCESSING EXECUTING flag 6b is in the set state, and the PROCESSING COMPLETE flag 6c is in the reset state, all of the conditions precedent to the execution of step S901 are satisfied. As a result, a 6D SET instruction 904 for setting a START CONDITION can be executed. This START CONDITION ESTABLISHING flag 6d is stored at an address indicated by 6D (904a) in the internal device memory 6. Proceeding to step S902, the state symbol 905 indicates the active state of the START CONDITION ESTABLISHING flag 6d. When the START CONDITION ESTABLISHING flag 6d is set as a result of step S901, the condition precedent to execution of step S902 is satisfied and RFRP instruction 906 is executed. Since the PROCESSING EXECUTING flag 6b and the PROCESSING COMPLETE flag 6c are stored at addresses which depend on the hardware configuration, it is necessary to check the hardware configuration and specify calculated addresses in the sequence program when performing a read or write. The RFRP instruction 906 has operands nl (906a), n2 (906b), n3 (906d) and D (906c). The instruction is used to transfer data from a particular slave station 3 to the master station 1 via the link cable 2. The instruction identifies the number of words, n3 (906d), starting at address n2 (906b) in the memory 13 of the processing module 11 of a slave station identified by n1 (906a), which are to be transferred to positions starting at address D (906c) of the link register 6a provided in the internal device memory 6 of the central data processing module 4 in the master station 1. When the transfer from slave to master according to this instruction has been completed, the PROCESSING COMPLETE flag 6c is set. As a result, the input conditions of steps S903 and S904 are satisfied, and a 6d reset instruction 907 and a 6b reset instruction 908 are executed. Address 6D (907a) identifies the location at which the START CONDITION ESTABLISHING flag 6d is stored, and address 6B (908a) identifies the location at which the PROCESSING EXECUTING flag 6b is stored. The operation of the ladder language program shown in Fig. 9 may be described with reference to a timing chart illustrated in Figs. 10A and 10B. When the RFRP instruction 906 is executed at step S902, the PROCESSING EXECUTING flag 6b is set at a point (1001) shown in Fig. 10A. This prevents execution of step S901 again until flag 6b is reset. When data transfer from the processing module 11 to the master station 1 is complete, the PROCESSING COMPLETE flag 6c is set at a point 1002 shown in Fig. 10B. When the PROCESSING COMPLETE flag 6c is set at step S903 in Fig. 9, the 6D RESET instruction 907 is executed, the START CONDITION ESTABLISHING flag 6d is reset, the 6B RESET instruction 908 is executed at step S904, and the PROCESSING EXECUTING flag 6b is reset at point 1003 shown in Fig. 10A. The PROCESSING COMPLETE flag 6c is automatically reset at a point 1004 after the PROCESSING EXECUTING flag 6b is reset, as shown in Fig. 10B. As is clear from the above explanation, flags 6b and 6c act as interlock conditions that assure that there is no overlap in the execution of program instructions. Thus, until flags 6b and 6c are both reset, the initial conditions of instruction S901 cannot be met, preventing further execution of that instruction until the current instruction has been completed. If instructions subsequent to those shown in S901-S904 are provided with initial conditions like those in S901, an effective step-by-step interlock can be achieved. However, the aforementioned process has disadvantages in that it is required to check whether or not the operation of the processing module 11 is complete in the sequence program itself. Interlock processing has to be performed in the sequence program itself rather than by the operating system (OS). Because they serve interlock functions, it is necessary to check the PROCESSING EXECUTING flag 6b and the PROCESSING COMPLETE flag 6c, the addresses of which depend on several factors including the hardware configuration and the processing module loading position, and to specify these addresses in the sequence program. When data transfer is made between the master and slave stations, using the RTOP or RFRP instructions, it is necessary to write an interlock into the processing program, as shown in Fig. 9, in order not to execute an instruction for data transfer with the slave station when one data transfer is already taking place. It is, accordingly, an object of the present invention to overcome the disadvantages in the prior art process by providing a programmable controller controlling process which will not require an interlock processing program to be written and the addresses of the flags, depending on the hardware configuration, to be specified in the program, and which will ensure ease of program creation and maintenance. According to the present invention, a system of programmable controllers and a control method are provided as defined in claims 6 and 1, respectively. Preferably when the programmable controller employed as the master station executes the data link instruction to transmit data between the master station and the slave station, the address information of the operation complete flag memory specified beforehand in the sequence program is recorded into the operation complete flag address memory, the communicating information indicating that communication is being made with the relevant slave station is entered into the communication entry memory provided in correspondence with each slave station, and when the data link instruction is executed and the operation started by the data link instruction is complete, the flag at the corresponding address in the operation complete flag memory is set in accordance with the address information recorded in the operation complete flag address memory. Preferably, after one or more cycles of the programmable controller is executed, the flag of the operation complete flag memory is reset and the information entered in the communication entry memory is erased. Fig. 1 illustrates an overall configuration of a programmable controller and a slave station to which one embodiment of the present invention is applied. Figs. 2A and 2B provide a program example of an MRFRP instruction written in ladder language in one embodiment of the present invention. Fig. 3 is an operation flowchart of an operating system for executing the MRFRP instruction in one embodiment of the present invention. Fig. 4 is an operation flowchart of an operating system for performing END processing for the MRFRP instruction in one embodiment of the present invention. Figs. 5A-5C are operation timing charts of a processing executing flag, a processing complete flag and an operation complete flag, respectively, in one embodiment of the present invention. Fig. 6 illustrates a communication entry memory in one embodiment of the present invention. Fig. 7 illustrates an operation complete flag address memory in one embodiment of the present invention. Fig. 8A illustrates the overall configuration of a programmable controller and a slave station to which a conventional programmable controller controlling process is applied. Fig. 9 illustrates a conventional program written in ladder language for executing an RFRP instruction. Fig. 10 is an operation timing chart of a processing executing flag and a processing complete flag in the conventional system. In the foregoing drawings, like reference characters designate like or corresponding parts throughout the several views. An embodiment of the present invention may be described with reference to Fig. 1, which is an overall configuration diagram of a programmable controller to which the present invention is applied. The overall configuration in Fig. 1 is identical to that of the conventional configuration shown in Fig. 8, with the exception of storage locations for additional information in the internal device memory 6 and the system program memory 9. Specifically, memory 6 further includes an OPERATION COMPLETE flag memory 6f and memory 9 includes a communications entry memory 9a and an OPERATION COMPLETE flag address memory 9b. Fig. 2A illustrates a program written in ladder diagram form for executing in a single step S201 an "MRFRP" instruction 202. The MRFRP instruction causes the master station 1 to receive data from a slave station 3 via the link cable 2 and is thus functionally the same as the prior art sequence of four instructions seen in Fig. 9. A similar instruction MRTOP will cause the master station 1 to transmit data to a slave station 3 via the link cable 2. The designation of the instruction with an "M" indicates that there is a "macro" function. In particular the macro function in the present embodiment will cause the OS to process the interlock flags 6b and 6c automatically. Referring to Fig. 2A, symbol 901 shows a START flag 6e which it is set for executing the MRFRP instruction 202. When the START flag 6e is set, the input condition of step S201 is established and the MRFRP instruction 202 is executed. Operands n1 (202a), n2 (202b), D (202c) and n3 (202d) of the MRFRP instruction 202 have the same meanings as those of the RFRP instruction 906 in the conventional process. The address 6f identifies a memory location (202e) for storing an OPERATION COMPLETE flag 6f for indicating whether or not the operation of the MRFRP instruction 202 is complete. The OPERATION COMPLETE flag 6f is referenced by other instructions in the sequence program in order to identify whether or not the predetermined operation by the MRFRP instruction 202 is complete, and may be located at any arbitrary memory location. The single step S201 in Fig. 2A is equivalent to the four steps (S901 to S904) in Fig. 9 of the conventional process. Whether or not the operation of the relevant instruction is complete may be checked simply by executing an OPERATION COMPLETE flag reference instruction which refers to the OPERATION COMPLETE flag 6f stored at address 6F. As a result, it is not necessary to refer, in the sequence program, to the PROCESSING EXECUTING flag 6b and the PROCESSING COMPLETE flag 6c, whose addresses depend on the hardware configuration and loading position, in order to determine the completion of an instruction, as required by the conventional process illustrated in Fig. 9. Figure 2B illustrates the basic instruction processing that is conducted with the use of the macro instruction of the present invention, beginning with a START command from the master station and ending with an END command. Several such processing functions are conducted in series in a sequence program, and overlap is avoided. Fig. 3 is an operation flowchart for an operating system, starting from step S300, for executing the MRFRP instruction 202, as an example of the instruction shown in Fig. 2 for transferring data between the master station 1 and slave station. In the process, the central data processing module 4 runs the sequence program repeatedly. In Fig. 3, step S301 checks whether or not the identity of a processing module 11 of a slave station 3A...3N has been entered into the communication entry memory 9a provided in the system program memory 9 in master station 1. This entry is made by setting a bit in the communication entry memory 9a corresponding to one of a plurality of processing modules 11. Memory 9a has a bit location corresponding to each unit in the network that communicates with the central data processing module 4 in the master station 1. As shown in Fig. 6, up to 64 units can be accommodated in this particular system, though there is no practical limit. If the identity of a specific processing module 11 already has been entered in memory 9a, it is concluded at step S301 that the processing module 11 is already operating. Hence, the MRFRP instruction 202 is terminated at step S306 without any operation. If it is determined that the identity of a specific processing module 11 has not been entered in memory 9a, the process proceeds to the next step S302, which checks the PROCESSING EXECUTING flag 6b and the PROCESSING COMPLETE flag 6c, which are the same as those in the conventional process of Fig. 9. If both flags have already been reset, indicating the absence of an interlock condition, execution progresses to the next step S303, which enters into the communication entry memory 9a communication information indicating that the processing module 11 has started operation. At step S304, an address of the OPERATION COMPLETE flag 6f in the processing module 11 is then stored in the OPERATION COMPLETE flag address memory 9b provided in the system program memory 9. This allows the OPERATION COMPLETE flags 6f to be stored in respective locations that correspond to each of the units that communicate with the central data processing module 4, as shown in Fig. 7 where again up to 64 units can be identified. Then, at step S305, the operation performed is the same as that of the RFRP instruction 906 shown in Fig. 9 in the conventional process. Specifically, as shown in Fig. 10, at the point 1001 the PROCESSING EXECUTING flag 6b is set and data transmission from the processing module 11 in the slave station to the central data processing module 4 in the master station 1 is initiated. When the data transmission is complete, execution progresses to the next step in the sequence program. If the PROCESSING EXECUTING flag 6b or the PROCESSING COMPLETE flag 6c has not yet been reset and a previously executed operation of an instruction for the processing module 11 is not complete, the program advances to step S306 and the process is terminated without any execution of the new instruction. The operation then progresses to the next step (not shown) in the sequence program. Fig. 4 is an operation flowchart of the operating system in an END processing mode, indicated by step S400. The mode is performed when one cycle of the sequence program is terminated in a process in which the central data processing module 4 runs the sequence program repeatedly. At step S401, a check is made of whether the identity of a processing module 11 has been entered at step S303 in Fig. 3. Since no instruction is being executed for the processing module 11 if there has not yet been an entry, END processing is not required and is terminated at step S409 without any execution. If the identity of a processing module 11 has been entered at step S303, an instruction has been provided to the processing module 11, and so program execution then progresses to step S402, where a check is made of the status of the PROCESSING COMPLETE flag 6c in order to determine whether or not that instruction has been completed, as seen in Fig. 5B. The PROCESSING COMPLETE flag 6c is set at a point 502 (Fig. 5B) when the data transmission from the processing module 11 is terminated as in the conventional process shown in Fig. 10. Flag 6c is automatically reset at point 505 after the sequence program has completed two cycles. If the PROCESSING COMPLETE flag 6c has not yet been set at step S402, the execution progresses to step S403, which checks the OPERATION COMPLETE flag 6f. If the flag has not yet been set, step S403 judges that data transmission from the processing module 11 to the central data processing module 4 is not yet complete and terminates the END processing at step S409 without any operation. If it is determined that the PROCESSING COMPLETE flag 6c has been set at step S402, program execution progresses to step S404, which checks the OPERATION COMPLETE flag 6f. If it is determined that that flag has not yet been set, the execution progresses to step S405, which sets the OPERATION COMPLETE flag 6f at point 503 in Fig. 5C, immediately following the setting of the PROCESSING COMPLETE flag 6c at point 502. Step S406 resets the PROCESSING EXECUTING flag 6b at point 504 as shown in Fig. 5A, and terminates the operation at step S409. If the OPERATION COMPLETE flag 6f has been set at step S404, then the execution is terminated at step S409 without any operation. If a reset of the PROCESSING COMPLETE flag 6c at step S402 had caused the execution to progress to step S403, which then determined that the OPERATION COMPLETE flag 6f was already set, the execution next progresses to step S407, which resets the OPERATION COMPLETE flag 6f at a point 506 subsequent to the point 505 as shown in Figs. 5B and 5C. Execution then progresses to step S408, which erases the communication information of the processing module 11 from the communication entry memory 9a and terminates the END processing at step S409. It will be evident that several slave stations 3A-3N may be used instead of one slave station 3 pictured in Fig. 1, and several processing modules 11 may also be used. It will also be appreciated that data transmission may be made from the master station 1 to the slave station 3, using an instruction MRTOP, in addition to the data transfer from the slave station 3 to the master station made by the MRFRP data link instruction in the above embodiment. It will further be appreciated that one memory may be used as both the communication entry memory 9a and the operation complete flag address memory 9b instead of the two provided separately in the above embodiment. It will be apparent that the invention, as described above, achieves a programmable controller controlling process which ensures ease of program creation by removing interlock processing from the sequence program. A programmable controller acting as a master station and transferring data to and from one or more slave stations can thus be more effectively operated.

Claims: A method of controlling the communication between a master station (1) and a plurality of slave stations (3A), said master station (1) including a programmable controller comprising an operation processor (7) for cyclically executing a sequence program and further including an operation complete flag memory (6f) for storing a flag indicating completion of an operation specified by a data link instruction (202) included in the sequence program, an operation complete flag address memory (9b) for each slave station (3A) for storing address information for the operation complete flag memory, and a communication entry memory (9a) for each slave station (3A) for entering communication information indicating that communication is being made with a particular slave station (3A), said method comprising the steps of: a) executing the data link instruction (202) in order to transfer data between the particular slave station (3A) and the master station (1), b) recording (S304) the address information of the operation complete flag memory (6f) specified in the sequence program into the operation complete flag address memory (9b) corresponding to the particular slave station (3A), c) entering (S305) the communication information into the communication entry memory (9a) corresponding to the particular slave station (3A), and prior to the execution in step (a) of the data link instruction (202), the steps of a1) setting (S405) a flag at a corresponding address in the operation complete flag memory (6f) in accordance with address information recorded in the operation complete flag address memory (9b) on completion of the operation specified by the data link instruction (202), and a2) resetting (S406) the flag of the operation complete flag memory (6f), and erasing (S408) the communication information entered in the communication entry memory (9a) after execution of at least one cycle of the sequence program. A method as claimed in Claim 1, further comprising the step of checking (S403, S404) the operation complete flag memory (6f) for an operation complete flag indicating the completion of the data link instruction (202). A method as claimed in Claim 2, wherein the checking step (S403, S404) is performed by executing an instruction in the sequence program that references an operation complete flag stored in the operation complete flag memory (6f). A method as claimed in Claim 1, further comprising the steps of: judging as to whether or not communication is being made based on said data link instruction (202) and the content of the communication entry memory (9a), and when communication is being made, interlocking said communication, or when communication is not being made, executing said communication and entering information indicating that communication is being made in said communication entry memory (9a) based on said data link instruction (202); and after completion of said communication, changing the content of said communication entry memory (9a) to indicate that the communication is not presently being made. A method as claimed in Claim 1, further comprising the steps of: inputting a ladder command as said data link instruction (202) for communicating with said slave station (3A) ; judging as to whether or not communication is being made based on the content of the communication entry memory (9a), and when communication is being made, interlocking said communication, or when communication is not being made, executing said communication and entering information indicating that said communication is being made in said communication entry memory (9a) based on said ladder command; after completion of said communication, setting the contents of a memory address while executing said sequence program more than one cycle, so that the completion of said communication can be referred by another command described on said sequence program, and changing the content of said communication entry memory (9a) to indicate that the communication is not being made. A system having a master station (1) and a plurality of slave stations (3A) in communication therewith, the master station (1) having a programmable controller comprising an operation processor (7) for executing a sequence program comprising a plurality of data link instructions (202) each of which defines a data transfer between the master station (1) and a designated slave station (3A), wherein the operation processor is adapted to execute the sequence program cyclically, and the master station characterized by: an operation complete flag memory (6f) for storing a flag indicating completion of an operation specified by a data link instruction included in the sequence program, an operation complete flag address memory (9b) having a storage location for each slave station (3A) for storing address information of the operation complete flag memory (6f), and a communication entry memory (9a) for each slave station (3A) for entering information indicating that communication is being made with a corresponding slave station (3A). A system as claimed in Claim 6, wherein each of the slave stations (3A) comprises a means for generating an end of a data transfer signal and in that the master station (1) comprises a means responsive to the end of data transfer signal to store the operation complete flag in the operation complete flag memory (6f). A system as claimed in Claim 6 or 7, wherein the programmable controller further comprises: a means for setting a flag at a corresponding address in the operation complete flag memory (6f) in accordance with address information recorded in the operation complete flag address memory (9b) on completion of the operation started by a data link instruction (202), and a means for resetting the flag of the operation complete flag memory (6f) and for erasing the communication information entered in the communication entry memory (9a) after execution of at least one cycle of the sequence program. A system as claimed in any one of Claims 6 to 8, wherein each operation specified by a data link instruction (202) is interlocked during its execution. A system as claimed in Claim 6, wherein each data link instruction (202) of the sequence program is defined by start and end commands, and wherein said operation processor (7) comprises macro instruction means responsive to completion of the operation specified by the data link instruction, for setting said flag in the operation complete flag memory (6f) and means for resetting the flag of the operation complete flag memory (6f) and for erasing the communication information entered in the communication entry memory (9a) after execution of at least one cycle of the sequence program.

Inventors: MORITA HIDEAKI, YAMAGUCHI TERUYO, MORITA, HIDEAKI, YAMAGUCHI, TERUYO, MORITA, HIDEAKI, C/O MITSUBISHI DENKI K.K., YAMAGUCHI, TERUYO, C/O MITSUBISHI DENKI K.K.
Applicants: MITSUBISHI ELECTRIC CORP, MITSUBISHI DENKI KABUSHIKI KAISHA
Application year: 1991
Main classification: G06F13
IPC codes: G06F13, G05B19