Handling multiple devices, Configuration, Handling multiple devices -14 – National Instruments NI-DNET User Manual

Page 45: Configuration -14

Advertising
background image

Chapter 4

NI-DNET Programming Techniques

NI-DNET User Manual

4-14

ni.com

Specification defines the overall format of these services, in most cases
their meaning and service data are object-specific or vendor-specific.
Unless your device requires such services and documents them in detail,
you probably do not need them for your application.

You need the following information to use the

ncWriteDnetExplMsg

and

ncReadDnetExplMsg

functions for a given explicit messaging service:

The class and instance identifiers for the object to which the service
will be directed.

The service code used to identify the service.

The length and format of service request and response data. Some of
data formats are defined by the service’s overall specification (such as
in Appendix G, DeviceNet Explicit Services, in the DeviceNet
Specification
manual), but many data formats are object-specific or
vendor-specific. For example, for the Reset service, Appendix G
defines the service’s code for use with any object, but its actual data
format is defined in the specification for the Identity Object.

The error codes that can be returned in the service response. Error
codes that are common to all services can be found in Appendix H,
DeviceNet Error Codes, in the DeviceNet Specification manual, but
many error codes are specific to the service, object, or vendor.

As with the

ncGetDnetAttribute

and

ncSetDnetAttribute

functions, the service data formats for the request and response are
specified in terms of DeviceNet data types. These DeviceNet data types are
converted to/from the data types of your programming environment (C or
LabVIEW) as discussed in previous sections.

Handling Multiple Devices

This section describes techniques you can use to efficiently implement an
application that communicates with a large number of DeviceNet devices.
In such an application, there might be only one call to

ncOpenDnetIntf

(only one network), but there are usually multiple calls to

ncOpenDnetIO

(and possibly

ncOpenDnetExplMsg

).

Configuration

If the configuration parameters used with

ncOpenDnetIO

tend to change

over time, you might want to organize them in data structures instead of
using constants.

Advertising