Sensoray 2600 User Manual
Page 53

Sensoray 2600 Programming Guide
49
Gateway Action Scheduling
Returns:
Error code as described in section 5.5. Zero is returned if the operation was successful.
Benchmark: 1.5 ms.
Notes:
This function configures a counter channel so that it will interface to either a quadrature-encoded or a single-phase
clock source, with optional index input for preload triggering.
Example:
// Configure counter 3 as an encoder interface on the 2620 at MM number 0, IOM port 12.
// Assumes: quadrature encoder, x4 clock multiplier, no index-triggered preloads.
void *x = S26_SchedOpen( 0, 1 );
S26_Sched2620_SetModeEncoder( x, 12, 3, 0, 0, 3 );
// Set mode.
S26_SchedExecute( x, 1000, 0 );
7.7.7 S26_Sched2620_SetModeFreqMeas()
Function:
Schedules the programming of the operating mode of one counter channel on a model 2620 IOM.
Prototype:
u32 S26_Sched2620_SetModeFreqMeas( XACT x, IOMPORT IomPort, u8 chan, u16 igate );
Returns:
Error code as described in section 5.5. Zero is returned if the operation was successful.
Benchmark: 2.0 ms.
Notes:
This function configures a counter channel so that it will measure the frequency of an external digital signal applied
to the
ClkA
input.
A periodic time gate signal is required. Note that it is the period of the gate signal (vs. its time in the active state)
that determines the sampling time for frequency measurement. The gate time is defined as the time between
consecutive rising edges of the gate signal.
The gate signal may be derived from an external signal that is applied to the index input pin or from the internal
time gate generator that is shared by all counter channels. When using the internal time gate generator, the gate
generator should be configured before calling this function; see
S26_Sched2620_SetCommonControl()
for
details. When using an external time gate generator, the index polarity defaults to active high so that sample
intervals begin in gate (index) rising edges.
The channel’s preload registers are automatically configured by this function. The preload registers should not be
modified while frequency measurement mode is in effect.
chan
u8
The counter channel number that is to be accessed. Legal values range from 0 to 3.
xp
u16
Index pin polarity: 1 = active low, 0 = active high.
pl
u16
Preload upon index leading edge: 0 = disable, 1 = enable.
m
u16
Clock mode. Set to one of these values:
0 - quadrature x1, clock on A rising edge, B sets direction.
1 - quadrature x1, clock on A falling edge, B sets direction.
2 - quadrature x2, clock on both A edges, B sets direction.
3 - quadrature x4, clock on all A and B edges.
4 - mono, clock on A rising edge, B sets direction.
5 - mono, clock on A falling edge, B sets direction.
6 - mono, clock on both A edges, B sets direction.
Parameter
Type
Description
x
void *
Transaction handle obtained from S26_SchedOpen().
IomPort
u8
The IOM port number (on the MM) to which the target IOM is connected.
chan
u8
The counter channel number that is to be accessed. Legal values range from 0 to 3.
igate
u16
Time gate signal source: 0 = external signal on index input, 1 = internal gate generator.
Parameter
Type
Description