Explicit Messaging Object

NI-DNET Programmer

Explicit Messaging Object

Description

The Explicit Messaging Object represents an explicit messaging connection to a remote DeviceNet device (physical device attached to your interface by a DeviceNet cable). Since only one explicit messaging connection is created for a given device, the Explicit Messaging Object is also used for features that apply to the device as a whole.

Use the Explicit Messaging Object to do the following:

  • Execute the DeviceNet Get Attribute Single service on the remote device (ncGetDnetAttribute).
  • Execute the DeviceNet Set Attribute Single service on the remote device (ncSetDnetAttribute).
  • Send any other explicit message requests to the remote device and receive the associated explicit message response (ncWriteDnetExplMsg, ncReadDnetExplMsg).
  • Configure NI-DNET settings that apply to the entire remote device.

Functions

Function Name Function Description
ncCloseObject Close an NI-DNET object
ncConvertForDnetWrite Convert an appropriate LabVIEW data type for writing data bytes on the DeviceNet network
ncConvertFromDnetRead Convert data read from the DeviceNet network into an appropriate LabVIEW data type
ncCreateNotification Create a notification callback for an object (C only)
ncGetDnetAttribute Get an attribute value from a DeviceNet device
ncGetDriverAttr Get the value of an attribute in the NI-DNET driver
ncOpenDnetExplMsg Configure and open an NI-DNET Explicit Messaging Object
ncReadDnetExplMsg Read an explicit message response
ncSetDnetAttribute Set an attribute value for a DeviceNet device
ncSetDriverAttr Set the value of an attribute in the NI-DNET driver
ncStatusToString Convert status returned from an NI-DNET function into a descriptive string (C only)
ncWaitForState Wait for one or more states to occur in an object
ncWriteDnetExplMsg Write an explicit message request

Driver Attributes

Current State

Attribute ID NC_ATTR_STATE
Hex Encoding 80000009
Data Type NCTYPE_STATE
Permissions Get
Description Current state of the NI-DNET object. This driver attribute provides the current ReadAvail and Established states as described in the ncWaitForState function.

Use ncGetDriverAttr when you need to determine the current state of an object but you do not need to wait for a specific state.

Device Type

Attribute ID NC_ATTR_DEVICE_TYPE
Hex Encoding 80000084
Data Type NCTYPE_UINT16
Permissions Set
Description Device Type of the device as reported in the Device Type attribute of device's Identity Object. This attribute verifies that the device is the same one expected by your application. If the Device Type does not match, NI-DNET returns the error DnetErrDevInitDevType.

The Device Type indicates conformance to a specific device profile, such as Photoelectric Sensor or Position Controller.

If you do not call ncSetDriverAttr to set the Device Type, a default value of zero is used. When Device Type is zero, NI-DNET does not verify the device's Device Type.

Keep Explicit Messaging

Attribute ID NC_ATTR_KEEP_EXPL_MSG
Hex Encoding 80000099
Data Type NCTYPE_BOOL
Permissions Set
Description To properly close I/O connections in the remote device when ncCloseObject is called, NI-DNET must ensure that an explicit messaging connection to the device remains open. When this attribute is set to NC_TRUE (the default), NI-DNET sends a nonoperational request (a "ping") to the device every few seconds, to ensure that the explicit messaging connection does not timeout. When this attribute is NC_FALSE, NI-DNET does not ping the explicit messaging connection. If you are certain that your application sends a request on a periodic basis, you can set this attribute to NC_FALSE. This attribute must be set prior to starting communication.

Mac Id

Attribute ID NC_ATTR_MAC_ID
Hex Encoding 80000080
Data Type NCTYPE_UINT8
Permissions Get
Description This driver attribute allows you to get the DeviceMacId originally passed into ncOpenDnetExplMsg.

Product Code

Attribute ID NC_ATTR_PRODUCT_CODE
Hex Encoding 80000083
Data Type NCTYPE_UINT16
Permissions Set
Description Product Code of the device as reported in the Product Code attribute of device's Identity Object. This attribute verifies that the device is the same one expected by your application. If the Product Code does not match, NI-DNET returns the error DnetErrDevInitProdCode.

The Product Code is a vendor-specific value which identifies a particular product within a device type.

If you do not call ncSetDriverAttr to set the Product Code, a default value of zero is used. When Product Code is zero, NI-DNET does not verify the device's Product Code.

Vendor Id

Attribute ID NC_ATTR_VENDOR_ID
Hex Encoding 80000082
Data Type NCTYPE_UINT16
Permissions Set
Description Vendor ID of the device as reported in the Vendor ID attribute of device's Identity Object. This attribute verifies that the device is the same one expected by your application. If the Vendor ID does not match, NI-DNET returns the error DnetErrDevInitVendor.

The Vendor ID is a number assigned to the device vendor by the Open Device Vendor's Association (ODVA).

If you do not call ncSetDriverAttr to set the Vendor ID, a default value of zero is used. When Vendor ID is zero, NI-DNET does not verify the device's Vendor ID.