Table Of Contents

XNET Read (Frame » Raw) (G Dataflow)

Version:
    Last Modified: February 22, 2017

    Reads data from a session as an array of raw bytes.

    connector_pane_image
    datatype_icon

    session in

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

    datatype_icon

    number to read

    The number of bytes (U8) desired. This number does not represent the number of frames to read. As encoded in raw data, each frame can vary in length. Therefore, the number represents the maximum raw bytes to read, not the number of frames.

    Standard CAN and LIN frames are always 24 bytes in length. If you want to read a specific number of frames, multiply that number by 24.

    CAN FD and FlexRay frames vary in length. For example, if you pass number to read of 91, the data might return 80 bytes, within which the first 24 bytes encode the first frame, and the next 56 bytes encode the second frame.

    If number to read is positive (or 0), the data array size is no greater than this number. The minimum size for a single frame is 24 bytes.

    If number to read is negative (typically -1), all available raw data is returned. If number to read is negative, you must use a timeout of 0.

    This input is optional. The default value is -1.

    If the session mode is Frame Input Single-Point, set number to read to -1. This ensures that XNET Read (Frame Raw) can return the current value of all session frames.

    datatype_icon

    timeout

    The time to wait for number to read frame bytes to become available. To avoid returning a partial frame, even when number to read bytes are available from the hardware, this read may return fewer bytes in data. For example, assume you pass number to read of 70 bytes and timeout of 10 seconds. During the read, two frames are received, the first 24 bytes in size, and the second 56 bytes in size, for a total of 80 bytes. The read returns after the two frames are received, but only the first frame is copied to data. If the read copied 46 bytes of the second frame (up to the limit of 70), that frame would be incomplete and therefore difficult to interpret. To avoid this problem, the read always returns complete frames in data.

    The timeout is a LabVIEW relative time, represented as 64-bit floating-point in units of seconds.

    If timeout is positive, XNET Read (Frame Raw) waits for number to read frame bytes to be received, then returns complete frames up to that number. If the bytes do not arrive prior to the timeout, an error is returned.

    If timeout is negative, XNET Read (Frame Raw) waits indefinitely for number to read frame bytes.

    If timeout is zero, XNET Read (Frame Raw) does not wait and immediately returns all available frame bytes up to the limit number to read specifies.

    This input is optional. The default value is 0.0.

    If the session mode is Frame Input Single-Point, you must leave timeout unwired (0.0). Because this mode reads 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

    data

    This output returns an array of bytes. The raw bytes encode one or more frames using the Raw Frame Format. This frame format is the same for read and write of raw data, and it is also used for log file examples.

    The data always returns complete frames.

    For information about which elements of the raw frame are applicable, refer to the frame read for the protocol in use (XNET Read (Frame CAN), XNET Read (Frame FlexRay), or XNET Read (Frame LIN)). For example, when you read FlexRay frames for a Frame Input Queued session, the only frame type is FlexRay Data (other types apply to Frame Input Stream only).

    datatype_icon

    error out

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

    Description

    The raw bytes encode one or more frames using the Raw Frame Format. The session must use a mode of Frame Input Stream, Frame Input Queued, Frame Input Single-Point, PDU Input Queued (similar to Frame Input Queued), or PDU Input Single-Point (similar to Frame Input Single-Point). The raw frame format is protocol independent, so the session can use either a CAN, FlexRay, or LIN interface.

    The raw frame format matches the format of data transferred to/from the XNET hardware. Because it is not converted to/from LabVIEW clusters for ease of use, it is more efficient with regard to performance. This XNET Read instance typically is used to read raw frame data from the interface and log the data to a file for later analysis. The NI-XNET examples provide code to read the raw frame data from the log file and convert the raw data into protocol-specific LabVIEW clusters.

    The raw frames are associated to the session's list of frames as follows:

    • Frame Input Stream: Array of all frame values received (list ignored).
    • Frame Input Queued: Array of frame values received for the single frame specified in the list.
    • Frame Input Single-Point: Array of single frame values, one for each frame specified in the list.
    • PDU Input Queued: Array of frame (PDU payload) values received for the single PDU specified in the list. This mode is similar to Frame Input Queued.
    • PDU Input Single-Point: Array of single frame (PDU payload) values, one for each PDU specified in the list. This mode is similar to Frame Input Single-Point.

    Where This Node Can Run:

    Desktop OS: Windows

    FPGA: Supported


    Recently Viewed Topics