Sensoray 2600 User Manual
Page 56

Sensoray 2600 Programming Guide
52
Gateway Action Scheduling
Pulse width and gap times are determined by the values stored in the Preload registers. Preload1 specifies the
duration of the pulse, and Preload0 specifies the time interval between pulses. Preload values are related to time as
follows:
value = 10 * t - 1
, where t is specified in microseconds. For example, the value 99 corresponds to 10
microseconds.
The application should program the initial pulse width and gap times into the preload registers before calling this
function. After calling
S26_Sched2620_SetModePwmGen()
, the pulse width and/or gap times may be changed at
any time by programming new values into the associated preload registers.
Example:
// Configure counter 3 for pwm generation on the 2620 at MM number 0, IOM port 12.
// Settings: active high output pin, 2KHz @ 2% duty cycle.
void *x = S26_SchedOpen( 0, 1 );
S26_Sched2620_SetPreload( x, 12, 3, 1, 99 );
// 10.0 us pulse width.
S26_Sched2620_SetPreload( x, 12, 3, 0, 4899 );
// 490.0 us gap time.
S26_Sched2620_SetModePwmGen( x, 12, 3, 0 );
// Set mode.
S26_SchedExecute( x, 1000, 0 );
7.7.12 S26_Sched2620_SetMode()
Function:
Schedules the programming of the operating mode of one counter channel on a model 2620 IOM.
Prototype:
u32 S26_Sched2620_SetMode( XACT x, IOMPORT IomPort, u8 chan, u16 mode );
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.
mode
u16
Value to be written to the mode register.