Chapter 5 Straight-Line Moves
© National Instruments Corporation 5-13 NI-Motion User Manual
LabVIEW Code
Figure 5-6. Velocity-Based Straight-Line Move in LabVIEW
C/C++ Code
The following example code is not necessarily complete, and may
notcompile 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 moveTime1;// Time for the 1st segment
i32 moveTime2;// Time for the 2nd segment
i32 initialTime;
i32 currentTime;
//Variables for modal error handling
u16 commandID;// The commandID of the function
u16 resourceID;// The resource ID
1 Load Velocity
2 Load Acceleration/Deceleration
3 Load Acceleration/Deceleration
4 Load S-Curve Time
5 Set Operation Mode
6 Start Motion
7 Read per Axis Status
8 Load Velocity
9 Start Motion
10 Read per Axis Status
11 Stop Motion
12 Motion Error Handler
84
1
2
3
96 107
11 12
5