ncOperateDnetIntf (Operate DeviceNet Interface)

NI-DNET Programmer

ncOperateDnetIntf (Operate DeviceNet Interface)

Purpose

Perform an operation on an NI-DNET Interface Object.

Format

LabVIEW

C

NCTYPE_STATUS
ncOperateDnetIntf	(NCTYPE_OBJH	ObjHandle,
		 NCTYPE_UINT32	Opcode,
		 NCTYPE_UINT32	Param);

Input

ObjHandle Object handle of an open Interface Object
Opcode Operation code indicating which operation to perform
Param Parameter whose meaning is defined by Opcode

Output

None

Function Description

ncOperateDnetIntf operates on an NI-DNET Interface Object.

Use ncOperateDnetIntf to start and stop all DeviceNet communication for the associated interface, including all explicit messaging and I/O connections. After you open the Explicit Messaging Objects and I/O Objects required by your application, you must use ncOperateDnetIntf to start communication. You must also use ncOperateDnetIntf to stop communication before terminating your application.

Parameter Descriptions

ObjHandle

Description ObjHandle must contain an object handle returned from the ncOpenDnetIntf function.

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

Opcode

Description Determines which operation to perform on the Interface Object.

Start

Start all DeviceNet communication for the associated interface. For each Explicit Messaging Object and I/O Object which has been opened for the interface (same IntfName), this operation establishes the DeviceNet connection with the remote device. When the operation establishes I/O connections, it places outputs into active mode (data is produced on the network). If the default output data (all bytes zero) is not valid for your application, use ncWriteDnetIO for each I/O Object to initialize valid output data prior to starting communication. If the interface has already been started, this operation has no effect.

Stop

Stop all DeviceNet communication for the associated interface. For each Explicit Messaging Object and I/O Object which has been opened for the interface, this operation closes the DeviceNet connection with the remote device. Although closing all NI-DNET objects implicitly stops communication, you should perform this operation prior to calling ncCloseObject. If the interface has already been stopped, this operation has no effect.

Active

Place the outputs of all I/O connections into active mode. When an I/O connection is in active mode, it produces data in its outgoing I/O message. This operation is used after a previous Idle to restore normal communication on all I/O Objects associated with the interface. If the interface has already been placed into active mode or is stopped, this operation has no effect.

Idle

Place the outputs of all I/O connections into the idle mode. When an I/O connection is in the idle mode, it does not produce data in its outgoing I/O message, but the I/O connection is kept open by producing an I/O message with zero data bytes. Use this operation when valid output data is no longer available from your application, such as when a control algorithm has been paused. If the interface has already been placed into idle mode or is stopped, this operation has no effect.

Note  The DeviceNet Specification does not clearly define the behavior of a slave device on reception of an idle (zero length) I/O message. Many slave devices exhibit unexpected behavior when the Idle operation is used. If you need to suspend your application, but want to keep I/O connections open, you should provide valid idle values for outputs using ncWriteDnetIO rather than use the Idle operation.
Values Start (constant NC_OP_START, value 1)

Stop (constant NC_OP_STOP, value 2)

Active (constant NC_OP_ACTIVE, value 4)

Idle (constant NC_OP_IDLE, value 5)

In LabVIEW, you select the operation code from an enumerated list. The LabWindows/CVI function panel also provides an enumerated list.

Param

Description The meaning of Param is defined by each operation code (Opcode). Since none of the operations currently use this additional parameter, it is ignored and you should normally set it to zero. In the future, if new operations require some form of qualifying information, this parameter might be used.
Values 0

Examples

LabVIEW

Start communication using an Interface Object.

C

Stop communication for the Interface Object referenced by objh.

NCTYPE_STATUS	status;
NCTYPE_OBJH	objh;
status = ncOperateDnetIntf(objh, NC_OP_STOP, 0);