C/c++ code, C/c++ code -35 – National Instruments NI-Motion User Manual
Page 185

Chapter 12
Synchronization
© National Instruments Corporation
12-35
Figure 12-20. High-Speed Capture with RTSI Using LabVIEW
C/C++ Code
The following section includes C/C++ code for executing a high-speed
capture, as well as using RTSI to execute a high-speed capture. 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
capturedPositions[6]; // Array to store the
captured positions
i32
i;
//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 axis number
1
Select Signal
2
Configure High-Speed Capture
3
Enable High-Speed Capture
4
Read per Axis Status
5
Read Captured Position
5
4
2
3
1