National Instruments NI-Motion User Manual

Page 156

Advertising
background image

Chapter 12

Synchronization

NI-Motion User Manual

12-6

ni.com

// Buffer resources

i32

breakpointPositions[] = {1000, 1100, 1200, 1300,

1400, 1500, 1600};

u16

numberOfPoints = 7;// Number of breakpoints

f64

actualInterval;// Required in the function call

but not being //used

f64

requestedInterval = 10.0;// Required in the

function call but //not being used

u32

backLog;// Number of space available in buffer

u16

bufferState;// Buffer state

u32

pointsDone;// Number of breakpoints done or

consumed

// Configure the buffer for buffered breakpoint

err = flex_configure_buffer(boardID, buffer,axis,

NIMC_BREAKPOINT_DATA, numberOfPoints,

numberOfPoints,NIMC_TRUE, requestedInterval,

&actualInterval);

CheckError;

// Write the breakpoint position to the buffer

err = flex_write_buffer(boardID, buffer,

numberOfPoints, NIMC_REGENERATION_NO_CHANGE,

breakpointPositions, 0xFF);

CheckError;

// Configure the breakpoint to be buffered breakpoint

err = flex_configure_breakpoint(boardID, axis,

NIMC_ABSOLUTE_BREAKPOINT, NIMC_PULSE_BREAKPOINT,

NIMC_OPERATION_BUFFERED);

CheckError;

// Enable the breakpoint

err = flex_enable_breakpoint(boardID, axis,

NIMC_TRUE);

CheckError;

// Poll the status of the buffer, if you have more

breakpoint //positions to write, insert

flex_write_buffer call here.

do

{

// Check the buffer status

err = flex_check_buffer_rtn(boardID, buffer,

&backLog, &bufferState, &pointsDone);

CheckError;

Sleep(50);

Advertising