Application Solutions
Precision MicroControl Corp.
142
MC_COMPARE_ONESHOT
Configures the compare output for one shot operation (one shot
period is defined by the
period
parameter of
McConfigureCompare
( ) function. The one shot pulse period
range is from 1millisecond to 1.0 second. For one shot periods
less than 50 milliseconds the timer resolution is 1 millisecond.
For one shot periods greater than 50 milliseconds the timer
resolution is 50 milliseconds.
MC_COMPARE_STATIC
Configures the compare output to turn on when a compare
event occurs. The output will stay on until a new compare event
is called
MC_COMPARE_TOGGLE
Configures the compare output to toggle between the active and
inactive state each time a compare event occurs
For all of the output modes, the compare output will be activated within 100 nano seconds of the
encoder/step count reaching the compare position. When the compare output mode is set to Disabled,
the output will be at its' in-active level (TTL low). The controller sets the output mode to Disabled on
power up or reset.
To report the number of compare events that have occurred issue the
MCGetCount ( )
function
with the
type
=
MC_COUNT_COMPARE
. To disable position compare issue
MCEnableCompare ( )
with parameter
flag
value =
MC_COMPARE_DISABLE
.
//
// Use positions spaced 5 units apart, beginning at 10.0 as compare
// positions. Toggle the output pin on valid compares. Wait for 20
// compares to complete.
//
data[0] = 10.0;
// starting point
MCConfigureCompare( hCtlr, 1, data, 1, 5.0, MC_COMPARE_TOGGLE, 0.0 );
MCEnableCompare( hCtlr, 1, MC_ENABLE_COMPARE );
// enable compare
MCMoveRelative( hCtlr, 1, 100.0 );
do {
// wait for 5 points
MCGetCount( hCtlr, 1, MC_COUNT_COMPARE, &count );
} while (count < 20);
Artisan Technology Group - Quality Instrumentation ... Guaranteed | (888) 88-SOURCE | www.artisantg.com