User manual
Technical reference 12
Copyright 2004 Pico Technology Limited. All rights reserved.
3.2.3 Get Single mode
Get Single mode is an operational mode in which readings are produced on demand, using the
usb_tc08_get_single
function. Since the function relies entirely on the timing of the calling application, it
is ideal for time intervals of greater than 1 minute. If high-speed sampling is required, use
Streaming mode
.
Note: The function call overhead can be significant, since it takes approximately 360 ms to convert all 9
channels, equating to 40 ms per channel. To reduce this overhead, disable channels that are not
required.
Example
The following code is a fragment of a C application demonstrating how to use Get Single mode with the
USB TC-08 driver:
//========================================================
// Setting up and converting readings with Get Single mode
//========================================================
usb_tc08_set_mains
(handle,
0
);
// use 50Hz mains noise rejection
for
(channel =
0
; channel <
9
; channel++)
{
// set each channel up as a type K thermocouple
// channel 0 is the cold junction and will be enabled
// by setting the third argument to anything other than ' '
usb_tc08_set_channel
(handle, channel,
'K'
);
}
// find out the approximate conversion time
// for a call to usb_tc08_get_single
minimum_interval =
usb_tc08_get_minimum_interval_ms
(handle);
printf(
"Conversion time: %d\n"
, minimum_interval);
// Collect 10 readings over approximately 9 minutes
last_time = GetTickCount();
for
(i =
0
, i <
10
, i++)
{
// do the conversion for all channels
usb_tc08_get_single
( handle,
value_array,
// short value_array[9]
&overflow_flags,
0
);
// degrees Centigrade units
// print out the values
printf(
"\n\nTime: %d minute(s)"
, i);
for
(c =
0
; c <
9
; c++)
{
// check for overflows on each channel
// with a bitwise & comparator
// shift the comparison bit to match the channel
if
(overflow_flags & (
1
<< c))
{