DDE (Dynamic Data Exchange) is a well-established mechanism for exchanging data among processes in MS-Windows. The mechanism was intentionally designed to be easy to use and to represent data as simply as possible. DDE is implemented in many popular programs that run in Windows, such as Microsoft Excel and Microsoft Word. This widespread availability makes DDE a good choice for general data sharing.
The competition with DDE is COM, with its variants for OLE: OPC and ActiveX. By comparison, DDE is simpler, and therefore faster, than the equivalent COM interface if implemented as a separate process. DDE is much easier to implement in code, and offers a particular data model as (name, value) pairs. In the case of real-time data, this model is well suited, and therefore offers the best cost/benefit ratio when programming for real-time data.
However, DDE was not designed to be used over a network. The Cogent solution for this shortcoming is to tunnel two OPC DataHubs over a network or the Internet using TCP. Thus, two programs that use only DDE can exchange data across a robust, TCP-enabled link.
DDE defines data in terms of (service, topic, item), explained as follows:
A name used by a DDE server to identify its service to DDE clients. The default DDE service name for the OPC DataHub is datahub. Unlike most Windows programs, the OPC DataHub lets you change this name, or add more names if you'd like.
A way to categorize items. This corresponds to a OPC DataHub domain.
A variable that holds a value. This corresponds to a OPC DataHub point.
Here are some service and topic names for several Windows programs:
|Application||DDE Service Name||DDE Topic Name|
|OPC DataHub||Multiple names can be assigned. The default name is datahub.||Any OPC DataHub domain name, the default domain is default.|
|Microsoft Excel||EXCEL||The name of the spreadsheet, chart, macro, etc. For example: mysheet.xls|
|Microsoft Access||MSACCESS||The name of the table, SQL query, or macro to run.|
|Microsoft Word||WINWORD||The name of the document, including the .doc extension.|
|National Instruments' Lookout||LOOKOUT||The name of the application, without the .lkp extension.|
|Asymetrix Toolbook||TOOLBOOK||The name of the toolbook application, with the .tbk extension.|
Here are a few service and topic names for financial data feeds:
|Data Feed||DDE Service Name||DDE Topic Name||Symbol Example|
|Bloomberg||BLP||M||IBM EQUITY,[LAST TRADE]|
|Future Source (CalcSource)||CALCSRC||P||USH8.LAST|
|Future Source (ProfNet)||PROFDDE||LIVE||APIU02,LAST|
|Knight Rider Profit Center||QMASTER||QUOTE||USH8.LAST|
|METATRADER v. 4||MT4||BID||USDCHF|
|Moneycast||WBSERVER||SES||19/L (19 is a stock code)|
|Reuters||REUTER||IDN||USH8 /IBM ,LAST|
|Telerate WorkStation||TWINDDE||QUOTES||USH8.3 LAST|
|Universal Market Data Server||USDDE||QUOTE||US8H;LAST|
In DDE, the role of client and server in data exchange is fairly clear. A client initiates the activity, and the server responds. To facilitate two-way data transfer, each OPC DataHub can each act as both client and server. This is what allows Excel spreadsheets to share data bidirectionally across a network.
There are three ways to send and receive ordinary data over DDE. Here is a brief explanation, using the OPC DataHub and Microsoft Excel as examples:
Poke The client sends data for an item directly to the server. In Excel, this is done with a macro. The server does not necessarily reply. The actual data flow is from client to server—from Excel to DataHub.
Request The client asks the server to send an item's data. In Excel, this is done with a macro. The client receives either the requested value, or NULL if the server can't send the value. The actual data flow is from server to client—from DataHub to Excel.
Advise The client asks to be notified of any change in the data for an item. If the server agrees to the request, it sends the new value for the item each time its value changes. The OPC DataHub can conduct two-way communication with Excel using only this advise capability, as follows:
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.