To download NI software, including the products shown below, visit ni.com/downloads.
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
Hardware
Steps to Implement or Execute Code
Additional Information or References
**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.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
The received frame for this mode is not stored in the queues, how do you manage the issue of data loss?