Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
March, 2011
V. 1.001
Kepware Technologies
Table of Contents
1.
Overview ................................................................................................ 1
2.
Requirements .......................................................................................... 1
3.
4.
5.
6.
3.1
3.2
4.2
5.2
________________________________________________________________________________________
www.kepware.com
1. Overview
This guide will demonstrate how to establish a connection between Excel and the
KEPServerEX data server. Users must complete the following before continuing
with this tutorial:
Configure a server project. Users may either select the appropriate driver
and settings or run the Simulation Driver Demo that is included with
KEPServerEX. The Simulation Driver Demo project will be used for all
examples in this tutorial.
Start KEPServerEX and load the Simulation Driver Demo project. Once
the server project has been loaded, open the Runtime menu on the main
menu bar and verify that the server project has been connected.
2. Requirements
The following requirements are necessary to perform DDE connections to the
server.
2. Next, open the Runtime Process tab and then locate Process Mode.
3. Use the Selected Mode drop-down menu to select Interactive.
________________________________________________________________________________________
www.kepware.com
3.2
________________________________________________________________________________________
www.kepware.com
4.2
________________________________________________________________________________________
www.kepware.com
3. In Trust Center, select Macro Settings and then check Enable all
macros.
4. Click OK to exit.
5.2
________________________________________________________________________________________
www.kepware.com
1. To start, enter two consecutive DDE read links into column 1 of Sheet1.
2. In Cell(1,1), enter the following formula for reading server data:
=kepdde|_ddedata!Channel1.Device1.Tag1
3. In Cell(2,1), enter the following formula for reading server data:
=kepdde|_ddedata!Channel1.Device1.Tag2
4. Next, select Excels Developer tab and then open Visual Basic Editor.
SetValue=Worksheets("Sheet1").Cells(2,2)
Application.DDEPokechannel,"Channel1.Device1.Tag2",Value
Application.DDETerminatechannel
EndSub
________________________________________________________________________________________
www.kepware.com
6. Next, click File | Save, and then name the code module "Poke".
7. Exit Visual Basic and return to the Excel spreadsheet.
Note: The macro is now ready to be tested.
8. Next, enter some numbers in Cell(1,2) and Cell(2,2). Click on an unused
cell to make sure that the last value is set.
________________________________________________________________________________________
www.kepware.com
2. Next, enter the following formula into the Formula Bar. Do not enter the
formula into a cell.
=kepdde|_ddedata!'Channel1.Device1.R100[5][4]'
________________________________________________________________________________________
www.kepware.com
Note: In Excel, escape characters must be used around any formula string
that contains square brackets. Therefore, the tick marks included in the
formula above are essential.
3. Next, press Shift, Control, and Enter simultaneously. This combination
informs Excel that an array element has been entered.
Note: If these keys are not pressed simultaneously, only a single item will be
displayed in the first cell.
4. If the formula and command worked correctly, changing data should be
visible in each of the array's cells.
________________________________________________________________________________________
www.kepware.com