Write values to the Communication Driver from Excel
- Last UpdatedSep 16, 2024
- 1 minute read
You can write values from Microsoft Excel to the Communication Driver by creating an Excel macro that uses the POKE command.
The proper command is entered in Excel as follows:
channel=INITIATE("applicationname","topicname")
=POKE(channel,"itemname", Data_Reference)
=TERMINATE (channel)
=RETURN()
The following describes each of the above POKE macro statements:
channel=INITIATE("applicationname","topicname")
-
Opens a channel to a specific topic name that is defined in the Communication Driver in a particular application name (the executable name without the .exe).
-
Assigns the number of that opened channel to channel.
Note: When using the channel=INITIATE statement, the word channel must be used in the =POKE statement instead of the actual cell reference. The "application name" and "topic name" portions of the formula must be enclosed in quotation marks.
=POKE(channel,"itemname", Data_Reference)
-
Pokes the value contained in the Data_Reference to the specified item name or the actual location in the PLC, via the channel number that is returned by the previously executed INITIATE function.
-
Data_Reference is the row/column ID of the cell containing the data value.
=TERMINATE(channel)
-
Closes the channel at the end of the macro.
-
Channel is the channel number returned by the previously executed INITIATE function.
-
Some applications have a limited number of channels, therefore they should be closed when finished
=RETURN()
Marks the end of the macro.
Note: See the .xlm sample Excel poke macro provided on the install CD. See the Microsoft Excel documentation for complete details on entering Remote Reference formulas for cells.