
4.In this case, we are accessing 32 words of global data, so set the bottom portion of the MSTR instruction (“number of registers”) to 32. In the case of MSTR global reads, this number cannot exceed 32 by definition.
5.Initiate the global read command by closing internal relay 1. The data response will be seen in the MSTR Data Area (starting at register 40300).
16.6 MSTR Global Write Example
The following example demonstrates how to use the MSTR instruction to write 32 words of global data from a Modbus Plus master located at network address
1.Once written, any node on the Modbus Plus network will have access to this global data. The same global data values will continue to be available until another global data write occurs. Global data can only be cleared by performing a global data write with a length of 0 words.
1. | Set up a ladder logic program as shown in Figure 37. |
|
|
| ||||
2. | Set the top portion of the MSTR Instruction to 40080. This will be the | |||||||
| starting address of the MSTR Control Block. Set the control block registers | |||||||
| to the following values: |
|
|
|
|
| ||
|
|
|
|
|
|
|
|
|
|
| Address |
| Description |
| Register Value |
| |
| 40080 | MSTR function (global write) |
| 5 |
|
| ||
| 40081 | Error code |
|
| Read Only |
| ||
| 40082 | Number of consecutive registers to write |
| 32 |
|
| ||
3. | Set the middle portion of the MSTR instruction to 40400. This will be the | |||||||
| starting address of the MSTR Data Area. This is the location of the data | |||||||
| that will be written to the master’s network global data. |
|
|
| ||||
|
|
|
|
|
|
| ||
|
| Address | Value |
|
|
| ||
|
| 40400 Value to write to offset 0 in the master’s global data | ||||||
40401 Value to write to offset 1 in the master’s global data
::
40400+n Value to write to offset n in the master’s global data
::
40431 Value to write to offset 31 in the master’s global data
4.In this case, we are writing 32 words of global data, so set the bottom portion of the MSTR instruction (“number of registers”) to 32. In the case of MSTR global writes, this number cannot exceed 32 by definition.
5.Initiate the global write command by closing internal relay 1. The data at registers
66