Synchronizing Host Applications with Onboard Programs LabVIEW Diagram
|
Tip Refer to NI-Motion\Documentation\Examples\NI-Motion User Manual\ for the LabVIEW VIs for these examples. |
This example moves axis 1 between target positions of 5000 and 5000. The host reads the target position only after the move has completed, and the new target position has been calculated. The following figure shows the code that runs as an onboard program.
|
1 Load Constant to Variable |
6 Insert Program Label |
11 Multiply Variables |
2 Load Constant to Variable |
7 Load Target Position |
12 Set User Status MOMO |
3 Begin Program Storage |
8 Start Motion |
13 Jump to Label on Condition |
4 Set Operation Mode |
9 Select MOMO |
14 End Program Storage |
5 Load Velocity |
10 Wait on Condition |
15 Motion Error Handler |
The following figure shows the code that runs on the host.
|
1 Read Move Complete Status |
2 Set User Status MOMO |
3 Read Variable |
|
Note As the host is polling a register on the motion controller, it is not invoking the Host Communication Task on the real-time operating system on the motion controller. Therefore, the onboard programs executing are not preempted. In this situation, the onboard programs run deterministically. |