I/O Object

NI-DNET Programmer

I/O Object

Description

The I/O Object represents an I/O connection to a remote DeviceNet device (physical device attached to your interface by a DeviceNet cable). The I/O Object usually represents I/O communication as a master with a remote slave device. If your computer is being used as the primary controller of your DeviceNet devices, you should configure I/O communication as a master.

You can also configure the I/O Object for I/O communication as a slave with a remote master. If your computer is being used as a peripheral device for another primary controller, you can configure I/O communication as a slave. To configure I/O communication as a slave, set the I/O Object's DeviceMacId to the same MAC ID as the Interface Object (IntfMacId parameter of ncOpenDnetIntf).

The I/O Object supports as many master/slave I/O connections as currently allowed by the DeviceNet Specification (version 2.0). This means that you can use polled, strobed, and COS/cyclic I/O connections simultaneously for a given device. As specified by the DeviceNet Specification, only one master/slave I/O connection of a given type can be used for each device (MAC ID). For example, you cannot open two polled I/O connections for the same device.

Use the I/O Object to do the following:

  • Read data from the most recent message received on the I/O connection (ncReadDnetIO).
  • Write data for the next message produced on the I/O connection (ncWriteDnetIO).

Functions

Function Name Function Description
EasyIOClose Close multiple NI-DNET objects (LabVIEW only)
EasyIOConfig Configure and open multiple NI-DNET objects (LabVIEW only)
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)
ncGetDriverAttr Get the value of an attribute in the NI-DNET driver
ncOpenDnetIO Configure and open an NI-DNET I/O Object
ncReadDnetIO Read input data from an I/O Object
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
ncWriteDnetIO Write output data to an I/O Object

Driver Attributes

Ack Suppress

Attribute ID NC_ATTR_ACK_SUPPRESS
Hex Encoding 8000009A
Data Type NCTYPE_BOOL
Permissions Set
Description This driver attribute applies only to change-of-state (COS) or cyclic I/O connections (ConnectionType of COS or Cyclic). It determines whether acknowledgments are used (false) or suppressed (true). Acknowledgments are used with COS or cyclic I/O connections to verify that produced data is received successfully.

When InputLength is nonzero, the acknowledgment is produced by NI-DNET. When OutputLength is nonzero, the acknowledgment is consumed by NI-DNET.

If you do not call ncSetDriverAttr to Set Ack Suppress, a default value of false is used.

When successful device operation can be verified by other means, COS or cyclic acknowledgment can often be suppressed. For example, if you open a polled I/O connection in addition to the COS or cyclic I/O connection, you can Set Ack Suppress to true.

If the ConnectionType of this I/O object is Poll or Strobe, the Ack Suppress attribute is ignored.

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 ncWaitForState.

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.

Exp Packet Rate

Attribute ID NC_ATTR_EXP_PACKET_RATE
Hex Encoding 80000095
Data Type NCTYPE_DURATION
Permissions Get
Description This driver attribute allows you to get the ExpPacketRate originally passed into ncOpenDnetIO.

Inhibit Timer

Attribute ID NC_ATTR_EXP_INHIBIT_TIMER
Hex Encoding 80000097
Data Type NCTYPE_DURATION
Permissions Set
Description This driver attribute applies only to COS I/O connections (ncOpenDnetIO with ConnectionType of COS). This driver attribute configures the minimum delay time between subsequent data productions. This attribute can limit the amount of network traffic used for COS messages from devices with frequently changing I/O.

The default value for Inhibit Timer is zero, as specified in the DeviceNet Specification. Since this default is appropriate for most applications, the Inhibit Timer attribute is not included in the configuration attributes provided with ncOpenDnetIO. If you want to change the default Inhibit Timer, call ncSetDriverAttr prior to starting communication.

If ConnectionType is Poll, Strobe, or Cyclic, the Inhibit Timer attribute is ignored. For these I/O connection types, the frequency of data production is controlled entirely by the ExpPacketRate attribute.

Input Length

Attribute ID NC_ATTR_IN_LEN
Hex Encoding 80000091
Data Type NCTYPE_UINT32
Permissions Get
Description This driver attribute allows you to get the InputLength originally passed into ncOpenDnetIO.

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 device can internally close its own I/O connections (deferred delete), 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 ncOpenDnetIO.

Output Length

Attribute ID NC_ATTR_OUT_LEN
Hex Encoding 80000092
Data Type NCTYPE_UINT32
Permissions Get
Description This driver attribute allows you to get the OutputLength originally passed into ncOpenDnetIO.

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 is used to verify 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.