National Instruments NI-Motion User Manual page 110

Motion control
Table of Contents

Advertisement

Chapter 8
Reference Moves
NI-Motion User Manual
//Variables for modal error handling
u16 commandID;// The commandID of the function
u16 resourceID;// The resource ID
i32 errorCode;// Error code
//Get the board ID
printf("Enter the Board ID: ");
scanf("%d", &scanVar);
boardID=(u8)scanVar;
//Check if the device is at power up reset condition
err = flex_read_csr_rtn(boardID, &csr);
CheckError;
if (csr & NIMC_POWER_UP_RESET ){
printf("\nThe FlexMotion device is in the reset
condition. Please initialize the device before
");
printf("running this example.
\"flex_initialize_controller\" function will
initialize the ");
printf("board with settings selected through
Measurement & Automation Explorer.\n");
return;
}
//Get the axis number
printf("Enter the axis: ");
scanf("%d",&scanVar);
axis=(u8)scanVar;
//Flush the Stdin
fflush(stdin);
//Load acceleration and deceleration to the axis
selected
err = flex_load_rpsps(boardID, axis, NIMC_BOTH,
acceleration, 0xFF);
CheckError;
//Load velocity to the axis selected
err = flex_load_rpm(boardID, axis, velocity, 0xFF);
CheckError;
//Start the Find Reference move
err = flex_find_reference(boardID, axis, 0,
NIMC_FIND_HOME_REFERENCE);
CheckError;
8-4
The
ni.com

Advertisement

Table of Contents
loading

Table of Contents