Interfaces
- Updated2023-09-14
- 2 minute(s) read
Interfaces
The interface represents a single CAN, FlexRay, LIN, or Ethernet connector on an NI hardware device. Within NI-XNET, the interface is the object used to communicate with external hardware described in the database.
Each interface name uses the following syntax:
<protocol><n>
The <protocol> is one of the following:
- CAN for a CAN interface
- FlexRay for a FlexRay interface
- LIN for a LIN interface
- ENET for an Ethernet interface
The number <n> identifies the specific interface within the <protocol> scope. The numbering starts at 1. For example, if you have a two-port CAN device, a two-port FlexRay device, a two-port LIN device, and a two-port Ethernet device in your system, the interface names are CAN1, CAN2, FlexRay1, FlexRay2, LIN1, LIN2, ENET1, and ENET2, respectively. Devices that use a transceiver cable receive an interface name only when the transceiver cable is connected and identified.
Although you can change the interface number <n> within Measurement & Automation Explorer (MAX), the typical practice is to allow NI-XNET to select the number automatically. NI-XNET always starts at 1 and increments for each new interface found. If you do not change the number in MAX, and your system always uses a single two-port CAN device, you can write all your applications to assume CAN1 and CAN2. For as long as that CAN card exists in your system, NI-XNET uses the same interface numbers for that device, even if you add new CAN cards.
NI-XNET also uses the term port to refer to the connector on an NI hardware device. This physical connector includes the transceiver cable if applicable. The difference between the terms is that port refers to the hardware object (physical), and interface refers to the software object (logical). The benefit of this separation is that you can use the interface name as an alias to any port, so that your application does not need to change when your hardware configuration changes. For example, if you have a PXI chassis with a single CAN PXI device in slot 3, the CAN port labeled Port 1 is assigned as interface CAN1. Later on, if you remove the CAN PXI card and connect a USB device for CAN, the CAN port on the USB device is assigned as interface CAN1. Although the physical port is in a different place, VIs or programs written to use CAN1 work with either hardware configuration without change.
For Ethernet interfaces, a special suffix "/monitor" appended to the interface name indicates the use of a monitor path. For example, "ENET1" specifies use of the endpoint path, and "ENET1/monitor" specifies use of the monitor path. The monitor path is used to read Ethernet frames that are received or transmitted on each port. When Tap is enabled, data received via the monitor path by a Tap pair will be identical on each port in the pair. Additional information on the monitor and endpoint paths is provided in Using Ethernet.