Exploring Remote Communication Methods
- Updated2023-02-21
- 3 minute(s) read
You can use high-level software protocols to communicate between applications running on the RT target and applications running on other targets, such as the host computer. Each protocol has its advantages and disadvantages. The following list classifies the different communication methods:
- Network Communication—Used for communication over Ethernet networks.
- Network Variables
- Network Streams
- TCP
- UDP
- Bus Communication—Used for communication over different bus communication ports.
- Serial
- CAN
Network Communication
This section describes the most common network communication protocols used with the LabWindows/CVI Real-Time Module. Use this information to help you select the right networking protocol(s) for your application.
Network Variables
You can use network variables to share data between applications running on different targets across a network. However, the transfer of the data across the network is not deterministic. Due to network latency, the most recently written data may not be available to an application running on a machine across the network. In this case, the application attempting to read from the network variable returns the previous value. For data logging applications, you can use timestamps to programmatically ensure that each value is logged once and only once.
Network Streams
You can use network streams to stream data or send commands between an RT target and a host computer. A network stream is a lossless, unidirectional, one-to-one communication channel that consists of a writer and a reader endpoint.
TCP
TCP is an industry-standard protocol for communicating over networks. Applications running on the host computer can communicate with RT target DLLs using the TCP Support Library functions. However, TCP is non-deterministic, and using TCP communication in deterministic code can affect the determinism of the code.
The Real-Time Module extends the capabilities of the existing TCP functions to enable communication with networked RT Series devices.
UDP
UDP is a network transmission protocol for transferring data between two locations on a network. UDP is not a connection-based protocol, so the transmitting and receiving computers do not establish a network connection. Because there is no network connection, there is little overhead when transmitting data. However, UDP is non-deterministic, and using UDP communication in deterministic code can affect the determinism of the code.
When using UDP functions to send data, the receiving computer must have a read port open before the transmitting computer sends the data. Use the CreateUDPChannel or CreateUDPChannelConfig functions to open a write port and specify the IP address and port of the receiving computer. The data transfer occurs in byte streams of varying lengths called datagrams. Datagrams arrive at the listening port, and the receiving computer buffers and then reads the data.
You can transfer data bidirectionally with UDP. With bidirectional data transfers, both computers specify a read and write port and transmit data back and forth using the specified ports. You can use bidirectional UDP data transfers to send and receive data from a LabWindows/CVI application on the RT target.
UDP has the ability to perform fast data transmissions. However, UDP cannot guarantee that all datagrams arrive at the receiving computer. Because UDP is not connection-based, you cannot verify the arrival of datagrams. You must ensure that network congestion does not affect the transmission of datagrams. Also, you must read data stored in the data buffer of the receiving computer fast enough to prevent overflow and loss of data.
Bus Communication
Serial
Serial communication is the transmission of data between two locations through the serial ports. The RS-232 Library functions provide serial communication support for communication between RT targets with serial devices and serial instruments or computers that have a serial connection. Serial communication is ideal when transfer data rates are low or for transmitting data over long distances. You must add the NI-Serial RT software on the RT target from NI Measurement & Automation Explorer (MAX). Refer to the Measurement & Automation Explorer Help for information about adding software on an RT target.
Serial communication is non-deterministic and using serial communication in deterministic code can affect the determinism of the code.
CAN
Controller Area Network (CAN) is a deterministic, multi-drop communication bus standardized as ISO 11898. Using CAN, you can transfer up to 8 data bytes per frame at a rate of up to 1 Mbit per second. You can network multiple RT systems using NI-CAN interface cards and NI-CAN driver software. You must add the NI-CAN RT software on the RT target from MAX. Refer to the Measurement & Automation Explorer Help for information about adding software on an RT target.
Visit ni.com/info and enter the Info Code CANManual to view the NI-CAN Hardware and Software Manual for information about using NI-CAN hardware and software.