background image

Chapter 14

Onboard Programs

NI-Motion User Manual

14-28

ni.com

LabVIEW Code

This example moves axis 1 between target positions of 5000 and –5000. 
The host reads the target position only after the move has completed, and 
the new target position has been calculated. Figure 14-17 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 Mode

5

Load Velocity

6

Insert Program Label

7

Load Target Position

8

Start Motion

9

Select MOMO

10 Wait on Condition

11 Multiply Variables
12 Set User Status MOMO
13 Jump to Label on Condition
14 End Program Storage
15 Motion Error Handler

13

15

11

12

10

8

1

2

3

5

4

6

7

9

14

Содержание NI-Motion

Страница 1: ...Motion Control NI Motion TM User Manual NI Motion User Manual November 2005 371242B 01...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 31: ...Chapter 3 Tuning Servo Systems National Instruments Corporation 3 3 NI Motion User Manual Figure 3 2 NI Motion Servo PID Loop...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 41: ...Part III Programming with NI Motion NI Motion User Manual III 2 ni com Synchronization Torque Control Onboard Programs...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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_...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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_...

Страница 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_...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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_...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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_...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Страница 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...

Отзывы: