flex_load_bp_modulus

NI-Motion Functions

flex_load_bp_modulus

Device Compatibility

Device Compatibility
7330
Y
7340
Y
7344
Y
7350
Y
7390
Y
NI SoftMotion Controller for CANopen—Xenus
N
NI SoftMotion Controller for CANopen—Accelnet
N

Load Breakpoint Modulus

Usage

status = flex_load_bp_modulus(u8 boardID, u8 axisOrEncoder, u32 breakpointModulus, u8 inputVector);

Purpose

Load the breakpoint modulus for a position breakpoint.

Parameters

Name Type Description
boardID u8 assigned by Measurement & Automation Explorer
axisOrEncoder u8 axis or encoder to control
breakpointModulus u32 breakpoint modulus in counts
inputVector u8 source of the data for this function

Parameter Discussion

axisOrEncoder is the axis or encoder to control. You can load breakpointModulus on encoders mapped to axes NIMC_AXIS1 through NIMC_AXIS30 or directly on encoders NIMC_ENCODER1 through NIMC_ENCODER30. On motion controllers that support fewer than thirty axes, configuring non-existent axes returns error –70006 (NIMC_badResourceIDOrAxisError). Refer to Axes and Encoders for axis and encoder resource IDs.

breakpointModulus is the period, for periodic breakpoints, or the modulus, for modulus breakpoints. The range for period is 1 to 215–1. The range for modulus is 0 to 231–1. A modulus value of 0 makes a modulus breakpoint behave the same as an absolute breakpoint on 7330/40/90 controllers.

inputVector indicates the source of the data for this function. Available input vectors include immediate (0xFF), variable (0x01 through 0x78), or indirect variable (0x81 through 0xF8). Refer to Input and Return Vectors for more detailed information.

Using This Function

This function loads a position modulus/period, depending on the breakpoint mode. This value is double-buffered in the controller and does not take effect until you execute the Enable Breakpoint Output function.

Modulo breakpoints are used in applications that require repetitive breakpoints equally spaced. When using a breakpoint modulus, it is no longer necessary to load ever increasing (or decreasing) breakpoint positions. It is still necessary, however, to re-enable the breakpoint after each use.

Note  For closed-loop stepper motion systems in which the encoder counts per revolution differs from the steps per revolution, the breakpoint position is loaded in encoder counts.

When you enable a modulo breakpoint, two breakpoint positions, one in front and one behind the present encoder position, are enabled.

Note  If you use modulus breakpoint or enable the same breakpoint repeatedly at low velocity (< 50 counts/sec), you may get a breakpoint output immediately after you re-enable it, because the breakpoint is re-enabled before you have moved from the previous breakpoint position.

To avoid this problem, use MAX or the Set u32 function to change the breakpoint window. The breakpoint window is a buffer around the breakpoint position in which a breakpoint is not enabled while the current position remains inside the buffer.

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 accomplish this, you load a breakpoint position of –500 with the Load Breakpoint Position function and a breakpoint modulus of 2,000. If the instantaneous encoder position is 2,210 counts when you execute the Enable Breakpoint Output function (in modulo mode), the breakpoints at 1,500 counts and 3,500 counts are both enabled.