Programmable logic controller, external apparatus, method, and recording medium

A programmable logic controller performs execution of a program in each set period and repeats the execution of the program. The first device storage stores a device value that is an input value and an output value of the program. The second device storage stores the device value stored in the first device storage in a previous period. In a case in which a reading target preset for a device designated by a monitor request received from an engineering tool is the first device storage, the command processor reads the device value stored in the first device storage after execution of the program in a current period is completed, and in a case in which the reading target is the second device storage, the command processor immediately reads the device value stored in the second device storage. The command transmission/reception element transmits the device value to the engineering tool.

CROSS-REFERENCE TO RELATED APPLICATION

The present application is based on PCT filing PCT/JP2018/038262, filed Oct. 15, 2018, the entire contents of which are incorporated herein by reference.

TECHNICAL FIELD

The present disclosure relates to a programmable logic controller, an external apparatus, a method, and a program.

BACKGROUND ART

A central processing unit (CPU) unit of a programmable logic controller, in order to control the control target device, executes each command of a program at each scan time, performs processing using an input signal supplied from a detector, and supplies to a control target device an output signal that is a result of the processing. An inputter of the programmable logic controller inputs, to the CPU unit of the programmable logic controller, the input signal supplied from the detector connected to the inputter. An outputter of the programmable logic controller supplies, to the control target device connected to the outputter, the output signal output by the CPU unit. In the CPU unit of the programmable logic controller, the input signal supplied from the detector and the output signal that is the result of the processing are stored in a memory area of the CPU unit that is called a device memory.

A user monitors data in the device memory via an external device such as a programmable device or a program development tool, for example, in order to confirm whether operation of a program of the programmable logic controller is normal. Patent Literature 1 discloses a programmable that (i) reads a device value from a device memory at each scan time, that is, at a timing of an input/output (I/O) refresh, and (ii) displays the read device value on a display.

Here, the term “I/O refresh” means an act of exchanging data of the device memory all together between the programmable logic controller, the inputter and the outputter at the end of each scan time. Specifically, exchange of data in the device memory is performed between the CPU unit and the inputter, and exchange of data in the device memory is performed between the CPU unit and the outputter. Since the data stored in the device memory includes data that is rewritten as necessary during the execution of the program, the I/O refresh is executed at the end of the scan time, that is, after all commands are executed.

Also, Patent Literature 2 discloses performance of the I/O refresh not only at the end of the scan time but also after interrupting execution of a program during the execution of the program.

CITATION LIST

Patent Literature

Patent Literature 1: Unexamined Japanese Patent Application Publication No. 2003-84811

Patent Literature 2: Unexamined Japanese Patent Application Publication No. 2016-110458

SUMMARY OF INVENTION

Technical Problem

As disclosed in Patent Literature 1, upon receiving, from a programmable display, a development tool or the like, a read request to read the device memory, a conventional programmable logic controller transmits, to the programmable display, the development tool or the like at the timing of I/O refresh, a value of the device memory designated by the read request as an response to the read request.

The length of scan time varies depending on the programmable logic controller. When the programmable display, the development tool, or the like transmits a read request to the programmable logic controller for which the scan time is set to be long, the programmable logic controller does not transmit a response until the end of the scan time. The programmable display, the development tool or the like is on standby for a long period until a response is received. For this reason, the user cannot operate the programmable display, the development tool or the like that is on standby, which results in a remarkable reduction of the operability of an external device such as the programmable display or the development tool.

In the configuration described in Patent Literature 2, the execution of the program is interrupted and then the I/O refresh is performed. Accordingly, the CPU unit can also transmit a response to the read request to the programmable display, the development tool or the like at the timing at which the execution of the program is interrupted, and then the I/O refresh is performed. In this case, waiting until all commands of the program are executed is unnecessary for the programmable display, the development tool or the like. However, the value read from the device memory in this case is not a value at a time after the commands of the program are completely executed. That is, the value read from the device memory is not data determined by executing the commands of the program completely. Accordingly, even in the configuration disclosed in Patent Literature 2, the determined device value cannot be immediately returned.

In consideration of the aforementioned circumstances, an objective of the present disclosure is (i) to enable an external device for monitoring a device memory to read the determined device value without depending on the scan time of the programmable logic controller and (ii) to improve the operability of the external device.

Solution to Problem

In order to achieve the aforementioned objective, a programmable logic controller performs execution of a program in each set period and repeats the execution of the program. Device storage means stores a device value that is an input value and an output value of the program. Saved data storage means stores the device value stored in the device storage means in a previous period. Upon receiving, from an external device, a read request to read the device value, command processing means (i) reads, in a case in which a reading target preset for a device designated in the read request is the device storage means, the device value stored in the device storage means after execution of the program in a current period is completed, and (ii) immediately reads, in a case in which the reading target preset for the designated device is the saved data storage means, the device value stored in the saved data storage means. Transmission means transmits, to the external device, the device value read by the command processing means.

Advantageous Effects of Invention

In the programmable logic controller of the present disclosure, the saved data storage means stores the device value stored in the device storage means in the previous period. In the case in which the reading target preset for the device designated by the read request received from the external device is the device storage means, the programmable logic controller (i) reads the device value stored in the device storage means after the execution of the program in the current period is completed and (ii) transmits the device value to the external device. In the case in which the reading target preset for the designated device is the saved data storage means, the programmable logic controller (i) immediately reads the device value stored in the saved data storage means and (ii) transmits the device value to the external device. Such a configuration enables the device memory to be read without dependency on the scan time of the programmable logic controller, and the operability of the external device can be improved.

DESCRIPTION OF EMBODIMENTS

A programmable logic controller1according to an embodiment of the present disclosure is described below in detail with reference to the drawings.

Embodiment

The programmable logic controller1illustrated inFIG. 1controls a detector901and a controlled device902that operate in a production system, a control system or the like. The programmable logic controller1includes (i) a central processing unit (CPU) unit100that controls the entire programmable logic controller1, (ii) an inputter200that supplies, to the CPU unit100, an input signal received from the detector901, (iii) an outputter300that outputs, to the controlled device902, an output signal indicating a processing result by the CPU unit100, and (iv) a base400for mounting the CPU unit, the inputter and the outputter.

The CPU unit100(i) executes a command of a program in accordance with an ON/OFF state of an input signal supplied from the inputter200and (ii) outputs, to the outputter300, the processing result represented by the ON/OFF state as an output signal. The CPU unit100starts execution of the program at a set period, executes an END command that is the last command of the program, and then ends the execution of the program. The CPU unit100starts executing the program again in a next period. This set period is called a scan time.

The detector901including a sensor, a switch and the like is connected to the inputter200. The inputter200(i) converts, into a predetermined signal level, the input signal indicating “ON/OFF” and supplied from the detector901and (ii) supplies the converted input signal to the CPU unit100. The controlled device902including an actuator, a solenoid valve, an indicator lamp and the like is connected to the outputter300. The outputter300(i) converts, into a predetermined signal level, the output signal indicating “ON/OFF” and supplied from the CPU unit100and (ii) supplies the converted output signal to the controlled device902.

The CPU unit100, the inputter200and the outputter300are mounted on the base400. The CPU unit100, the inputter200and the outputter300(i) are connected to a non-illustrated power supply via the base400and (ii) are operated by power supplied from the power supply. Also, the CPU unit100, the inputter200and the outputter300are connected to one another via a shared bus410and communicate with one another via the shared bus410.

Also, an engineering tool500that is a development tool can be connected to the CPU unit100of the programmable logic controller1. The configuration of the engineering tool500is described later.

In the following descriptions, the CPU unit100having a characteristic configuration in the embodiment is mainly described.

The CPU unit100includes, as a configuration of hardware, (i) a memory110that stores various types of programs and data, (ii) an input/output interface120that communicates with the inputter200and the outputter300, (iii) a tool interface130that communicates with the engineering tool500described later, and (iv) a processing device140that controls the entire CPU unit100. The memory110, the input/output interface120, and the tool interface130are connected to the processing device140via a bus190and communicate with the processing device140.

The memory110(i) includes a volatile memory111and a non-volatile memory112and (ii) stores various types of programs and data. The volatile memory111is used as a working memory of the processing device140. The non-volatile memory112stores (i) a device setting1121that stores data about allocation of data stored in the device memory, (ii) a user program1122that is executed at each scan time, and (iii) a monitor response program1123for responding to a monitor request received from an engineering tool500described later. An access speed of the volatile memory111is higher than an access speed of the non-volatile memory112. The user program1122is one example of the program of the present disclosure.

Furthermore, the memory110achieves the functions of the device memory. The device memory is a memory area that stores (i) the input value of the processing by the user program1122that is a value that indicates an input signal supplied from the detector901to the CPU unit100and (ii) the output value output as the processing result of the user program1122. The output value output by the processing device140executing the user program1122is a value indicating an output signal supplied to the controlled device902. A value indicating the input signal stored in the device memory and a value indicating the output signal stored in the device memory are called device values. The device memory may be simply called a device. In the embodiment, the CPU unit100includes (i) a master device memory that stores the device value at the current scan time and (ii) a device memory for saving that stores the device value occurring at the previous scan time. The volatile memory111functions as the master device memory. The non-volatile memory112functions as the device memory for saving.

The device value includes, for example, time-series data collected from the same sensor or data collected from multiple sensors at the same timing.

The device setting1121is data defining an area for storing the input signal, an area for storing the output signal, and the like. The device value and the data of the input signal and the output signal are stored in the area corresponding to a type of data. In the device setting1121, the area in which the value of the input signal is stored is defined as “X”, the area in which the value of the output signal is stored is defined as “Y”, and the area in which other values are stored is defined as “D”. Further, the device setting1121includes a starting number and a finishing number for identifying the size of each of the areas “X”, “Y”, and “D”. Here, the numbers correspond to a so-called memory address. Multiple device values are stored in each of the areas “X”, “Y”, and “D”, and each device value is assigned a number indicating ordering of data in the area. For example, when the starting number of the area “X” is 1, data stored in “X100” is the 100th data in the “X” area. The starting number is a number assigned to the first device value in the area, and the finishing number is a number assigned to the last device value in the area.

The user program1122is a program created by a user and is executed by the processing device140. The processing device140executes the user program1122to perform processing using the value indicating the input signal supplied from the detector901.

The monitor response program1123is a program for the CPU unit100to achieve a function of transmitting, to the engineering tool500, a monitor response including a designated device value as a response to the monitor request received from the engineering tool500. The monitor response program1123is executed by the processing device140. Here, the monitor request means a command transmitted by the engineering tool500to the CPU unit100in order to request reading of the device value. Also, the monitor response means a response that the CPU unit100transmits to the engineering tool500in response to the monitor request.

The input/output interface120is a communication interface for the CPU unit100to communicate with the inputter200and the outputter300. The input/output interface120(i) converts, into an electric signal, the data supplied from the processing device140and (ii) transmits the converted signal to the outputter300via the shared bus410. Also, the input/output interface120(i) recovers as data the electric signal received from the inputter200and (ii) outputs the data to the processing device140.

The tool interface130is a communication interface for the CPU unit100to communicate with an engineering tool500described later. The tool interface130(i) converts, into an electric signal, the data supplied from the processing device140and (ii) transmits the converted signal to the engineering tool500via a communication cable509. Also, the tool interface130(i) recovers as data the electric signal received from the engineering tool500and (ii) outputs the data to the processing device140.

The processing device140(i) includes micro processors (MPUs)150and160and (ii) executes various types of programs stored in the memory110to achieve various types of functions of the CPU unit100. As described in detail later, the MPU150has a function for receiving the monitor request from the engineering tool500and transmitting the monitor response to the engineering tool500. The MPU160has a function for executing the user program1122at each scan time.

The engineering tool500(i) is a device in which a dedicated application is installed in a personal computer and (ii) is a development tool having a program creation function. In the embodiment, the engineering tool500has a function of monitoring the device memory of the CPU unit100. Accordingly, the user can monitor the device memory of the CPU unit100using the engineering tool500. The engineering tool500is one example of the external device of the present disclosure.

The engineering tool500includes (i) a memory510that stores programs and data, (ii) an input device520that detects input operation by the user, (iii) an output device530that outputs an image, (iv) a communication interface540that communicates with the CPU unit100, and (v) a processing device550that controls the entire engineering tool500. The components of the engineering tool500are connected to one another by a bus590.

The memory510(i) includes a volatile memory and a non-volatile memory and (ii) stores various types of programs and data used when the programs are executed. In the embodiment, the memory510stores (i) a setting program511for setting a target for reading the device value by the CPU unit100and (ii) a monitoring program512for monitoring the device value by the CPU unit100.

The input device520includes an input device such as a keyboard or a mouse, detects the input operation by the user, and supplies, to the processing device550, a signal indicating the detected user's input operation. The output device530includes a display and displays, on the display, an image based on the signal supplied from the processing device550. The communication interface540is a communication interface for communicating with the CPU unit100via the communication cable509. The communication interface540(i) converts, into an electric signal, the data supplied from the processing device550and (ii) transmits the converted signal to the CPU unit100via the communication cable509. Also, the communication interface540(i) recovers as data the electric signal received from the CPU unit100and (ii) outputs the data to the processing device550.

The processing device550includes a CPU unit and executes various types of programs stored in the memory110to achieve various types of functions of the engineering tool500. In the embodiment, the processing device550executes the monitoring program512, transmits, to the CPU unit100, a monitor request of the device memory, and displays, on the display of the output device530, the content of the monitor response received from the CPU unit100. Also, the processing device550(i) executes the setting program511and (ii) in response to the monitor request, sets for the CPU unit100a target for reading the device value by the CPU unit100.

Next, functional configuration of the CPU unit100is described with reference toFIG. 2. The CPU unit100functionally includes (i) a first device storage101that stores a device value, (ii) a second device storage102that stores saved data of the first device storage101, (iii) a reading target designation table103that designates a reading target for which the device value is to be read, (iv) a command transmission/reception element104that transmits and receives a command to and from the engineering tool500, (v) a command processor105that reads the device value from the reading target designated in the reading target designation table103, (vi) a writing controller106that saves the device value of the first device storage101in the second device storage102, and (vii) an executor107that executes the user program1122. The first device storage101is one example of the device storage means of the present disclosure. The second device storage102is one example of the saved data storage means of the present disclosure. The reading target designation table103is one example of setting information storage means of the present disclosure. The command transmission/reception element104is one example of the transmission means of the present disclosure. The command processor105is one example of the command processing means of the present disclosure. The writing controller106is one example of writing control means of the present disclosure.

The first device storage101stores the input value and the output value of the user program1122, that is, device values at the current scan time. The first device storage101is a master device memory of the CPU unit100. The input value of the user program1122is written in the first device storage101by the I/O refresh. Further, by executing the user program1122, the output value output by executing the user program1122is written in the first device storage101. The functions of the first device storage101are achieved by the volatile memory111of the memory110illustrated inFIG. 1. This is because the access speed of the volatile memory111is higher than that of the non-volatile memory112.

The second device storage102illustrated inFIG. 2stores the data saved from the first device storage101. More specifically, the second device storage102stores the device values stored in the first device storage101at the previous scan time, that is, the input value and the output value at the previous scan time. The second device storage102is a device memory for saving. The writing controller106writes the device values of the first device storage101into the second device storage102. The functions of the second device storage102are achieved by the non-volatile memory112of the memory110illustrated inFIG. 1.

The reading target designation table103stores data that designates which of the first device storage101and the second device storage102the device value designated by the monitor request is acquired from. As illustrated inFIG. 3, in the reading target designation table103, designation is made as to whether, for a device value of a range identified by device area name, starting number, and finishing number, the reading target is the first device storage101or the second device storage102.

In the illustrated example, the starting number and the finishing number respectively indicate a start point and an end point of the set range of the device. The reading target indicates whether the reading target having the device value in the set range is set to be the first device storage101or the second device storage102. For example, the device values of “X1” to “X250” are designated to be read from the second device storage102. Here, the device values of “Y200” to “Y400” are also designated to be read from the first device storage101. In the reading target designation table103, a reading target can be designated for each designated range. In the embodiment, a default reading target is assumed to be the first device storage101. Accordingly, device values in a range not set in the reading target designation table103are read from the first device storage101. The functions of the reading target designation table103are achieved by the non-volatile memory112of the memory110illustrated inFIG. 1.

The command transmission/reception element104illustrated inFIG. 2receives a monitor request from the engineering tool500and outputs the received monitor request to the command processor105. Also, the command transmission/reception element104transmits, to the engineering tool500, the monitor response supplied from the command processor105. The functions of the command transmission/reception element104are achieved by the tool interface130and the MPU150ofFIG. 1.

The command processor105illustrated inFIG. 2(i) reads, from the read target designated in the reading target designation table103, the device value designated in the monitor request and (ii) outputs, to the command transmission/reception element104, the monitor response including the read device value. The monitoring request transmitted by the engineering tool500includes (i) a value that identifies an area of the device, and (ii) the starting number and the finishing number that indicate a range of a monitoring target. Also, the monitor response includes the device values read in an order designated by the monitor request. For example, device values of the starting number “100” to the finishing number “150” of a device “X” and device values of the starting number “50” to the finishing number “100” of a device “D” are assumed to be requested by the monitor request. In this case, the monitor response stores the device values of “X100” to “X250” and the device values of “D50” to “D100” with these device values arranged in such order.

The engineering tool500is assumed to request the CPU unit100to read the 100th to 150th device values of the device “X” by a monitor request. In this case, the command processor105determines, from the reading target designation table103ofFIG. 3, that the reading target having the device values of “X100” to “X150” is the second device storage102. Also, reading of the 1001st to 1200th device values of a device “Y” are assumed to be requested by the monitor request. In this case, the command processor105determines, from the reading target designation table103, that the reading target having the device values “Y1001” to “Y1200” is the first device storage101. Upon request to read a device value for which a reading target is not set in the reading target designation table103, the command processor105determines that the reading target having such a device value is the first device storage101that is the default reading target.

When the first device storage101is designated as the reading target of the device value designated by the monitor request in the reading target designation table103, the command processor105executes reading of the device value as follows. The command processor105(i) reads, from the first device storage101, the device value designated by the monitor request after the executor107executes the END command of the user program1122, and (ii) outputs the read device value to the command transmission/reception element104.

When the second device storage102is designated as the reading target of the device value designated by the monitor request in the reading target designation table103, the command processor105executes reading of the device value as follows. The command processor105(i) immediately reads, from the second device storage102, the device value designated by the monitor request and (ii) outputs the read device value to the command transmission/reception element104. In the embodiment, the MPU160reads the device value from the first device storage101, and the MPU150reads the device value from the second device storage102. The functions of the command processor105are achieved by the MPU150and MPU160ofFIG. 1.

Further, upon receiving a command providing instruction to update the reading target designation table103from the engineering tool500, the command processor105registers data in the reading target designation table103based on (i) the value for identifying the area of the device, (ii) the starting number and the finishing number indicating the range of a monitor target of the area and (iii) the value for identifying the designated reading target that are included in the command. For example, when receiving, from the engineering tool500, a command providing instruction to set the reading targets of No. 100 to No. 250 of “X” to be slaves, the command processor105records, in the reading target designation table103illustrated inFIG. 3, data “device: X, starting number: 1, finishing number 250, read target: second device storage”.

When the writing controller106illustrated inFIG. 2receives, from the executor107, notification that the END command of the user program1122is executed, the device value of the first device storage101is copied in the second device storage102. Although the device value of the first device storage101is overwritten by execution of the user program1122at the next scan time, the second device storage102stores the device value occurring at the previous scan time. In other words, the device value of the first device storage101is saved in the second device storage102. The functions of the writing controller106are achieved by the MPU160inFIG. 1.

The executor107illustrated inFIG. 2executes the user program1122at each scan time. Specifically, the executor107(i) executes each command of the user program1122in accordance with the input signal stored in the first device storage101and (ii) stores a processing result in the first device storage101. After executing the END command that is the last command of the user program1122, the executor107notifies the writing controller106that one scan is completed. In response to this notification, the writing controller106copies the device value of the first device storage101to the second device storage102. Afterward, the executor107performs the I/O refresh to exchange, all at once, the device values of the first device storage101with those of the inputter200and the outputter300. The functions of the executor107are achieved by the MPU160ofFIG. 1.

As illustrated inFIG. 2, the engineering tool500functionally includes (i) a receiver501that receives instruction regarding reading of a device value, (ii) an acquisition processor502that acquires the device value from the CPU unit100, (iii) a command transmission/reception element503that transmits and receives the command to and from the CPU unit100. The receiver501is one example of reception means of the present disclosure. The acquisition processor502is one example of acquisition processing means of the present disclosure.

The receiver501receives from a user the instruction regarding the reading of a device value. Specifically, the receiver501receives, from the user, instruction as to whether reading target of the device value is designated as the master or the save target. For example, the receiver501(i) displays, on the output device530, a screen as illustrated inFIG. 4and (ii) receives, from the user, instruction regarding designation of the reading target. In this case, the receiver501receives, from the user, designation of the area of the device, designation of a range in the area, and designation of the reading target. The acquisition processor502, which is described later, transmits, to the CPU unit100via the command transmission/reception element503, a command providing instruction to update the reading target designation table103, in accordance with the content input by the user on the screen illustrated inFIG. 4.

Further, the receiver501receives, from the user, instruction to read the designated device value. For example, the receiver501(i) displays, on the output device530, a screen as illustrated inFIG. 5Aand (ii) receives, from the user, instruction regarding reading of the device value. In this case, the receiver501receives, from the user, the designation of the area of the device and the designation of the range in the area. The acquisition processor502, which is described later, transmits the monitor request to the CPU unit100via the command transmission/reception element503in accordance with the content input by the user on the screen illustrated inFIG. 5A.

The acquisition processor502illustrated inFIG. 2transmits, to the CPU unit100, a command depending on the user's instruction received by the receiver501. Specifically, the acquisition processor502transmits, to the CPU unit100via the command transmission/reception element503, a command providing instruction to update the reading target designation table103in accordance with the instruction that the receiver501receives from the user for the designation of the reading target. The command includes a value that identifies the area of the device, the starting number and the finishing number that indicate the range of the monitoring target in the area, and a value that identifies the specified read target.

Further, the acquisition processor502(i) generates a monitor request for requesting reading of the designated device value in accordance with the instruction to read the device, the instruction being received by the receiver501from the user, and (ii) outputs the monitor request to the command transmission/reception element503. The monitor request includes (i) the value that identifies the area of the device and (ii) the starting number and the finishing number that indicate the range of the monitoring target in the area.

Also, the acquisition processor502(i) acquires the device value that is included in the monitor response received from the CPU unit100by the command transmission/reception element503and (ii) stores the device value in the memory510illustrated inFIG. 1. As described above, the monitor response includes the device values that are read in the order designated by the monitor request. Furthermore, the acquisition processor502may display, on the output device530, a screen displaying the device values included in the monitor request, as illustrated inFIG. 5B. The above-described functions of the acquisition processor502are achieved by the processing device550ofFIG. 1executing the monitoring program512and the setting program511.

The command transmission/reception element503illustrated inFIG. 2transmits, to the CPU unit100, a command that is output from the acquisition processor502and that provides instruction to update the reading target designation table103. Furthermore, the command transmission/reception element503transmits, to the CPU unit100, the monitor request output from the acquisition processor502. Also, the command transmission/reception element503also outputs, to the acquisition processor502, the monitor response received from the CPU unit100. The functions of the command transmission/reception element503are achieved by the communication interface540and the processing device550ofFIG. 1

As described above, the reading target having the device value designated by the monitor request is designated in the reading target designation table103. Accordingly, prior to monitoring of the device, data designating a reading target having the device value is to be registered in the reading target designation table103.

Hereinafter, a method is described in which the user uses the engineering tool500to register the data for designating a reading target in the reading target designation table103of the CPU unit100. As illustrated inFIG. 1, the user operates the input device520such as a keyboard or a mouse in a state in which the engineering tool500and the CPU unit100are connected to each other via the communication cable509, to launch the setting program511. The processing device550executes the setting program511in response to the user's operation and achieves the following functions.

The processing device550requests that the CPU unit100provide the data of the device setting1121. The CPU unit100is assumed to transmit the data of the device setting1121to the engineering tool500in response to this request. The device name “X” indicating the area in which the value of the input signal is stored, the device name “Y” indicating the area in which the value of the output signal is stored, the device name “D” indicating the area in which other values are stored, and the starting number and the finishing number indicating the size of each area are assumed to be transmitted as the data of the device setting1121.

The processing device550displays such a designation screen for the reading target as illustrated inFIG. 4on the output device530based on data of the device setting1121provided from the CPU unit100. The user can operate the input device520such as a keyboard or a mouse via the screen illustrated in the drawing to freely select a device from “X”, “Y”, and “D”. Also, the user can enter a starting number and a finishing number for designating the range in each device. The user can select “master” or “save” as the reading target. Here, the term “master” indicates the first device storage101, and the term “save” indicates the second device storage102.

The user is assumed to finish the input operation and press the “register” button. Accordingly, the processing device550transmits, to the CPU unit100, the command providing instruction to update the reading target designation table103. The command includes data indicating the content of an update input by the user. In response to this command, the CPU unit100updates the reading target designation table103based on the received data. The user can use the engineering tool500to update the data in the reading target designation table103as needed. Upon updating the data of the reading target designation table103, the CPU unit100reads the device value from the reading target designated by the updated reading target designation table103.

Next, a method used by the user for monitoring the device value of the CPU unit100using the engineering tool500is described. As illustrated inFIG. 1, the user operates the input device520such as a keyboard or a mouse in a state where the engineering tool500and the CPU unit100are connected to each other via the communication cable509, to launch the monitoring program512. The processing device550executes the monitoring program512in response to the user's operation and achieves the following functions.

The processing device550displays, on the output device530, the input screen of the device monitor as illustrated inFIG. 5A. The user is assumed (i) to operate the input device520such as a keyboard or a mouse on the screen illustrated in the drawing to input a device to be monitored and the starting number and the finishing number indicating the range and (ii) to press the “send” button. Accordingly, the processing device550transmits, to the CPU unit100, a monitor request including the designated device and the starting number and the finishing number. In response to this request, the CPU unit100reads the device value designated by the monitor request and transmits, to the engineering tool500, a monitor response including the read device value.

Upon receiving the monitor response from the CPU unit100, the processing device550displays on the output device530an output screen on the device monitor as illustrated inFIG. 5B. In the illustrated example, the processing device550also displays a number indicating which data each device value corresponds to. For example, the CPU unit100(i) reads the device values of “X100” to “X150” in a designated order and (ii) transmits the read device values to the engineering tool500. The processing device550displays not only the device value received from the CPU unit100but also a device number indicating, based on the starting number and the finishing number input by the user, which order-numbering of data each device value corresponds to in the area “X”.

Next, processing (monitor response process) is described in which the CPU unit100returns a monitor response to the engineering tool500when receiving the monitor request from the engineering tool500. The following processing is achieved by the MPU150executing the monitor response program1123illustrated inFIG. 1. On the other hand, the MPU160is assumed to execute the user program1122at each scan time.

As illustrated inFIG. 6, the MPU150determines whether a monitor request is received from the engineering tool500(step S11). Upon determining that the monitor request is received (Yes in step S11), the MPU150determines, based on the reading target designation table103, a reading target of the device value designated by the monitor request (step S12). On the other hand, if the monitor request is not received from the engineering tool500(No in step S11), the MPU150executes the process of step S11again after the MPU150stands by for a certain period of time.

Upon determining that the reading targets include the first device storage101(Yes in step S13;), after the MPU160executes the END command of the user program1122(Yes in step S14), the MPU150and MPU160cooperate with each other to read the designated device value (step S15).

Specifically, in step S13, the MPU150requests that the MPU160read the device value for which the first device storage101is designated as the reading target in the reading target designation table103. After executing the END command, the MPU160determines whether a read request is received from the MPU160. Upon determining that the read request is received from the MPU150after executing the END command in step S14, the MPU160reads the designated device value from the first device storage101in step S15. The MPU160transmits, to the MPU150, the device value read from the first device storage101.

Also, the MPU150reads, from the second device storage102, a device value for which the second device storage102is designated as the reading target in the reading target designation table103. When the reading target is only the first device storage101, the MPU150does not need to read the device value from the second device storage102.

The MPU150transmits the device value to the engineering tool500(step S16). When both the first device storage101and the second device storage102are the reading target, the MPU150transmits, to the engineering tool500, the device value of the first device storage101received from the MPU160and the device value of the second device storage102read by the MPU150. When only the first device storage101is the reading target, the MPU150transmits, to the engineering tool500, the device value of the first device storage101received from the MPU160.

On the other hand, upon determining, in step S13, that the reading target does not include the first device storage101(No in step S13), that is, when only the second device storage102is the reading target, the MPU150(i) reads a device value designated from the second device storage102(step S17) and (ii) transmits the read device value to the engineering tool500(step S18). Specifically, the MPU150transmits, to the engineering tool500, a response command including the read device value.

As described above, in the embodiment, when the device value requested by the engineering tool500is designated to be read from the second device storage102in the reading target designation table103, the CPU unit100immediately returns, to the engineering tool500, the device value stored in the second device storage102. Accordingly, the device value for which the user designates the second device storage102as a reading target can be read without depending on the scan time of the CPU unit100. There is no case in which the engineering tool500is made to wait for a long time until reception of the monitor response. As a result, the operability of the engineering tool500is improved.

On the other hand, when the device value requested by the engineering tool500is designated to be read from the first device storage101in the reading target designation table103, the CPU unit100returns the device value stored in the first device storage101to the engineering tool500at each scan time as in the conventional case.

As for the device value that does not change during the execution of the user program, designation of the second device storage102as a reading target avoids need for the user to wait for a long time for the purpose of monitoring the device value. In such a case, the configuration according to the embodiment is particularly effective.

Alternatively, when devices of multiple CPU units100are monitored, the second device storage102can be also set to be a reading target concerning the CPU unit100having a long scan time, and the first device storage101can be also set to be a reading target concerning the CPU unit100having a short scan time.

In step S13ofFIG. 6, when both the first device storage101and the second device storage102are the reading target, the device values are returned to the engineering tool500at each scan time. Accordingly, the response of the device value of the second device storage102also becomes slow. For example, occurrence of such a situation can be prevented by the following method. The memory510of the engineering tool500stores beforehand data having the same content as the content registered in the reading target designation table103of the CPU unit100. For example, when both the first device storage101and the second device storage102are included in reading targets of the device values designated by the user in the input screen of the device monitor illustrated inFIG. 5A, the processing device550may be configured to display, on the screen, a message warning that the response becomes slow.

Modified Example 1

In the above-described embodiment, although the example is described in which a reading target having a device value is preset in the reading target designation table103of the CPU unit100, the designation method of the reading target is not limited to such configuration.

The engineering tool500may transmit, to the CPU unit100, a monitor request including information that designates the reading target. The receiver501receives, from the user, designation of an area of a device to be read, designation of a range in the area, and designation of the reading target. For example, the receiver501may be configured to be capable of designating the reading target on the input screen of the device monitor as illustrated inFIG. 7.

In this case, the acquisition processor502illustrated inFIG. 2(i) generates a monitor request depending on a user's instruction received by the receiver501and (ii) transmits the generated monitor request to the CPU unit100via the command transmission/reception element503. The monitor request includes (i) a value that identifies an area of a device, (ii) a starting number and a finishing number that indicate a range of a monitoring target in the area, and (iii) a value that identifies a designated reading target. The CPU unit100(i) reads the designated device value from the reading target designated by the monitor request and (ii) transmits, to the engineering tool500, a monitor response including the read device value. In the case of the above-described configuration, there is no need to register the reading target in the reading target designation table103.

Also in the configuration according to Modified Example 1, as in the embodiment, the device value for which the user designates the second device storage102as the reading target is immediately returned from the CPU unit100to the engineering tool500, thereby improving the operability of an external device.

Modified Example 2

In the embodiment, the CPU unit100includes two MPUs150and160, the MPU150executes the processing related to the monitor response, and the MPU160executes the user program1122. In this case, since the processing is performed by the two MPUs in a distributed manner, processing load on each MPU can be suppressed. However, the CPU unit100may not include two MPUs.

As illustrated inFIG. 8, the CPU unit100may include only one MPU150. Since the CPU unit100includes only one MPU, cost can be reduced in comparison to the case in which the CPU unit100includes two MPUs. In this case, the MPU150achieves the functions of both the command processor105and the writing controller106illustrated inFIG. 2.

Modified Example 3

In the embodiment, as illustrated inFIG. 1, the example is described in which the first device storage101is achieved by the volatile memory111and the second device storage102is achieved by the non-volatile memory112. In this case, for example, when power supply to the CPU unit100is cut off due to a blackout, the embodiment has the following advantage.

When the power supply to the CPU unit100is cut off due to the blackout, the data stored in the first device storage101is not saved. However, the data stored in the second device storage102is saved. In this case, the executor107illustrated inFIG. 2has only to execute the user program1122using the device value stored in the second device storage102. Since the second device storage102stores the device value at the scan time completed before occurrence of the blackout, such configuration is advantageous in that the controlled device902can be restored from the intermediate process.

Alternatively, in the case of slow access speed of the second device storage102, the writing controller106may copy, to the first device storage101, the device value stored in the second device storage102. Since the data is copied between memories in the same CPU unit100, such data transfer does not require much time. Afterward, the executor107executes the user program1122using the device value stored in the first device storage101, thereby achieving a desired result. Since the device value at the scan time completed before the occurrence of the blackout occurs is copied to the first device storage101, this case is advantageous in that the controlled device902can be restored from the intermediate process.

Also, in the embodiments, the command processor105reads the device value from the default reading target when the reading target is not designated in the reading target designation table103. The provision of such a configuration is advantageous as follows. For example, when the first device storage101is the default reading target, there is no need to register, in the reading target designation table103, a device value for which the reading target is the first device storage101. The user has only to only designate, in the reading target designation table103, (i) a device specifying the second device storage102as the read target and (ii) the range of such.

In the embodiment, the example is described in which all device values of the first device storage101are copied to the second device storage102, without particular limitation. Among the device values of the first device storage101, configuration may be used in which only a device value in a designated range is copied to the second device storage102.

In the embodiment, the example is described in which the second device storage102is achieved by the non-volatile memory112. However, the second device storage102may be achieved by a volatile memory. Also in this case, the CPU unit100immediately returns, to the engineering tool500, a designated device value for which the reading target is the second device storage102. Accordingly, the operability of the external device can be improved. Also, the first device storage101may be achieved by a non-volatile memory instead of a volatile memory if a sufficient access speed is guaranteed for the first device storage101. In this case, even if the power supply to the CPU unit100is cut off, the device value of the first device storage101is saved.

In the embodiment, the engineering tool500is described as an example of the external device for monitoring the device memory. However, the external device may be a programmable display or another information processing device capable of communicating with the CPU unit100.

As the recording medium in which the program is recorded, a computer-readable recording medium such as a magnetic disk, an optical disc, a magneto-optical disc, a flash memory, a semiconductor memory, or a magnetic tape can be used.

REFERENCE SIGNS LIST

1Programmable logic controller

101First device storage

102Second device storage

103Reading target designation table

1123Monitor response program