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

Page 164

Advertising
background image

Chapter 12

Synchronization

NI-Motion User Manual

12-14

ni.com

LabVIEW Code

In this example, a breakpoint generates and then is re-enabled 5,000 counts
from where the move starts. The following code examples are designed to
illustrate the relative breakpoint algorithm only. These examples are not
complete.

Figure 12-7. Relative Position Breakpoint with RTSI Using 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

u16

axisStatus;// Axis status

i32

breakpointPosition = 5000;

//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;

1

Select Signal

2

Configure Breakpoint

3

Load Breakpoint Position

4

Enable Breakpoint Output

5

Read per Axis Status

6

Motion Error Handler

5

6

3

2

1

4

Advertising