From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

NI-XNET Frame Notifier

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Hardware

  • Industrial Communication

    Software

  • LabVIEW

    Driver

  • Other

Code and Documents

Attachment

Overview

The example demonstrates how to event-like wait for a XNET CAN frame to be received.

 

Description

NI-XNET does not have the ability to trigger an event when a frame arrives. The example shows a suitable workaround to work around the limitation.

The example uses a Frame In Queued session type to build a queue of the specified frame. XNET Read is configured to read just one frame with a timeout of 100 ms, which means that the frame will be returned as soon as the NI-XNET hardware receives the frame. The timeout prevents the application from locking up if the frame is not yet received by the NI-XNET hardware. Therefore the expected timeout error is cleared and the XNET Read is tried again until the frame has been received or the loop is manually stopped.

 

Requirements

 Software

  • LabVIEW 2012 Base Development System (or compatible)
  • NI-XNET 14.0 (or compatible)

 Hardware

  • NI-XNET CAN hardware

 

Steps to Implement or Execute Code

  1. Open the attached file
  2. Run the VI 

 

Additional Information or References

NI-XNET Frame Notifier - Front Panel.png

 

NI-XNET Frame Notifier - Block Diagram.png

 

 

**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text 'NIVerified'. Read here for more information about the new Example Guidelines and Community Platform.**

Matthew B.
Offering Manager
NI

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
DanielDu
Member
Member
on

The received frame for this mode is not stored in the queues, how do you manage the issue of data loss?