Chapter 10
Electronic Gearing and Camming
©
National Instruments Corporation
10-5
LabVIEW Code
Figure 10-4.
Tracking an Encoder Using Electronic Gearing with Superimposed Move
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
slaveAxis; //
Slave axis number
u8
master; //
Gear master
u16
csr = 0; //
Communication status register
u16
moveComplete;
//
Variables for modal error handling
u16
commandID;//
The command ID of the function
u16
resourceID;//
The resource ID of the function
i32
errorCode;//
Error code
///////////////////////////////
1
Configure Gear Master
2
Load Gear Ratio
3
Enable Gearing
4
Wait
5
Load Velocity
6
Load Acceleration/Deceleration
7
Set Operation Mode
8
Load Target Position
9
Start Motion
10 Wait for Move Complete
11 Enable Gearing Single Axis
12 Read per Axis Status
12
11
10
9
8
7
6
5
4
3
2
1