Sensoray 2600 User Manual

Page 32

Advertising
background image

Sensoray 2600 Programming Guide

28

Gateway Action Scheduling

Prototype:

u32 S26_Sched2608_SetTempUnits( XACT x, IOMPORT IomPort, int DegreesF );

Returns:

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

Benchmark: 0.1 ms.

Notes:

This sets the units for all analog input channels that are configured for thermocouple interface. Temperature units
default to degrees C upon module reset. After calling this function, no delay is required before fetching analog
input data.

Example:

// Set temperature units to degrees F on the 2608 at MM number 0, IOM port 1.

void *x = S26_SchedOpen( 0, 1 );

S26_Sched2608_SetTempUnits( x, 1, 1 );

S26_SchedExecute( x, 1000, 0 );

7.4.6 S26_Sched2608_GetAins()

Function:

Schedules the fetching of all analog input values from a model 2608 IOM.

Prototype:

u32 S26_Sched2608_GetAins( XACT x, IOMPORT IomPort, double *data, BOOL Integrated );

Returns:

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

Benchmark: 4.1 ms.

Notes:

Important: The application must call

S26_Sched2608_GetCalData()

at least once before calling

S26_Sched2608_GetAins()

. See section 7.4.9 for details.

Sixteen double-precision values are fetched when the scheduled action executes, so the application’s data buffer
must be large enough to receive all sixteen data values. One data value is fetched for each of the 2608’s analog
input channels. This action does not cause the analog input channels to be digitized; it simply fetches the
previously digitized values. Excluding communication latency, the fetched values range in age from 0 to 2
milliseconds for snapshot values, or from 0 to 16 (or 20, if the power line frequency has been declared to be 50 Hz)
milliseconds for integrated values.

For each analog input channel, the fetched data value is represented in units that are appropriate for the declared
input type that was specified in a prior call to

S26_Sched2608_SetAinTypes()

. See section 7.4.2 for details.

Thermocouple channels will be returned in either degrees C (default) or F, depending on the units selected in any
prior call to

S26_Sched2608_SetTempUnits()

.

When the 2608 module is reset, or when the client calls

S26_Sched2608_SetAinTypes()

, the client must wait at

least 32 milliseconds before calling

S26_Sched2608_GetAins()

. This delay ensures that the digitizer will have

enough time to acquire valid data for all analog input channels before the data is passed to the client.

Example:

// Do a calibrate and read snapshot data from the 2608 at MM number 0, IOM port 1.

double ain[16];

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.

DegreesF

int

Set to 0 for degrees C, or to 1 for degrees F.

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.

data

double *

Pointer to a 16-element application buffer that is to receive the analog input data
values.

Integrated

int

Set to 0 to fetch the “snapshot” values, or set to 1 to fetch the “integrated” values.

Advertising