XNET Write (Frame CAN).vi
- Updated2023-11-11
- 6 minute(s) read
XNET Write (Frame CAN).vi
Purpose
Writes data to a session as an array of CAN frames. The session must use a CAN interface and a mode of Frame Output Stream, Frame Output Queued, or Frame Output Single-Point.
Format
Inputs
![]() |
session in is the session to write. This session is selected from the LabVIEW project or returned from the XNET Create Session VI. The session mode must be Frame Output Stream, Frame Output Queued, or Frame Output Single-Point. | ||||||||||||||||||||||
![]() | data provides the array of LabVIEW clusters. Each array element corresponds to a frame value to transmit. For a Frame Output Single-Point session mode, the order of frames in the array corresponds to the order in the session list. The data you write is queued up for transmit on the network. Using the default queue configuration for this mode, you can safely write 64 frames if you have a sufficiently long timeout. To write more data, refer to the XNET Session Number of Values Unused property to determine the actual amount of queue space available for write. For an example of how this data applies to network traffic, refer to Frame Output Stream Mode, Frame Output Queued Mode, or Frame Output Single-Point Mode. Additionally, the XNET Write (Frame CAN) VI can be called on any signal or frame input session if it contains one or more Event Remote frames (refer to CAN:Timing Type). In this case, it signals an event to transmit those remote frames. The data parameter is ignored in this case, and you can set it to an empty array. The elements of each cluster are specific to the CAN protocol. For more information, refer to Summary of the CAN Standard or the CAN protocol specification. The cluster elements are:
| ||||||||||||||||||||||
![]() | timeout is the time to wait for the CAN frame data to be queued up for transmit. The timeout is a LabVIEW relative time, represented as 64-bit floating-point in units of seconds. If timeout is positive, the XNET Write (Frame CAN) VI waits up to that timeout for space to become available in queues. If the space is not available prior to the timeout, a timeout error is returned. If timeout is negative, the XNET Write (Frame CAN) VI waits indefinitely for space to become available in queues. If timeout is 0, the XNET Write (Frame CAN) VI does not wait and immediately returns with a timeout error if all data cannot be queued. Regardless of the timeout used, if a timeout error occurs, none of the data is queued, so you can attempt to call the XNET Write (Frame CAN) VI again at a later time with the same data. This input is optional. The default value is 10.0 (10 seconds). If the session mode is Frame Output Single-Point, you must set timeout to 0.0. Because this mode writes the most recent value of each frame, timeout does not apply. | ||||||||||||||||||||||
![]() |
error in is the error cluster input (refer to Error Handling). |
Outputs
![]() |
session out is the same as session in, provided for use with subsequent VIs. |
![]() |
error out is the error cluster output (refer to Error Handling). |
Description
The data represents an array of CAN frames. Each CAN frame uses a LabVIEW cluster with CAN-specific elements.
The CAN frames are associated to the session's list of frames as follows:
- Frame Output Stream: Array of all frame values for transmit (list ignored).
- Frame Output Queued: Array of frame values to transmit for the single frame specified in the list.
- Frame Output Single-Point: Array of single frame values, one for each frame specified in the list.
- Any signal or frame input mode: The data parameter is ignored, and you can set it to an empty array. The VI transmits an event remote frame.