Patent Publication Number: US-5530888-A

Title: Process and apparatus for controlling a programmable controller with efficient identification of operation completion

Description:
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates to a process of controlling a programmable controller (PC) for transferring data to and from processing units linked therewith. 
     2. Description of the Background Art 
     FIG. 6 is a block diagram illustrating a master station 1 containing a programmable controller 2, employing a conventional PC controlling process, and slave stations 3 and 13, comprising coding devices, readers and the like. Processing units 4 and 14 are provided in the slave stations 3 and 13, respectively, and may be in the master station 1 as well. A cable 5 links the master station 1 to its adjacent slave stations and links adjacent slave stations to each other. A sequence program memory 6 is used for storing a sequence program, a flag memory 7 for storing a variety of flags, and a system program memory 11 for storing a system program required to execute the sequence program. A data link instruction information area 8, e.g., a data link instruction information memory, is used for storing the contents of data link instructions for effecting data transfer between the programmable controller 2 and the processing units linked therewith, e.g., data link instruction information and addresses for storing flags that are set when the operation of each of these data link instructions are complete, e.g., operation completion flag addresses, as a set in order. A communication control data area 9 is used for temporarily storing together information concerned with each processing unit as communication control data, including the information stored in the data link instruction information area 8, for the purpose of communication control. The data link instruction information area 8 and the communication control data area 9 are provided in the system program memory 11. 
     FIG. 7 illustrates a sequence program for setting a flag M20 (not illustrated) provided for indicating the completion of all operations of a series of data link instructions executed for a multiple of processing units in the conventional programmable controller control method. In FIG. 7, steps S701 to S720 are steps for executing a series of the data link instructions and a series of operation completion flag addressing instructions for specifying flag addresses to be temporarily set when the respective operations of the series of data link instructions are complete. A communication command flag 701 is employed as a flag that is set when the series of ten data link instructions and the series of operation completion flag addressing instructions are executed. 
     At steps S721 to S730, flags M0 (702) to M9 (711) are set by the series of operation completion flag addressing instructions. These flags are automatically reset after they have been set and the sequence program is run once. 
     A set of instructions 734-743 for setting flags M10 (760) to M19 (769) are provided in correspondence with flags M0 (702) to M9 (711), and flags M10 (760) to M19 (769) remain set until flag RESET instructions, discussed later, are executed. 
     At step S731, a flag SET instruction 744, which specifies a flag address M20A and is executed when flags M10 (760) to M19 (769) are all set, sets flag M20 (not illustrated) for indicating that the operations of the entire series of data link instructions is complete. 
     Located at steps S732 (745) to S741 (754) are flag RESET instructions, which reset flags M10 (760) to M19 (769). These instructions are executed when the same conditions exist as those for the execution of step S731, i.e. flags M10 (760) to M19 (769) are all set. 
     FIG. 8 illustrates part of the memory contents of the link instruction information area 8 shown in FIG. 6. In FIG. 8, a first data link instruction 801 is composed of information included in the data link instructions that are employed for data transfer to and from a first processing unit 4 and are written in the sequence program, e.g., the processing unit number as a transfer source or destination, a memory address as a transfer source or destination, etc. An operation completion flag address 802, specified by the operation completion flag addressing instruction, is written subsequent to the data link instruction in the sequence program. 
     The data link instruction information 801 and the operation completion flag address 802 are employed as a set and comprise a &#34;data link instruction-related information group&#34; 821 used for data transfer to and from the first processing unit 4. 
     Several data link instruction-related information groups 821 to 830 are stored sequentially in the data link instruction information area 8, in correspondence with the data link instruction and operation completion flag addressing instructions written in the sequence program. 
     Although FIG. 7 illustrates the execution of a single data link instruction for each processing unit, multiple data link instructions for each unit may be executed. FIG. 9 illustrates a sequence program employing the conventional programmable PC process where several data link instructions (four in FIG. 9) are executed for the same processing unit 4. 
     In FIG. 9, flag 901 at step S901 is a communication command flag, stored in the flag memory 7, that is accompanied by a first data link instruction 902, executed when the communication command flag 901 is set. At step S902, an operation completion flag addressing instruction 902 specifies an address M30A for storing a flag M30 (911) that is set when the operation of the first data link instruction 902 is complete. 
     At step S903, a second data link instruction 903 is executed subsequent to the first data link instruction 902. The second data link instruction 903 is executed when flag M30 (911), stored at the address M30A specified at step S902, is set. 
     At step S904, an operation completion flag addressing instruction 907 specifies an address M31A for storing a flag M31 (912) that is set when the operation of data link instruction 903 is complete. 
     Third and fourth data link instructions 904 and 905, at steps S905 to S908 are instructions for performing operations similar to those effected by the second data link instruction 903 at steps S903 and S904. 
     At step S909, a flag SET instruction 910 specifies an address M50A and is executed when the operation of the fourth data link instruction 905 is complete at step S907. In this regard, a flag M33 (914) is set for setting a flag M50 (not illustrated) for indicating that the operations of the first data link instruction 902 to fourth data link instruction 905 for unit 4 are all complete. 
     The system operation will now be described. Referring to FIG. 7, when the communication command flag 701 stored in the flag memory 7 is set at step S701, the series of instructions 712 to 721 and 722 to 731, for effecting data transfer between the programmable controller 2 and a first of several processing units are executed. 
     When the operation of the data link instruction 712 for data transfer to or from the first processing unit 4 is completed at step S701 by the operation completion flag addressing instruction 722 at step S702, M0A is specified as a memory address for storing operation completion flag M0 (702), which is set as the sequence program is run once. 
     At steps S703 to S720, the operations of the instructions used for the second processing unit 14 through tenth processing unit (units 3-10 are not illustrated in FIG. 6) are performed in correspondence with those of the data instruction 712 and the operation completion flag addressing instruction 722, specifying address MOA, employed for the first processing unit 4 at steps S701 and S702. 
     When flag M0 (702), specified by operation completion flag addressing instruction 722 at step S702, is set at step S721, flag M10 (760) is set by FLAG SET instruction 734. This stores at address M10A the fact that flag M0 (702) has been set. 
     At steps S722 to S730, flags M11 (761) to M19 (769) related to the second processing unit 14 through the tenth processing unit are set in the same manner that flag M10 (760), related to the first processing unit 4, was set at step S721. 
     When all flags M10 (760) to M19 (769) have been set at step S731, FLAG SET instruction 744 is executed to set flag M20 (not illustrated). This stores the fact that the operation of the data link instruction 712 for transfer to or from the first processing unit 4 through the operation of the data link instruction 721 for data transfer to or from the last processing unit (not illustrated) are all complete. 
     FLAG RESET instruction M10 (745) to M19 (754) at steps S732 to S741 cause flags M10 (760) to M19 (769) to be reset. 
     Information set in the data link instruction information area 8, when the sequence program shown in FIG. 7 is executed, will now be described with reference to FIG. 8. When the communication command flag 701 is set at step S701 in FIG. 7 and the data link instruction 712 for data transfer to or from the first processing unit 4 is executed, the information included in the data link instruction 712 for data transfer to or from the first processing unit 4, e.g., a processing unit number as a transfer source or destination (&#34;1&#34; for the first unit in this case), the memory address as a transfer source or destination, etc., is written to the data link instruction information area 8 as data link instruction information 801 shown in FIG. 8. 
     When the operation completion flag addressing instruction M0 (722) is executed at step S702, M0A is employed as the address of flag M0 (702) and is written to the data link instruction information area 8 as the operation completion flag address 802 in FIG. 8. 
     At steps S703 to S720, the operation performed for the first processing unit 4 at steps S701 and S702 is effected in a similar manner for the second processing unit 14 to the tenth processing unit, and the data link instruction-related information 822 for the second processing unit 14 through the data link instruction-related information 830 for the tenth processing unit are written to the data link instruction information area 8. While the sequence program is run repeatedly, the information is written to the data link instruction information area 8 only once after the communication command flag 701 is set. 
     Data transfer between the programmable controller 2 and the first processing unit 4 through the tenth processing unit in accordance with the information stored in the data link instruction information area 8 will now be described. 
     Assuming that the instructions for the first processing unit 4 are being processed every time the sequence program is executed once, a control part (not illustrated) included in the second processing unit 14 checks the contents of the communication control data area and data link instruction information area 8. If the operation performed immediately beforehand for processing unit 4 is already compete and there is data link instruction-related information which can be started for processing unit 14, a start is effected. When an interrupt signal that occurs periodically at a predetermined period of time is generated, a data transfer is effected to and from processing unit 14 in accordance with the communication control data stored in the communication control data area 9. Further, the information related to the data link instruction for unit 4, which has already completed its operation and terminated the operation of holding the corresponding operation completion flag in the set state while the sequence program is executed once, is erased from the data link instruction information area 8. This process is applied correspondingly to each of the remaining processing units. 
     As mentioned above, operation completion flag addressing instructions 722 to 731, specifying the addresses of flags M0 to M9, must be written in the sequence program in correspondence with each of the data link instruction 712, for data transfer to or from the processing unit 4, through the data link instruction 721, for data transfer to or from the processing unit 10 (not illustrated). Instructions 722 to 731 are used to set flag M20 (not illustrated). Flag M20 indicates whether or not the operations of the data link instruction 712 for data transfer to or from the first processing unit 4 through the data link instruction 721 for data transfer to or from the tenth processing unit (not illustrated) are all complete. Moreover, since flags M0 (702) to M9 (711) specified by operation completion flag addressing instructions for flags M0 (722) to flags M9 (731) are only set as the sequence program is run once, flags M10 (760) to M19 (769) must be provided in correspondence with flags M0 (702) to M9 (711), and steps S721 to S730 are all required in order to store the fact that any one of the flags M0 (702) to M9 (711) has been set while the sequence program is running once. Furthermore, step S731, for setting flag M20 (not illustrated) when all flags M10 (760) to M19 (769) have been set, must be provided. Finally, a sequence program, for resetting flags M10 (760) to M19 (769) that previously have been set, must be provided; and, a sequence program, for resetting flags M10 (760) to M19 (769) at steps S732 to S741, must be written. 
     As previously discussed, FIG. 9 illustrates a sequence program for executing a plurality of data link instructions composed of a first data link instruction 902 to fourth data link instruction 905 for the same processing unit, wherein each subsequent data link instruction is allowed to be executed only after completion of the operation of the data link instruction currently being executed. Therefore, the sequence program must be written so that only when the operation completion flag of the data link instruction executed immediately beforehand is set, can the operation of the next data link instruction be started. As illustrated in FIG. 7, it is also necessary to program the operation completion flag addressing instructions Mn (where n is an integer) in correspondence with respective data link instructions l (where l is an integer). 
     With the known programmable controller controlling process made up as described above, the sequence program cannot be written easily. For example, when it is only desired to store into the operation completion flag addresses 722-731 the information indicating whether or not the operation of a multiple of instructions for effecting data transfer to and from the processing units linked with the programmable controller in the master station are all complete, an operation completion flag addressing instruction 722-731 for specifying the address for storing the operation completion flag for each of the multiple instructions must be written in the sequence program in addition to the multiple instructions 712-721. This additional effort is time consuming and inefficient. 
     SUMMARY OF THE INVENTION 
     It is, accordingly, an object of the present invention to overcome the disadvantages of the prior art by providing a programmable controller controlling process which ensures ease of programming. Thus, when it is only needed to store into the operation completion flag addresses the information indicating whether the operations of a multiple of instructions for effecting data transfer to and from the processing units linked with the programmable controller in the master station are all complete or not, the programmable controller controlling process of the present invention does not require an operation completion flag addressing instruction to be written for each of the multiple instructions. 
     The present invention concerns a process for controlling a programmable controller provided in a master station for running a sequence program, including plural data link instructions for effecting data transfer between the programmable controller and processing units, provided in the master station or in slave stations linked with the master station, and an operation completion flag addressing instruction for specifying operation completion flag addresses employed as addresses for storing an operation completion flag set on completion of the operations of said multiple data link instructions. The invention comprises a step of transferring the contents of the multiple data link instructions and the operation completion flag addresses to a data link instruction information memory having a memory area for storing the contents of the multiple data link instructions, a memory area for storing the operation completion flag addresses, and a memory area for storing data link instruction operating condition information provided in correspondence with each of the multiple data link instructions and including information on whether or not the operations of the data link instructions are complete. It further comprises a step of executing the multiple data link instructions and setting the operation completion flag when all of said data link instruction operating condition information corresponding to the multiple data link instructions have shown operation completion conditions, while concurrently updating the data link instruction operating condition information serially in accordance with the information stored in the data link instruction information memory. 
     In the process for controlling a programmable controller according to the present invention, when the programmable controller runs a sequence program, including a multiple of data link instructions and an operation completion flag addressing instruction for specifying operation completion flag addresses employed as addresses for storing an operation completion flag set on completion of the operations of said multiple data link instructions, the contents of the multiple data link instructions and the operation completion flag addresses are transferred to a data link instruction information memory having a memory area for storing the contents of the multiple data link instructions, a memory area for storing the operation completion flag addresses, and a memory area for storing data link instruction operating condition information provided in correspondence with each of the multiple data link instructions, and including information on whether or not the operations of the data link instructions are complete. The multiple data link instructions are executed and the operation completion flag is set when all of the data link instruction operating condition information corresponding to the multiple data link instructions have shown operation completion conditions, while concurrently the data link instruction operating condition information is updated serially in accordance with the information stored in the data link instruction information memory. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is an overall configuration block diagram illustrating a master station and slave stations to which one embodiment of the present invention applies. 
     FIG. 2 shows a sequence program example according to one embodiment of the present invention for executing data link instructions for a plurality of processing units and setting an operation completion flag on completion of all the operations of the data link instructions for the multiple processing units. 
     FIG. 3 illustrates information stored in a data link instruction information area in one embodiment of the present invention. 
     FIG. 4 is a flowchart illustrating how the operation completion flag is set in one embodiment of the present invention. 
     FIG. 5 shows a sequence program example according to one embodiment of the present invention for executing a plurality of data link instructions for the same processing unit and setting an operation completion flag on completion of all the operations of the multiple data link instructions for that processing unit. 
     FIG. 6 is an overall configuration block diagram illustrating a master station and slave stations to which the conventional programmable controller controlling process applies. 
     FIG. 7 illustrates a sequence program in the conventional programmable controller controlling process. 
     FIG. 8 illustrates a data link instruction information area in the conventional programmable controller controlling process. 
     FIG. 9 illustrates a sequence program in the conventional programmable controller controlling process. 
    
    
     PREFERRED EMBODIMENT OF THE PRESENT INVENTION 
     The present invention will now be described with reference to FIG. 1, whichillustrates an overall configuration of a master station employing one embodiment of the present invention and slave stations linked therewith. 
     Referring to FIG. 1, the elements 3 to 7, 9, 13 and 14 are identical to those elements shown in FIG. 6, illustrating the conventional process. Element 8 is similar to the one shown in FIG. 8, but differs in that it has additional data link instruction operating condition information 302, 305, 308, . . . 329, as shown in FIG. 3. An instruction block operation completion processing program area 10 is used to store an instruction block operation completion processing program having a function to set oneoperation completion flag automatically when the operation of a series of data link instructions in a sequence program are complete. If the series of data link instructions and the operation completion flag addressing instruction have been written in the sequence program, it is only needed to store into appropriate operation completion flag addresses information on whether or not the operations of the series of data link instructions are complete. It will ba appreciated that this permits one of the processing units to check operating condition information stored in memoryof the programming controller concerning another processing unit. 
     Operation of the system in accordance with the present invention will now be described. FIG. 2 illustrates a sequence program for use in the programmable controller controlling process according to one embodiment ofthe present invention. The illustrated program corresponds to the sequence program employed in the conventional programmable controller controlling process shown in FIG. 7. 
     In FIG. 2, steps S201 to S211 are executed when a communication command flag 201 is set, data link instructions for effecting data transfer to or from a first processing unit 4 through a tenth processing unit (units 3-10are not illustrated in FIG. 1) are executed at steps S201 to S210, and the address M200A of an operation completion flag set on completion of all operations of steps S201 to S210 is specified at step S211. Since the operation completion flag M200 (202) specified by the operation completionflag address M200A is only set when the sequence program is executed once, after the operations of steps S201 to S210 are all complete, flag M20 (notillustrated) specified at flag address M20A is set at step S212 to store the fact that flag M200 (202) has been set. The presence of an identical operation completion flag at each instruction for a common processing unitpermits an efficient execution of all related instructions for that unit. 
     By executing the sequence program shown in FIG. 2, information written in the data link instruction for data transfer to or from the first processing unit 4 is written to the data link instruction information area8 shown in FIG. 3 at step S201 as the data link instruction information 301, e.g., a processing unit number as a transfer source or destination (1in this case) and a memory address as a transfer source or destination, when the communication command flag 201 is set. 
     At steps S202 to S210, the operation performed for the first processing unit 4 at step S201 is effected in a similar manner for the second processing unit 14 to the tenth processing unit. Also, data link instruction-related information 332 for data transfer to or from the second processing unit 14 through data link instruction-related information 340 for data transfer to or from the tenth processing unit arewritten to the data link instruction information area 8. Although the sequence program is run repeatedly, the information is only written to thedata link instruction information area 8 once, after the communication command flag 201 has been set, as in the conventional programmable controller controlling process. 
     Zeroes are first written to all operation completion flag addresses 303, 306, 309, . . . 327. Thereafter, the content of flag address M200A, written at step S211 in FIG. 2, is transferred to operation completion flag address 330. Subsequently, an instruction block operation completion processing program is executed to set all of the remaining operation completion flag addresses, e.g., 303, 306, 309, . . . 327, to M200. 
     Data transfer made between the programmable controller 2 and the first through tenth processing units (not illustrated), in accordance with the information stored in the data link instruction information memory 8, willnow be described. 
     As described in the case of the conventional process, a control part (not illustrated) included in the programmable controller 2 checks the contentsof the communication control data area 9 and data link instruction information area 8 every time the sequence program is executed once. If the operation performed for the immediately preceding processing unit is already complete and there is data link instruction-related information which can be started, a start is effected. When an interrupt signal occurring every predetermined period of time is generated, data transfer is made to and from the corresponding data unit in accordance with the communication control data stored in the communication control data area 9. 
     Data link instruction operating condition information 302, 305, 308, . . . 329, shown in FIG. 3, retains coded operating conditions of the data transfer to and from the corresponding processing units in continuously updated states, based on the corresponding data link instruction information. 
     Operation completion flag set processing will now be described with reference to FIG. 4, which is a flowchart illustrating the operation completion flag set processing operation performed each time the sequence program is run once. The operation is intended to keep track of the completion of the programmed instructions for each of the data links and is generally performed as follows. The control part (not illustrated) of the programmable controller 2 reads the data link instruction-related information sequentially from the data link instruction information area 8and checks for any of the series of data link instruction-related information having the same operation completion flag address (i.e., wheremultiple instructions are performed for multiple units and have been given a single operating completion flag address, as described with respect to FIG. 3), that has not completed its operation. If there is information in a ladder block that has not yet completed the operation, the control part completes the series of data link instruction-related information. If there is no information that has not yet completed all of its operation inthe series of data link instruction-related information having the same operation completion flag address, i.e. forming the same ladder block, thecontrol area erases the series of data link instruction-related informationhaving the same operation completion flag address from the data link instruction information area 8 and sets the corresponding operation completion flag. 
     FIG. 4 will now be described in greater detail. First, at step S401, data link instruction-related information stored at the first address of the data link instruction information area 8 is read. 20 At step S402, the contents of the data link instruction operating condition information are checked. If the operation based on the data link instruction-related information is not yet complete, the execution progresses to step S403 to check whether or not the next data link instruction-related information ispresent. If there is no such information written, the operation completion flag set processing operation is terminated at step S413 without any further processing. If the next data link instruction-related information exists, the execution advances to the next step S404 and reads this data link instruction-related information. 
     Step S405 determines whether or not the read operation completion flag address is identical to the previously read address. If identical, the execution returns to step S403, judging it as data link instruction-related information corresponding to the previously executed data link instruction and forming part of a series of instructions with the same operation completion flag address. 
     If the operation completion flag address is different from that just read previously, the execution returns to step S402, judging it as different from the data link instruction-related information corresponding to the previously executed data link instruction and as not forming part of a series of instructions with the same operation completion flag address. 
     Steps S403 to S405 are steps for skipping the data link instruction-relatedinformation having the same operation completion flag address that has not yet completed the operation, if such information exists in the data link instruction information area 8. This skipping procedure permits an execution of the program in a manner more efficient than that of the conventional process. 
     Step S402 checks the data link instruction operating condition information of the read data link instruction-related information. If the operation iscomplete, the execution proceeds to step S406. If the next data link instruction-related information to be read does not exist in the data linkinstruction information area 8 at step S406, e.g., if information 332 of FIG. 3 did not exist, the execution progresses to step S407, determining that the data transfer processing based on the data link instruction-related information stored in the data link instruction information area 8 has been terminated. 
     At step S407, the operation completion flag stored at the operation completion flag address is set while the sequence program is run once. This can store the fact that the operations of the data link instructions,which were read previously in a series and have identical operation completion flag addresses, are all complete. 
     At step S408, the data link instruction-related information, which may correspond to a series of data link instructions having identical operation completion flag addresses, is erased from the data link instruction information area 8 and the operation completion flag set processing operation is terminated. 
     At step S406, if the next data link instruction-related information, e.g., information 332, is present in the data link instruction information area 8, the execution advances to step S409, reads the data link instruction-related information, e.g., information 332, from the data linkinstruction information area 8, and progresses to the next step S410. It will be noted that while step S409 specifically addresses reading data link instructions, both reading and transmitting of the next data link instruction to a corresponding processing unit is actually performed at this step. 
     At step S410, if the operation completion flag address 306 included in the data link instruction-related information 332 is identical to address 303 read previously, the execution returns to step S402, judging it to be partof a series of data link instruction-related information having an identical operation completion flag. 
     If the operation completion flag address 304 of the data link instruction-related information 332 read at step S410 is different from address 303 read previously, the operation concludes that any execution ofa series of data link instructions having the same operation completion flag has terminated and sets the operation completion flag at step S411. Significantly, the flag is set after the sequence program is run only once. 
     Step S412 erases the series of data link instruction-related information written in the data link instruction information area 8 corresponding to the series of data link instructions having the same operation completion flag address, and returns to step S402. 
     As described above, FIG. 9 shows a sequence program example according to the conventional programmable controller controlling process for data communication with the same processing unit. FIG. 5 illustrates a sequenceprogram according to the programmable controller controlling process in oneembodiment of the present invention corresponding to FIG. 9. While in FIG. 5, an operation completion flag addressing instruction is not written for each of the data link instructions 502 to 505 as compared to those in FIG.9, an interlock is provided so that an operation according to the next datalink instruction-related information is not performed before the operation effected immediately before the identical processing unit is terminated. At the same time, the flag M500 (508) specified by the operation completion flag addressing instruction M500A (506), is automatically set when the operations of first data link instructions 502 to fourth data link instructions 505 are completed, in accordance with the information stored in the data link instruction information area 8. 
     Other operations in executing the sequence program shown in FIG. 5 are not described because they are similar to those in the execution of the sequence program shown in FIG. 2. 
     It will be apparent that the invention, as described above, achieves a programmable controller process which ensures ease of program debugging and correction as well as the simplified creation of sequence programs. Italso achieves a reduction of programming time, because is it is only necessary to set an operation completion flag when the operations of multiple data link instructions for data transfer between the programmablecontroller provided in the master station and processing units provided in slave stations or the master station, are all complete. Also, the process of the present invention only requires the multiple data link instructionsand one instruction for specifying the addresses of the operation completion flag for the multiple data link instructions to be written intothe sequence program. 
     While the present invention has been described in connection with certain preferred embodiments, it is not limited thereto; and the scope thereof isas set forth in the appended claims.