MIL_ID ComId, | //in |
MIL_CONST_TEXT_PTR DataObjectEntryName, | //in |
MIL_INT Offset, | //in |
MIL_INT Size, | //in |
void *UserArrayPtr | //out |
This function reads data from a device that uses the specified communication protocol. In most cases, this function actually reads the local computer's memory for data received from a controller (e.g. a PLC) during the controller's last write cycle. However, when communicating with the device using the Modbus protocol in master configuration, or reading configuration data from an EtherNet/IP device explicitly, this function can read the data directly from the device's memory. This function can also read the data last written to local memory using McomWrite().
A controller that uses the PROFINET protocol writes data to the local computer in modules in local memory. As such, you must specify the module's index from which to read the received data.
A controller that uses the Modbus protocol writes data to the local computer in data tables in local memory, when the local computer is in a slave configuration. To read from a Modbus device (either in a slave or master configuration), you must specify the data table from which to read.
A controller that uses the EtherNet/IP protocol writes data to the local computer, typically, in the consumer assembly in local memory. As such, to read data received from an EtherNet/IP controller, specify to read from the consumer assembly in local memory. You can also read from the producer or configuration assembly in local memory. When reading from a producer assembly, you are reading your own published data in local memory. When reading from a configuration assembly, you are reading EtherNet/IP configuration data in local memory about the local computer. Note that you can also specify another device on the network from which to read data explicitly, although this should only be used to read configuration data.
A controller that uses the CC-Link IE Field Basic protocol writes data to the local computer, in register and flag data tables in local memory. As such, to read data received from a CC-Link controller, you must specify whether to read the data in the flags or registers data table. The local computer can only be configured as a slave device.
For PROFINET and EtherNet/IP, use McomInquire() with M_COM_PROFINET_GET_MODULE_OUTSIZE or M_COM_ETHERNETIP_CONSUMER_SIZE to establish the size of the output module, or assembly, respectively, to which the controller has written. You must know how the module/assembly is divided into fields.
For CC-Link IE Field Basic, use McomInquire() with M_COM_CCLINK_TOTAL_OCCUPIED_STATION to learn the number of stations used by the industrial protocol instance. To establish the number of registers (RWw) or flags (RY) to which the controller can write, multiply the number of stations by 32 or 64 respectively.
If the time to execute this function is greater than the value set using McomControl() with M_COM_TIMEOUT, an error occurs.
This function is only available if you have the MIL Industrial Communication package, or another relevant update installed.
Specifies the identifier of the Industrial Communication context that specifies the protocol of the device with which to communicate.
Specifies the location from which to read the data. This location is protocol specific. This parameter must be set to one of the following.
When reading from a device (controller) that uses the PROFINET protocol (McomAlloc() with M_COM_PROTOCOL_PROFINET), use the following format to specify the location.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description |
MIL system-specific tooltip (‡) |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||||||||||
![]() ![]() |
Specifies the location in local memory from which to read the data received from a controller. Replace ModuleIndex with the index of the module in local memory from which to read the data. ModuleIndex can be from 0 to 255. (summarize)Specifies the location in local memory from which to read the data received from a controller. (more details...) |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
MIL system specific | |||||||||||||||||||||||||||||||||||||||
Note that the Host system is only supported on the Matrox 4Sight GPm and EV6 platforms. Support for the Matrox 4Sight EV6 platform requires driver update 93. |
‡ | a |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
When reading from a device (controller or slave automation device) that uses the Modbus protocol (McomAlloc() with M_COM_PROTOCOL_MODBUS), use the following format to specify the location.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description |
MIL system-specific tooltip (‡) |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||||||||||
![]() ![]() |
Specifies to read the coil data table in local memory for data received from a Modbus controller, or written by the last call to McomWrite() with M_COILS. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the discrete input table in local memory for data written by the last call to McomWrite() with M_DISCRETE_INPUT. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the holding register table in local memory for data received from a Modbus controller, or written by the last call to McomWrite() with M_HOLDING_REGISTER. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the input register table in local memory for data written by the last call to McomWrite() with M_INPUT_REGISTER. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the coil data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. Replace SlaveId with the slave device's identifier number. If connecting to a slave device over the Modbus TCP protocol, also enter @ and replace [SlaveIP] with the slave device's IP address; the MIL Industrial Communication module supports IPv4 addresses. A typical IPv4 string has the format n.n.n.n, where n is a number between 0 and 255. (summarize)Specifies to read the coil data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. (more details...) |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the discrete input data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. Replace SlaveId with the slave device's identifier number. If connecting to a slave device over the Modbus TCP protocol, also enter @ and replace [SlaveIP] with the slave device's IP address; the MIL Industrial Communication module supports IPv4 addresses. A typical IPv4 string has the format n.n.n.n, where n is a number between 0 and 255. (summarize)Specifies to read the discrete input data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. (more details...) |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the holding register data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. Replace SlaveId with the slave device's identifier number. If connecting to a slave device over the Modbus TCP protocol, also enter @ and replace [SlaveIP] with the slave device's IP address; the MIL Industrial Communication module supports IPv4 addresses. A typical IPv4 string has the format n.n.n.n, where n is a number between 0 and 255. (summarize)Specifies to read the holding register data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. (more details...) |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the input register data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. Replace SlaveId with the slave device's identifier number. If connecting to a slave device over the Modbus TCP protocol, also enter @ and replace [SlaveIP] with the slave device's IP address; the MIL Industrial Communication module supports IPv4 addresses. A typical IPv4 string has the format n.n.n.n, where n is a number between 0 and 255. (summarize)Specifies to read the input register data table of a slave device, when the local computer is communicating using the Modbus protocol in master configuration. (more details...) |
‡ | a | t U28 |
w U53 |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
When reading from a device (typically a controller) that uses the EtherNet/IP protocol (McomAlloc() with M_COM_PROTOCOL_ETHERNETIP), or when reading local memory for data written by the last call to McomWrite(), use one of the following to specify the location.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description |
MIL system-specific tooltip (‡) |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||||||||||
![]() ![]() |
Specifies to read the configuration assembly in local memory for EtherNet/IP configuration data typically written by the last call to McomWrite(). |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the consumer assembly in local memory for data received from an EtherNet/IP controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the producer assembly in local memory for data written by the last call to McomWrite(). |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies another slave device on the network and the assembly from which to read the data when communicating using the Ethernet/IP protocol. Replace [RemoteIP] with the slave device's IP address; the MIL Industrial Communication module supports IPv4 addresses. A typical IPv4 string has the format n.n.n.n, where n is a number between 0 and 255. This method uses explicit messaging to read from a particular device's specified assembly. While this is supported in MIL, this method will be slower than using implicit messaging. This should, in theory, only be used to read a configuration setting on the specified device. (summarize)Specifies another slave device on the network and the assembly from which to read the data when communicating using the Ethernet/IP protocol. (more details...) |
‡ | a | t U28 |
w U53 |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
When reading from a device (controller) that uses the CC-Link IE Field Basic protocol (McomAlloc() with M_COM_PROTOCOL_CCLINK), or when reading local memory for data written by the last call to McomWrite(), use one of the following to specify the location.
![]() |
|||||||||||||||||||||||||||||||||||||||
![]() ![]() |
Description |
MIL system-specific tooltip (‡) |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
||||||||||||||||||
![]() ![]() |
Specifies to read the input flag (RX) data table in local memory for data written by the last call to McomWrite(). |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the input flag (RWr) data table in local memory for data written by the last call to McomWrite(). |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the output flag (RY) data table in local memory for data received from a CC-Link IE Field Basic master controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
![]() ![]() |
Specifies to read the output register (RWw) data table in local memory for data received from a CC-Link IE Field Basic master controller. |
‡ | a | t U28 |
w U53 |
Specifies the offset from which to start reading the data in the specified module/data table/assembly. Typically, the offset is specified in bytes. The following exceptions apply:
For Modbus register-type data tables (M_..._REGISTER) and CC-Link register-type data tables (M_COM_CCLINK_INPUT_REGISTER), specify the offset in 16-bit words.
For Modbus bit-type data tables (M_COILS and M_DISCRETE_INPUT) and CC-Link flag-type data tables (M_COM_CCLINK_INPUT_FLAG), specify the offset in bits.
Specifies the amount of the data to read. Typically, the size is specified in bytes. The following exceptions apply:
For Modbus register-type data tables (M_..._REGISTER) and CC-Link register-type data tables (M_COM_CCLINK_INPUT_REGISTER), specify the size in 16-bit words.
For Modbus bit-type data tables (M_COILS and M_DISCRETE_INPUT) and CC-Link flag-type data tables (M_COM_CCLINK_INPUT_FLAG), specify the size in bits.
Data type: address of a
MIL_UINT8
Required array size:(Size)
Specifies the address of the array in which to write the data.
When reading 1-bit data, the array contains one byte for each bit that is read. The read values are stored in the least-significant bit of each byte.
When reading 16-bit data, the array contains two bytes for each 16-bit word that is read. The read values are stored as byte pairs. The first byte is the most-significant byte of the word, the second byte is the least-significant byte of the word.
Header | Include mil.h. |
Library | Use mil.lib; milcom.lib. |
DLL | Requires mil.dll; milcom.dll. |