National Instruments NI-Motion User Manual page 202

Motion control
Table of Contents

Advertisement

Chapter 13
Torque Control
NI-Motion User Manual
err = flex_load_acceleration(boardID, axis,
NIMC_DECELERATION, 100000, 0xFF);
CheckError;
// Set the jerk (s-curve value) for the move (in
sample periods)
err = flex_load_scurve_time(boardID, axis, 100,
0xFF);
CheckError;
// Set the operation mode to velocity
err = flex_set_op_mode(boardID, axis,
NIMC_RELATIVE_POSITION);
CheckError;
do
{
// Read the ADC channel number 1 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;
// Move based on delta force
err = flex_start(boardID, axis, 0);
CheckError;
}
// Check the move complete status/following
error/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;
// Check the modal errors
if (csr & NIMC_MODAL_ERROR_MSG)
{
err = csr & NIMC_MODAL_ERROR_MSG;
CheckError;
13-12
ni.com

Advertisement

Table of Contents
loading

Table of Contents