National Instruments NI-Motion User Manual

Page 103

Advertising
background image

Chapter 7

Contoured Moves

© National Instruments Corporation

7-7

NI-Motion User Manual

i32

* downloadData = NULL;// The temporary array that

is created to // download the points to the motion

controller

u32

currentDataPoint = 0;// Indicates the next point

in the points // array to download

i32

backlog;// Indicates the available space to

download more //points

u16

bufferState;// Indicates the state of the onboard

buffer

u32

pointsDone;// Indicates the number of points that

have been // consumed

u32

dataCopied = 0;// Keeps track of the points

copied

//Variables for modal error handling

u16

commandID;// The commandID of the function

u16

resourceID;// The resource ID

i32

errorCode;// Error code

///////////////////////////////

// Set the board ID

boardID = 1;

// Set the vector space number

vectorSpace = NIMC_VECTOR_SPACE1;

////////////////////////////////

// Configure a 2D vector space comprising of axes 1

and 2

err = flex_config_vect_spc(boardID, vectorSpace,

NIMC_AXIS1, NIMC_AXIS2, NIMC_NOAXIS);

CheckError;

//Set the operation mode to absolute position

err = flex_set_op_mode(boardID, vectorSpace,

NIMC_ABSOLUTE_CONTOURING);

CheckError;

// Configure buffer on motion controller memory (RAM)

// Note requested time interval is hardcoded to 10

milliseconds

err = flex_configure_buffer(boardID, 1 /*buffer

number*/, vectorSpace, NIMC_POSITION_DATA,

bufferSize, numPoints, NIMC_TRUE, 10,

&actualInterval);

CheckError;

// Send the first 1,000 points of the data

downloadData = malloc(sizeof(i32)*bufferSize);

Advertising