FIG. 29 is a block diagram illustrating an outline of a conventional type of programmable controller. In this figure, designated at the reference numeral 1 is a peripheral device, at 2 a CPU unit. In the CPU unit 2, designated at 3 is an interface section for a peripheral device which executes data transaction with the peripheral device, at 4 a computing processing section, at 4A is an H/W computing circuit executing a portion of a sequence program at a high processing speed, at 5 a microprogram memory to store a program or programs for the system therein, at 6 a memory for user to store user data such as a sequence program, file memory, or comments therein, at 7 a scan time memory to store scan time for the entire program, at 8 a pointer table to store address data for a pointer, and at 15 a user memory allocation data memory.
At 16 is a group of units each connected to the CPU, at 16a an input unit, at 16b a high speed counter, at 16c an output unit, at 16d an analog unit, at 16e a link unit, at 17 a group of devices each connected to a unit group 16 connected to the CPU, at 17a a limit switch, at 17b a sensor, at 17c a valve adjustor, and at 17d a motor.
A description is made hereinafter for operations of a conventional type of programmable controller with reference to a concrete example thereof.
FIG. 30 shows an example of user memory allocation in a peripheral device, and in this case 1000 bytes are allocated to a sequence program, 2000 bytes for file data, and 3000 bytes for comments. User allocation data memory 15 and allocation of a user memory 6 in this case are as shown in this figure (program area 6a, file data area 6b, comment area 6c). Referring to this figure, designated at 15-1 is a header address of an area where a sequence program is stored, at 15-2 an header address of an area where data is stored, and at 15-3 a header address of an area where comment data is stored. In actual operation, when a sequence program read or write demand is issued from a peripheral device 1, the output unit 16c starts data write from each header address.
FIG. 31 shows a concrete example of configuration of a program area 6a shown in FIG. 30. In this figure, blocks corresponding to functions BK1 to BK5 are allocated to the execution sequence. Herein, BK1 indicates a functional block (starting processing) such as checking conditions for start or initial data setting which is executed only at a start. BK2 is a functional block (input processing) where a processing for an input unit 16a or a high speed counter 16b which has fetched a signal from such a device as the limit switch 17a or the sensor 17b is executed. BK3 is a functional block (operation control processing) where computing is executed upon an instruction from the BK2. BK4 is a functional block (output processing) where output to the valve adjustor 17c or the motor 17d is executed via the output unit 16c or the analog unit 16d upon an operational instruction from the BK3, and in this block FEND FEDN is a command indicating completion of the processing.
A series of processes from BK1 to BK4 is called a scan, and the processes are executed successively and cyclically as shown in right side of FIG. 31, thus actual control being executed. BK5 is a functional block (subroutine processing) such as processing of numerical data called and executed only when required. This configuration is an example of a configuration of a sequence program. Generally a sequence program is divided into several functional blocks as described above, and each block is developed by several persons.
Next, a description is made hereinafter of a program read or write operation. FIG. 32 is an example of operations in a peripheral device for reading a program, and setting as to whether the entire program should be read or only a specified range thereof should be read is performed. If only a specified range of program should be read, a start step and an end step are specified. FIG. 32 shows a method of specifying to read BK2 in FIG. 31. The same is true for write operation.
Next, a description is made of operations for adding new contents to a program memory. FIG. 33 shows an arrangement of each block in a sequence program, and in this figure, designated at 6a (1) is memory contents before change, at 6a (2) memory contents after a change of program steps in the BK2 block from 100 to 200 to 6a (1), 6a (3) memory contents in the case where a new block of BK6 has been added to 6a (2), at 1 (2) operations from a peripheral device corresponding to 6a (2), and at 1 (3) operations from a peripheral device corresponding to 6a (3). Herein BK6 is a block of input check processing, which must be executed between BK2 and BK3.
Next a description is made of operations for executing a program. When executing a program, at first a head of the sequence program memory, namely a head of BK1, is set at an address for starting execution, and then the blocks BK1, BK2 and BK3 are successively executed. In this process, simple commands are processed by a hardware computing circuit 4A, and other commands are processed by a microprogram stored in the microprogram memory 5. When a FEND command is detected, a specified END processing is executed, and again the program is cyclically executed from BK1. BK5 is not executed cyclically, and is executed only when a CALL command is executed. Also a processing time required for a series scan is stored in the scan time memory 7 by END processing.
Next a description is made of operations of a pointer. FIG. 34 shows examples of programs in BK1, BK2 and BK4. Herein JMP is a command for jumping to a specified pointer, and the CALL command is a command for calling a subroutine at the specified pointer. It should be noted that the pointer numbers for each block should not be redundant. MOV command is a command for transferring a constant to a file memory, and LEDC is a command for displaying a comment by a specified device on a display unit.
FIG. 35 shows a configuration of the pointer table 8, and this table is set before execution of a program. If a pointer does not exist, it is assumed that an address of a large program not existing actually such as a value for FFFFH has been stored there.
FIG. 36 shows a flow chart for processing JMP command. When JMP command is detected, the pointer No. is read out from the sequence program memory 5 (f141), and the program address is computed according to contents of the pointer management table 8 in FIG. 29 (f142). Then, a determination is made as to whether the value is an existing address or not (f143), and if it is determined that "the pointer address is larger than the maximum address" an error processing is executed on the recognition that there is no pointer (f145). On the contrary address is equal to or smaller the maximum, a processing for jumping to the specified address is executed (f144), thus execution of the command being finished.
FIG. 37 shows a flow chart for processing MOV command. At first, after a constant for a first device is read out (f281), a file No. for a second device is read out (f282), and the data is written in an address obtained by adding a value indicated by the file data header address 15-2 refer to FIG. 30 for the user memory allocation data 15 (f283).
FIG. 38 shows configuration inside comment data. FIG. 39 shows a flow chart for processing LEDC command which is a comment read command. At first, stored comment data is read out from the comment header address 15-3 refer to FIG. 30 for the user memory allocation data 15 (f291), and the data is displayed on a display unit (f292).
In relation to the method of managing a plurality of data, especially of programs, the method as disclosed Japanese Patent Laid Open publication No.205203/1989 exists, but in this method, when change in system capacity occurs, it is necessary to read all programs into the peripheral device side.
Furthermore, as for the processing time, as it is possible to detect only the entire processing time, it has been difficult to grasp what portions of the processing sequence require a long processing time. Especially, a program size used in a programmable controller is apt to become larger year by year in association with scaling up at a system. Up to only a few years ago, at most several thousand steps were enough for a program, but recently, programs each consisting at 100,000 steps or more are sometimes required. It is practically impossible to analyze the processing time by checking each step one by one in case of such a large size program. However, the performance of a programmable controller largely contributes to the real-time processing capability of a control system as a whole. Accordingly, it is quite important to shorten a processing time in each block by checking each block in detail.
Japanese Patent Laid Open Publication No.259910/1990 discloses a file management system for the case of a numerical control (NC). However, the significant feature of this system is that absolute addresses are employed in the file management section. Otherwise, the file system is not largely different from those in general personal computers. Moreover, it is necessary to successively execute programs according to factory automation techniques, so this system is hardly applicable to a programmable controller generally requiring a high speed responsiveness.
Also, Japanese Patent Laid Open Publication No.222047/1991 discloses effective utilization of unused storage areas, but it is necessary to successively search for empty areas to acquire continued areas.
The conventional types of programmable controller has been based on user memory management systems as described above, and there exist the following problems.
First, a user memory as a whole is managed according to user allocation data, so that it is not easy to change a storage capacity for programs or file data because it causes a change of absolute addresses in the storage space.
Secondly, when making a sequence program by dividing it into several blocks, the developed blocks must be compiled into a program and stored in a basic system of a CPU, so that, even when only one block of the program is changed, it is necessary to write all the blocks behind the changed block again in the CPU.
Also when the file management system used in common personal computers is stored into a programmable controller, several problems occur. Namely, a sequence program is generally executed at a high speed in a hardware computing circuit, so that it is difficult to stop execution of a program and jump to execution of another program during execution of a sequence program. For this reason program file data must be allocated continuously.
In addition scanning must always be executed, even for a block which is executed only at a start, which results in a waste of processing time.
Furthermore, the processing time is detected only as a whole, so that it can not be determined how long each block in the program takes for processing. Accordingly, it is difficult to take effective measures necessary for reduction of the processing time. Especially in case of programmable controller, mechanical control is provided once for every several milliseconds (mS), so that detecting a block requiring a long processing time is quite important for reducing the entire processing time and enhancing performance of the control unit.
Thirdly, as a common pointer numbering scheme is used in each block, it is necessary to allocate pointer numbers to each block before the start of a design process. On the contrary, if a program prepared previously is used again, it is necessary to change the pointer numbers already allocated to each block.
Fourthly, when making a plurality of programs by dividing each program into several blocks, the entire data memory is shared by all the programs. Accordingly, it is necessary to allocate devices to each program, and reallocation of data and change of programs corresponding to the reallocation must be carried out when a data increase is required before completion of a sequence program.
Fifthly, also when making a plurality of programs by dividing each program into several blocks, all comment data is shared by a plurality of programs, so that it is necessary to reunite the comment data each time any comment is changed or added anew.
In recent years, control systems are become more and more complicated and sophisticated, and the problems as described above have been significant obstacles to improving the designing efficiency by dividing each program into functional blocks and carrying out program designing by a plurality of persons as well as to clarifying functions of each program.