Chapter 14
Onboard Programs
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
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
//
Variables for modal error handling
u16
commandID;//
The commandID of the function
u16
resourceID;//
The resource ID
i32
errorCode;//
Error code
///////////////////////////////
1
Begin 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
9
8
7
3