ncOpen.vi

NI-CAN

ncOpen.vi

Purpose

Open an object.

Format

Input

ObjName is the name of the object to open. For CAN interfaces, you must have already wired this name into a previous config VI.

CAN Network Interface Object

This name uses the syntax "CANx", where x is a decimal number starting at zero that indicates the CAN network interface (CAN0, CAN1, up to CAN63). CAN network interface names are associated with physical CAN ports using the Measurement & Automation Explorer (MAX).

The special interface values 256 and 257 refer to virtual interfaces. For more information on usage of virtual interfaces, refer to Frame to Channel Conversion.

LIN Network Interface Object

This name uses the syntax LINx, where x is a decimal number starting at zero that indicates the LIN network interface (LIN0, LIN1, up to LIN63), where CAN and LIN share the same range. LIN network interface names are associated with physical LIN ports using Measurement & Automation Explorer (MAX).

CAN Object

This name uses the syntax "CANx::STDy" or "CANx::XTDy". CANx is the name of the CAN network interface that you used for the preceding ncConfigCANNet VI. STD indicates that the CAN Object uses a standard (11-bit) arbitration ID. XTD indicates that the CAN Object uses an extended (29-bit) arbitration ID. The number y specifies the actual arbitration ID of the CAN Object. The number y is decimal by default, but you also can use hexadecimal by adding "0x" to the beginning of the number. For example, "CAN0::STD25" indicates standard ID 25 decimal on CAN0, and "CAN1::XTD0x0000F652" indicates extended ID F652 hexadecimal on CAN1.

The special virtual interface names "CAN256" and "CAN257" are not supported for CAN Objects.

Error in describes error conditions occurring before the VI executes. If an error has already occurred, the VI returns the value of the Error in cluster in Error out.
status is True if an error occurred. If status is True, the VI does not perform any operations.
code is the error code number identifying an error. A value of 0 means success. A negative value means error: VI did not execute the intended operation. A positive value means warning: VI executed intended operation, but an informational warning is returned. For a description of the code, wire the error cluster to a LabVIEW error-handling VI, such as the Simple Error Handler.
source identifies the VI where the error occurred.

Output

ObjHandle out is the object handle for all subsequent NI-CAN VIs for this object, including the final call to ncClose.
Error out describes error conditions. If the Error in cluster indicated an error, the Error out cluster contains the same information. Otherwise, Error out describes the error status of this VI.
status is True if an error occurred.
code is the error code number identifying an error. A value of 0 means success. A negative value means error: VI did not execute the intended operation. A positive value means warning: VI executed intended operation, but an informational warning is returned. For a description of the code, wire the error cluster to a LabVIEW error-handling VI, such as the Simple Error Handler.
source identifies the VI where the error occurred.

Description

ncOpen.vi takes the name of an object to open and returns a handle to that object that you use with subsequent NI-CAN function calls.

The Frame API and Channel API cannot use the same CAN network interface simultaneously. If the CAN network interface is already initialized in the Channel API, this function returns an error.

If ncOpen.vi is successful, a handle to the newly opened object is returned. You use this object handle for all subsequent function calls for the object.