Integration with Motion Using RTSI
Overview
Many systems using motion control often do more than just motion control. Frequently, systems combine motion control with something else, such as image acquisition or data acquisition. One of the challenges in integrating different processes is getting them to synchronize and work together. RTSI is one of the keys to getting motion control, data acquisition, and image acquisition to work in a coordinated fashion.
Table of Contents
What Is RTSI?
RTSI stands for Real-Time System Integration bus, a dedicated high-speed digital bus designed to facilitate systems integration by low-level, high-speed, real-time communication between National Instruments boards. Using RTSI, motion boards can share high-speed digital signals with data acquisition, image acquisition, or digital I/O boards with no external cabling and without consuming bandwidth on the host bus. The RTSI bus also has built-in switching, so you can route signals to and from the bus on-the-fly through software.For PCI boards, the physical bus interface is an internal 34-pin connector; signals are shared via a ribbon cable inside the PC enclosure. RTSI cables are available for chaining two, three, four, or five boards together. PXI modules require no cabling at all because the built-in PXI Trigger Bus handles RTSI functions.
Note -- although the RTSI connector has 34 pins, only seven are available for user signals. The software-configurable RTSI switch is used to accommodate more than seven signal options for each board. The switch is a digital many-to-few selector switch; any available signal can be routed to any RTSI pin.
RTSI functionality varies depending on the board type. For example, on 7344 Series motion controller boards, you can directly read and write to the RTSI pins. You can also configure them as high-speed capture inputs or breakpoint outputs. High-speed capture inputs are used as a trigger to capture and store position or initiate motion events. Breakpoint outputs are used to trigger other devices by asserting at preset positions. On E Series DAQ boards, 15 timing signals are available to RTSI, including timebase, acquisition clock, and general-purpose counter signals. On National Instruments image acquisition devices, a variety of trigger and video synchronization signals are available.
RTSI provides high-speed, hardware-based synchronization capability to any automated measurement or machine control application, making it easy for you to:
Build high-axis-count motion systems
Clock data acquisition based on position
Integrate your motion and vision together
See Also:
Data Acquisition
Image Acquisition
Motion Control
PXI/CompactPCI
What Functions Are Available Over RTSI and How Is It Configured?
The functions available to RTSI vary by device type. Below is a list of popular National Instruments devices and the functions available on each. In the "Direction" column, output means from device to RTSI bus and input means from RTSI bus to device.
| Function | Direction | Description | LabVIEW VI |
| High-Speed Capture | Input | Capture position or trigger event when asserted | Select Signal.flx |
| Breakpoint | Output | Assert at preset position | Select Signal.flx |
| RTSI Software Port | Input or output | Read or write directly to RTSI bus | Select Signal.flx |
The motion libraries for LabVIEW contain a Select Signal VI, which is used to route the signals. The LabVIEW Motion online help for this VI contains specific information about routing the signals.
| Function | Direction | Description | LabVIEW VI |
| TRIG1 | Input or output | Trigger for the analog input | Route Signal.vi |
| TRIG2 | Input or output | Trigger for the analog input | |
| CONVERT | Input or output | Convert signal for analog input | |
| UPDATE | Input or output | Update clock for the analog output | |
| WFTRIG | Input or output | Trigger for the analog output | |
| GPCTR0_SRC | Input or output | Source for counter 0 | |
| GPCTR0_GATE | Input or output | Gate for counter 0 | |
| GPCTR0_OUTPUT | output | Output from counter 0 | |
| STARTSCAN | input (both for PXI) | Scan clock for analog input | |
| AIGATE | output | Gate for analog input | |
| SISOURCE | output | Sample clock for analog input | |
| UISOURCE | output | Sample clock for analog output | |
| GPCTR1_SRC | output | Source for counter 1 | |
| GPCTR1_GATE | output | Gate for counter 1 | |
| RTSI_OSC (20 MHZ) | Input or output | Timebase for all board clocks |
| Function | Direction | Description | LabVIEW VI |
| Disabled | none | The trigger line is disabled | IMAQ Trigger Drive VI |
| Acquisition in Progress | output | High when acquisition is in progress | IMAQ Trigger Drive VI |
| Acquisition done | output | Asserted when the entire acquisition is finished | IMAQ Trigger Drive VI |
| Pixel Clock | output | Pixel clock times the sampling of pixels | IMAQ Trigger Drive VI |
| Unasserted | output | Write line to unasserted state | IMAQ Trigger Drive VI |
| Asserted | output | Write line to asserted state | IMAQ Trigger Drive VI |
| Horizontal Synchronization Signal | output | Horizontal synchronization signal produced at the beginning of each line by the camera | IMAQ Trigger Drive VI |
| Vertical Synchronization Signal | output | Vertical synchronization signal produced at the beginning of each field by the camera | IMAQ Trigger Drive VI |
| Frame start | output | High when a frame is being captured | IMAQ Trigger Drive VI |
| Frame done | output | Asserted at the end of each frame that is captured | IMAQ Trigger Drive VI |
| Disabled | none | Triggering is disabled | IMAQ Trigger Configure VI |
| Trigger start of acquisition | input | When the assertion edge of the trigger is received, the acquisition is started | IMAQ Trigger Configure VI |
| Trigger start of each buffer list | input | When the assertion edge of a trigger is received, the buffer list is acquired. If the acquisition is continuous, buffer index 0 will always wait on a trigger before acquiring | IMAQ Trigger Configure VI |
| Trigger each buffer | input | Each buffer waits for a trigger before acquiring an image into the buffer | IMAQ Trigger Configure VI |
| Trigger each line | input | Each line is triggered. This is useful when using an encoder to acquire line scan images | IMAQ Trigger Configure VI |
| Function | Direction | Description | LabVIEW VI |
| REQ1 | Input or output | Handshaking request 1 | Route Signal.vi |
| REQ2 | Input or output | Handshaking request 2 | Route Signal.vi |
| ACK1 | Input or output | Handshaking acknowledge 1 or start trigger | Route Signal.vi |
| ACK2 | Input or output | Handshaking acknowledge 2 or start trigger | Route Signal.vi |
| STOPTRIG1 | Input | Stop trigger | Route Signal.vi |
| STOPTRIG2 | Input | Stop trigger | Route Signal.vi |
| PCLK1 | Input or output | Data clock | Route Signal.vi |
| PCLK2 | Input or output | Data clock | Route Signal.vi |
How Is RTSI Used For Motion Control?
You can use RTSI signals to synchronize high-axis-count motion applications or to synchronize data or image acquisition. More detail on each of these applications is given below.
Application 1
You can use two or more 7344 Series motion controllers to create a single, high-axis-count, coordinated real-time controller. While the Vector Space feature of the 7344 Series board is used to closely coordinate axes located on the same board, if axes need to be coordinated and reside on separate devices, you must use the RTSI bus. You can use direct reads and writes from the RTSI bus to synchronize motion between axes on different devices. Note that although several devices are involved, the motion control system retains its hard real-time performance by using RTSI and onboard programming without having to use a real-time operating system.
The following code details how to directly read and write to the RTSI bus from your 7344 Series controller. The code writes RTSI 0 high, performs a move, and writes RTSI 0 low on completion. The VIs we need are shown in Figure 1a and the wired diagram is shown in Figure 1b.
Note that storage VIs on each end of the code make this an onboard program. We first prepare RTSI 0 for reading and writing, then load a target position. Just before the move, we set bit 1 high using the Must On feature of Set I/O Port MOMO.flx. (Port 5 is specified for this vi to indicate the RTSI port.) We then start the move and wait for it to complete. We must use Select_MOMO.flx to change the axis number into a bit map for input to Wait on Condition.flx. Finally when the move is over, we reset RTSI 0 using the Must Off feature of Set I/O Port MOMO.flx and end the program.
Figure 1a. The VIs Needed to Directly Write to the RTSI Bus from an Onboard Program
You can also use RTSI to clock your data acquisition based on the position from the motion controller. The Breakpoint Output feature of the FlexMotion device is used to assert a digital output at specific positions during the move. This digital output is routed over RTSI to the National Instruments E Series DAQ device scan clock input. The DAQ device takes one scan (one sample from each active channel) at every breakpoint. This arrangement finds application in torque and force measurement systems, antenna directionality characterization, and any measurement systems where data versus position is of interest.
The following code shows how to implement the Breakpoint Outputs over RTSI. This onboard program configures the RTSI line, then activates RTSI 0 half way through the move. The unwired VIs are shown in Figure 2a and the wired diagram is show in Figure 2b.

[+] Enlarge Image
Figure 2a. The VIs Needed to Activate Breakpoints over the RTSI Bus from an Onboard Program

Figure 2b. The Block Diagram Showing How To Activate the Breakpoint for Axis 1 over RTSI 0.
Application 3
The following code shows how to implement High-Speed Capture and position logging over RTSI. The unwired VIs are shown in Figure 3a and the wired diagram is show in Figure 3b.
The code routes the capture line for axis 1 to RTSI 0, loads a target position, and begins the move. Each time RTSI 0 is activated, the captured position is stored in variable location 1 for retrieval by the host. Note that the capture is reenabled each time through the loop. In addition, Select.flx creates a bitmap for Enable High-Speed Position Capture.flx. The only difference between this VI and Select_MOMO.flx is the number of elements in the output cluster.
This code is meant to illustrate concepts of the High-Speed Capture rather than to serve as a working example of data manipulation. It is clear that onboard buffering or capture reads directly from the host would be more practical in this case. In addition, the code leaves no means to exit the loop.

[+] Enlarge Image

[+] Enlarge Image
Figure 3b. The Block Diagram Showing How To Accept High-Speed Capture for Axis 1 over RTSI 0.
References
The following documents contain more information about using RTSI with your National Instruments product:
See Also:
NI-DAQ Function Reference Manual for PC Compatibles
NI-DAQ User Manual for PC Compatibles
Data Acquisition Basics Manual
NI-IMAQ Function Reference Manual
NI-IMAQ VI Reference Manual
PXI-1010 Chassis User Manual
PCI E Series User Manual
Advanced Synchronization Techniques for Data Acquisition
Reader Comments | Submit a comment »
Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).


