Labview code, C/c++ code, Labview code -29 c/c++ code -29 – National Instruments NI-Motion User Manual

Page 179

Advertising
background image

Chapter 12

Synchronization

© National Instruments Corporation

12-29

NI-Motion User Manual

LabVIEW Code

Figure 12-17. Buffered High-Speed Capture in LabVIEW

C/C++ Code

The following example code is not necessarily complete, and may
not compile if copied exactly. Refer to the

examples

folder on the

NI-Motion CD for files that are complete and compile as is.

// Main Function

void main(void)

{

u8

boardID;// Board identification number

u8

axis;// Axis number

u16

csr = 0;// Communication status register

i32

bufferSize = 100;// The size of the buffer to

allocate on the //motion controller

u32

totalPoints = 100;// The number of high speed

capture to //acquire

i32

capturedPositions[100];// Array to store the

captured //positions

f64

actualInterval;// The interval at which the

motion controller can //really contour

u32

backlog;// Indicates the available space for

captured positions

1

Configure Buffer

2

Configure High-Speed Capture

3

Enable High-Speed Capture

4

Check Buffer

5

Read Buffer

6

Clear Buffer

7

Motion Error Handler

4

1

6

7

3

2

5

Advertising