beautypg.com

Sensoray 2600 User Manual

Page 44

background image

Sensoray 2600 Programming Guide

40

Gateway Action Scheduling

Prototype:

u32 S26_Sched2612_GetValues( XACT x, IOMPORT IomPort, s32 *values, u8 *tstamp );

Returns:

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

Benchmark: 6.2 ms.

Example:

// Get raw values on the 2612 at MM number 0, IOM port 10.

s32 values[4];

u8 tstamp[4];

void *x = S26_SchedOpen( 0, 1 );

S26_Sched2612_GetValues( x, 10, vbuff, tbuff );

S26_SchedExecute( x, 1000, 0 );

7.6.6 S26_Sched2612_RefreshData()

Schedules the fetching of the raw values of all channels to internal middleware buffers on a model 2612 IOM.

Prototype:

u32 S26_Sched2612_RefreshData( XACT x, IOMPORT IomPort );

Returns:

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

Benchmark: 0.1 ms.

Notes:

This function does the actual work of scheduling the transfer of measured raw data from the 2612 IOM into a
middleware buffer. Once the raw data values have been transferred to the middleware buffer, the application
program can then call

S26_2612_GetCalibratedValue()

to obtain corrected data in the desired engineering

units.

This function must be called periodically to refresh internally buffered data. To avoid a timestamp overflow this
period must be less than 256 sample periods. For example, if the sample rate is 55 Hz, the data must be refreshed at
least every 4.6 (255 / 55) seconds.

Since all 2612-specific functiona are thread-safe, it is possible to call

S26_Sched2612_RefreshData()

from one

thread to fetch raw data into the internal middleware buffer, while another thread calls

S26_2612_GetCalibratedValue()

to acquire corrected data for use by the application.

Example:

// Get buffered values on the 2612 at MM number 0, IOM port 10.

void *x = S26_SchedOpen( 0, 1 );

S26_Sched2612_RefreshData( x, 10 );

S26_SchedExecute( x, 1000, 0 );

7.6.7 S26_2612_RegisterZero()

Establishes the “zero offset” on one analog input channel on a model 2612 IOM.

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.

values

s32 *

Pointer to array of 4*32bit buffer to receive the values.

tstamp

u8 *

Pointer to array of 4*8bit buffer to receive the last sample numbers (timestamps).

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.