Chapter 14 Onboard Programs
NI-Motion User Manual 14-12 ni.com
LabVIEW Code
Figure 14-7. Onboard Program Waiting for an I/O Line to Go Active
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
//Variables for modal error handling
u16 commandID;// The commandID of the function
u16 resourceID;// The resource ID
i32 errorCode;// Error code
///////////////////////////////
1Begin Program
Storage
2 Set Operation Mode
3 Load Velocity in RPM
4 Load Target Position
5 Select MOMO
6 Wait on Condition
7 Start Motion
8 End Program Storage
9 Motion Error Handler
6
1
2
4 5
987
3