Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI

Document Type: Tutorial
NI Supported: Yes
Publish Date: Apr 11, 2007

Integration with Motion Using RTSI

4 ratings | 5.00 out of 5
Print

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.

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.


FunctionDirectionDescriptionLabVIEW VI
High-Speed CaptureInputCapture position or trigger event when assertedSelect Signal.flx
BreakpointOutputAssert at preset positionSelect Signal.flx
RTSI Software PortInput or outputRead or write directly to RTSI busSelect Signal.flx
Table 1. RTSI Functionality for the PCI/PXI-7344 Control Boards

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.

FunctionDirectionDescriptionLabVIEW VI
TRIG1Input or outputTrigger for the analog inputRoute Signal.vi
TRIG2Input or outputTrigger for the analog input
CONVERTInput or outputConvert signal for analog input
UPDATEInput or outputUpdate clock for the analog output
WFTRIGInput or outputTrigger for the analog output
GPCTR0_SRCInput or outputSource for counter 0
GPCTR0_GATEInput or outputGate for counter 0
GPCTR0_OUTPUToutputOutput from counter 0
STARTSCANinput (both for PXI)Scan clock for analog input
AIGATEoutputGate for analog input
SISOURCEoutputSample clock for analog input
UISOURCEoutputSample clock for analog output
GPCTR1_SRCoutputSource for counter 1
GPCTR1_GATEoutputGate for counter 1
RTSI_OSC (20 MHZ)Input or outputTimebase for all board clocks
Table 2. RTSI Functionality for E Series Data Acquisition Boards


FunctionDirectionDescriptionLabVIEW VI
Disablednone The trigger line is disabledIMAQ Trigger Drive VI
Acquisition in Progress outputHigh when acquisition is in progressIMAQ Trigger Drive VI
Acquisition doneoutputAsserted when the entire acquisition is finishedIMAQ Trigger Drive VI
Pixel Clock outputPixel clock times the sampling of pixelsIMAQ Trigger Drive VI
Unasserted outputWrite line to unasserted stateIMAQ Trigger Drive VI
AssertedoutputWrite line to asserted stateIMAQ Trigger Drive VI
Horizontal Synchronization Signal outputHorizontal synchronization signal produced at the beginning of each line by the cameraIMAQ Trigger Drive VI
Vertical Synchronization Signal outputVertical synchronization signal produced at the beginning of each field by the cameraIMAQ Trigger Drive VI
Frame startoutputHigh when a frame is being capturedIMAQ Trigger Drive VI
Frame done outputAsserted at the end of each frame that is capturedIMAQ Trigger Drive VI
DisablednoneTriggering is disabledIMAQ Trigger Configure VI
Trigger start of acquisitioninputWhen the assertion edge of the trigger is received, the acquisition is startedIMAQ Trigger Configure VI
Trigger start of each buffer list inputWhen 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 acquiringIMAQ Trigger Configure VI
Trigger each bufferinputEach buffer waits for a trigger before acquiring an image into the bufferIMAQ Trigger Configure VI
Trigger each lineinputEach line is triggered. This is useful when using an encoder to acquire line scan imagesIMAQ Trigger Configure VI
Table 3. RTSI Functionality for the PCI/PXI-1408, PCI/PXI-1422, PCI-1424 Image Acquisition Boards


FunctionDirectionDescriptionLabVIEW VI
REQ1Input or outputHandshaking request 1Route Signal.vi
REQ2Input or outputHandshaking request 2Route Signal.vi
ACK1Input or outputHandshaking acknowledge 1 or start triggerRoute Signal.vi
ACK2Input or outputHandshaking acknowledge 2 or start triggerRoute Signal.vi
STOPTRIG1InputStop triggerRoute Signal.vi
STOPTRIG2InputStop triggerRoute Signal.vi
PCLK1Input or outputData clockRoute Signal.vi
PCLK2Input or outputData clockRoute Signal.vi
Table 4. RTSI Functionality for the PXI-6533, PCI-DIO-32HS High-Speed Digital I/O Boards

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.

[+] Enlarge Image

Figure 1a. The VIs Needed to Directly Write to the RTSI Bus from an Onboard Program


Figure 1b. The Block Diagram Showing Direct Writes to RTSI 0

Application 2

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

Another common application is to use the RTSI bus to capture and record the position of video frames. You can use the High-Speed Capture Input feature of the FlexMotion board to capture and log position based on the Frame Start pulse. The Frame Start pulse is routed over RTSI from a National Instruments IMAQ 1408 image acquisition device. A typical application for video frame/position logging is autofocusing. Note that the principles shown here illustrate a powerful technology that finds application in many other position logging and event synchronization scenarios.

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
Figure 3a. The VIs Needed To Accept High-Speed Capture Inputs over the RTSI Bus from an Onboard Program


[+] 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

4 ratings | 5.00 out of 5
Print

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/).