Table of Contents
- Acquiring Sample Data
- Gearing Axes
- Using Breakpoints
- Performing Linear Vector Moves
- Software Trigger Buffers
- Hardware Trigger Buffers
- Mastering Motion I/O
- Managing Limit Inputs
- Utilizing Digital I/O
- Exercising Analog I/O
Acquiring Sample Data
Functions:ValueMotion | FlexMotion |
| Acquire Samples | Acquire Trajectory Data |
| Read 4A Acquired Samples | Read Trajectory Data |
Conversion Example:

This example acquires 50 samples of data and outputs them to indicators. While the organization of the data is different, the data is essentially the same. One could easily convert one form to the other if needed.
Conversion Tips:
Acquire Samples and Acquire Trajectory Data require similar inputs. However, Acquire Trajectory Data does not acquire sample data from the I/O port as Acquire Samples does.
Read 4A Acquired Samples retrieves a specified number of samples arranged in individual arrays for each data parameter. Read Trajectory Data retrieves a single sample in a cluster. You are responsible for looping. With ValueMotion you can acquire a maximum of 200 samples, however FlexMotion allows you to acquire a number of samples equal to 4,096 divided by the number of axes.
Gearing Axes
Functions:
ValueMotion | FlexMotion |
| Configure Master Slave | Configure Gear Master |
| Enable Gearing | |
| Enable Gearing Single Axis | |
| Load Gear Ratio | Load Gear Ratio |
| Load Slave Offset | Load Gear Ratio |
Conversion Example:

This example gears axis 2 to axis 1 using a 5:1 ratio, meaning five slave rotations to one master.
Conversion Tips:
Setting up master and slave axes in ValueMotion requires two calls to Configure Master Slave, each call specifying an axis and its mode. FlexMotion, on the other hand, requires a call to Configure Gear Master. This function takes an axis and allows you to specify a master. The master could be an axis, encoder, or ADC Channel.
Similar parameters are used when calling Load Gear Ratio. However, FlexMotion has one extra parameter allowing you to specify absolute or relative gearing. Using relative gearing allows you to emulate the Load Slave Offset function from ValueMotion. If a relative gear ratio is selected and loaded after gearing is enabled, the position of the master is recorded as its relative reference point and every incremental change from this reference point is multiplied by the relative gear ratio and applied to the slave axis or axes.
The ValueMotion function "Load Gear Ratio" has one additional parameter called sequence. This is no longer required or necessary, hence no longer supported in FlexMotion.
Enabling the axis for gearing is achieved through a separate VI in FlexMotion. This allows you to configure you gearing on initialization, then enable or disable as you desire. In ValueMotion gearing is enabled when you call Configure Master Slave. In FlexMotion you must call Enable Gearing or Enable Gearing Single Axis. Because of this design, you can change gear ratios on-the-fly using FlexMotion.
If there is no need to change your gearing programmatically, and you only set it at initialization, gearing is even easier when setup using Measurement & Automation Explorer.
Using Breakpoints
Functions:
ValueMotion | FlexMotion |
| Set I/O Port Polarity & Direction | Set Breakpoint Output MOMO |
| Load Breakpoint | Load Breakpoint Position |
| Enable Breakpoint | Enable Breakpoint Output |
| Configure Breakpoint | |
| Load Breakpoint Repeat Period | Load Breakpoint Modulus |
| N/A | Read Breakpoint Status |
Conversion Example:

This example sets up a breakpoint on axis 1 at encoder position 1000. The initial state of the breakpoint output will be inactive, and a state transition will be triggered when the breakpoint position is reached on breakpoint output 1.
Conversion Tips:
Load Breakpoint and Load Breakpoint Position have similar parameters and perform the same basic tasks. Load Breakpoint takes one extra type parameter used to specify position or anticipation time. FlexMotion does not support anticipation time breakpoints.
The Configure Breakpoint VI configures the breakpoint as an absolute, relative, or modulo position breakpoint. It also defines the action to perform when the breakpoint is reached—leave the breakpoint output unchanged, reset the breakpoint output low, set the breakpoint output high, or toggle the state of breakpoint output. In contrast, in ValueMotion allows you specify absolute or relative breakpoint modes when you call Enable Breakpoint.
In FlexMotion the direction for the breakpoint output lines is static (output only). Although setting the polarity does not directly translate to FlexMotion, you can emulate it using Set Breakpoint Output MOMO, and picking the correct action when configuring your breakpoint. For example, to achieve inverting polarity, set must on/must off to 1/0 respectively and set action to toggle on breakpoint. This will keep the output high and toggle it to low when a breakpoint occurs.
Performing Linear Vector Moves
Functions:
ValueMotion | FlexMotion |
| Load Steps/Sec | Load Velocity |
| Load Velocity | Load Velocity |
| Load Steps/Sec^2 | Load Acceleration/Deceleration |
| Load Acceleration | Load Acceleration/Deceleration |
| Load RPM | Load Velocity in RPM |
| Load RPS/s | Load Accel/Decel in RPS/sec |
| Load Target Position | Load Target Position |
| Load Vector Space Position | |
| Multi-Axis Start | Start Motion |
Conversion Example:

This example performs a vector space move to position x = 2000 and y = 3000. It loads a vector velocity of 500 RPM and a vector acceleration of 200 RPS/s. FlexMotion has Linear Interpolation, making the process much easier.
Conversion Tips:
ValueMotion has no equivalent to Vector Spaces. If you want to perform a vector move you have to do the vector calculations yourself. FlexMotion, using linear interpolation, will perform those tedious conversions for you, greatly simplifying the diagram as shown above. FlexMotion allows you to specify vector positions, velocities, accelerations, and s-curves.
For ValueMotion servo you would use Load Velocity and Load Acceleration to load values in counts. For ValueMotion stepper you would use Load Steps/Sec and Load Steps/Sec^2 to load values in steps. In FlexMotion there is no distinction between loading values in steps or counts, you only use Load Velocity and Load Acceleration.
FlexMotion offers different ways of sequencing moves. Target position, velocity, acceleration, and s-curve are double buffered so you can load them on the fly without affecting the move in process, and they will take effect on the next Start or Blend Motion. The primary difference between calling Start Motion and calling Blend Motion is that Start Motion is immediate and preemptive, while Blend Motion waits and starts the next move upon the completion of the previous move.
Software Trigger Buffers
(Onboard programming available on 734x series FlexMotion controllers only)
Functions:
ValueMotion | FlexMotion |
| Trigger Prestore | Begin Store |
| End Store | |
| Trigger I/O Port # | Run Program |
| Trigger Buffer Delimiter | Wait On Condition |
Conversion Example:

This example sets up a trigger buffer (ValueMotion) / onboard program (FlexMotion) to execute a move to position 1000 when instructed. Triggered either via a call to Trigger I/O Port # (ValueMotion) or Run Program (FlexMotion).
Conversion Tips:
The function calls to setup a trigger buffer versus setting up an onboard program are very similar. However, while ValueMotion allows only four trigger buffers, FlexMotion allows up to 10 onboard programs. Trigger buffers are static sets of functions executed when commanded; onboard programs can be much more.
You can use Onboard Programming VIs to load, execute, and save onboard programs. FlexMotion offers a rich set of programming VIs and features that allow you to write and execute autonomous programs that are completely independent from the host computer. FlexMotion has the capability of executing up to 10 simultaneous motion programs in a preemptive, real-time multitasking environment.
This extremely powerful feature is designed for real-time applications that need tight synchronization and/or minimum latency from a motion or other I/O event and fast command execution. In addition, programs support basic math and data operation functions on general-purpose variables. Onboard programs also offer event-based VIs such as Jump to Label on Condition and Wait on Condition, which allow you to sequence and make decisions in your programs. Programs can even start and stop other programs. In addition, FlexMotion has a Delay command, allowing you to better synchronize your onboard programs.
Emulating a Trigger Buffer Delimiter is fairly straightforward. One purpose of a trigger buffer delimiter is to set up a sequence of moves in the trigger buffer, and active one move after the next, perhaps in a square. You can achieve the same functionality using Wait on Condition, waiting on an I/O bit to transition.
Hardware Trigger Buffers
(Onboard programming available on 734x series FlexMotion controllers only)
Functions:
ValueMotion | FlexMotion |
| Trigger Prestore | Begin Store |
| End Store | |
| Trigger I/O Port # | Run Program |
| Trigger Buffer Delimiter | Wait On Condition |
| Enable Trigger Inputs | Wait On Condition |
| Set Breakpoint/Trigger Link | Jump to Label on Condition |
Conversion Example:

This example sets up a trigger buffer (ValueMotion) / onboard program (FlexMotion) to execute a move to position 1000 when instructed. Triggered by a true signal on trigger input 1 (ValueMotion) or the digital I/O port 1, bit 1 (FlexMotion).
Conversion Tips:
In ValueMotion you may have used Enable Trigger Inputs to trigger a sequence using hardware. Each Trigger Buffer has an associated Trigger Input on the I/O Port. In FlexMotion the same functionality can be achieved using Wait on Condition and some flow control. With FlexMotion you can wait on many different types of conditions, including any bit or combination of bits on any of the four I/O Ports.
The basic premise of emulating trigger buffers for this purpose involves a loop at the front of which you wait for a condition. When the condition is triggered the subsequent code is executed and the loop returns to the Wait on Condition, essentially resetting the trigger.
The Wait on Condition VI controls the flow of execution in a stored program. It suspends program execution and waits until the specified condition is met or the timeout expires. When the condition is met, program execution is resumed with the next VI after the Wait on Condition.
The Jump to Label on Condition VI controls the flow of execution in a stored program by defining a conditional jump to any label within the program. In addition to condition codes set as the result of a previous data operations VI, you can test virtually any instantaneous status of axes or resources to decide whether to jump or not.
Currently, the Wait on Condition VI does not have an infinite timeout value. The maximum timeout value is over 100 minutes. Infinite timeout can be achieved by using the Jump to Label on Condition VI immediately after the Wait on Condition VI, checking on the same condition and jumping back to the Wait on Condition if the condition has not been met.
Using Wait on Condition and/or Jump to Label on Condition you can achieve a virtually infinite number of different flow control patterns. These two VI’s are also a superset of the Set Breakpoint/Trigger Link VI for ValueMotion. You can wait on virtually any instantaneous status of axes, encoders, programs, motion I/O, or general-purpose I/O. Where applicable, you can select the desired resource with the resource parameter.
Waits are one of the most powerful and useful features on the FlexMotion controller. While a program is suspended waiting for a condition, FlexMotion is not wasting CPU cycles on it. The preemptive multitasking real-time operating system (RTOS) on the FlexMotion controller suspends the task until the condition is met or the timeout expires. This feature allows up to 10 programs to be running simultaneously with little impact on command execution performance.
See Software Trigger Buffers for more information on the differences between Trigger Buffers and Onboard Programs.
Mastering Motion I/O
Functions:
ValueMotion | FlexMotion |
| Set I/O Port Polarity & Dir | Set High-Speed Capture Polarity |
| Configure Inhibit Outputs | |
| Set I/O Port Output | Set Inhibit MOMO |
| Set Breakpoint Output MOMO | |
| Read I/O Port | Read High-Speed Capture Status |
| Read Breakpoint Status |
There are many different uses for the Motion I/O, hence it is not feasible to provide one conversion example. For information on breakpoints see Using Breakpoints. For information on high-speed capture or inhibits see your software user manual. If you used the Motion I/O for general purpose I/O see Utilizing Digital I/O.
Conversion Tips:
ValueMotion has one 8-bit I/O port for all motion related I/O signals. This port can be used for trigger inputs, breakpoint outputs, and/or inhibit outputs. These signals are broken up into their individual parts on the FlexMotion controller. The FlexMotion inhibit outputs, breakpoint outputs, and high-speed capture inputs each have separate dedicated lines.
All of the dedicated motion I/O can also function as general-purpose digital I/O when it is not being used for its motion specific features. You can set and reset outputs, you can read inputs at any time, and you can set and change their polarity as required. The high-speed capture lines are considered inputs, while the breakpoint and inhibit lines are considered outputs.
Managing Limit Inputs
Functions:
ValueMotion | FlexMotion |
| Set 4A Limit Sw Input Polarity | Set Limit Input Polarity |
| Set Home Input Polarity | |
| Enable 4A Limit Switch Inputs | Enable Limits |
| Enable Home Inputs | |
| Read 4A Limit Switch Status | Read Limit Status |
| Read Home Input Status | |
| N/A | Load Software Limit Positions |
Conversion Example:

This example gets the status of the forward and reverse limits and the home input for axis 1. The example sets the polarity of the home inputs to non-inverting, and the polarity of the limit inputs to inverting.
Conversion Tips:
FlexMotion differentiates home inputs versus limit inputs. Where as ValueMotion had one function to interface with both home and limit inputs, FlexMotion breaks this up into two separate functions, allowing for a much cleaner interface. Other than this difference, functionality is the very similar between ValueMotion and FlexMotion.
Another feature included with FlexMotion is software limits. You can use software limits to implement a position-based simulated limit switch. Software limits are often used to restrict the range of travel and avoid hitting the hardware end-of-travel limit switches. For example, you can travel at a high velocity until hitting the software limit switch, and then move more slowly until hitting the hardware limit switch.
As a result of software limits, Enable Limits, and Read Limit Status have an extra parameter, Limit Type, which specifies limit inputs versus software limits. In addition the position for the software limit is specified by Load Software Limit Positions.
If there is no need to change your preferences for home and limit inputs programmatically, and you only set it at initialization, configuring these preferences is even easier when setup using Measurement & Automation Explorer.
Utilizing Digital I/O
Functions:
ValueMotion | FlexMotion |
| Set 24 Dig Port C Dir | Set I/O Port Direction |
| N/A | Set I/O Port Polarity |
| Set 24 Dig Outputs | Set I/O Port MOMO |
| Read 24 Dig I/O |

This example reads from port A, writes 11110000 to port B, and 00001111 to port C. The FlexMotion version looks more complicated; this is because it is more flexible, you can set direction and polarity for each bit on any port.
Conversion Tips:
ValueMotion has three digital I/O ports. Port A is input only, port B is output only, and port C has a configurable direction. FlexMotion has four digital I/O ports. The 32 bits of digital I/O on the FlexMotion controllers are available on the Digital I/O Connector. These bits are organized into 8-bit ports that you can configure as inputs or outputs on a port-wise basis, or on a bitwise basis. Each bit has individually programmable polarity that you can configure as inverting (active-low) or noninverting (active-high).
The FlexMotion VIs to access the digital I/O are very similar to those of ValueMotion. The main difference is that each FlexMotion VI takes a port as a parameter, whereas ValueMotion acts on all ports via one call.
Setting up preferences for digital I/O is even easier when setup using Measurement & Automation Explorer.
Exercising Analog I/O
Functions:
ValueMotion | FlexMotion |
| Read A/D Converter | Read ADCs |
| N/A | Enable ADCs |
| N/A | Set ADC Range |
| N/A | Load DAC |
Conversion Example:

This is a simple example of reading ADC Channel 1.
Conversion Tips:
The ValueMotion Read A/D Converter lets you read an 8-bit value from one of eight analog converter channels. The default reference voltage for the ADC is 5 V. The range of voltages allowed for each input is 0 through 5 V, and an external reference can be used to further control the measured analog signal value. For a range of 0 through 5 V, the 8-bit A/D converter resolves to 256 distinct values.
In FlexMotion the Analog Value is the signed 12-bit value from the ADC channel. Analog Value is from –2048 to +2047 for the ±5 V and ±10 V ranges, and 0 to 4096 for the 0 to 5 V and 0 to 10 V ranges. This range is specified via the Set ADC Range VI. In addition you must call Enable ADCs before using them. By default, all channels are enabled at power-up. Consult your software reference for reasons to disable ADCs.
The ADC inputs 1 through 4 are on the 68-pin Motion I/O connector on all FlexMotion controllers.
The FlexMotion Load DAC VI is used to send a value directly to an unmapped DAC resource. DACs not mapped as servo axis outputs are available for general-purpose analog out applications (734x series controllers only).
Setting up preferences for analog I/O is even easier when setup using Measurement & Automation Explorer.
See Also:
ValueMotion to FlexMotion Conversion, Part II
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/).
