XNET Read (State CAN Comm) VI
- Updated2025-10-07
- 4 minute(s) read
Reads the state of CAN communication using an XNET session.

Inputs/Outputs
session in
—
session in is the session to read. This session is selected from the LabVIEW project or returned from the XNET Create Session VI.
error in (no error)
—
The error in cluster can accept error information wired from VIs previously called. Use this information to decide if any functionality should be bypassed in the event of errors from other VIs. The pop-up option Explain Error (or Explain Warning) gives more information about the error displayed.
session out
—
session out is the same as session in, provided for use with subsequent VIs.
CAN comm
—
CAN comm returns a LabVIEW cluster containing the communication elements. The elements are:
error out
—
The error out cluster passes error or warning information out of a VI to be used by other VIs. The pop-up option Explain Error (or Explain Warning) gives more information about the error displayed. |
Description
You can use the XNET Read (State CAN Comm) VI with any XNET session mode, as long as the session interface is CAN. Because the state reflects the CAN interface, it can apply to multiple sessions.
Your application can use the XNET Read (State CAN Comm) VI to check for problems on the CAN network independently from other aspects of your application. For example, you intentionally may introduce noise into the CAN cables to test how your ECU behaves under these conditions. When you do this, you do not want the error out of NI-XNET VIs to return errors, because this may cause your application to stop. Your application can use the XNET Read (State CAN Comm) VI to read the CAN network state quickly as data, so that it does not introduce errors into the flow of your LabVIEW VIs.
Alternately, to log bus errors, you can set the Interface:Bus Error Frames to Input Stream? property to cause CAN bus errors to be logged as a special frame (refer to Special Frames for more information) into a Frame Stream Input queue.
session in
—
error in (no error)
—
session out
—
CAN comm
—
fault code
—
fault?
—
communication state
—
error out
—