Requesting a one-time network variable update – Echelon LNS DDE Server User Manual

Page 76

Advertising
background image


The Al- 1.Node Object 0.Node_Directory item would be reformatted as a
UNVT_u_long, by using the -t option as follows:

Al- 1. Node Object 0.Node_Directory –t#8011223344556677[1].UNVT_u_long


This item specifies the AI- 1 device, the Node Object 0 L

ON

M

ARK

object, and the

Node_Directory network variable member of the L

ON

M

ARK

object. The format is

specified as the format defined for program ID 8011223344556677, with a selector of

1, and a format name of UNVT_u_long.

Requesting a One-Time Network Variable Update

To request a one-time update, your client application sends a DDE Request message

to the LNS DDE Server. The LNS DDE Server responds with the requested value.
The format of the request is application dependent. The following sections describe

how to request a one-time update in Excel and InTouch.

Requesting a One-Time Network Variable Update Using Excel

Three separate functions are required to request a one-time network variable update

using Excel. They are the Excel DDEInitiate(), DDERequest(), and DDETerminate()

functions. To call these functions, you must implement a Visual Basic for
Applications (VBA) macro for each value to be requested. VBA is included with

Excel.

The request macro will typically be called from an ActiveX control such as a button.

To request a one-time network variable update using an Excel button control, follow
these steps:

1. Create or open an Excel spreadsheet and select the worksheet that will contain

the button.

2. If the Control Toolbox is not displayed, point to Toolbars on the View menu, and

then select Control Toolbox.

3. Click the Command Button control on the Control Toolbox.

4. On the worksheet, drag the control to the size you want.

5. To set the properties for the control, right-click the control, and then select

Properties on the shortcut menu.

6. To add VBA macro code to the control, right-click the control, and then select

View Code on the shortcut menu. The VBA editor will be opened, and a new VBA
function will be created for your button code.

7. Enter the following code:

Dim Channel As Long

5-6

Reading and Writing Network Variables

Advertising