104
11. Appendix D: Sample Use under PL7 PRO
The “Pkw_service” program includes the ST instructions that use the settings and values from the first frames
of the previously described
“PKW Service” operation screen. These instructions are mainly designed to update
the PLC outputs that relate to the commands of the aperiodic parameter reading/writing service (%QW4.0.9 to
%QW4.0.11 for the read command, %QW4.0.12 to %QW4.0.14 for the write command, and %QW4.0.15 for the
counters associated to these two commands). This program processes the following tasks:
• Test of all the checkboxes from the “Slave” and “Command” parts of the screen. If none of the boxes from
each of these two parts is currently checked, one of them will be checked by default (Slave = TeSys U
no. 1; Command = Parameter Reading).
• Comparison of the values that correspond to these checkboxes over two consecutive PLC cycles in order to
keep only one checked box at any given time in each part.
• When the “SEND command” button is detected as being pushed, this program first updates some local
variables, then updates the outputs that relate to the aperiodic parameter reading/writing service. This two-
times update procedure is intended to cut off the outputs update from the rest of the program. The output
data of the gateway are update on a conditionnal basis:
Parameter Reading Æ Updates the %QW4.0.9 to %QW4.0.11 outputs in order for the gateway to issue
the corresponding Modbus reading query (data displayed in the “Query (LUFP7 Outputs)” part of the
“READING of a parameter value” frame). An 8-bit local counter is incremented each time a new query is
issued (the 0 value being reserved, it will be replaced with 1), then transmitted to the gateway using the
MSB byte of the %QW4.0.15 output.
The response from the polled slave will then be used by the gateway in order to update the %IW4.0.9 to
%IW4.0.11 inputs (data displayed in the “Response (LUFP7 Inputs)” part of the “READING of a
parameter value” frame). Each time such a response is received, the gateway increments the MSB byte
of the %IW4.0.15 input in order to tell the Profibus-DP master that it has received a new response. This
8-bit counter is not used in this example.
Parameter Writing Æ Updates the %QW4.0.12 to %QW4.0.14 outputs in order for the gateway to issue
the corresponding Modbus writing query (data displayed in the “Query (LUFP7 Outputs)” part of the
“WRITING of a parameter value” frame). An 8-bit local counter is incremented each time a new query is
issued (the 0 value being reserved, it will be replaced with 1), then transmitted to the gateway using the
LSB byte of the %QW4.0.15 output.
The response from the polled slave will then be used by the gateway in order to update the %IW4.0.12 to
%IW4.0.14 inputs (data displayed in the “Response (LUFP7 Inputs)” part of the “WRITING of a
parameter value” frame). Each time such a response is received, the gateway increments the LSB byte
of the %IW4.0.15 input in order to tell the Profibus-DP master that it has received a new response. This
8-bit counter is not used in this example.