Using visual basic – Rockwell Automation 8520-9API 9/Series OCI API Developer's Guide User Manual

Page 19

Advertising
background image

2–2

DDE Data Server Examples

Publication 8520-6.6 - August 1999

Topic Name

The topic name is created by the data server when it is launched.
9/Series only topic names are defined by you in the INI file
OCIDSCFG.INI. A different topic name is created for each 9/Series
CNC connection to the data server as an alias. If you are using the
9/PC, you create the topic name during 9/PC executive software
installation or change the topic name via the 9/PC Configuration
Manager. The 9/PC has only one topic name. The default alias for
one CNC connection is:

“CNC_1”

The rest of this chapter assumes this is the alias you are using. Refer
to your 9/Series OCI Installation Manual for details on configuring
the INI file for 9/Series OCI or the Configuration Manager in the
9/PC Installation and Integration Manual for configuring the 9/PC.

Item Name

The item name for the 9/Series or 9/PC data server can be either a
data item (refer to chapter 3 or appendix A) or a command (refer to
chapter 4 or appendix B). For example:

AVAILABLE_MEMORY

Is the valid name of an OCI topic that returns free memory
information from the 9/Series or 9/PC.

Several different VB objects can be used to create DDE links to a
DDE server. Refer to your VB instruction manual for these items.
For the following example we created a text box on the VB form and
named that text box ”X_RAW”. This text box then stores the data
returned from the data server (X_RAW.Text). It is important to
remember that if the command fails or is invalid for some reason the
string “Server Error [code]” for the connection will also be returned
as the text value for this text box. Your code should test the value of
your DDE objects to identify and handle errors appropriately.

Reading Data

In Microsoft Visual Basic the Service and Topic are included in the
same property separated by a pipe character and enclosed in quotes.
This example simply gets the raw value of the axis 1 position (no
decimal point). Later you’ll need to format this data as determined
by your system configuration before passing it on to users.

Using Visual Basic

Advertising