Page 3
The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
NI SoftMotion Controller Communication Watchdog ...1-9 Chapter 2 Creating NI-Motion Applications Creating a Generic NI-Motion Application ...2-1 Adding Measurements to an NI-Motion Application ...2-2 Chapter 3 Tuning Servo Systems NI SoftMotion Controller Considerations ...3-1 NI SoftMotion Controller for CANopen ...3-1 NI SoftMotion Controller for Ormec ...3-1...
Code instructions and examples assume a working knowledge of the given programming language. This manual also assumes a general knowledge of motion control terminology and development requirements. This manual pertains to all NI motion controllers that use the NI-Motion driver software. Conventions The following conventions appear in this manual: <>...
NI-Motion ReadMe—Refer to this HTML document for information about hardware and software installation and information about changes to the NI-Motion driver software in the current version. This document also contains last-minute information about NI-Motion. Application notes—For information about advanced NI-Motion concepts and applications, visit ni.com/appnotes.nsf/...
Page 13
• • In addition to the NI Developer Zone, you can find NI-Motion C/C++ and Visual Basic programming examples in the FlexMotion\Examples default directory is NI-Motion You can find LabVIEW example programs under in the directory where you installed LabVIEW. You can find LabWindows where you installed LabWindows/CVI.
Introduction to NI-Motion About NI-Motion NI-Motion is the driver software for National Instruments 73xx motion controllers and the NI SoftMotion Controller. You can use NI-Motion to create motion control applications using the included library of LabVIEW VIs and C/C++ functions.
Chapter 1 Introduction to NI-Motion Software and Hardware Interaction Measurement and Automation Explorer Configuration Utility Note The last block in Figure 1-1 is not applicable to the NI SoftMotion Controller. NI Motion Controller Architecture This section includes information about the architecture for both the 73xx family of NI motion controllers and the NI SoftMotion Controller.
Chapter 1 Introduction to NI-Motion Figure 1-2 illustrates the physical architecture of the NI motion controller hardware. Host Computer Because the NI SoftMotion Controller is not a hardware device, information about its architecture is not covered in this section. Refer to the...
Page 20
Chapter 1 Introduction to NI-Motion Figure 1-5 illustrates the functional architecture of NI motion controllers. Supervisory Control (ms) User API Interface Supervisory Commands for Trajectory Generator Control Event Monitoring Interface The following list describes how each component of the 73xx controllers and the NI SoftMotion Controller functions: •...
• NI SoftMotion Controller Architecture The NI-Motion architecture for the NI SoftMotion Controller uses standard PC-based platforms and open standards to connect intelligent drives to a real-time host. In this architecture, the software components of the motion controller run on a real-time host and all I/O is implemented in the drives.
Page 22
Chapter 1 Introduction to NI-Motion NI SoftMotion Controller for CANopen When you use the NI SoftMotion Controller with a CANopen device, you can daisy chain up to 15 drives together and connect them to the real-time host. The real-time Process Data Objects (PDOs) defined by the CANopen protocol are used to transfer data between the drives and host.
Creating NI-Motion Applications This chapter describes the basic form of an NI-Motion application and its interaction with other I/O, such as a National Instruments data and/or image acquisition device. Creating a Generic NI-Motion Application Figure 2-1 illustrates the steps for creating an application with NI-Motion, and describes the generic steps required to design a motion application.
NI-Motion User Manual Measurement & Automation Explorer Help for Motion Part III: Figure 2-1. Generic Steps for Designing a Motion Application NI-Motion, of this manual. For information about items Determine the system requirements Determine the required mechanical system Connect the hardware...
Page 27
Chapter 2 Creating NI-Motion Applications If you are using RTSI to connect your motion controller to a National Instruments Note data or image acquisition device, be aware that the NI SoftMotion Controller does not support RTSI. NI-Motion User Manual ni.com...
You can configure the control loop to perform a Proportional, Integral and Derivative (PID) loop or a more advanced control loop, such as the velocity feedback (PIV) or velocity feedforward (PIVff) loops. NI-Motion User Manual Settling Time Figure 3-1. Properly Tuned Servo Motor Behavior ni.com...
This effect can be mitigated through the use of the Integration Limit parameter. Too high a value of Ki often results in servo loop instability. National Instruments therefore recommends that you leave Ki at its default value of zero until the servo system operation is stable. Then you can add a small amount of Ki to minimize static position errors.
Page 34
Kdac Kdac is the Digital to Analog Converter (DAC) gain. Use the following equation to calculate Kdac: 20 V represents the ±10 V range in the motion controller. NI-Motion User Manual 20 V Kdac ----------- ni.com...
Use the velocity feedforward term (Vff) to ensure that there is minimum following error during the constant velocity profiles. NI-Motion User Manual in Addition to Kd Figure 3-6. Alternate Dual-Loop Feedback Algorithm Figure 3-7.
Page 39
National Instruments does not recommend increasing Ki. Note Velocity feedforward is rarely used when operating in PID mode with torque block amplifiers.
Page 40
You can use the C/C++ functions and LabVIEW VIs, included with NI-Motion, to configure and execute motion control applications. Part III of this manual covers the NI-Motion algorithms you need to use all the features of NI-Motion. Each task discussion uses the same structure. First, a generic algorithm flow chart shows how the component pieces relate to each other.
Page 41
Part III Programming with NI-Motion • • • NI-Motion User Manual Synchronization Torque Control Onboard Programs III-2 ni.com...
Basic Moves There are four basic move types: • • • NI-Motion User Manual Velocity Figure 4-1. Trapezoidal Move Profile Velocity Figure 4-2. S-Curve Move Profile Reference Move—Initializes the axes to a known physical reference such as a home switch or encoder index Straight-Line Move—Moves from point A to point B in a straight...
In coordinate spaces, this behavior is calculated automatically. Trajectory Parameters Use trajectory parameters to control the moves you program in NI-Motion. All trajectory parameters for servo axes are expressed in terms of quadrature encoder counts. Parameters for open-loop and closed-loop stepper axes are expressed in steps.
Velocity values in RPM are converted to an internal 16.16 fixed-point format in units of counts (steps) per sample period (update period) before being used by the trajectory generator. NI-Motion can control velocity to 1/65,536 of a count or step per sample.
Page 47
250 µs update rate, the minimum RPM increment is You can calculate the maximum velocity in RPM with the following equation: where NI-Motion User Manual minimum RPM Vmin = 1/65,536 counts/sample or steps/sample Ts = sample period in seconds per sample...
Page 49
437.5 µs 167,183,673 counts/sec 500 µs 128,000,000 counts/sec NI-Motion User Manual maximum velocity Vmax = 20 MHz for servos 8 MHz for steppers on a NI 7350 controller 4 MHz for steppers on a NI 7330, NI 7340, or NI 7390 motion controller velocity ≤...
Page 51
For a typical servo axis with 2,000 counts or steps per revolution operating at the 250 µs update rate, calculate the minimum RPS/s increment using the following equation: NI-Motion User Manual Table 4-3. Acceleration Update Rate in RPS/s 3906 counts/sec...
Page 52
(f32) data value from 0 to 150%, but velocity override is internally implemented as a velocity scale factor of 0 to 384 with an implicit fixed denominator of 256. NI-Motion uses the velocity override to increase the speed of the calculation for the sake of calculation speed—the division is a shift right by eight bits.
Page 53
What You Need to Know about Moves If the distance of the move is too small, it may not be possible to reach the Note commanded maximum move constraints. In such instances, NI-Motion adjusts the move constraints lower to reach the commanded position. NI 73xx...
Chapter 4 What You Need to Know about Moves Timing Loops National Instruments recommends that you use the loop timings discussed in the following sections. Status Display When you are displaying status information to the user, such as position, move status, or velocity, an update rate faster than 60 ms has no value.
Page 57
Start or Blend Move. You must load the move constraints only if they are different from what was previously loaded. NI-Motion User Manual Figure 5-1. Position-Based Straight-Line Move Algorithm ni.com...
Page 63
Chapter 5 Straight-Line Moves NI-Motion User Manual // Configure a 2D vector space comprised of axes 1 and 2 err = flex_config_vect_spc(boardID, vectorSpace, 1, 2, 0); CheckError; // Set the velocity for the move (in counts/sec) err = flex_load_velocity(boardID, vectorSpace, 10000, 0xFF);...
The sign of the loaded velocity specifies the direction of motion. Positive velocity implies forward motion and negative velocity implies reverse motion. You can change the move constraints during a velocity move. NI-Motion User Manual flex_read_csr_rtn(boardID,&csr); }while(csr & NIMC_MODAL_ERROR_MSG); else// Display regular error nimcDisplayError(err,0,0);...
Page 67
The axis decelerates to a stop using the Stop Motion function. The velocity profile created in the example code is shown in Figure 5-5. NI-Motion User Manual Velocity 10,000 5,000 Figure 5-5.
Page 69
Chapter 5 Straight-Line Moves NI-Motion User Manual i32 errorCode;// Error code // Set the board ID boardID = 3; // Set the axis number axis = NIMC_AXIS1; // Move time for the first segment moveTime1 = 5000; //milliseconds // Move time for the second segment moveTime2 = 10000;...
Figure 5-7 is a generic algorithm applicable to both C/C++ and VI code. Waits the duration of time you specified for the originally loaded velocity Waits the duration of time you specified for the newly loaded velocity Figure 5-7. Velocity Override Algorithm NI-Motion User Manual 5-18 ni.com...
Straight-Line Moves C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual u8 boardID;// Board identification number...
Page 80
• 1 Original Arc • NI-Motion User Manual Radius—Specifies the distance from the center of the arc to its edge Start Angle—Orients the arc on its plane using the starting point as an axis to spin around. Because the starting point for a new arc is fixed based on the current position, moving its center around the starting point alters the orientation of a new arc.
4 Load Acceleration/Deceleration C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual...
Page 84
Chapter 6 Arc Moves NI-Motion User Manual err = flex_check_move_complete_status(boardID, vectorSpace, 0, &moveComplete); CheckError; // Check the following error/axis off status for axis 1 err = flex_read_axis_status_rtn(boardID, NIMC_AXIS1, &status); CheckError; axisStatus |= status; // Check the following error/axis off status for...
Page 86
X'Y'Z' vector space rotates around the original Z-axis. The radius, start angle, and travel angle parameters also apply to a spherical arc that defines the arc in two dimensions. NI-Motion User Manual Figure 6-7. Changing Yaw by Rotating the Z Axis ni.com...
4 Load Acceleration/Deceleration C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual...
Page 90
Chapter 6 Arc Moves NI-Motion User Manual // Check the following error/axis off status for axis 1 err = flex_read_axis_status_rtn(boardID, NIMC_AXIS1, &status); CheckError; axisStatus |= status; // Check the following error/axis off status for axis 2 err = flex_read_axis_status_rtn(boardID, NIMC_AXIS2, &status);...
Page 94
Chapter 6 Arc Moves NI-Motion User Manual // Set the board ID boardID = 1; // Set the vector space number vectorSpace = NIMC_VECTOR_SPACE1; //////////////////////////////// // Configure a 3D vector space comprising of axes 1, 2 and 3 err = flex_config_vect_spc(boardID, vectorSpace, NIMC_AXIS1, NIMC_AXIS2, NIMC_AXIS3);...
NI Motion Assistant prototyping tool can remap a user-defined trajectory based on specified move constraints, preserving move characteristics and move geometry. NI-Motion User Manual Point[n] = Point[n-1] + bufferPosition[n] – 1. For absolute position mode, the first position in the array passed to –...
28. If the axis starts at position 10, it ends up at position 38 in both cases. NI-Motion User Manual Figure 7-3. Absolute Contouring Buffer Values Figure 7-4. Relative Contouring Buffer Values...
1 Check Buffer C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual Figure 7-6.
Page 106
Chapter 7 Contoured Moves NI-Motion User Manual // Free the buffer allocated on the motion controller memory err = flex_clear_buffer(boardID, 1/*buffer number*/); CheckError; return;// Exit the Application ////////////////////// // Error Handling nimcHandleError; //NIMCCATCHTHIS: // Check to see if there were any Modal Errors if (csr &...
Chapter 8 Reference Moves Reference Move Algorithm NI-Motion User Manual Load Velocity Load Acceleration/ Deceleration Load Jerk Find Reference Typically a Find Home Loop Waiting for Find Complete Check Reference Find Reference Typically a Find Index Loop Waiting for Find Complete Check Reference Figure 8-1.
Page 110
Chapter 8 Reference Moves NI-Motion User Manual //Variables for modal error handling u16 commandID;// The commandID of the function u16 resourceID;// The resource ID i32 errorCode;// Error code //Get the board ID printf("Enter the Board ID: "); scanf("%d", &scanVar); boardID=(u8)scanVar;...
Page 112
// Check to see if there were any Modal Errors if (csr & NIMC_MODAL_ERROR_MSG){ else// Display regular error return;// Exit the Application NI-Motion User Manual //Get the command ID, resource ID, and the error code of the modal //error from the error stack on the device flex_read_error_msg_rtn(boardID,&commandID,&reso...
The velocity during the superimposition depends on the cruising velocity, deceleration, and jerk of the first move segment, and the jerk, acceleration, and cruising velocity of the second move segment. NI-Motion User Manual Superimpose the two moves by starting the second move as the first move starts to decelerate...
Because two move segments are always used while blending, it is very important that you wait for the blend to complete before loading the next move segment you want to blend. NI-Motion User Manual Velocity 2 Blend is Complete Figure 9-4. Blending after a Delay...
Page 122
Chapter 9 Blending Moves NI-Motion User Manual NIMC_AXIS_OFF_BIT)); //Exit on move complete/following error/axis off return;// Exit the Application /////////////////////////////////////////////////// // Error Handling nimcHandleError; //NIMCCATCHTHIS: // Check to see if there were any Modal Errors if (csr & NIMC_MODAL_ERROR_MSG){ //Get the command ID, resource ID, and the...
Relative gearing allows you to change the gear ratio on-the-fly. The master move is calculated based on the master reference position, which is updated when gearing is enabled and is updated each time a new gear ratio is loaded. NI-Motion User Manual Set the Gear Ratio Enable gearing on the...
When an axis is geared to an ADC, the slave axis follows the binary value of the ADC as if it were a position. For example, if the binary code for 2 V is 6553, the slave axis tracks to this position. NI-Motion User Manual 10-4 ni.com...
Page 128
Chapter 10 Electronic Gearing and Camming NI-Motion User Manual // Set the board ID boardID = 1; // Set the axis number slaveAxis = NIMC_AXIS1; // Master is encoder 4 master = NIMC_ENCODER4; //////////////////////////////// // Set up the gearing configuration for the slave...
These ratios are handled automatically by the motion controller, allowing precise switching of the gear ratios, as shown in Figure 10-6. Camming is used in applications where the slave axis follows a non-linear profile from a master device. NI-Motion User Manual Slave Figure 10-5. Master/Slave Ratio in Gearing 10-8...
Page 132
If this application used gearing instead of camming, the latency, or delay, of loading a new gear ratio might cause an accumulation of position errors. NI-Motion User Manual position Figure 10-7. Welding Application First, it follows the material with the same speed as the conveyor belt.
To move the welding point to its original position at the same time that the next part is in the correct position on the conveyor belt, the welding point must travel NI-Motion User Manual Time to dwell during welding...
Page 136
Figure 10-13 shows that when the master axis moves to position 4,000, the gear ratio changes to –0.5. The slave axis travels half the distance that the master axis travels, and it travels in the opposite direction. NI-Motion User Manual Master 1000...
Page 138
1500 counts away from the starting position (0). With a slave offset of 500, the slave axis traverses the positions specified in the camming table, but it does not maintain the camming ratio. NI-Motion User Manual Figure 10-15. Camming without Offset 10-16...
Page 140
Figure 10-16 and Figure 10-17. 2500 Without Master Offset 2000 1500 1000 NI-Motion User Manual Camming starts here at position 50 Master cycle begins at position 50. Figure 10-17. Camming Profile Starts when First Material Passes With Master Offset...
1,024 samples per axis for four axes. You also can vary the time period between acquired samples from 3 ms to 65,535 ms. Algorithm NI-Motion User Manual Acquire Data Specify the number of axes, sample period, and number of samples...
1 Acquire Trajectory Data C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual 2 Read Trajectory Data Figure 11-3.
Page 150
Chapter 11 Acquiring Time-Sampled Position and Velocity Data NI-Motion User Manual // Check to see if there were any Modal Errors if (csr & NIMC_MODAL_ERROR_MSG){ //Get the command ID, resource ID, and the error code of the //modal error from the error stack on the device flex_read_error_msg_rtn(boardID,&commandI...
You can synchronize NI motion controllers with NI data and image acquisition devices using breakpoints and high-speed captures. Timing and triggering with NI-Motion is always related to either position or velocity. Synchronizing position and velocity information with the external world allows you to coordinate measurements with moves. You can program the motion controller to trigger another device at specified positions using RTSI or a pin on the Motion I/O connector.
In certain cases, such as buffered and periodic breakpoints, the motion controller automatically re-enables the breakpoints. The implementation for absolute breakpoints is divided into the buffered breakpoint and single position breakpoint methods. NI-Motion User Manual Table 12-1. Breakpoint Modes on NI Motion Controllers NI 7350 12-2...
Write buffer (optional) Write remaining breakpoint positions to onboard buffer Clear buffer NI-Motion User Manual Load Breakpoint Array Set the buffer type to breakpoint positions Total Points is the total number of breakpoint positions you want to load Buffer Size is the size of the buffer you want to create on the device.
Page 156
Chapter 12 Synchronization NI-Motion User Manual // Buffer resources i32 breakpointPositions[] = {1000, 1100, 1200, 1300, 1400, 1500, 1600}; u16 numberOfPoints = 7;// Number of breakpoints f64 actualInterval;// Required in the function call but not being //used f64 requestedInterval = 10.0;// Required in the function call but //not being used u32 backLog;// Number of space available in buffer...
Single Position Breakpoints Single position breakpoints execute one breakpoint per enabling. Single Position Breakpoint Algorithm Figure 12-3 shows the basic algorithm for implementing single position breakpoints. NI-Motion User Manual Configure breakpoint Configure breakpoint for absolute mode Load breakpoint position Absolute position where...
RTSI line and the breakpoint line on the Motion I/O connector. C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual...
2 Configure Breakpoint C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual...
Chapter 12 Synchronization Periodically Occurring Breakpoints NI-Motion allows you to program the motion controller to generate multiple breakpoints at fixed and exact intervals, regardless of the direction of travel or velocity. There are two ways to create periodically occurring breakpoints using NI-Motion functions, depending on which motion controller you have.
3 Load Breakpoint Modulus C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual...
Page 172
1500, 3500. If the breakpoint is enabled when the axis is at 2210, the breakpoints at 1500 and 3500 are both armed, as shown in Figure 12-12. Each time a breakpoint occurs, re-enable it to load the next breakpoint. NI-Motion User Manual –1000 –500 Figure 12-11.
Read buffer (optional) Read captured positions to free the buffer for more data to be written NI-Motion User Manual Set the buffer type to be high-speed capture positions Total Points is the total number of high-speed capture positions you...
Page 180
Chapter 12 Synchronization NI-Motion User Manual u32 pointsDone;// Indicates the number of points that have been //consumed u16 bufferState;// Indicates the state of the onboard buffer u32 currentDataPoint = 0;// Indicates the next points to be read //from the buffer i32* readBuffer = NULL;// The temporary array that is...
Synchronization Non-Buffered High-Speed Capture Non-buffered high-speed capture allows you to configure a single high-speed capture event. For multiple high-speed captures, you must re-enable the high-speed capture each time it triggers. NI-Motion User Manual CheckError; return;// Exit the Application /////////////////////////////////////////////////// ////////////// // Error Handling nimcHandleError;...
To trigger the high-speed capture from a RTSI line, set the Destination parameter in Select Signal to High Speed Capture 1, as shown in Figure 12-20. NI-Motion User Manual 3 Read per Axis Status 4 Read Captured Position Figure 12-19. High-Speed Capture Using LabVIEW 12-34 ni.com...
The commandID of the function u16 resourceID;// The resource ID i32 errorCode;// Error code /////////////////////////////// // Set the board ID boardID = 1; // Set the axis number 12-35 Chapter 12 Synchronization folder on the NI-Motion CD for NI-Motion User Manual...
Page 186
Chapter 12 Synchronization NI-Motion User Manual axis = NIMC_AXIS1; //////////////////////////////// // Route HSC 1 to RTSI line 1 err = flex_select_signal (boardID, NIMC_HS_CAPTURE1 /*destination*/, NIMC_RTSI1/*source*/); CheckError; //Configure High-Speed Capture err = flex_configure_hs_capture(boardID, axis, NIMC_HS_LOW_TO_HIGH_EDGE, 0); CheckError; for(i=0; i<6; i++){ // Enable the high speed capture on axis err = flex_enable_hs_capture(boardID, axis, NIMC_TRUE);...
Host can read/update the buffers asynchronously Generate trigger (breakpoint) at a given position NI-Motion User Manual Write the captured position to the buffer or read the position from the buffer and enable the breakpoint. You must create the buffer. *NI 7350 only Figure 12-21.
High-Speed Capture Input Using RTSI When the RTSI line receives the trigger from a data or image acquisition device, the corresponding high-speed capture occurs, as shown in Figure 12-25. NI-Motion User Manual Source: RTSI line Figure 12-25. High-Speed Capture Input Using RTSI 12-40...
Page 192
+5 V, 0 V to 10 V, and –10 V to +10 V. When you use counts for entering the values of position, velocity, acceleration, and deceleration, you do not need to enter the counts/revolution value for the axis. Refer to the motion controller user manual for information about analog input ranges. NI-Motion User Manual 13-2 ni.com...
Chapter 13 Torque Control LabVIEW Code 1 Load Velocity 2 Load Acceleration/Deceleration 3 Load Acceleration/Deceleration NI-Motion User Manual 4 Set Operation Mode 5 Load Target Position 6 Start Motion Figure 13-3. Torque Control Using Analog Feedback Using LabVIEW 13-4 7 Read per Axis Status 8 Motion Error Handler ni.com...
For monitoring force, create an outer loop to monitor the torque sensor, and move the motor based on the value read from the torque sensor. NI-Motion User Manual Figure 13-4. Torque Control Using Analog Feedback Flowchart 13-8...
Page 202
Chapter 13 Torque Control NI-Motion User Manual err = flex_load_acceleration(boardID, axis, NIMC_DECELERATION, 100000, 0xFF); CheckError; // Set the jerk (s-curve value) for the move (in sample periods) err = flex_load_scurve_time(boardID, axis, 100, 0xFF); CheckError; // Set the operation mode to velocity err = flex_set_op_mode(boardID, axis, NIMC_RELATIVE_POSITION);...
Speed Control Based on Analog Feedback Algorithm The analog input could be connected to a force sensor, which ensures that the tension of a web being fed is maintained. NI-Motion User Manual Load move constraints Set operation mode Set to velocity mode...
Torque Control C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual u8 boardID;// Board identification number...
Page 208
Chapter 13 Torque Control NI-Motion User Manual Sleep (50); //Check every 50 ms }while (!(axisStatus & NIMC_AXIS_OFF_BIT)); //Exit on axis off return;// Exit the Application /////////////////////////////////////////////////// // Error Handling nimcHandleError; //NIMCCATCHTHIS: // Check to see if there were any Modal Errors if (csr &...
The jitter of the system increases with the number of devices used in your RT system. Enable only the devices you need to use for the current application. Because interrupts cause jitter, National Instruments recommends you configure your application to poll for data periodically rather than wait on an interrupt.
The onboard programs and housekeeping tasks are time-sliced among themselves. For greater control and determinism for the motion control system, National Instruments offers the LabVIEW Real-Time (RT) module motion control system, which consists of a PXI chassis, PXI motion controller or controllers, LabVIEW RT, and NI-Motion driver software.
Note controllers. Almost all NI-Motion functions that execute on the host can run onboard. You can store up to 32 onboard programs on the motion controller. These onboard programs remain on the motion controller until you reset it. If you want the onboard programs to persist through a reset of the motion controller, save them to FLASH, as shown in Figure 14-2.
Chapter 14 Onboard Programs 1 Write the program you want to load onto onboard memory. You can use any NI-Motion functions between Begin and End Store. 2 Transfer the program to onboard RAM using the host communication handler. 3 Store the program to FLASH memory for more permanent storage (optional).
Page 214
Onboard Programs C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual u8 boardID;// Board identification number...
You can pause an onboard program with a function call from the host, from the onboard program itself, or from another running onboard program. NI-Motion User Manual 14-8 ni.com...
3 Load Velocity in RPM C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual...
For example, you may want to update the velocity of an axis based on the analog voltage read from an ADC channel. This memory is statically allocated. NI-Motion User Manual CheckError; return;// Exit the Application ////////////////////// // Error Handling nimcHandleError;...
1 Load Constant to Variable 2 Load Constant to Variable 3 Begin Program Storage 4 Set Operation Mode 5 Insert Program Label NI-Motion User Manual 6 Read ADC 7 Multiply Variables 8 Subtract Variables 9 Jump to Label on Condition 10 Load Velocity Figure 14-9.
Page 226
Chapter 14 Onboard Programs NI-Motion User Manual err = flex_read_adc16(boardID, NIMC_ADC1, 2); CheckError; //Multiply variable 2 (ADC value) with variable 1 (constant) // Save the result in variable 3 err = flex_mult_vars(boardID, 1, 2, 3); CheckError; //Subtract value in variable 3 from variable 4. The result is //unimportant, you just want to set the condition on board.
Chapter 14 Onboard Programs Onboard Program Algorithm Figure 14-10 shows an onboard program waiting for an I/O line to go active before starting a move. NI-Motion User Manual Begin Store Put Controller in Store Mode Set a Label Load Move Parameters...
Onboard Programs C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual u8 boardID;// Board identification number...
Onboard Programs Math Operations NI-Motion always performs math operations on values stored in onboard variables, and all math operations set a global condition that the Jump to Label function uses to determine if the operation jumps to a particular label in the onboard program.
MustOn/MustOff (MOMO) protocol. Use these bits to synchronize an application running on the host computer with an onboard program, as shown in Figure 14-15. NI-Motion User Manual Set the buffer type to be high-speed capture positions Total Points is the total number of...
1 Load Constant to Variable 2 Load Constant to Variable 3 Begin Program Storage 4 Set Operation Mode 5 Load Velocity NI-Motion User Manual 6 Insert Program Label 7 Load Target Position 8 Start Motion 9 Select MOMO 10 Wait on Condition Figure 14-17.
Onboard Programs C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual u8 boardID;// Board identification number...
Page 240
Chapter 14 Onboard Programs NI-Motion User Manual err = flex_jump_on_event (boardID, 0, NIMC_CONDITION_TRUE, 0, 0, NIMC_MATCH_ALL, 1/*label number*/); CheckError; // End Program Storage err = flex_end_store(boardID, 1); CheckError; //------------------------------------------------ // Host program. This programs monitors the 13th bit in the move //complete status register and records the position the axis is //going to move to.
If the I/O line is active, the main onboard program calls an onboard subroutine that rotates the motor clockwise. If the I/O line is inactive, the main onboard program calls an onboard subroutine that rotates the motor to counter clockwise. NI-Motion User Manual Start program 2 Figure 14-19. Onboard Subroutine Algorithm 14-34...
Page 244
Figure 14-21 shows the subroutine that causes the motor to rotate clockwise. 1 Begin Program Storage 2 Set Operation Mode 3 Load Target Position 4 Load Velocity in RPM NI-Motion User Manual 5 Load Accel/Decel in RPS/sec 6 Start Motion 7 Select MOMO Figure 14-21. Clockwise Subroutine Using LabVIEW 14-36...
Onboard Programs C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. // Main Function void main(void) NI-Motion User Manual u8 boardID;// Board identification number...
I/O reaction time, even though host communications and I/O reaction have higher priorities than onboard programs because the motion controller must guarantee that every program runs for its allotted time per watchdog period. NI-Motion User Manual 14-42 ni.com...
Raster Scanning Using Straight Lines Algorithm The raster scanning algorithm for straight-line moves stops the motors after every segment of the move, so the cycle time is longer than other methods. NI-Motion User Manual Configure the coordinate space Load move constraints...
Page 255
Scanning C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. # define d_numberOfSegments // Main Function void main(void){ NI-Motion User Manual u8 boardID;// Board identification number...
Page 257
Chapter 15 Scanning NI-Motion User Manual //Read the communication status register and check the modal //errors err = flex_read_csr_rtn(boardID, &csr); CheckError; //Check the modal errors if (csr & NIMC_MODAL_ERROR_MSG) err = csr & NIMC_MODAL_ERROR_MSG; CheckError; Sleep(10); //Check every 10 ms }while (!moveComplete &&...
Chapter 15 Scanning Raster Scanning Using Blended Straight Lines Algorithm Start motion Loop waiting for move complete Check for errors NI-Motion User Manual Configure the coordinate space Load move constraints Set blend factor Set operation mode Create the move segments...
Scanning C/C++ Code The following example code is not necessarily complete, and may not compile if copied exactly. Refer to the NI-Motion CD for files that are complete and compile as is. #define d_numberOfSegments // Main Function void main(void) NI-Motion User Manual u8 boardID;// Board identification number...
Page 265
However you lose the benefit of the trajectory generator of the NI motion controller. Refer to Chapter 7, Contoured NI-Motion. NI-Motion User Manual Figure 15-7. User-Defined Scanning Path Moves, for information about using contoured moves with 15-14...
Page 269
Chapter 15 Scanning NI-Motion User Manual vectorSpace = NIMC_VECTOR_SPACE1; // Configure a 2D vector space comprised of axes 1 and 2 err = flex_config_vect_spc(boardID, vectorSpace, NIMC_AXIS1, NIMC_AXIS2, NIMC_AXIS3); CheckError; // Set the operation mode to absolute position err = flex_set_op_mode(boardID, vectorSpace, NIMC_ABSOLUTE_CONTOURING);...
Page 271
Chapter 15 Scanning NI-Motion User Manual err = flex_read_axis_status_rtn(boardID, NIMC_AXIS2, &status); CheckError; axisStatus |= status; if( (axisStatus & NIMC_FOLLOWING_ERROR_BIT) || (axisStatus & NIMC_AXIS_OFF_BIT) ){ break;//Break out of the for loop because an axis was killed //Set the mode back to absolute mode to get the motion...
5 Set Operation Mode Figures 16-4 and 16-5 show the remaining cases for the block diagram in Figure 16-3. 1 Read Captured Position NI-Motion User Manual 6 Enable Gearing Single Axis 7 Enable High-Speed Capture 8 Read High-Speed Capture Status 9 Motion Error Handler Figure 16-3.
Page 277
Chapter 16 Rotating Knife NI-Motion User Manual // Set the axis number slaveAxis = NIMC_AXIS1; // Master is encoder 4 master = NIMC_ENCODER4; //////////////////////////////// //------------------------------------------------- // Set up the gearing configuration for the slave axis //------------------------------------------------- // Configure Gear Master err = flex_config_gear_master(boardID, slaveAxis, master);...
Page 279
Chapter 16 Rotating Knife NI-Motion User Manual err = flex_start(boardID, slaveAxis, 0); CheckError; }// For loop return;// Exit the Application /////////////////// // Error Handling /////////////////// nimcHandleError; //NIMCCATCHTHIS: // Check to see if there were any Modal Errors if (csr & NIMC_MODAL_ERROR_MSG){...
Page 281
Therefore, the commutation frequency is limited by the update rate of the control loop. To calculate the maximum commutation frequency supported at a particular PID update rate, use the following formula: NI-Motion User Manual counts per electrical cycle counts per electrical cycle...
Page 284
• Configure find reference settings • Configure DIO settings • Configure PWM settings • Gearing NI-Motion User Manual Function and/or VI Use the Stop Motion VI with Stop Type (Decel) set to Halt stop. Use the VIs on the Motion I/O palette to configure the capture and compare settings.
Page 285
Using the Motion Controller with the LabVIEW Real-Time Module Using NI-Motion on a real-time (RT) system is designed to be almost transparent for anyone familiar with NI-Motion. Using NI-Motion with RT requires the following hardware and software: • • •...
Page 286
NI motion controller. NI-Motion User Manual If NI-Motion is not already installed, right-click within the dialog box and select Install Software. A dialog appears that lets you select what to download. Make sure the checkbox next to NI-Motion RT is selected.
Page 288
Technical Support and Professional Services Visit the following sections of the National Instruments Web site at ni.com • • • If you searched your local office or NI corporate headquarters. Phone numbers for our worldwide offices are listed at the front of this manual. You also can visit...
Page 290
API for the motion control devices. drive Electronic signal amplifier that converts motor control command signals into higher-voltage signals suitable for driving motors. driver Software that communicates commands to control a specific motion control device. NI-Motion User Manual ni.com...
Page 292
Sensors that alert the control electronics that the physical end of travel is end-of-travel position near and that the motion must stop. (input) NI-Motion User Manual , used with units of , used with B in quantifying data or ni.com...
Page 294
Sets the position breakpoint for an encoder in relative quadrature counts. relative position Destination or target position for motion specified with respect to the current location, regardless of its value. relative position mode Position relative to current position. NI-Motion User Manual ni.com...
Page 296
Timer task that shuts down, or resets, the motion control device if any serious error occurs. word Standard number of bits that a processor or memory manipulates at one time, typically 8-bit, 16-bit, or 32-bit. NI-Motion User Manual ni.com...
Page 297
, 4-8 acceleration in RPS/s, 4-9 acquiring data algorithm, 11-2 C/C++ code, 11-4 data path, 11-1 LabVIEW code, 11-4 adding, measurements to an NI-Motion application, 2-2 algorithms position-based straight-line move, 5-2 velocity-based straight-line move, 5-11 Amplifier Gain, 3-7 analog feedback...
Page 298
3-10 velocity amplifiers, 3-10 velocity feedforward, 3-5 controlling torque, 13-1 conventions used in the manual, xiii counts per electrical cycle, A-2 creating NI-Motion applications, 2-1 generic steps diagram, 2-2 I/O diagram, 2-3 data, acquiring time-sampled position and velocity algorithm, 11-2...
Page 300
Kdac, 3-6 Kt, 3-7 proportional gain, 3-4 velocity feedback, 3-5, 3-9 algorithm, 3-10 velocity amplifiers, 3-10 velocity feedforward, 3-5 creating NI-Motion applications, 2-1 generic steps diagram, 2-2 I/O diagram, 2-3 documentation, xiv examples, xiv NI motion controller architecture control loop, 1-6...
Page 301
2-1, 2-2 documentation, xiv examples, xiv introduction, 1-1 using with data acquisition, 2-3 using with image acquisition, 2-3 NI-Motion applications adding measurements, 2-2 creating, 2-1, 2-2 NI-Motion architecture, 1-1, 1-7 onboard buffers algorithm, 14-26 data flow, 14-25 Index NI-Motion User Manual...
Page 302
LabVIEW code, 14-35 synchronizing host applications with, 14-26 algorithm, 14-27 C/C++ code, 14-30 data flow, 14-27 LabVIEW code, 14-28 NI-Motion User Manual using onboard memory and data, 14-14 algorithm, 14-15 C/C++ code, 14-17 LabVIEW code, 14-16 writing, 14-3 output. See synchronization...