CAN Get Names.vi

NI-CAN

CAN Get Names.vi

Purpose

Get an array of CAN channel names or message names from MAX or a CAN database file.

Format

Inputs

filepath is an optional path to a CAN database file from which to get channel names. The file must use either a .DBC or .NCD extension. Files with extension .DBC use the CANdb database format. Files with extension .NCD use the NI-CAN database format. You can generate NI-CAN database files from the Save Channels selection in MAX.

The default (unwired) value of filepath is empty, which means to get the channel names from MAX. The MAX CAN channels are in the MAX CAN Channels listing within Data Neighborhood.

message name is an optional input that filters the names for a specific message. The default (unwired) value is an empty string, which means to return all names in the database. If you wire a nonempty string, the channel list output is limited to channels of the specified message. This input applies to mode of channels only. It is ignored for mode of messages.

mode is an optional input that specifies the type of names to return.

The value of mode is an enumeration:

0 channels Return list of channel names. You can write this list to CAN Init Start. This is the default value.
1 messages Return list of message names.
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.

Outputs

channel list returns the array of channel names, one string entry per channel.

The names in channel list use the minimum syntax required to properly initialize the channels:

  • If a channel name is used within only one message in the database, CAN Get Names returns only the channel name in the array.
  • If a channel name is used within multiple messages, CAN Get Names prepends the message name to that channel name, with a decimal point separating the message and channel name. This syntax ensures that the duplicate channel is associated to a single message in the database.

For more information on the syntax conventions for channel names, refer to CAN Init Start.vi.

To start a task for all channels returned from CAN Get Names, wire channel list to the CAN Init Start VI to start a task.

You also can wire channel list to the property nodes of a front panel control such as a ring or list box. The user of the VI can then select names using this control, and the selected names can be wired to CAN Init Start.

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.