1. Field of the Invention
The present invention relates to a programmable controller that performs sequence control of various types of machines and devices.
2. Description of Related Art
A sequence program used in a programmable controller is constructed by a ladder program shown by a ladder diagram as in
It takes time to edit a sequence program (ladder program) like the one described above, and to display the sequence program (ladder program) on the screen in the event a problem occurs in the sequence program (ladder program) and search out a target point. For this reason, according to a well-known programmable controller to which a monitor is connected, as shown in
As shown in
Although it is possible to designate a subprogram, display the ladder diagram thereof, and display the ON/OFF state of a signal in the ladder diagram, it is unknown whether the subprogram has actually been executed. For this reason, when a problem occurs in a subprogram, it is necessary to track back to the calling source of the subprogram in the ladder diagram, confirm that a call to the subprogram is made, and then investigate the cause of the problem within the program.
For example, in
As described, there is the problem that when a problem occurs in the sequence program, it takes time to investigate the cause of the problem.
The present invention provides a programmable controller that facilitates an investigation of a sequence program in a case where a problem occurs in the sequence program.
According to the present invention, a programmable controller with a monitoring device for monitoring a sequence program, comprises: recording means for recording execution state of subprograms in the sequence program in execution; reading means for reading out the execution state recorded by the recording means; and display control means for displaying an executed subprogram and an unexecuted subprogram to be distinguished from each other in the sequence program on the monitoring device according to the execution state read by the reading means, to thereby facilitate an investigation of the sequence program.
The display control means may display the executed subprogram and the unexecuted subprogram to be distinguished by different display brilliances or different display colors.
Since the subprogram that has been executed and the subprogram that has not been executed are distinguished from each other on the monitoring device, the investigation of the sequence program is facilitated in a case where the sequence program has a problem in subprograms, etc.
One embodiment of a programmable controller of the present invention will be described below with reference to the drawings.
A monitoring device 20 is connected to the bus 30. In the monitoring device 20, a processor 21 for controlling the entire monitor, a ROM 22 for storing monitoring software, a work memory 23, an interface 24 with a CRT 32 of a display, and an interface 25 with a keyboard 33 are bus-connected to each other. As a display, liquid crystal or another display may be utilized.
The programmable controller 10 to which the monitoring device 20 is connected is virtually the same as one publicly known. The programmable controller 10, however, differs from a conventional programmable controller in that there are disposed the subprogram information table 13b, the subprogram-execution state work memory 13c and the subprogram-execution state memory 13d in the RAM 13, and that, as described below, a ladder diagram of a subprogram in the executed state is displayed differently from other ladder diagrams in terms of brilliance and the like.
The subprogram-execution state work memory 13c stores information as to whether or not each subprogram has been executed in an execution cycle of the current sequence program with respect to each subprogram number (subprogram name) as shown in
In the subprogram-execution state memory 13d, after one execution cycle of the sequence program is ended, storage contents of state storage bits of the subprogram-execution state work memory 13c are copied, and as shown in
Once a START command with respect to the sequence program is inputted, an execution pointer P is first set to “1” that is an initial value (Step 100). A net under the net number indicated by the pointer P is read out from the ladder program, and a determination is made as to whether a command of the net is a CALL command of a subprogram (Step 101). If not a CALL command, the read-out command is executed (Step 102), and the pointer P is incremented by 1 (Step 103). A determination is made as to whether the command of the net indicated by the pointer P is END of the sequence program (Step 104). If the command is not END, the procedure returns to Step 101, to thereby determine whether the command is a CALL command of a subprogram as described above. Thereafter, the process from Step 101 to Step 104 is repeatedly executed until a SUBPROGRAM READ-OUT command is read out.
When Step 101 determines that the command is the SUBPROGRAM READ-OUT command, “1” is written as a state storage bit for the read-out subprogram number (subprogram name) in the subprogram-execution state work memory 13c, and the fact that the subprogram is used in this cycle is stored (Step 107). Subsequently, “1” is added to a value of the execution pointer P, and a value of the next net number in the main program is stored in a register MP (Step 108). A start net number of the number (name) of the subprogram to which the command is given is read out from the subprogram information table 13b, and the pointer P is set to the read-out start net number (Step 109). The command of the net indicated by the pointer P is executed while the pointer P is updated by “1” until the “SPE” meaning the END of the subprogram is read (Steps 110 to 112). Once the “SPE” meaning the END of the subprogram is read, the value indicative of the next net number of the main program, which has been stored in the register MP in Step 108 is set in the pointer P (Step 113), and the procedure returns to Step 101.
Thereafter, the process from Step 101 to Step 104 is executed. Every time a SUBPROGRAM CALL command is read, the process from Step 107 to Step 113 is executed, to thereby execute the sequence program.
In this manner, if Step 104 determines that the END command of the sequence program has been read, the value of the bit indicating the execution state of each subprogram in the subprogram-execution state work memory 13c (see
When a SEQUENCE PROGRAM DISPLAY command is inputted, a monitor screen is switched to a sequence program list display as shown in
In the next place, one net of the ladder program is read out from the ladder program stored in the ladder program memory 13a of the RAM 13 according to the “net number on display” stored in the register (Step 201). A determination is made as to whether the read-out net is a subprogram or not on the basis of the net number and the subprogram information table 13b (see
If the “net number on display” is recognized as a net number in a subprogram, the state stored in the subprogram-execution state memory 13d is read out with respect to the subprogram number (name) to which the net belongs (Step 203), and a determination is made as to whether the state is “1”, which means that the subprogram has been executed (Step 204). If the state is “1”, and the subprogram has been executed, the ladder diagram of the net is displayed with normal brilliance (Step 211), and the procedure proceeds to Step 206. If the state is “0”, and the subprogram is not in the executed state, the ladder diagram of the net is displayed with low brilliance (Step 205), and the procedure proceeds to Step 206.
In Step 206, it is determined whether or not display of one screen frame has been completed. If the display of one screen frame has not yet completed, the procedure proceeds to Step 212, and the register of the “net number on display” is incrementally increased by “1”. Then the procedure returns to Step 201 and executes the above-described process.
When the display of one screen frame is completed, signal states of contacts and coils in the ladder diagram displayed on the screen frame are read out from the signal memory 14 (Step 207). According to the read signal states, an ON/OFF state of each of the contacts and coils of the displayed ladder diagram is updated (Step 208).
A determination is made as to whether or not a SCROLL command is inputted (Step 209), and whether or not the selected program is changed (Step 210). If neither of them is inputted, the procedure returns to Step 207 and repeatedly executes the process from Step 207 to Step 210.
When the SCROLL command is inputted, a scroll process is carried out. In the case of SCROLL UP, the “net number on display” is increased by 1, and the net number is taken as an additional display net number, thereby returning to Step 202. In the case of a SCROLL-DOWN command, the display is scrolled down. The “net number on display” is reduced by 1, and simultaneously a net number smaller by 1 than a minimum net number that is currently displayed is taken as an additional display net number. Then the procedure proceeds to Step 202. When the SCROLL command is inputted, the display is scrolled as described. Moreover, the ladder diagram of the subprogram in the unexecuted state is displayed with low brilliance. As to the others, the ladder diagram is drawn with normal brilliance.
In case that another program (main program, the level thereof, subprogram or the like) is selected from the program list displayed on the screen of the monitoring device 20 (Step 210), the procedure returns to Step 200, and the display of the ladder diagram is started from the start net number of the selected program as described.
In other words, as shown by an arrow A in
In
Although in the above embodiment, the subprogram in the executed state and that in the unexecuted state can be distinguished from each other by differentiating brilliance of the displayed ladder diagrams, the subprograms may be distinguished from each other by display colors instead of brilliance. Alternatively, it is also possible to differentiate a background color with respect to the unexecuted subprogram. In short, in the ladder diagram of the executed subprogram and that of the unexecuted subprogram, display forms may be differentiated so that execution/non-execution may be distinguished from each other.
Number | Date | Country | Kind |
---|---|---|---|
279682/2004 | Sep 2004 | JP | national |