Initializing the Controller Programmatically

NI-Motion

Initializing the Controller Programmatically

You can initialize the motion controller from within a LabVIEW, Visual Basic, or C/C++ program, in addition to initializing controllers in Measurement & Automation Explorer (MAX).

Refer to the following table for the steps you must take to initialize a controller programmatically and the functions and VIs you use for each step.

Step Function and/or VI
  1. Clear the power-up state.
Use the Clear Power Up Status VI or function.
  1. Review any errors that occurred on the controller to determine how best to handle them.
Use the Read Error Message VI or function.
  1. Make sure all axes are stopped and disabled.
Use the Stop Motion VI or function and Enable Axes VIs or functions. In the Stop Motion VI or function, set Stop Type (Decel) set to Halt. In the Enable Axes VI or function, set Axis Bitmap to False for each axis you want to disable.
  1. Unconfigure vector spaces.
Use the Configure Vector Space VI or function with the X Axis, Y Axis, and Z Axis inputs set to None.
  1. Configure resources for axes.
Use the Configure Axis Resources VI or function.
  1. Load all axis configuration options you want to use.
Use the Axis & Resource Configuration VIs or functions.
  1. Initialize encoders and ADCs, as appropriate.
Use the appropriate VIs or functions on the Analog & Digital I/O palette.
  1. Enable the axes, but leave them deactivated.
Use the Enable Axes VI or function.
  1. Load the appropriate control loop parameters.
Use the Load Advanced Control Parameter VI or function and either Load Single PID Parameter VI or function or Load All PID Parameters VI or function.
  1. Call halt on all axes to activate them.
Use the Stop Motion VI or function with Stop Type (Decel) set to Halt stop.
  1. Configure capture and compare settings.
Use the VIs or functions on the Motion I/O palette to configure the capture and compare settings.
  1. Configure the following optional settings:
  • Configure trajectory settings
  • Configure find reference settings
  • Configure DIO settings
  • Configure PWM settings
  • Gearing
Use the following palettes or VIs/functions to configure the optional settings: