MSTR Block Read Operation

For general information on the MSTR Block, see Using the MSTR Modicon Ladder Logic Block.

Reading from Modbus Plus is described in Reading and Writing Modbus Plus Registers. Reading from Modbus/TCP is described in Using the Modicon Quantum with the RMC Ethernet Module.

 

Control Block

In a Read operation, the nine control-block registers are assigned in as shown:

Register

Content

1st

Operation: 2

2nd

Error Status: This register is filled by the operation. See MSTR Block Error Codes for a complete list.

3rd

Length: Indicates the number of registers to read.

4th

Operation-dependent Value: Indicates the address in the slave to read from.

Note: When entering register addresses into an MSTR block, do not add 40000 or 400000 to indicate holding registers. MSTR blocks expect the addresses to start at 1, rather than 40001 or 400001.

 

5th-9th

Routing 1-5: The uses of these fields depend on whether Modbus Plus or Modbus/TCP is being used:

Modbus Plus: For local addresses, Routing 1 gives the node address, and Routing 2 gives the data path (1-8) to use in the node. Routing 3 through 5 are zeros. For more complicated routing methods, refer to the section on routing path structure in Modbus Plus Network Planning and Installation Guide.

Modbus/TCP: Routing 1 is broken into two bytes: the MSB holds the Quantum backplane Slot ID of the NOE module, and the LSB holds the Map Index, which should be zero for the RMC. Routing 2 through 5 holds the four dot-separated values of the RMC IP address (e.g. 192.168.0.5).

 

Example (Modbus Plus)

Suppose that we wish to read the parameters for the first four axes of the RMC located at node address 3 whenever we reach state 1. After reading the parameters we are to return to state 0. The state is stored in holding register 400250, and we will read the parameters into the holding registers 400500 through 400563. The control block is located at 400100 to 400108. The following network would be used:

image\ebx_281123599.gif

This network waits until the state is equal to 1 and then triggers the MSTR block using the control block below. When the MSTR read operation completes, the state is set to 0. Notice that the MSTR enable input is powered for the duration of the operation.

Register

Content

400100

2 (decimal): Operation type: Read data

400101

0000 (hex): Error status: will be filled in by function

400102

64 (decimal): Length: there are 16 parameters on each of four axes

400103

129 (decimal): Address in slave (RMC) memory: This is the address of the first parameter on the first axis

400104

3 (decimal): Routing 1 (Node address)

400105

1 (decimal): Routing 2 (Data path): This could have been 1-8

400106

0 (decimal): Routing 3

400107

0 (decimal): Routing 4

400108

0 (decimal): Routing 5

 

Example (Modbus/TCP)

Suppose that we wish to read the parameters for the first four axes of an RMC whenever we reach state 1. The RMC has an IP address of 192.168.0.5 and we will use the Modicon Ethernet/TCP module (140 NOE 211 00) located in the Quantum backplane slot #3. After reading the parameters we are to return to state 0. The state is stored in holding register 400250, and we will read the parameters into the holding registers 400500 through 400563. The control block is located at 400100 to 400108. The following network would be used:

image\ebx_-995220213.gif

This network waits until the state is equal to 1 and then triggers the MSTR block using the control block below. When the MSTR read operation completes, the state is set to 0. Notice that the MSTR enable input is powered for the duration of the operation.

Register

Content

400100

2 (decimal): Operation type: Read data

400101

0000 (hex): Error status: will be filled in by function

400102

64 (decimal): Length: there are 16 parameters on each of four axes

400103

129 (decimal): Address in slave (RMC) memory: This is the address of the first parameter on the first axis

400104

0300 (hex): Routing 1: The high byte holds the Quantum backplane slot ID (3). The low byte holds the Map Index, which should be set to zero when communicating with the RMC.

400105

192 (decimal): Routing 2: First byte of the IP address: 192.168.0.5

400106

168 (decimal): Routing 3: Second byte of the IP address: 192.168.0.5

400107

0 (decimal): Routing 4: Third byte of the IP address: 192.168.0.5

400108

5 (decimal): Routing 5: Fourth byte of the IP address: 192.168.0.5

 


Copyright (c) 1997-2015 by Delta Computer Systems, Inc.