Application Solutions
Precision MicroControl Corp.
144
The encoder of an open loop stepper may be homed in one of two ways:
Home the encoder using the Auxiliary Encoder Index input
Re-define the position of the encoder when the axis is homed
i
If no encoder index mark output is available, the position of the auxiliary
encoder can be redefined at anytime using the Motion Control API function
MCSetAuxEncPos( )
.
If the encoder includes an index mark output it is recommended that this signal be used to home
both the
reported position of the axis and the auxiliary encoder
. The repeatability of a system homed using the
index mark will be significantly better than that of a system that uses a mechanical
switch/electromechanical sensor. The following programming example will reference both the reported
position of an open loop stepper and the auxiliary encoder at the location of the Index mark:
i
The following C example uses the
MCFindAuxEncIdx( )
and
MCSetPosition (
)
functions to redefine the encoder position register and the step count register
of an open loop stepper with an auxiliary encoder. For complete C code homing
samples that can be cut and pasted into an application program please refer to
the Motion Control API on-line help (mcapi.hlp).
MCFindAuxEncIdx( hCtlr, 5, 0.0 );
dwStatus = MCGetStatus( hCtlr, 5 );
while (! MCDecodeStatus( hCtlr, dwStatus, MC_STAT_AUX_IDX_FND ))
dwStatus = MCGetStatus( hCtlr, 5 );
IdxPosition = MCGetPosition( hCtlr, 5 );
MCStop( hCtlr, 5 );
if (!MCIsStopped( hCtlr, 5, 2.0 )) {
// Motor failed to stop within time limit (2 seconds),
// error handling code goes here
}
Position = MCGetPosition( hCtlr, 5 );
HomePosn = (Position - IdxPosition) * -1
MCSetOperatingMode( hCtlr, 5, 0, MC_MODE_POSITION );
MCEnableAxis( hCtlr, 5, TRUE );
MCMoveRelative( hCtlr, 5, HomePosn );
if (!MCIsStopped( hCtlr, 5, 2.0 )) {
// Motor failed to stop within time limit (2 seconds),
// error handling code goes here
}
MCSetPosition( hCtlr, 5, 0.0 );
i
After issuing the
MCFindAuxEncIdx( )
function the reported position of the
encoder of an open loop stepper will be redefined to equal parameter
position
once the index has been captured.
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com