ncSetDriverAttr (Set Driver Attribute)

NI-DNET Programmer

ncSetDriverAttr (Set Driver Attribute)

Purpose

Set the value of an attribute in the NI-DNET driver.

Format

LabVIEW

C

NCTYPE_STATUS
ncSetDriverAttr	(NCTYPE_OBJH ObjHandle,
		NCTYPE_ATTRID AttrId,
		NCTYPE_UINT32 SizeofAttr,
		NCTYPE_ANY_P Attr)

Input

ObjHandle Object handle of an open Explicit Messaging Object, I/O Object, or Interface Object
AttrId Identifier of the attribute to set
SizeofAttr Size of the Attr buffer in bytes (C only)
Attr New attribute value

Output

None

Function Description

ncSetDriverAttr sets the value of an attribute in the NI-DNET driver software. NI-DNET objects use attributes to represent configuration settings, status, and other information.

Since you only need to access NI-DNET driver attributes under special circumstances, you seldom need to use ncSetDriverAttr. For information about the attributes of each NI-DNET object, refer to NI-DNET Objects.

ncSetDriverAttr only applies to the NI-DNET software on your computer and cannot be used to set an attribute in a remote DeviceNet device. To set an attribute in a remote DeviceNet device, use ncSetDnetAttribute.

Parameter Descriptions

ObjHandle

Description ObjHandle must contain an object handle returned from ncOpenDnetExplMsg, ncOpenDnetIntf, or ncOpenDnetIO.

In LabVIEW, ObjHandle passes through the VI as an output so that it can be used for subsequent function calls for the object.
Values The encoding of ObjHandle is internal to NI-DNET.

AttrId

Description Identifier of the NI-DNET attribute. For each NI-DNET object, a list of supported attribute identifiers is provided in NI-DNET Objects.
Values 80000000 to 8000FFFF hex (high bit differentiates from DeviceNet IDs)

SizeofAttr

Description For C, SizeofAttr is the size of the buffer referenced by Attr. It is used to verify that the Attr buffer is large enough to hold the attribute's new value. This size is normally obtained using the C language sizeof function.

For LabVIEW, since Attr is obtained directly as an input, this size is not needed.
Values sizeof (buffer referenced by Attr)

Attr

Description New attribute value. The value is usually provided in an unsigned 32-bit integer (and thus Attr is of type NCTYPE_UINT32_P).
Values New value of NI-DNET attribute

Examples

LabVIEW

Verify vendor ID 20 for the DeviceNet device referenced by an Explicit Messaging Object.

C

Suppress acknowledgments for the COS I/O Object referenced by objh.

NCTYPE_STATUS	status;
NCTYPE_OBJH	objh;
NCTYPE_BOOL	ack_sup;
ack_sup = NC_TRUE;
status = ncSetDriverAttr(objh, NC_ATTR_ACK_SUPPRESS, sizeof(ack_sup), &ack_sup);