background image

Chapter 10

Electronic Gearing and Camming

NI-Motion User Manual

10-2

ni.com

Algorithm

Figure 10-1.  

Electronic Gearing Algorithm

The gear ratio is used to determine how far the slave axis must move in 
proportion to the master when gearing is enabled. The gear ratio can be 
absolute or relative.

Slave axis move = Master axis position 

×

 Gear ratio

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. 

Set the Gear Ratio

Load Move Constraints

Set Operation Mode

Load Target Position

Start Motion on Slave Axis

Enable gearing on the

Slave Axis

Gearing

Superimposed

Straight-line Move

(optional)

Designate a Master Device

The device can be one of the following:

• 

the trajectory generator of another axis

• 

an encoder driven externally

• αν

 analog sensor connected to one

   of the analog channels of the motion
   controller

The slave axis now moves in
proportion to the master device.

Summary of Contents for NI-Motion

Page 1: ...Motion Control NI Motion TM User Manual NI Motion User Manual November 2005 371242B 01...

Page 2: ...a 82 02 3451 3400 Lebanon 961 0 1 33 28 28 Malaysia 1800 887710 Mexico 01 800 010 0793 Netherlands 31 0 348 433 466 New Zealand 0800 553 322 Norway 47 0 66 90 76 60 Poland 48 22 3390150 Portugal 351 2...

Page 3: ...nder the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval system or transl...

Page 4: ...NI SoftMotion Controller Architecture 1 7 NI SoftMotion Controller Communication Watchdog 1 9 Chapter 2 Creating NI Motion Applications Creating a Generic NI Motion Application 2 1 Adding Measurement...

Page 5: ...xed Point 4 4 NI 73xx Time Base 4 5 NI 73xx Arc Move Limitations 4 13 Timing Loops 4 14 Status Display 4 14 Graphing Data 4 14 Event Polling 4 14 Chapter 5 Straight Line Moves Position Based Straight...

Page 6: ...15 C C Code 6 15 Chapter 7 Contoured Moves Overview 7 1 Arbitrary Contoured Moves 7 2 Contoured Move Algorithm 7 3 Absolute versus Relative Contouring 7 4 LabVIEW Code 7 5 C C Code 7 6 Chapter 8 Refer...

Page 7: ...VIEW Code 11 4 C C Code 11 4 Chapter 12 Synchronization Absolute Breakpoints 12 2 Buffered Breakpoints NI 7350 only 12 3 Buffered Breakpoint Algorithm 12 4 LabVIEW Code 12 5 C C Code 12 5 Single Posit...

Page 8: ...r 12 38 Position Breakpoints Using RTSI 12 39 Encoder Pulses Using RTSI 12 39 Software Trigger Using RTSI 12 39 High Speed Capture Input Using RTSI 12 40 Chapter 13 Torque Control Analog Feedback 13 1...

Page 9: ...abVIEW Code 14 16 C C Code 14 17 Branching Onboard Programs 14 19 Onboard Program Algorithm 14 20 LabVIEW Code 14 21 C C Code 14 22 Math Operations 14 24 Indirect Variables 14 24 Onboard Buffers 14 25...

Page 10: ...3 User Defined Scanning Path Algorithm 15 15 LabVIEW Code 15 16 C C Code 15 17 Chapter 16 Rotating Knife Solution 16 1 Algorithm 16 3 LabVIEW Code 16 4 C C Code 16 5 Appendix A Sinusoidal Commutation...

Page 11: ...I Motion driver software Conventions The following conventions appear in this manual Angle brackets that contain numbers separated by an ellipsis represent a range of values associated with a bit or s...

Page 12: ...xx Motion Controllers This document provides installation instructions and general information about the NI Motion product Getting Started NI SoftMotion Controller for Ormec ServoWire SM Drives Refer...

Page 13: ...o select motors and stages appropriate to the motion control application In addition to the NI Developer Zone you can find NI Motion C C and Visual Basic programming examples in the NI Motion FlexMoti...

Page 14: ...s information about the NI Motion driver software motion control setup and specific task based instructions for creating motion control applications using the LabVIEW and C C application development e...

Page 15: ...ol applications using the included library of LabVIEW VIs and C C functions National Instruments also offers the Motion Assistant and NI Motion development tools for Visual Basic NI Motion Architectur...

Page 16: ...I SoftMotion Controller NI 73xx Architecture NI 73xx controllers use a dual processor architecture The two processors a central processing unit CPU and a digital signal processor DSP form the backbone...

Page 17: ...latencies in the range of hundreds of nanoseconds for breakpoints and high speed captures Refer to Chapter 12 Synchronization for information about breakpoints and high speed capture The motion contro...

Page 18: ...oller Functional Architecture Functionally the architecture of the NI 73xx motion controllers and the NI SoftMotion Controller is generally divided into four components supervisory control trajectory...

Page 19: ...oller Figure 1 4 NI SoftMotion Controller Functional Architecture Bus Control Loop Trajectory Generation Supervisory Control To drive From feedback sensors Typical NI 73xx Motion Controller Architectu...

Page 20: ...profiles based on user defined events and so on Fault Detection which includes stopping moves on a limit switch encounter safe system reaction to emergency stop or drive faults watchdog and so on Tra...

Page 21: ...vement modes needed to initialize the system NI SoftMotion Controller Architecture The NI Motion architecture for the NI SoftMotion Controller uses standard PC based platforms and open standards to co...

Page 22: ...Controls Corp When used with CANopen devices the Supervisory Control and Trajectory Generation components of the NI SoftMotion Controller execute in a real time environment that is running LabVIEW Rea...

Page 23: ...ng to that drive is disabled and the communication watchdog status bit which is returned by the Read Per Axis Status function is set to TRUE Similarly all drives connected to the NI SoftMotion Control...

Page 24: ...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...

Page 25: ...f this manual For information about items in the diagram refer to Chapter 12 Synchronization Getting Started with NI Motion for NI 73xx Motion Controllers Determine the system requirements Determine t...

Page 26: ...ger High speed captures are not supported by NI SoftMotion Controller for CANopen You can use two high speed captures per axis when you are using the NI SoftMotion Controller with an Ormec device 1 De...

Page 27: ...pplications NI Motion User Manual 2 4 ni com Note If you are using RTSI to connect your motion controller to a National Instruments data or image acquisition device be aware that the NI SoftMotion Con...

Page 28: ...iguring Motion Control Motion control is divided into two parts configuration and execution Part II of this manual discusses configuring the hardware and software components of a motion control system...

Page 29: ...e control loop is implemented on the drive Refer to the drive documentation for information about tuning the servo motors you are using with the CANopen drive NI SoftMotion Controller for Ormec If you...

Page 30: ...By tuning the servo motors you can affect the settling time the amount of overshoot and various other performance characteristics Control Loop NI motion servo control uses control loops to continuous...

Page 31: ...Chapter 3 Tuning Servo Systems National Instruments Corporation 3 3 NI Motion User Manual Figure 3 2 NI Motion Servo PID Loop...

Page 32: ...of restoring force that increases with time ensuring that the static position error in the servo loop is forced to zero This restoring force works against constant torque loads to help achieve zero po...

Page 33: ...lue other than zero 0 enables velocity feedback using the secondary encoder if configured or the primary encoder if a secondary encoder is not configured Kv is used to scale this velocity feedback bef...

Page 34: ...lution Tip In PIVff mode the Kd and Kv gains are set to zero Velocity feedforward is rarely used when operating in PID mode with torque block amplifiers In this case because the following error is pro...

Page 35: ...er the trajectory The control loop consists of three main parts proportional integral and derivative known as PID parameters The derivative part estimates motor velocity by differentiating the followi...

Page 36: ...p You can enable dual loop feedback on the NI motion controller by mapping an encoder as the secondary feedback for the axis and then using the velocity feedback gain instead of the derivative gain to...

Page 37: ...ck loop on NI motion controllers to achieve the same results you would get from using velocity amplifiers as shown in Figure 3 5 Figure 3 5 Velocity Feedback Setting any non zero value for Kv allows y...

Page 38: ...ose the velocity loop using a tachometer on the amplifier itself as shown in Figure 3 7 In this case the controller must ensure that the voltage output is proportional to the velocity Use the velocity...

Page 39: ...following error by applying velocity feedforward Increasing the integral gain Ki also reduces the following error during constant velocity but at the expense of increased following error during accele...

Page 40: ...iscussion details any aspects of creating the task that are specific to LabVIEW or C C programming complete with diagrams and code examples Note The LabVIEW block diagrams and C C code examples are de...

Page 41: ...Part III Programming with NI Motion NI Motion User Manual III 2 ni com Synchronization Torque Control Onboard Programs...

Page 42: ...type of motor you are using Move constraints are the maximum velocity acceleration deceleration and jerk that the system can handle The trajectory generator creates a velocity profile based on these...

Page 43: ...rol system but increases cycle time The value by which the profile is smoothed is called the maximum jerk or s curve value Figure 4 2 S Curve Move Profile Basic Moves There are four basic move types R...

Page 44: ...s or on a coordinate space A coordinate space is a logical grouping of axes such as the XYZ axis shown in Figure 4 3 Arc moves always execute on a coordinate space If you are performing a move that us...

Page 45: ...es is limited to the steps per revolution or encoder counts per revolution whichever value is more coarse Floating point versus fixed point parameter representation and time base are two additional fa...

Page 46: ...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 Table 4 1 shows the minimum and maximum velocity in c...

Page 47: ...ula shown in the Calculation Based on Units column in Table 4 1 For a typical servo axis with 2 000 counts per revolution operating at a 250 s update rate the minimum RPM increment is or You can calcu...

Page 48: ...of counts or steps per sample update period before being used by the trajectory generator Although the motion controller can control velocity to 1 65 536 of a count or step per sample it is impossibl...

Page 49: ...and deceleration values are converted to an internal 16 16 fixed point format in units of counts s2 before being used by the trajectory generator Table 4 2 shows the minimum and maximum acceleration u...

Page 50: ...ximum acceleration deceleration using the following equation where Amax 32 counts sample2 Ts sample period in seconds per sample and is constrained according to the following equations acceleration 25...

Page 51: ...ation or Table 4 3 Acceleration Update Rate in RPS s Update Rate MAX MIN Calculation Based on Units 62 5 s 2 048 000 000 counts sec2 3906 counts sec2 RPS smax MAX 1 r where r counts revolution 125 s 2...

Page 52: ...t f64 NI 73xx Velocity Override in Percent The Load Velocity Override function takes a single precision floating point f32 data value from 0 to 150 but velocity override is internally implemented as a...

Page 53: ...6 16 fixed point representation where the integer part corresponds to multiples of 45 for example 360 is represented as 0x0008 0000 Use the following formula to convert from floating point to fixed po...

Page 54: ..._invalidVelocityError is generated and where V Velocity in counts s P PID sample rate in seconds I Arc Interval 10 ms or 20 ms in seconds R Radius in counts Arc moves must use the following equations...

Page 55: ...equates to 100 samples every second and provides enough resolution for typical applications Consider how accurate the graph display is when choosing the timing for the loop Event Polling Use a pollin...

Page 56: ...d position Also known as the target position or where you want to move to Move constraints Maximum velocity maximum acceleration maximum deceleration and maximum jerk Tip When you are using the NI Sof...

Page 57: ...an absolute position to move to or as a position relative to the starting position Although you can update any parameter while the move is in progress the new parameter is used only after a subsequent...

Page 58: ...anual Figure 5 2 1D Straight Line Move in LabVIEW 1 Load Velocity 2 Load Acceleration Deceleration 3 Load Acceleration Deceleration 4 Load S Curve Time 5 Set Operation Mode 6 Load Target Position 7 St...

Page 59: ...onfigure Vector Space 2 Load Velocity 3 Load Acceleration Deceleration 4 Load Acceleration Deceleration 5 Load S Curve Time 6 Set Operation Mode 7 Load Target Position 8 Start Motion 9 Check Move Comp...

Page 60: ...axisStatus Axis status u16 moveComplete Variables for modal error handling u16 commandID The commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID...

Page 61: ...complete status err flex_check_move_complete_status boardID axis 0 moveComplete CheckError Check the following error axis off status for the axis err flex_read_axis_status_rtn boardID axis axisStatus...

Page 62: ...ID Read the communication status register flex_read_csr_rtn boardID csr while csr NIMC_MODAL_ERROR_MSG else Display regular error nimcDisplayError err 0 0 return Exit the Application 2D Straight Line...

Page 63: ...ation for the move in counts sec 2 err flex_load_acceleration boardID vectorSpace NIMC_DECELERATION 100000 0xFF CheckError Set the jerk scurve time in sample periods err flex_load_scurve_time boardID...

Page 64: ...oardID csr CheckError Check the modal errors if csr NIMC_MODAL_ERROR_MSG err csr NIMC_MODAL_ERROR_MSG CheckError while moveComplete axisStatus NIMC_FOLLOWING_ERROR_BIT axisStatus NIMC_AXIS_OFF_BIT Exi...

Page 65: ...l in a straight line for a specific amount of time at a given speed This type of move is known as velocity profiling or jogging You can use a motion control application to move a motor at a given spee...

Page 66: ...raight Line Moves National Instruments Corporation 5 11 NI Motion User Manual Algorithm Figure 5 4 is a generic algorithm applicable to both C C and VI code Figure 5 4 Velocity Based Straight Line Mov...

Page 67: ...tion controller to accelerate or decelerate to the newly loaded velocity using the acceleration or deceleration parameters last loaded The axis decelerates to a stop using the Stop Motion function The...

Page 68: ...tification number u8 axis Axis number u16 csr 0 Communication status register u16 axisStatus Axis status i32 moveTime1 Time for the 1st segment i32 moveTime2 Time for the 2nd segment i32 initialTime i...

Page 69: ...Set the acceleration for the move in counts sec 2 err flex_load_acceleration boardID axis NIMC_ACCELERATION 100000 0xFF CheckError Set the deceleration for the move in counts sec 2 err flex_load_acce...

Page 70: ...time and check if time is over for the first segment currentTime timeGetTime if currentTime initialTime moveTime1 break Sleep 100 Check every 100 ms while axisStatus axisStatus NIMC_FOLLOWING_ERROR_BI...

Page 71: ...y 100 ms while axisStatus axisStatus NIMC_FOLLOWING_ERROR_BIT axisStatus NIMC_AXIS_OFF_BIT Exit on move complete following error axis off Decelerate the axis to a stop err flex_stop_motion boardID axi...

Page 72: ...Velocity Override You also can use Load Velocity Override to shift from one velocity to another while executing moves When you use this function you indicate the new velocity in terms of a percentage...

Page 73: ...Algorithm Figure 5 7 is a generic algorithm applicable to both C C and VI code Figure 5 7 Velocity Override Algorithm Waits the duration of time you specified for the originally loaded velocity Waits...

Page 74: ...ty Based Move Using Velocity Override in LabVIEW 1 Load Velocity 2 Load Acceleration Deceleration 3 Load Acceleration Deceleration 4 Load S Curve Time 5 Set Operation Mode 6 Start Motion 7 Read per Ax...

Page 75: ...segment i32 moveTime2 Time for the 2nd segment i32 initialTime i32 currentTime Variables for modal error handling u16 commandID The commandID of the function u16 resourceID The resource ID i32 errorC...

Page 76: ...VELOCITY CheckError Start the move err flex_start boardID axis 0 CheckError Wait for the time for first segment initialTime timeGetTime do Check the following error axis off status err flex_read_axis_...

Page 77: ...rror axis off status err flex_read_axis_status_rtn boardID axis axisStatus CheckError Read the communication status register and check the modal errors err flex_read_csr_rtn boardID csr CheckError Che...

Page 78: ...mcHandleError NIMCCATCHTHIS Check to see if there were any modal errors if csr NIMC_MODAL_ERROR_MSG do Get the command ID resource ID and the error code of the modal error from the error stack on the...

Page 79: ...ry two points of the arc ensuring smooth motion minimum jerk and maximum accuracy at all times The data path is shown in Figure 6 1 Figure 6 1 Arc Move Data Path Circular Arcs A circular arc defines a...

Page 80: ...arting point alters the orientation of a new arc For example Figure 6 2 shows the effect of changing the start angle from 0 to 180 Figure 6 2 Rotating Start Angle Travel Angle Indicates how far the ar...

Page 81: ...ravel Angles Arc Move Algorithm Figure 6 4 Circular Arc Move Algorithm 1 Positive Travel Angle 2 Negative Travel Angle 1 2 Load Velocity Start Motion Load Acceleration Deceleration Perform Measurement...

Page 82: ...is Main Function void main void u8 boardID Board identification number u8 vectorSpace Vector space number u16 csr 0 Communication status register u16 axisStatus Axis status u16 status u16 moveComplet...

Page 83: ...ocity for the move in counts sec err flex_load_velocity boardID vectorSpace 10000 0xFF CheckError Set the acceleration for the move in counts sec 2 err flex_load_acceleration boardID vectorSpace NIMC_...

Page 84: ...tatus status 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_...

Page 85: ...gister flex_read_csr_rtn boardID csr while csr NIMC_MODAL_ERROR_MSG else Display regular error nimcDisplayError err 0 0 return Exit the Application Spherical Arcs A 3D spherical arc defines a 2D circu...

Page 86: ...th no absolute position offset Its orientation is relative to the XYZ vector space and is defined in terms of pitch and yaw angles When rotating through the pitch angle the Y and Y axes stay aligned w...

Page 87: ...tion User Manual Algorithm Figure 6 8 Spherical Arc Algorithm Load Velocity Start Motion Load Acceleration Deceleration Perform Measurements Optional Load Spherical Arc Radius Start Angle Travel Angle...

Page 88: ...n number u8 vectorSpace Vector space number u16 csr 0 Communication status register u16 axisStatus Axis status u16 status u16 moveComplete Variables for modal error handling u16 commandID The commandI...

Page 89: ...t the acceleration for the move in counts sec 2 err flex_load_acceleration boardID vectorSpace NIMC_ACCELERATION 100000 0xFF CheckError Set the deceleration for the move in counts sec 2 err flex_load_...

Page 90: ...r axis 3 err flex_read_axis_status_rtn boardID NIMC_AXIS3 status CheckError axisStatus status Read the communication status register and check the modal errors err flex_read_csr_rtn boardID csr CheckE...

Page 91: ...sr NIMC_MODAL_ERROR_MSG else Display regular error nimcDisplayError err 0 0 return Exit the Application Helical Arcs A helical arc defines an arc in a 3D coordinate space that consists of a circle in...

Page 92: ...i com Algorithm Figure 6 11 Helical Arc Algorithm Load Velocity Start Motion Load Acceleration Deceleration Perform Measurements Optional Load Helical Arc Radius Start Angle Travel Angle Linear Travel...

Page 93: ...identification number u8 vectorSpace Vector space number u16 csr 0 Communication status register u16 axisStatus Axis status u16 status u16 moveComplete Variables for modal error handling u16 commandI...

Page 94: ...in counts sec 2 err flex_load_acceleration boardID vectorSpace NIMC_ACCELERATION 100000 0xFF CheckError Set the deceleration for the move in counts sec 2 err flex_load_acceleration boardID vectorSpace...

Page 95: ...heckError axisStatus status 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 NI...

Page 96: ..._rtn boardID commandI D resourceID errorCode nimcDisplayError errorCode commandID res ourceID Read the communication status register flex_read_csr_rtn boardID csr while csr NIMC_MODAL_ERROR_MSG else D...

Page 97: ...current position when starting There is an assumed 0 point that the firmware adds to the front of the buffer of points For example if the contour buffer is 10 20 30 40 the positions are 0 10 20 30 40...

Page 98: ...in the array passed to the controller must be less than 215 1 and any two consecutive points must be less than 215 1 For relative position mode no point passed to the controller can be greater than 2...

Page 99: ...med Write Buffer Write remaining points to onboard buffer Write Buffer Write the array of points and the number of points you are writing Restore Operation Mode Set operation mode back to absolute pos...

Page 100: ...absolute positions in the array or relative positions which imply incremental position differences between contouring points Absolute versus Relative Contouring If an axis starts at position 0 and use...

Page 101: ...de Figure 7 5 Contoured Move in LabVIEW 1 Configure Vector Space 2 Set Operation Mode 3 Configure Buffer 4 Write Buffer 5 Start Motion 6 Read per Axis Status 7 Read per Axis Status 8 Check Move Comple...

Page 102: ...boardID Board identification number u8 vectorSpace Vector space number u16 csr 0 Communication status register u16 axisStatus Axis status u16 status Temporary copy of status u16 moveComplete Move comp...

Page 103: ...commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the vector space number vectorSpace NIMC_VECTOR_SPACE1 Configure a 2D vector space com...

Page 104: ...vailable space and download remaining points every 50 milliseconds Sleep 50 Check to see if there are more points to download if currentDataPoint numPoints err flex_check_buffer_rtn boardID 1 buffer n...

Page 105: ...eck the modal errors if csr NIMC_MODAL_ERROR_MSG err csr NIMC_MODAL_ERROR_MSG CheckError Check the motor off status on all the axes or axis err flex_read_axis_status_rtn boardID NIMC_AXIS1 status Chec...

Page 106: ...if there were any Modal Errors if csr NIMC_MODAL_ERROR_MSG do 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 c...

Page 107: ...s complete This function is often placed in a loop that continues until the status for the Find Reference operation is shown to be complete You can use the Wait Reference function if there is no need...

Page 108: ...Figure 8 1 Find Reference Move Algorithm Load Velocity Load Jerk Load Acceleration Deceleration Find Reference Typically a Find Home Find Reference Typically a Find Index Move Constraints Loop Waitin...

Page 109: ...ard identification number u8 axis Axis number f64 acceleration 100 Acceleration value in RPS s f64 velocity 200 Velocity value in RPM u16 found finding Check reference statuses u16 axisStatus Axis sta...

Page 110: ...ndition Please initialize the device before printf running this example The flex_initialize_controller function will initialize the printf board with settings selected through Measurement Automation E...

Page 111: ...Status Check if the reference has finished finding err flex_check_reference boardID axis 0 found finding CheckError Read the communication status register check the modal error bit err flex_read_csr_r...

Page 112: ...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 urceID errorCode nimcDisplayError errorCode commandID resourceID...

Page 113: ...velocity profiles of two move segments so the end positions of each move segment may or may not be reached For example if you are blending two straight line moves that form a 90 angle the blended move...

Page 114: ...r more information about move profiles Superimpose Two Moves Superimposing two moves is the most common use of blending In this case the motion controller tries to maintain continuous motion by superi...

Page 115: ...is complete causes the first move segment to come to a complete stop before starting the profile of the second segment as shown in Figure 9 3 Figure 9 3 Blending after Move Complete This type of blend...

Page 116: ...can be either straight line moves or arc moves Because blending occurs on velocity profiles the effect of reaching the end positions of the move segments and the maximum velocity depends on the veloci...

Page 117: ...generic algorithm for blending moves Figure 9 5 Blending Algorithm Start Motion Load Move Segment 2 Blend Motion Perform Measurements Optional Load Move Segment 1 Coordinate Space Move Constraints etc...

Page 118: ...eleration 5 Load S Curve Time 6 Set Operation Mode 7 Load Vector Space Position 8 Start Motion 9 Load Blend Factor 10 Load Circular Arc 11 Blend Motion 12 Check Blend Complete Status 13 Read per Axis...

Page 119: ...esource ID i32 errorCode Error code Set the board ID boardID 1 Set the vector space number vectorSpace NIMC_VECTOR_SPACE1 Configure a 2D coordinate space comprised of axes 1 and 2 err flex_config_vect...

Page 120: ...r Blend the move err flex_blend boardID vectorSpace 0 CheckError Wait for blend to complete before loading the next segment do axisStatus 0 Check the blend complete status err flex_check_blend_complet...

Page 121: ...ck the move complete status err flex_check_move_complete_status boardID vectorSpace 0 complete CheckError Check the following error axis off status for axis 1 err flex_read_axis_status_rtn boardID NIM...

Page 122: ...Errors if csr NIMC_MODAL_ERROR_MSG do 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 resourceID error...

Page 123: ...ing Electronic gearing allows one slave motor to be driven in proportion to a master motor or feedback sensor such as an encoder or torque analog sensor As the slave follows the master position at a c...

Page 124: ...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 Set the Gear Ratio Load Move Constraints Set Oper...

Page 125: ...s updated only when gearing is enabled This difference is apparent when the gear ratio is updated on the fly For example if the gear ratio is 2 1 the current master position is 1010 the current slave...

Page 126: ...ou manually move the master axis the slave axis does not move because the trajectory generator of the master axis is not active When you gear an axis to an encoder or feedback device the slave axis fo...

Page 127: ...tion void main void u8 boardID Board identification number u8 slaveAxis Slave axis number u8 master Gear master u16 csr 0 Communication status register u16 moveComplete Variables for modal error handl...

Page 128: ...EARING 3 ratioNumerator 2 ratioDenominator 0xFF CheckError Enable gearing on slave axis err flex_enable_gearing_single_axis boardID slaveAxis NIMC_TRUE CheckError Wait for 5 000 ms 5 seconds Sleep 500...

Page 129: ...ng on slave axis err flex_enable_gearing_single_axis boardID slaveAxis NIMC_FALSE CheckError return Exit the Application Error Handling nimcHandleError NIMCCATCHTHIS Check to see if there were any Mod...

Page 130: ...ler Gearing is used in applications where a constant gear value creates a linear slave position profile as shown in Figure 10 5 Figure 10 5 Master Slave Ratio in Gearing Camming creates a more flexibl...

Page 131: ...7 shows that the welding point moves to the first position and then welds the material for a couple of seconds Because the conveyor belt keeps moving at a constant rate the welding point must follow t...

Page 132: ...tion as the next material approaches Each segment of the move is represented with a gear ratio that dictates how fast and which direction the welding point is moving in relative to the conveyor belt T...

Page 133: ...Camming Algorithm Set the Master Cycle Load Move Constraints Set Operation Mode Load Target Position Start Motion on Slave Axis Enable Camming Camming Superimposed Straight line Move optional Designat...

Page 134: ...on Time and Speed Constraints In this welding application the slave axis must follow the part with the same velocity as the conveyor belt while welding is in progress Because it takes two seconds to w...

Page 135: ...Profile Table 10 1 shows the camming table that corresponds to the move profile in Figure 10 10 Table 10 1 shows that the camming cycle is 6 000 counts and is divided into equal length segments Tip Be...

Page 136: ...the same speed as the master device to position 1000 Figure 10 11 shows that the master position in this interval is inside the modulus Figure 10 11 Master and Slave Positions at Enable Figure 10 12 s...

Page 137: ...n and the camming cycle begins again Figure 10 14 Camming Cycle Repeats Slave Offset In some camming applications the slave axis might begin and end the camming cycle at different positions as shown i...

Page 138: ...away from the starting position 0 with the slave offset and that without the slave offset the slave axis end position is 1500 counts away from the starting position 0 With a slave offset of 500 the sl...

Page 139: ...difference Figure 10 16 Misaligned Material and Welding Point Without the master offset the master device position is already inside the first interval as soon as the first material passes the welding...

Page 140: ...18 shows the camming profile used for the application portrayed in Figure 10 16 and Figure 10 17 Figure 10 18 Camming Profiles with and without Master Offset Camming starts here at position 50 Master...

Page 141: ...oid main void Locals u8 boardID 1 Board ID as assigned by MAX f64 bufferInterval 0 Ignored Master axis information u8 masterAxis 2 Master axis ID f64 camCycle 70000 Position cycle to repeat the cammin...

Page 142: ...rce ID that is set on the failed command i32 errorCode Error code from the controller Configuring camming profile Configure the cam master master cycle err flex_configure_camming_master boardID slaveA...

Page 143: ..._pos boardID slaveAxis targetPos 0xFF CheckError Start the master axis movement err flex_start boardID slaveAxis 0x0 CheckError Wait for move to complete err flex_wait_for_move_complete boardID slaveA...

Page 144: ...ad_error_msg_rtn boardID commandID resourceID errorCode nimcDisplayError errorCode commandID resourceID Read the Communication Status Register flex_read_csr_rtn boardID csr while csr NIMC_MODAL_ERROR_...

Page 145: ...y data into a FIFO buffer on the motion controller You can read data in from this buffer asynchronously from the host computer as shown in Figure 11 1 Figure 11 1 Acquire Data Path The acquire data ta...

Page 146: ...ou also decrease the total number of samples you can acquire per axis For example you can acquire up to 1 024 samples per axis for four axes You also can vary the time period between acquired samples...

Page 147: ...The data must be read one sample at a time A four axis sample uses the following pattern for returning the data If you request 1 024 samples you must read each of the 1 024 samples individually Axis 1...

Page 148: ...The following example code is not necessarily complete and may not compile if copied exactly Refer to the examples folder on the NI Motion CD for files that are complete and compile as is Main Functi...

Page 149: ...andID The commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Axes whose data needs to be acquired axisMap 1 1 1 2 Axis 1 and axis 2 err flex_a...

Page 150: ...nd 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 D resourceID errorCode nimcDisplayError errorCode commandID res ourc...

Page 151: ...Relative Position Breakpoints and Periodically Occurring Breakpoints In some cases it may be necessary to synchronize position with some measurement occurring external to the motion controller For exa...

Page 152: ...tion while the device under test is in continuous motion the motion controller must be able to trigger the image acquisition device as it reaches those positions The current position is continuously c...

Page 153: ...hen a breakpoint is not intended Increase the size of the breakpoint window to compensate for system jitter Buffered Breakpoints NI 7350 only Instead of enabling breakpoints in your application at the...

Page 154: ...ional Write remaining breakpoint positions to onboard buffer Check the onboard buffer optional Check the number of breakpoints consumed Loop checking for buffered breakpoints usage Load Breakpoint Arr...

Page 155: ...for files that are complete and compile as is Main function void main void Resource variables u8boardID 1 Board identification number u8axis NIMC_AXIS1 Axis number u8 buffer 1 Buffer number Modal erro...

Page 156: ..._BREAKPOINT_DATA numberOfPoints numberOfPoints NIMC_TRUE requestedInterval actualInterval CheckError Write the breakpoint position to the buffer err flex_write_buffer boardID buffer numberOfPoints NIM...

Page 157: ...ck to see if there were any Modal Errors if csr NIMC_MODAL_ERROR_MSG do 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...

Page 158: ...Breakpoint Algorithm Figure 12 3 shows the basic algorithm for implementing single position breakpoints Figure 12 3 Single Position Breakpoint Algorithm Enable breakpoint Wait for breakpoint to occur...

Page 159: ...uments Corporation 12 9 NI Motion User Manual LabVIEW Code Figure 12 4 Single Position Breakpoint in LabVIEW 1 Configure Breakpoint 2 Load Breakpoint Position 3 Enable Breakpoint Output 4 Read per Axi...

Page 160: ...not compile if copied exactly Refer to the examples folder on the NI Motion CD for files that are complete and compile as is Main Function void main void u8 boardID Board identification number u8 axis...

Page 161: ...T action NIMC_OPERATION_SINGLE single operation CheckError for i 0 i 3 i Load breakpoint position where breakpoint should occur err flex_load_pos_bp boardID axis breakpointPosition i 0xFF CheckError E...

Page 162: ...x_read_csr_rtn boardID csr while csr NIMC_MODAL_ERROR_MSG else Display regular error nimcDisplayError err 0 0 return Exit the Application Relative Position Breakpoints Relative position breakpoints tr...

Page 163: ...hm Notice that relative breakpoints are not ideal for periodic breakpoints There is a latency between the time a breakpoint generates and is re enabled If the axis is moving at sufficient velocity the...

Page 164: ...e and may not compile if copied exactly Refer to the examples folder on the NI Motion CD for files that are complete and compile as is Main Function void main void u8 boardID Board identification numb...

Page 165: ...sition where breakpoint should occur err flex_load_pos_bp boardID axis breakpointPosition 0xFF CheckError for Enable the breakpoint on axis 1 err flex_enable_breakpoint boardID axis NIMC_TRUE CheckErr...

Page 166: ...on 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 veloc...

Page 167: ...ling required For example if an axis is enabled at position zero the initial breakpoint is set for position 100 and the breakpoint period is set at 1 000 then the axis behaves as shown in Figure 12 8...

Page 168: ...in void u8 boardID Board Identification number u8 axis Axis u16 csr 0 Communication Status Register u8 profileStatus Profile Complete Status u8 bpStatus Breakpoint found Status i32 bpPos Breakpoint Po...

Page 169: ...Enter a breakpoint position scanf ld bpPos Get the Breakpoint Period printf Enter a breakpoint period scanf ld bpPer Configure the breakpoint to be absolute err flex_configure_breakpoint boardID axis...

Page 170: ...ck the profile complete bit profileStatus axisStatus NIMC_PROFILE_COMPLETE_BIT 0 printf Current Position 10d Breakpoint Status d Profile Complete d r currentPos bpStatus profileStatus Check for modal...

Page 171: ..._MODAL_ERROR_MSG else Display regular error nimcDisplayError err 0 0 return Exit the Application Modulo Breakpoints NI 7330 NI 7340 and NI 7390 only Modulo breakpoints use a breakpoint window which de...

Page 172: ...0 500 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 Figure 12 12 Breakpoint Modulus of 2000 with an Offset of...

Page 173: ...lgorithm for modulo breakpoints Figure 12 13 Modulo Breakpoints Algorithm Enable breakpoint Wait for breakpoint to cause a trigger Configure breakpoint Configure breakpoint for modulo mode Load breakp...

Page 174: ...TSI Using LabVIEW 1 Configure Breakpoint 2 Load Breakpoint Modulus 3 Load Breakpoint Position 4 Enable Breakpoint Output 5 Read per Axis Status 6 Motion Error Handler 1 Select Signal 2 Configure Break...

Page 175: ...mandID The commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis NIMC_AXIS1 Route breakpoint 1 to RTSI line 1 err flex_s...

Page 176: ...IMC_MODAL_ERROR_MSG CheckError Sleep 10 Check every 10 ms while axisStatus NIMC_POS_BREAKPOINT_BIT Wait for breakpoint to be triggered return Exit the Application Error Handling nimcHandleError NIMCCA...

Page 177: ...e implementation for high speed capture is divided into the buffered and non buffered high speed capture methods Buffered High Speed Capture NI 7350 only Buffered high speed capture lets you create a...

Page 178: ...tions to free the buffer for more data to be written Check buffer on the device optional Check number of captured positions available to read Loop checking for captured data array usage Set the buffer...

Page 179: ...identification number u8 axis Axis number u16 csr 0 Communication status register i32 bufferSize 100 The size of the buffer to allocate on the motion controller u32 totalPoints 100 The number of high...

Page 180: ...Set the board ID boardID 1 Set the axis number axis NIMC_AXIS1 Configure buffer on motion controller memory RAM Notice requested time interval is hardcoded to 10 milliseconds err flex_configure_buffe...

Page 181: ...rentDa taPoint readBuffer i printf capture pos d n capturedPositions currentDataPoin t currentDataPoint free readBuffer readBuffer NULL CheckError Check for axis off status following error or any moda...

Page 182: ...ce err flex_read_error_msg_rtn boardID commandID resourceID errorCode nimcDisplayError errorCode commandID res ourceID Read the communication status register err flex_read_csr_rtn boardID csr while cs...

Page 183: ...8 High Speed Capture Algorithm Configure high speed capture Read the captured position optional Enable high speed capture Do the required task on trigger This could be a starting move on an axis or ve...

Page 184: ...h Speed Capture Using LabVIEW 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 1 Configure High Speed...

Page 185: ...on the NI Motion CD for files that are complete and compile as is Main Function void main void u8 boardID Board identification number u8 axis Axis number u16 csr 0 Communication status register u16 ax...

Page 186: ...apture boardID axis NIMC_TRUE CheckError do Check the high speed capture status err flex_read_axis_status_rtn boardID axis axisStatus CheckError Read the communication status register and check the mo...

Page 187: ...level high speed real time communication between National Instruments devices Many applications such as scanning and alignment synchronize measurements made with data and image acquisition devices wit...

Page 188: ...oint functionality to synchronize the motion application with data or image acquisition As shown in Figure 12 21 the I O reaction task automatically re enables the breakpoints or high speed captures o...

Page 189: ...g RTSI Encoder Pulses Using RTSI You may need to trigger the external device to acquire data every encoder phase or on an encoder index pulse as shown in Figure 12 23 Figure 12 23 Encoder Pulses Using...

Page 190: ...apture 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 Figure 12 25 High Speed Cap...

Page 191: ...position control systems returns the current position while the feedback in torque control systems returns a voltage proportional to the current force or torque You can implement force feedback on NI...

Page 192: ...e system may require higher gains to ensure a faster response NI motion controllers have 12 bit or 16 bit analog inputs whose ranges can be set from 0 V to 5 V 5 V to 5 V 0 V to 10 V and 10 V to 10 V...

Page 193: ...pdate target position optional Set operation mode Loop waiting for move complete Set to absolute mode Load move constraints max velocity max acceleration and max deceleration in volts Map the analog s...

Page 194: ...ode Figure 13 3 Torque Control Using Analog Feedback Using LabVIEW 1 Load Velocity 2 Load Acceleration Deceleration 3 Load Acceleration Deceleration 4 Set Operation Mode 5 Load Target Position 6 Start...

Page 195: ...andling u16 commandID The commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis NIMC_AXIS1 Is is assumed that the axis b...

Page 196: ...motor to maintain 2047 5V in this example err flex_load_target_pos boardID axis 2047 0xFF CheckError Start the move err flex_start boardID axis 0 CheckError do axisStatus 0 Check the move complete sta...

Page 197: ...ATCHTHIS Check to see if there were any Modal Errors if csr NIMC_MODAL_ERROR_MSG do Get the command ID resource ID and the error code of the modal error from the error stack on the device flex_read_er...

Page 198: ...on to the torque sensor The control loop on the motion controller closes the position and velocity loops as usual Use MAX to map the encoder as the feedback device for the axis Figure 13 4 Torque Cont...

Page 199: ...log sensor Check against required value Start motion optional Update target position optional Loop reading the analog channel that is connected to the force or torque sensor Load move constraints max...

Page 200: ...igure 13 6 Torque Control Using Monitoring Force in LabVIEW 1 Load Velocity 2 Load Acceleration Deceleration 3 Load Acceleration Deceleration 4 Set Operation Mode 5 Read ADC 6 Load Target Position 7 S...

Page 201: ...ue ADC value read Variables for modal error handling u16 commandID The commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number...

Page 202: ...and calculate the position to be updated err flex_read_adc16_rtn boardID NIMC_ADC1 adcValue CheckError if constant adcValue 0 err flex_load_target_pos boardID axis constant adcValue 0xFF CheckError Mo...

Page 203: ...there were any Modal Errors if csr NIMC_MODAL_ERROR_MSG do 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 comma...

Page 204: ...the axis based on the value of the voltage read In this system the feedback is a normal position sensor such as an encoder Speed Control Based on Analog Feedback Algorithm Figure 13 7 Speed Control B...

Page 205: ...ode Figure 13 8 Speed Control Based on Analog Feedback Using LabVIEW 1 Load Velocity 2 Load Acceleration Deceleration 3 Load Acceleration Deceleration 4 Set Operation Mode 5 Start Motion 6 Read ADC 7...

Page 206: ...C value read Variables for modal error handling u16 commandID The commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis...

Page 207: ...te the velocity to be updated err flex_read_adc16_rtn boardID NIMC_ADC1 adcValue CheckError Set the velocity based on the ADC value read err flex_load_velocity boardID axis adcValue constant 0xFF Chec...

Page 208: ...y Modal Errors if csr NIMC_MODAL_ERROR_MSG do 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 D resourc...

Page 209: ...ed loop instead of changing the priority of your top level VI Follow the guidelines in the LabVIEW Real Time Module User Manual The guidelines regarding memory allocation and using shared resources ar...

Page 210: ...ltitasking environment running on the embedded microprocessor because the primary function of the embedded processor is supervisory control and I O reaction Instead the onboard programs run in a time...

Page 211: ...oves for information about programming delays in the loops Writing Onboard Programs Note This section and the sections that follow it apply only to the NI 73xx motion controllers Almost all NI Motion...

Page 212: ...ou 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 FL...

Page 213: ...on 14 5 NI Motion User Manual LabVIEW Code Figure 14 4 Onboard Program in LabVIEW 1 Begin Program Storage 2 Load Target Position 3 Load Velocity in RPM 4 Load Accel Decel in RPS s 5 Load Accel Decel i...

Page 214: ...The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis NIMC_AXIS1 Onboard program 1 This onboard program moves axis one clockwise 5 000 counts steps To execute t...

Page 215: ...ling nimcHandleError NIMCCATCHTHIS Check to see if there were any Modal Errors if csr NIMC_MODAL_ERROR_MSG do Get the command ID resource ID and the error code of the modal error from the error stack...

Page 216: ...Program ends the execution of an onboard program that is currently running Stopping an onboard program using the Stop Program function completely ends execution It is not possible to resume execution...

Page 217: ...can use the Pause Resume Program function to effectively single step through an onboard program To single step add a Pause Resume Program call after each function and then resume the onboard program...

Page 218: ...Chapter 14 Onboard Programs NI Motion User Manual 14 10 ni com Figure 14 5 Executing Onboard Programs generator reaction task communication task Run program Onboard programs...

Page 219: ...User Manual Onboard Program Conditional Execution Algorithm Figure 14 6 Onboard Program Conditional Execution Algorithm Start move Wait for move event signal Begin store Put motion controller in stor...

Page 220: ...that are complete and compile as is Main Function void main void u8 boardID Board identification number u8 axis Axis number u16 csr 0 Communication status register Variables for modal error handling u...

Page 221: ...tive err flex_set_op_mode boardID axis NIMC_RELATIVE_POSITION CheckError Load Target Position to move relative 5 000 counts steps err flex_load_target_pos boardID axis 5000 0xFF CheckError Wait for li...

Page 222: ...ex_read_csr_rtn boardID csr while csr NIMC_MODAL_ERROR_MSG else Display regular error nimcDisplayError err 0 0 return Exit the Application Using Onboard Memory and Data NI motion controllers allow you...

Page 223: ...ve Jump to label Begin store Put motion controller in store mode End store End the store mode Read ADC Read the analog channel and save value to an onboard variable Jump to label Jump to label if no u...

Page 224: ...to Variable 2 Load Constant to Variable 3 Begin Program Storage 4 Set Operation Mode 5 Insert Program Label 6 Read ADC 7 Multiply Variables 8 Subtract Variables 9 Jump to Label on Condition 10 Load V...

Page 225: ...andID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis NIMC_AXIS1 constant to multiply the ADC value read to calculate the re...

Page 226: ...3 and 4 are the same err flex_jump_on_event boardID 0 NIMC_CONDITION_EQUAL 0 0 NIMC_MATCH_ALL 1 label number Set the velocity for the move in counts sec by loading the value from variable 3 which is a...

Page 227: ...the device flex_read_error_msg_rtn boardID commandI D resourceID errorCode nimcDisplayError errorCode commandID res ourceID Read the communication status register flex_read_csr_rtn boardID csr while...

Page 228: ...ws an onboard program waiting for an I O line to go active before starting a move Figure 14 10 Using Labels with Onboard Programs Start Move Set a Label Wait for Move Event Signal Jump to Label Begin...

Page 229: ...ng Onboard Program in LabVIEW 1 Begin Program Storage 2 Set Operation Mode 3 Load Velocity in RPM 4 Insert Program Label 5 Load Target Position 6 Select MOMO 7 Wait on Condition 8 Start Motion 9 Selec...

Page 230: ...ndID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis NIMC_AXIS1 Begin onboard program storage program number 1 err flex_begi...

Page 231: ...0 NIMC_WAIT NIMC_CONDITION_MOVE_COMPLETE u8 1 axis 0 NIMC_MATCH_ALL 1000 time out 0 CheckError Jump unconditionally to label 1 and check IO line again err flex_jump_on_event boardID 0 NIMC_CONDITION_T...

Page 232: ...e data to be saved In the previous example the ADC channel is read to onboard variable 2 This value is then multiplied with a scale factor loaded into variable 1 using the Load Constant function You c...

Page 233: ...hanging the input values to functions Onboard Buffers You can use the memory on the NI motion controllers to create general purpose buffers to read and write data as shown in Figure 14 13 Figure 14 13...

Page 234: ...his function controls the upper three bits in the MCS register using the MustOn MustOff MOMO protocol Use these bits to synchronize an application running on the host computer with an onboard program...

Page 235: ...synchronize the host application with an onboard program and read an onboard variable that has been updated by an onboard program Figure 14 16 Synchronization Algorithm I O register for sending comman...

Page 236: ...shows the code that runs as an onboard program Figure 14 17 Synchronization Onboard Code in LabVIEW 1 Load Constant to Variable 2 Load Constant to Variable 3 Begin Program Storage 4 Set Operation Mod...

Page 237: ...e in LabVIEW Note As the host is polling a register on the motion controller it is not invoking the Host Communication Task on the real time operating system on the motion controller Therefore the onb...

Page 238: ...tus Variables for modal error handling u16 commandID The commandID of the function u16 resourceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis NIMC_AXIS...

Page 239: ...onboard variable 1 err flex_load_target_pos boardID axis 0 1 CheckError Start the move err flex_start boardID axis 0 CheckError Wait for move to complete err flex_wait_on_event boardID 0 NIMC_WAIT NIM...

Page 240: ...xis off status err flex_read_axis_status_rtn boardID axis axisStatus CheckError Read the communication status register and check the modal errors err flex_read_csr_rtn boardID csr CheckError Check the...

Page 241: ...tion Error Handling nimcHandleError NIMCCATCHTHIS Check to see if there were any Modal Errors if csr NIMC_MODAL_ERROR_MSG do Get the command ID resource ID and the error code of the modal error from t...

Page 242: ...tate to determine which onboard subroutine to execute Figure 14 19 Onboard Subroutine Algorithm If the I O line is active the main onboard program calls an onboard subroutine that rotates the motor cl...

Page 243: ...ne call Figure 14 20 Onboard Subroutine Call Using LabVIEW 1 Begin Program Storage 2 Insert Program Label 3 Select MOMO 4 Jump to Label on Condition 5 Run Program 6 Wait on Condition 7 Jump to Label o...

Page 244: ...motor to rotate clockwise Figure 14 21 Clockwise Subroutine Using LabVIEW 1 Begin Program Storage 2 Set Operation Mode 3 Load Target Position 4 Load Velocity in RPM 5 Load Accel Decel in RPS sec 6 St...

Page 245: ...s the motor to rotate counter clockwise Figure 14 22 Counter Clockwise Subroutine Using LabVIEW 1 Begin Program Storage 2 Set Operation Mode 3 Load Target Position 4 Load Velocity in RPM 5 Load Accel...

Page 246: ...ceID The resource ID i32 errorCode Error code Set the board ID boardID 1 Set the axis number axis NIMC_AXIS1 Onboard program 2 This onboard program moves axis one clockwise 5 000 counts steps This onb...

Page 247: ...program moves axis one counter clockwise 5000 counts steps This onboard program is executed by onboard program one Begin onboard program storage program number 3 err flex_begin_store boardID 3 CheckEr...

Page 248: ...ardID 1 CheckError Insert Label number 1 err flex_insert_program_label boardID 1 CheckError Jump to label 2 if the line 1 on port one is active err flex_jump_on_event boardID NIMC_IO_PORT1 NIMC_CONDIT...

Page 249: ...0 NIMC_CONDITION_TRUE 0 0 NIMC_MATCH_ALL 1 label number CheckError End Program Storage err flex_end_store boardID 1 CheckError return Exit the Application Error Handling nimcHandleError NIMCCATCHTHIS...

Page 250: ...d controller boot up Changing a Time Slice Use the Load Program Time Slice function to specify the minimum time an onboard program has to be run per watchdog period with a total of 20 ms allowed for a...

Page 251: ...n You can combine the moves input output and other functionality discussed in Part III Programming with NI Motion to create complete motion control applications The following chapters show examples of...

Page 252: ...ng the scan time lowers the cycle time and increases the speed of the production or testing You can perform a scanning application in one of the following three ways Move the stage in a raster by conn...

Page 253: ...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 Load move constraints Set operati...

Page 254: ...IEW 1 Configure Vector Space 2 Load Velocity 3 Load Acceleration Deceleration 4 Load Acceleration Deceleration 5 Load S Curve Time 6 Set Operation Mode 7 Load Vector Space Position 8 Start Motion 9 Ch...

Page 255: ...0 5000 5000 0 0 5000 5000 0 i32 yPosition d_numberOfSegments 0 1000 1000 2000 2000 3000 3000 4000 4000 5000 5000 Variables for modal error handling u16 commandID The commandID of the function u16 res...

Page 256: ...Load the straight line segments one by one for i 0 i d_numberOfSegments i Load Target Position err flex_load_vs_pos boardID vectorSpace xPosition i yPosition i 0 0xFF CheckError Start the move err fle...

Page 257: ...ERROR_BIT axisStatus NIMC_AXIS_OFF_BIT break Break out of the for loop because an axis was killed return Exit the Application Error Handling nimcHandleError NIMCCATCHTHIS Check to see if there were an...

Page 258: ...ents enables continuous motion which decreases the cycle time of the scan The cycle time is much faster because the motors are not forced to stop after each move segment Figure 15 4 shows the path of...

Page 259: ...nded Straight Lines Algorithm Configure the coordinate space Load move constraints Set blend factor Set operation mode Create the move segments Load move segment Is this the first move segment Start m...

Page 260: ...gure Vector Space 2 Load Velocity 3 Load Acceleration Deceleration 4 Load Acceleration Deceleration 5 Load S Curve Time 6 Load Blend Factor 7 Set Operation Mode 8 Load Vector Space Position 9 Start Mo...

Page 261: ...ts 5000 5000 0 0 5000 5000 0 0 5000 5000 0 i32 yPosition d_numberOfSegments 0 1000 1000 2000 2000 3000 3000 4000 4000 5000 5000 Variables for modal error handling u16 commandID The commandID of the fu...

Page 262: ...e 1 0xFF CheckError Set the operation mode to absolute position err flex_set_op_mode boardID vectorSpace NIMC_ABSOLUTE_POSITION CheckError Load the straight line segments one by one for i 0 i d_number...

Page 263: ...2 err flex_read_axis_status_rtn boardID NIMC_AXIS2 status CheckError axisStatus status Read the communication status register and check the modal errors err flex_read_csr_rtn boardID csr CheckError C...

Page 264: ...ourceID Read the communication status register flex_read_csr_rtn boardID csr while csr NIMC_MODAL_ERROR_MSG else Display regular error nimcDisplayError err 0 0 return Exit the Application User Defined...

Page 265: ...Path Using the contoured move gives you the greatest amount of flexibility regarding the scan area and speed However you lose the benefit of the trajectory generator of the NI motion controller Refer...

Page 266: ...ed Scanning Path Algorithm Configure onboard buffer Write buffer Start motion Clear the onboard buffer Used to store the points Set operation mode Loop waiting for move complete Write the array of poi...

Page 267: ...abVIEW Code Figure 15 9 Scanning Using Contouring 1 Configure Vector Space 2 Set Operation Mode 3 Configure Buffer 4 Write Buffer 5 Start Motion 6 Check Buffer 7 Write Buffer 8 Clear Buffer 9 Set Oper...

Page 268: ...r of points to contour through i32 bufferSize 1000 The size of the buffer to allocate on the motion controller f64 actualInterval The interval at which the motion controller can really contour i32 dow...

Page 269: ...uffer number vectorSpace NIMC_POSITION_DATA bufferSize numPoints NIMC_TRUE 10 actualInterval Send the first 1000 points of the data downloadData malloc sizeof i32 bufferSize for i 0 i bufferSize i dow...

Page 270: ...Data downloadData NULL CheckError Check the move complete status err flex_check_move_complete_status boardID vectorSpace 0 moveComplete CheckError if moveComplete break Check for axis off status follo...

Page 271: ...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...

Page 272: ...Camming for information about superimposed moves registration applications Solution The rotary knife is electronically geared to the web with a gear ratio of 1 1 which ensures that at the time of cut...

Page 273: ...Chapter 16 Rotating Knife NI Motion User Manual 16 2 ni com Figure 16 1 Rotating Knife A Synchronization Point B Correction Point A B...

Page 274: ...1 1 Assuming circumference of the blade length of cut Needed for the superimposed correction move Set operation mode to be relative to captured position Also called registration move mode Wait for hi...

Page 275: ...the block diagram in Figure 16 3 Figure 16 4 Figure 16 3 Sequence Structure 1 1 Configure Gear Master 2 Load Gear Ratio 3 Load Velocity in RPM 4 Load Accel Decel in RPS s 5 Set Operation Mode 6 Enabl...

Page 276: ...er u8 slaveAxis Slave axis number u8 master Gear master u16 csr 0 Communication status register i32 synchronizationPosition 0 Synchronization position i32 correctionPoint 500 Point where the correctio...

Page 277: ...parameters for the superimposed move to be done on registration Set the operation mode to relative err flex_set_op_mode boardID slaveAxis NIMC_RELATIVE_TO_CAPTURE CheckError Load Velocity in RPM err f...

Page 278: ...wing error axis off high speed capture if axisStatus NIMC_FOLLOWING_ERROR_BIT axisStatus NIMC_AXIS_OFF_BIT break Break out of the for loop Update the variables for this cycle synchronizationPosition c...

Page 279: ...rs if csr NIMC_MODAL_ERROR_MSG do 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 resourceID errorCode...

Page 280: ...tes the phase angle based on the transition location To obtain maximum torque at the beginning of the move perform a move that is 1 6th of the magnetic cycle after system initialization Refer to the h...

Page 281: ...cification In many cases the information also may be specified as the number of poles To convert from the number of poles to the number of counts per electrical cycle use the following formula Caution...

Page 282: ...f any limits before you start 3 Record the Hall effect sensors states by reading the DIO lines connected to the Hall sensors Refer to the hardware documentation for the Hall effect sensor lines This i...

Page 283: ...ead Error Message VI 3 Make sure all axes are stopped and disabled Use the Stop Motion and Enable Axes VIs In the Stop Motion VI set Stop Type Decel set to Halt In the Enable Axes VI you must set Axis...

Page 284: ...re and compare settings 12 Configure the following optional settings Configure trajectory settings Configure find reference settings Configure DIO settings Configure PWM settings Gearing Use the follo...

Page 285: ...you can configure an NI motion controller on a remote PXI chassis through the remote configuration feature of MAX You must install NI Motion onto the remote system to use RT Then program the RT NI Mot...

Page 286: ...the host system You can initialize the controller download firmware and use the interactive and configuration panels exactly as you would on a controller installed in the host machine You also can wr...

Page 287: ...nstruments Corporation C 3 NI Motion User Manual To remove the mapped motion controller browse to My System under Device and Interfaces Right click the mapped controller and select Unmap Remote Device...

Page 288: ...every question receives an answer For information about other technical support options in your area visit ni com services or contact your local office at ni com contact Training and Certification Vi...

Page 289: ...value is low 0 ADC analog to digital converter address Character code that identifies a specific location or series of locations in memory or on a host PC bus system amplifier Drive that delivers powe...

Page 290: ...tion and velocity data for status reporting and accurately controlling position and velocity CPU central processing unit CSR communications status register CW clockwise Implies the direction the motor...

Page 291: ...for a given axis filtering Type of signal conditioning that filters unwanted signals from the signal being measured flash ROM Type of electrically reprogrammable read only memory following error trip...

Page 292: ...stem involving communications channels operator interface devices and or motion control interfaces ID identification index Marker between consecutive encoder revolutions inverting Polarity of a limit...

Page 293: ...ion Treat the position as if it is within the range of total quadrature counts per revolution for an axis N noise Undesirable electrical signal Noise comes from external sources such as the AC power l...

Page 294: ...another action such as a data acquisition or an image acquisition can take place You can set position breakpoints in absolute or relative quadrature counts When the encoder reaches a position breakpo...

Page 295: ...of current to three motor inputs each 120 out of phase from the next stepper Specifies an axis that controls a stepper motor T toggle Changing state from high to low back to high and so on torque For...

Page 296: ...Move the axis continuously at a specified velocity W watchdog Timer task that shuts down or resets the motion control device if any serious error occurs word Standard number of bits that a processor o...

Page 297: ...1 algorithm 16 3 C C code 16 5 LabVIEW code 16 4 solution 16 1 scanning 15 1 blending move segments 15 7 algorithm 15 8 C C code 15 10 LabVIEW code 15 9 connecting move segments 15 1 algorithm 15 2 C...

Page 298: ...sensors A 3 conditional execution of onboard programs 14 9 algorithm 14 11 C C code 14 12 LabVIEW code 14 12 configuration tuning 3 1 contoured move 7 2 absolute versus relative 7 4 algorithm 7 3 C C...

Page 299: ...10 1 gearing 10 1 algorithm 10 2 C C code 10 5 10 19 LabVIEW code 10 5 10 19 graphing data 4 14 H Hall effect sensors A 1 troubleshooting A 3 hardware functional architecture of NI motion controllers...

Page 300: ...y generator 1 6 NI Motion 1 1 architecture 1 2 software hardware interaction 1 2 J jogging 5 10 5 17 K Kdac 3 6 KnowledgeBase D 1 Kt 3 7 L LabVIEW code position based straight line move 5 3 velocity p...

Page 301: ...de 5 5 LabVIEW code 5 3 velocity profiling using velocity override 5 17 algorithm 5 18 C C code 5 20 LabVIEW code 5 19 velocity based 5 10 algorithm 5 11 LabVIEW code 5 13 straight line moves 4 1 5 1...

Page 302: ...st applications with 14 26 algorithm 14 27 C C code 14 30 data flow 14 27 LabVIEW code 14 28 using onboard memory and data 14 14 algorithm 14 15 C C code 14 17 LabVIEW code 14 16 writing 14 3 output S...

Page 303: ...3 5 3 9 algorithm 3 10 velocity amplifiers 3 10 velocity feedforward 3 5 shake and wake A 1 single stepping onboard programs 14 9 sinusoidal commutation A 1 commutation frequency A 2 determining count...

Page 304: ...capture 12 27 buffered 12 27 C C code 12 29 non buffered algorithm 12 33 C C code 12 35 LabVIEW code 12 34 single algorithm 12 33 C C code 12 35 LabVIEW code 12 34 RTSI encoder pulses 12 39 hardware i...

Page 305: ...ooting NI resources D 1 tuning the motors 3 1 U using data acquisition with NI Motion 2 3 image acquisition with NI Motion 2 3 using onboard memory and data 14 14 algorithm 14 15 C C code 14 17 LabVIE...

Reviews: