Table Of Contents

XNET Write (Frame » CAN) (G Dataflow)

Version:
    Last Modified: February 22, 2017

    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.

    connector_pane_image
    datatype_icon

    session in

    The session to write. This session is selected from the LabVIEW project or returned from XNET Create Session. The session mode must be Frame Output Stream, Frame Output Queued, or Frame Output Single-Point.

    datatype_icon

    data

    An input that 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.

    Additionally, XNET Write (Frame CAN) 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 the CAN protocol specification.

    datatype_icon

    identifier

    The CAN frame arbitration identifier. If extended? is false, the identifier uses standard format, so 11 bits of this identifier are valid.

    If extended? is true, the identifier uses extended format, so 29 bits of this identifier are valid.

    datatype_icon

    extended?

    A Boolean value that determines whether the identifier uses extended format (true) or standard format (false).

    datatype_icon

    echo?

    A parameter not used for transmit. You must set this element to false.

    datatype_icon

    type

    The frame type (decimal value in parentheses).

    CAN Data (0) The CAN data frame contains payload data. This is the most commonly used frame type for CAN. In ISO CAN FD interface mode, this transmits a frame according to the interface setting (FD or FD+BRS). ISO CAN FD mode allows transmitting CAN 2.0, CAN FD, or CAN FD+BRS frames using the frame type (refer to the types listed below).
    CAN 2.0 Data (8) The CAN data frame contains payload data. In ISO CAN FD interface mode, this frame is transmitted as a CAN 2.0 frame. When the interface is not in ISO CAN FD mode, this type is treated like CAN Data (0).
    CAN FD Data (16) The CAN data frame contains payload data. In ISO CAN FD interface mode, this frame is transmitted as a CAN FD (no BRS) frame. When the interface is not in ISO CAN FD mode, this type is treated like CAN Data (0).
    CAN FD+BRS Data (24) The CAN data frame contains payload data. In ISO CAN FD+BRS mode, this frame is transmitted as a CAN FD+BRS frame. When the interface is not in ISO CAN FD mode, this type is treated like CAN Data (0).
    CAN Remote (1) A CAN remote frame. Your application transmits a CAN remote frame to request data for the corresponding identifier. A remote ECU should respond with a CAN data frame for the identifier, which you can obtain using XNET Read.
    datatype_icon

    timestamp

    A parameter that represents absolute time using the LabVIEW absolute timestamp type. timestamp is not used for transmit. You must set this element to the default value, invalid (0).

    datatype_icon

    payload

    The array of data bytes for the CAN data frame. The array size indicates the payload length of the frame value to transmit. According to the CAN protocol, the payload length range is 0-8. For CAN FD, the range can be 0-8, 12, 16, 20, 24, 32, 48, or 64.

    When the session mode is Frame Output Single-Point or Frame Output Queued, the number of bytes in the payload array must be less than or equal to the Payload Length property of the corresponding frame. You can leave all other CAN frame cluster elements uninitialized. For more information, refer to the section for each mode.

    For a transmitted remote frame (CAN Remote type), the payload length in the frame value specifies the number of payload bytes requested. Your application provides this payload length by filling payload with the requested number of bytes. This enables your application to specify the frame payload length, but the actual values in the payload bytes are ignored (not contained in the transmitted frame).

    datatype_icon

    timeout

    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, XNET Write (Frame CAN) 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, XNET Write (Frame CAN) waits indefinitely for space to become available in queues.

    If timeout is 0, XNET Write (Frame CAN) 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 XNET Write (Frame CAN) 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.

    datatype_icon

    error in

    Error conditions that occur before this node runs. The node responds to this input according to standard error behavior.

    Default: No error

    datatype_icon

    session out

    An output that is the same as session in, provided for use with subsequent nodes.

    datatype_icon

    error out

    Error information. The node produces this output according to standard error behavior.

    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 node transmits an event remote frame.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: Supported


    Recently Viewed Topics