Getting Started with NI-XNET LabVIEW API
- Updated2023-09-14
- 3 minute(s) read
Getting Started with NI-XNET LabVIEW API
NI-XNET driver software provides the ability to build projects using NI-XNET, learn from and build onto NI-XNET examples, and use the NI-XNET palette to create your own virtual instrument (VI).
LabVIEW Project
Using NI-XNET for LabVIEW, you can start with a LabVIEW project and create NI-XNET sessions to use within a VI to read or write network data.
Within a LabVIEW project, you can create NI-XNET sessions used within a VI to read or write network data. Using LabVIEW project sessions is best suited for static applications, in that the network data does not change from one execution to the next. Even if your application is more dynamic, a LabVIEW project is an excellent introduction to NI-XNET concepts.
To get started, open a new LabVIEW project, right-click My Computer, and select New»NI-XNET Session. In the resulting dialog, the window on the left provides an introduction to the NI-XNET session in the LabVIEW project. The introduction links to help topics that describe how to create a session in the project, including a description of the session modes.
NI-XNET
Examples
NI-XNET includes LabVIEW examples that demonstrate a wide variety of use cases. The examples build on the basic concepts to demonstrate more in-depth use cases. Most of the examples create a session at run time rather than a LabVIEW project.
To view the NI-XNET examples, select Find Examples... from the LabVIEW Help menu. When you browse examples by task, NI-XNET examples are under Hardware Input and Output. The examples are grouped by protocol in Automotive Ethernet, CAN, FlexRay, and LIN folders, and each folder contains shared examples. You can write NI-XNET applications for any of these protocols; this organization helps you to find examples for your specific hardware product.
Open an example VI by double-clicking its name in the NI Example Finder. To run the example, select values using the front panel controls, then read the instructions on the front panel to run the examples. A few examples are suggested to get started with NI-XNET:
Automotive Ethernet (Hardware Input and Output»Automotive Ethernet)
- Ethernet Basic Input and Output.lvproj (Ethernet Reader.vi with Ethernet Writer.vi)
- NI-XNET IP Stack Simple TCP.lvproj (Simple TCP - Server.vi with Simple TCP - Client.vi)
CAN (Hardware Input and Output»CAN»NI-XNET»Intro to Sessions)
- CAN Signal Input Single Point.vi with CAN Signal Output Single Point.vi
- CAN Signal Input Waveform.vi with CAN Signal Output Waveform.vi
- CAN Frame Input Stream.vi with any output example.
FlexRay (Hardware Input and Output»FlexRay»Intro to Sessions)
- FlexRay Signal Input Single Point.vi with FlexRay Signal Output Single Point.vi
- FlexRay Signal Input Waveform.vi with FlexRay Signal Output Waveform.vi
- FlexRay Frame Input Stream.vi with any output example.
LIN (Hardware Input and Output»LIN»NI-XNET»Intro to Sessions)
- LIN Signal Input Single Point.vi with LIN Signal Output Single Point.vi
- LIN Signal Input Waveform.vi with LIN Signal Output Waveform.vi
- LIN Frame Input Stream.vi with any output example.
NI-XNET
Function Palette
After learning the fundamentals of NI-XNET with a LabVIEW project and the examples, you can begin to write your own application.
The NI-XNET functions palette includes nodes that you drag to your VI block diagram. When your VI block diagram is open, this palette is in the Measurement I/O»XNET functions palette.
To view help for each node in the NI-XNET functions palette, open the context help window by selecting Show Context Help from the LabVIEW Help menu (or pressing <Ctrl-H>). As you hover over each node or subpalette, a brief summary appears. To open the complete help, click the Detailed help link in the summary.
The NI-XNET controls palette includes I/O name controls that you drag to the your VI front panel. These controls enable the VI end user to select NI-XNET objects from the front panel. You view help for these controls in the same manner as on the functions palette.