Packets, Handshaking, and FIFO Buffers

NI-Motion Functions

Packets, Handshaking, and FIFO Buffers

This topic briefly describes how commands and data are passed between the host computer and the NI motion controller. This information is provided for reference purposes. The NI-Motion software provides drivers, DLLs, and C function libraries that handle the host-to-controller communications for you.

Data passed to or from the NI motion controller is handled in a packet format. A packet consists of a packet identifier word, command and data content, and a packet terminator word. This approach to communications enhances the integrity of data communications, speeds the processing of the transferred command and data, and organizes operation into powerful, high-level functions.

Each word in a packet is sent over the bus after checking the Ready-to-Receive (RTR) handshaking bit in the CSR. Refer to the Read Communication Status function for the status cluster and more information about the status reported in the CSR.

Command and data packets are checked for packet format errors as the controller receives them. If the controller detects a packet error, it immediately reports the error by setting an error bit in the CSR. After the packet is received without error, the command and data is stored in a FIFO buffer.

This FIFO can hold up to 16 commands. The NI-Motion RTOS processes commands when it is not busy with higher priority tasks. In the unlikely event that the FIFO fills up before any commands can be processed, the host is held off with a Not-Ready-to-Receive condition.

Each command is processed and a determination is made either to execute the command immediately, or store it away in a program to be executed later. Commands are also checked for data and modal (sequence) errors at this time. Modal errors are flagged by setting the Error Message bit in the CSR. This modal error is functionally different from the packet communication error previously described. Refer to Errors and Error Handling for more information.