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

Document Type: Tutorial
NI Supported: Yes
Publish Date: Sep 6, 2006


Feedback


Yes No

Related Categories

Related Links - Developer Zone

Related Links - Products and Services

Using Breakpoints in the Motion Control Module

0 ratings | 0.00 out of 5
Print

Overview

The Motion Control Module for Measurement Studio provides easy configuration of hardware breakpoints through the NIMotionBreakpoint object.

The NIMotionBreakpoint Object

The NIMotionBreakpoint object configures a breakpoint output operation for an axis in a motion task. You can use this object to specify the axis name, position, and action. When the axis reaches the specified encoder position, the breakpoint output line changes to the state specified by action. You can configure the breakpoint to be automatically enabled by setting the AutoEnable property to True. Call the Enable method to programmatically enable the breakpoint at a specific time.

There are two types of NIMotionBreakpoint objects - task breakpoints and move breakpoints. A task breakpoint is associated with a particular axis on a task. Use task breakpoints when the breakpoint position can occur during any move in the move sequence. If you set AutoEnable to True, task breakpoints are enabled when the Start or Blend method is called. Task breakpoint objects remain enabled until the requested number of breakpoints has occurred or are interrupted by another breakpoint operation on the same axis. A task breakpoint is disabled at the end of the task if it has not successfully completed.

A move breakpoint is associated with a particular move in the NIMotionMoves collection. Use a move breakpoint when the breakpoint position must occur within a specific move in the move sequence. If you set AutoEnable to True, move breakpoints are enabled when the motion controller starts the corresponding move. The breakpoint is disabled at the end of the move if it has not successfully completed. You can enable move breakpoints with the Enable method only while the corresponding move is executing.
Use caution when working with both move and task breakpoints in your application. If you have task and move breakpoints configured for the same axis, you might get unexpected results. When the NIMotion control starts a move, all move breakpoints are automatically enabled if so configured. If there is an enabled task breakpoint operation currently executing on the same axis as a move breakpoint, the task breakpoint is interrupted and terminated. Likewise, calling Enable on a breakpoint also interrupts any other enabled breakpoint object for the same axis.

Note: Breakpoint functionality is available only on servo and closed-loop stepper axes that use encoder feedback resources.
See Also:
Breakpoints

Configuring a Single Breakpoint


To configure a single breakpoint output, complete the following steps:
  1. Specify the encoder position and mode (absolute or relative).
  2. Set the TotalPoints property to 1. When the encoder passes through the specified position, the breakpoint output is triggered.
    See Also:
    Single Breakpoint

    Configuring Repeating Breakpoints

To configure a breakpoint that repeats at the same encoder position, complete the following steps:
  1. Specify the encoder position and mode (absolute or relative).
  2. Set TotalPoints to the number of desired breakpoints.
  3. Set the ReuseData property to True. When the encoder associated with the axis reaches the specified position, the breakpoint is automatically re-enabled.
The breakpoint operation terminates when the number of breakpoints completed is equal to the value of TotalPoints.
See Also:
Repeating Breakpoints

Configuring Modulo Breakpoints


Modulo breakpoints are a special case of repeating breakpoints. A modulo breakpoint is characterized by an initial position and a modulus. To create modulo breakpoints, complete the following steps:
  1. Set the Positions property to a single breakpoint position.
  2. Set the breakpoint Mode to modulo.
  3. Set the Modulus property to the repeat interval of the breakpoint.
When the NIMotionBreakpoint object is enabled, two breakpoints are automatically enabled on the controller-one breakpoint in front of the current position and one breakpoint behind it. The breakpoint positions are computed to the closest breakpoint intervals based on the current encoder position. For example, an application requires breakpoints every 2,000 counts offset at -500 counts: -4,500, -2,500, -500, 1,500, 3,500, and so on. To create this interval, set Positions to -500 and set Modulus to 2000. If the instantaneous encoder position is 2,210 counts when the breakpoint is enabled, the breakpoints at 1,500 counts and 3,500 counts are both enabled.

When the encoder passes through one of those positions, the breakpoint output is triggered. If the value of TotalPoints is greater than one, the next set of modulus breakpoint positions are computed and enabled. The breakpoint operation terminates when the number of breakpoints completed is equal to the value of TotalPoints.
See Also:
Modulo Breakpoints

Configuring Buffered Breakpoints


The NIMotionBreakpoint object can store an ordered array of breakpoint positions. The NIMotion control allocates a software buffer to hold the array of positions. For buffered breakpoints, the breakpoint positions are provided to the motion controller one point at a time. To create a breakpoint buffer, set Positions to an array of breakpoint positions. The next breakpoint position in the array is enabled when the previous breakpoint position is reached.

To trigger once on each breakpoint position in the array, set TotalPoints equal to the number of points in the Positions array. To create a circular breakpoint buffer, set TotalPoints greater than the size of the Positions array. The motion controller returns to the beginning of the Positions array once the end has been reached. Set ReuseData to True if you want the controller to use the original breakpoint positions again. If you want to update the buffer with new data, set ReuseData to False. You must provide new breakpoint positions to the motion controller through the AppendPositions method.

See Also:
Buffered Breakpoints

The BreakpointProgress Event


The BreakpointProgress event provides status notification of a breakpoint operation. Specify the progress interval to control how often the BreakpointProgress event is generated. For a single breakpoint, set ProgressInterval to 1. The BreakpointProgress event is generated when the breakpoint position is reached. For repeating, modulo, or buffered breakpoints, you can specify the ProgressInterval to generate the BreakpointProgress event at a regular interval. The BreakpointProgress event also is generated when the requested number of total breakpoints have completed.

The BreakpointProgress event returns the number of completed breakpoints in the PointsDone parameter. For buffered breakpoints, the backlog also is returned. The Backlog parameter specifies how many new breakpoint positions can be written to the breakpoint buffer through AppendPositions. The AppendPositions method takes two parameters - an array of breakpoint positions, and a termination flag specified by LastAppend. If you do not know the exact number of total breakpoints when you configure the NIMotionBreakpoint object, you can set TotalPoints to a number larger than the actual total. When the final breakpoint position is determined and appended to the buffer, set LastAppend to True. The NIMotionBreakpoint object recalculates the total number of points and terminates when the final position has been reached.
0 ratings | 0.00 out of 5
Print

Reader Comments | Submit a comment »

 

Legal
This tutorial (this "tutorial") was developed by National Instruments ("NI"). Although technical support of this tutorial may be made available by National Instruments, the content in this tutorial may not be completely tested and verified, and NI does not guarantee its quality in any way or that NI will continue to support this content with each new revision of related products and drivers. THIS TUTORIAL IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).