Figure 16-5. figure 16-3 sequence structure 2, C/c++ code, C/c++ code -5 – National Instruments NI-Motion User Manual
Page 276

Chapter 16
Rotating Knife
© National Instruments Corporation
16-5
Figure 16-5. Figure 16-3 Sequence Structure 2
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
slaveAxis;// Slave axis number
u8
master;// Gear master
u16
csr = 0;// Communication status register
i32
synchronizationPosition = 0; // Synchronization
position
i32
correctionPoint = 500;// Point where the correction
can be //applied
i32
cyclePosition = 2000;// One revolution is 2,000
counts
i32
currentPosition;// The current slave position
i32
capturedPosition;// The position at which the
trigger happens
u16
axisStatus;
//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
Read Position
2
Start Motion
1
2