beautypg.com

Sensoray 2410 API User Manual

Page 26

background image

Sensoray 24xx Programming Guide

22

Model 2410 Digital I/O Module

6.4.5 s2410_WriteCapPolarity()

Function:

Select the polarities of events to be captured on all DIO channels.

Prototype:

BOOL s2410_WriteCapPolarity( SESSION sess, u32 *err, u16 *flags );

Returns:

True if the operation was successful, otherwise False is returned and

err

will contain the associated error code.

Notes:

This selects the edge transition type that is to be captured on each of the 48 DIO channels. For any given channel,
only one edge may be selected for capture at a time.

If asynchronous event notification is enabled, the application’s callback function will be called with message type

CAPMSG_POLARITY

when the specified polarities go into effect.

Example:

// Set capture polarities: chan0=inactive-to-active, all others=active-to-inactive.

u32 err = ERR_NONE;
u16 flags[3] = { 0, 0, 1 };

if

( !s2410_WriteCapPolarity( sess, &err, flags ) )

printf( "Error: %s\n", s24xx_ErrorText(err) );

6.4.6 s2410_WriteCapContinuous()

Function:

Enable continuous event capture on an arbitrary set of DIO channels.

Prototype:

BOOL s2410_WriteCapContinuous( SESSION sess, u32 *err, u16 *flags );

Returns:

True if the operation was successful, otherwise False is returned and

err

will contain the associated error code.

Notes:

This function enables continuous capture for an arbitrary set of digital input channels. Any channel that is
configured for continuous capture will remain enabled when an event is captured on that channel. This is in
contrast to one-shot capture mode, in which event capturing is automatically disabled when an event is captured.

The boolean bits in

flags[]

specify the channels that are to be affected. A boolean True enables continuous

capture on the associated channel, while False will leave the channel’s capture mode unchanged. When this
function enables continuous capture on a channel, the channel’s previous capture mode (i.e., disabled or one-shot)
is no longer in effect.

If asynchronous event notification is enabled, the application’s callback function will be called with message type

CAPMSG_CONTINUOUS

when the specified channels become enabled for continuous capture.

Argument

Description

sess

Session handle obtained from

s24xx_SessionOpen()

.

err

Pointer to error code. See Section 4.3.1 for details.

flags

Pointer to array that contains capture polarity flags for all 48 digital input
channels. Each bit has the following meaning:

1 - enables capture of inactive-to-active (physical high-to-low) edges.
0 - enables capture of active-to-inactive (physical low-to-high) edges.

Argument

Description

sess

Session handle obtained from

s24xx_SessionOpen()

.

err

Pointer to error code. See Section 4.3.1 for details.

flags

Pointer to array that contains boolean flags for all digital input
channels. Each bit has the following meaning:

1 - enable continuous capture on the channel.
0 - don’t modify the channel’s capture configuration.