MIL_ID ComId, | //in |
MIL_CONST_TEXT_PTR DataObjectEntryName, | //in |
MIL_INT Offset, | //in |
MIL_INT Size, | //in |
const void *UserArrayPtr | //in |
This function writes data to a device that uses the specified communication protocol. In most cases, this function actually writes to the local computer's memory, the data to send to a controller (e.g. a PLC) during the controller's next read cycle. However, when communicating with the device using the Modbus protocol in master configuration, or writing configuration data to an EtherNet/IP device explicitly, this function can write the data directly to the device's memory.
A controller that uses the PROFINET protocol reads data from the local computer, from modules in local memory. As such, you must specify the module's index in which to write the data to send to the controller.
A controller that uses the Modbus protocol reads data from the local computer, from data tables in local memory, when the local computer is in a slave configuration. To write to a Modbus device (either in a slave or master configuration), you must specify the data table in which to write. Note that when the local computer is configured as a master, you can only write to the coil or holding register data tables of a slave device.
A controller that uses the EtherNet/IP protocol reads data from the local computer, from a producer assembly in local memory. As such, to send data to an EtherNet/IP controller, specify to write to the producer assembly in local memory. You can also write to a configuration assembly. When writing to a configuration assembly, you are writing EtherNet/IP configuration data in local memory about the local computer.
For EtherNet/IP, you can also specify to write explicitly to another device on the network. However, this method is slower than using implicit messaging. You should only use explicit messaging for data that is not time critical; typically, this means only writing data to the configuration assemblies of other devices.
A controller that uses the CC-Link IE Field Basic protocol reads data from the local computer, from register and flag data tables in local memory. As such, to send data to a CC-Link controller, you must specify whether to write 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_INSIZE, M_COM_ETHERNETIP_PRODUCER_SIZE to establish the size of the input module, or assembly, respectively, from which the controller can read. 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 (RWr) or flags (RX) from which the controller can read, multiply the number of stations by 32 or 64 respectively.
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 in which to write the data. This location is protocol specific. This parameter must be set to one of the following.
When writing to a device (controller) that uses the PROFINET protocol (McomAlloc() with M_COM_PROTOCOL_PROFINET), use the following format to specify the location.
For specifying the path of the data to write in
PROFINET
|
|||||||||||||||||||||||||||||||||||||||
Value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
MIL_TEXT("mcom://ModuleIndex") 1 |
Specifies the location in local memory in which to write the data to send to a controller. Replace ModuleIndex with the index of the input module in local memory in which to write the data. ModuleIndex can be from 0 to 255. (summarize)Specifies the location in local memory in which to write the data to send to 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 writing to a device (controller) that uses the Modbus protocol (McomAlloc() with M_COM_PROTOCOL_MODBUS), use the following format to specify the location.
For specifying the path of the data to write in
Modbus
|
|||||||||||||||||||||||||||||||||||||||
Value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
M_COILS |
Specifies to write to the coils data table in local memory the data to send to the Modbus controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
M_DISCRETE_INPUT |
Specifies to write to the discrete input data table in local memory the data to send to the Modbus controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
M_HOLDING_REGISTER |
Specifies to write to the holding register data table in local memory the data to send to the Modbus controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
M_INPUT_REGISTER |
Specifies to write to the input register data table in local memory the data to send to the Modbus controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
MIL_TEXT("[mcom://SlaveId[@SlaveIP]/]M_COILS") 1 |
Specifies to write to the coils 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 write to the coils 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 |
||||||||||||||||||||||||||||||||||
MIL_TEXT("[mcom://SlaveId[@SlaveIP]/]M_HOLDING_REGISTER") 1 |
Specifies to write to 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 write to 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 |
1 If you are passing the value in a variable, don't enclose it in MIL_TEXT().
When writing to a device (typically a controller) that uses the EtherNet/IP protocol (McomAlloc() with M_COM_PROTOCOL_ETHERNETIP), use one of the following to specify the location.
For specifying the path of the data to write in
EtherNet/IP
|
|||||||||||||||||||||||||||||||||||||||
Value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
M_COM_ETHERNETIP_CONFIG |
Specifies to write EtherNet/IP configuration data about the local computer to the configuration assembly in local memory. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
M_COM_ETHERNETIP_PRODUCER |
Specifies to write data to the producer assembly in local memory to send the data to the Ethernet/IP controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
MIL_TEXT("mcom://[RemoteIP]/AssemblyID") 1 |
Specifies the slave device on the network and the assembly in which to write 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 write to a particular device's specified assembly. While this is supported in MIL, this method will be slower than using implicit messaging. Therefore, in theory, this method should only be used to write configuration data to another slave device on the network. (summarize)Specifies the slave device on the network and the assembly in which to write 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 writing to a device (controller) that uses the CC-Link IE Field Basic protocol (McomAlloc() with M_COM_PROTOCOL_CCLINK), use one of the following to specify the location.
For specifying the path of the data to write in
CC-Link IE Field Basic
|
|||||||||||||||||||||||||||||||||||||||
Value | Description |
MIL system-specific tooltip (‡) |
|||||||||||||||||||||||||||||||||||||
M_COM_CCLINK_INPUT_FLAG |
Specifies to write the data to the input flag (RX) data table in local memory to send the data to the CC-Link IE field basic controller. |
‡ | a | t U28 |
w U53 |
||||||||||||||||||||||||||||||||||
M_COM_CCLINK_INPUT_REGISTER |
Specifies to write the data to the input register (RWr) data table in local memory to send the data to the CC-Link IE field basic controller. |
‡ | a | t U28 |
w U53 |
Specifies the offset from which to start writing 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 size of the data to be written. 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 containing the data.
When writing 1-bit data, the array must contain one byte for each bit that is read. The values to write must be stored in the least-significant bit of each byte.
When writing 16-bit data, the array must contain two bytes for each 16-bit word that is written. The values to write must be 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. |