ncAction.vi

NI-CAN

ncAction.vi

Purpose

Perform an action on an object.

Format

Input

ObjHandle in is the object handle from the previous NI-CAN VI. The handle originates from the ncOpen VI.
Opcode is the operation code indicating which action to perform. Refer to the following tables.
Param is an optional parameter whose meaning is defined by Opcode.
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 the next NI-CAN VI.
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

ncAction is a general purpose VI you can use to perform an action on the object specified by ObjHandle in. Its normal use is to start and stop network communication on a CAN Network Interface Object.

NI-CAN provides VIs such as ncOpen.vi and ncReadNet.vi for the most frequently used and/or complex actions. ncAction provides an easy, general purpose way to perform actions that are used less frequently or are relatively simple.

Network Interface Object

NI-CAN propagates all actions on the CAN Network Interface Object up to all open Objects when CAN Objects are supported.

The following table describes the actions supported by the CAN or LIN Network Interface Object.

Opcode Param Description
Start N/A (ignored) Transitions network interface from stopped (idle) state to started (running) state. If network interface is already started, this operation has no effect. When a network interface is started, it is communicating on the network. When you execute the Start action on a stopped CAN Network Interface Object, NI-CAN propagates it upward to all open higher-level CAN Objects. Thus, you can use it to start all higher-level network communication simultaneously.
Stop N/A (ignored) Transitions network interface from started state to stopped state. If network interface is already stopped, this operation has no effect. When a network interface is stopped, it is not communicating on the network. The Stop action clears all entries from the read queue of the Network Interface. When you execute the Stop action on a running CAN Network Interface Object, NI-CAN propagates it upward to all open higher-level CAN Objects.
Reset N/A (ignored) Resets network interface. The Reset action first issues the Stop action, then clears all entries from the write queue, then resets the CAN or LIN hardware. Resetting the CAN hardware sets the CAN error counters to zero, returning the CAN controller to error active state. Resetting the LIN hardware returns the interface to slave mode and resets all slave task response queue entries so that the slave task subscribes to all LIN IDs. The reset action is propagated up to all open higher-level CAN Objects.
Output on RTSI line N/A (ignored) Output a pulse or toggle on the RTSI line depending upon the RTSI Behavior attribute. The Output on RTSI line action is not supported on the 847x or 847x with Sync series hardware.

CAN Object

All actions performed on a CAN Object affect that CAN Object alone, and do not affect other CAN Objects or communication as a whole. The following table describes the actions supported by the CAN Object.

Opcode Param Description
Start N/A (ignored) Transitions the CAN object from stopped (idle) state to started (running) state. If the CAN object is already started, this operation has no effect.
Stop N/A (ignored) Stops the CAN Object. For example, if the CAN Object is configured to transmit data frames periodically, this action stops the periodic transmissions. This action will also clear all entries from the read queue.
Reset N/A (ignored) Resets the CAN Object. Stops the CAN Object, then clears all entries from read and write queues.
Output on RTSI line N/A (ignored) Output a pulse or toggle on the RTSI line depending upon the RTSI Behavior attribute.