beautypg.com

Sensoray 2600 User Manual

Page 55

background image

Sensoray 2600 Programming Guide

51

Gateway Action Scheduling

Example:

// Configure counter 3 as a pulse generator on the 2620 at MM number 0, IOM port 12.

// Assumes: active low output pulse, hardware triggered by active low signal.

void *x = S26_SchedOpen( 0, 1 );

S26_Sched2620_SetModePulseGen( x, 12, 3, 1, 1, 3 );

// Set mode.

S26_SchedExecute( x, 1000, 0 );

7.7.10 S26_Sched2620_SetModePulseMeas()

Function:

Schedules the programming of the operating mode of one counter channel on a model 2620 IOM.

Prototype:

u32 S26_Sched2620_SetModePulseMeas( XACT x, IOMPORT IomPort, u8 chan, u16 ActLowX );

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 measure the width of pulses applied to the

index

input.

When a measurement is completed, the result is latched and the next measurement begins automatically. The most
recently acquired measurement value may be read from the latch at any time.

The channel’s preload registers are automatically configured by this function. The preload registers should not be
modified while pulse width measurement mode is in effect.

Example:

// Configure counter 3 for pulse width measurement on the 2620 at MM number 0, IOM port 12.

// Assumes: active high pulse is being measured.

void *x = S26_SchedOpen( 0, 1 );

S26_Sched2620_SetModePulseMeas( x, 12, 3, 0 );

// Set mode.

S26_SchedExecute( x, 1000, 0 );

7.7.11 S26_Sched2620_SetModePwmGen()

Function:

Schedules the programming of the operating mode of one counter channel on a model 2620 IOM.

Prototype:

u32 S26_Sched2620_SetModePwmGen( XACT x, IOMPORT IomPort, u8 chan, u16 op );

Returns:

Error code as described in section 5.5. Zero is returned if the operation was successful.

Benchmark: 1.5 ms.

Notes:

S26_Sched2620_SetModePwmGen()

configures a counter channel so that it will toggle its output signal at periodic

intervals, with programmable period and duty cycle. This can be used to generate a continuous train of output
pulses in which both the pulse width and time gap between pulses is programmable.

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.

ActLowX

u16

Index pin polarity: 1 = active low, 0 = active high.

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.

op

u16

Output pin polarity: 1 = active low, 0 = active high.