CAN Create Message.vi
Purpose
Create a message configuration and associated channel configurations within the LabVIEW application.
Format
Inputs
interface specifies the CAN interface to use for this task. The interface input uses a ring typedef in which value 0 selects CAN0, value 1 selects CAN1, and so on. The interface input is required. Since the messages and channels are not defined in MAX, you cannot use MAX default as the interface. The default baud rate for the interface is defined within MAX, but you can change it by setting the Interface Baud Rate property with CAN Set Property.vi. 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. | ||||||||||||||||||||||||||||||||||||
mode specifies the I/O mode for the task. For an overview of the I/O modes, including figures, refer to the Channel API Basic Programming Model. Input Input channel data from received CAN messages. Use CAN Read.vi to obtain input samples as single point, array, or waveform. Use this input mode to read waveforms of timed samples, such as for comparison with NI-DAQ waveforms. You also can use this input mode to read a single point from the most recent message, such as for control or simulation. Output Output channel data to CAN messages for transmit. Use CAN Write.vi to write output samples as single-point, array, or waveform. Each sample value that you write is transmitted in a message on the network. If you write an array or waveform, the samples are buffered for subsequent transmit. Output Recent Output channel data to CAN messages for transmit. This mode is used with sample rate greater than zero (periodic transmit). Use CAN Write.vi to provide a single sample per channel. Each periodic message uses the sample values from the most recent CAN Write.vi. For this mode, there are restrictions on using channels in channel list that are contained in multiple messages. Refer to CAN Read.vi for more information. Timestamped Input Input channel data from received CAN messages. Use CAN Read.vi to obtain input samples as an array of sample/timestamp pairs (Poly VI types ending in Timestamped Dbl). Use this input mode to read samples with timestamps that indicate when each message is received from the network. | ||||||||||||||||||||||||||||||||||||
sample rate specifies the timing to use for samples of the task. The sample rate is specified in Hertz (samples per second). A sample rate of zero means to sample immediately. For mode of Input, a sample rate of zero means that CAN Read returns a single point from the most recent message received, and greater than zero means that CAN Read returns samples timed at the specified rate. For mode of Output, a sample rate of zero means that CAN messages transmit immediately when CAN Write is called, and greater than zero means that CAN messages are transmitted periodically at the specified rate. For mode of Timestamped Input, sample rate is ignored. When the interface specifies a virtual interface (256 or 257), and mode is Output or Output Recent, this sample rate must be zero (greater than zero not supported). | ||||||||||||||||||||||||||||||||||||
message config configures properties for a new message. These properties are similar to the message properties in MAX. Can Create Message.vi creates a task for a single message with one or more channels.
| ||||||||||||||||||||||||||||||||||||
channel config list configures a list of channels for the new message. The channel config list is an array of clusters, with one cluster for each channel. The properties of each channel entry are similar to the channel properties in MAX:
| ||||||||||||||||||||||||||||||||||||
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.
|
Outputs
Use task reference out with all subsequent VIs to reference the task. Wire this task reference to CAN Start.vi before you read or write samples for the message. | |||||||
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.
|
Description
To use message and channel configurations from MAX or a CAN database, use CAN Init Start.vi or CAN Initialize.vi. The CAN Create Message provides an alternative in which you create the message and channel configurations within the application, without use of MAX or a CAN database.
CAN Create Message returns a task reference that you wire to CAN Start.vi to start communication for the message and its channels.