beautypg.com

Sensoray 2410 API User Manual

Page 27

background image

Sensoray 24xx Programming Guide

23

Model 2410 Digital I/O Module

Example:

// Enable continuous capture on channels 0, 1, and 47.

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

if

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

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

6.4.7 s2410_WriteCapOneshot()

Function:

Enable one-shot event capture on an arbitrary set of DIO channels.

Prototype:

BOOL s2410_WriteCapOneShot( 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 one-shot capture for any arbitrary set of digital input channels. When a channel is configured
for one-shot capture, only one event can be captured on that channel. Upon the first event capture for that channel,
capturing will be disabled and no subsequent events will be captured. This is in contrast to continuous capture
mode, in which channels remain enabled for capturing after captures have occurred.

The boolean bits in

flags[]

specify the channels that are to be affected. A boolean True enables one-shot capture

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

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

CAPMSG_ONESHOT

when the specified channels become enabled for one-shot capture.

Example:

// Enable one-shot capture on channel 8.

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

if

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

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

6.4.8 s2410_WriteCapDisable()

Function:

Disable event capture on an arbitrary set of DIO channels.

Prototype:

BOOL s2410_WriteCapDisable( 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.

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 one-shot capture on the channel.
0 - don’t modify the channel’s capture configuration.

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 - disable capture on the channel.
0 - don’t modify the channel’s capture configuration.