www.vtiinstruments.com
EX10xxA Programming 121
// STREAMING DATA CALLBACK
ViInt32 streaming_function( void *priv, EX10xxA_SampleData *data )
{
int channel;
int limits_broken = 0;
//Check limit status
for (channel = 0; channel < data->x.x_len; channel++)
{
int offset = channel / 32;
int mask = 1 << (channel % 32);
if ( (data->limits.limits_val[0+offset] & mask) != 0 ||
(data->limits.limits_val[2+offset] & mask) != 0 )
{
//Limits have been breached for this channel.
}
}
//Print the data
printf("%u.%09u", data->ss_secs, data->ss_nsecs);
for (channel = 0; channel < data->x.x_len; channel++)
{
printf(", %f", data->x.x_val[channel]);
}
printf("\n");
return 0;
}
It is imperative that the streaming data interface be enabled prior to initializing acquisition (the
vtex10xxA_init function) and disabled after acquisition completes, or is aborted explicitly
(vtex10xxA_abort).
The streaming callback function extracts the acquisition and timestamp data from the
EX10xxA_SampleData structure. The EX10xxA_SampleData structure is documented in the
instrument driver header file and can also be found in the vtex10xxA_enable_streaming_data.