Omega Engineering 8 Channel Thermocouple USB Data Acquisition Module TC-08 User Manual page 15

8 channel thermocouple usb data acquisition module
Table of Contents

Advertisement

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
for
(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
}
// find out the approximate conversion time
// for a call to usb_tc08_get_single
minimum_interval =
printf("Conversion time:
// Collect 10 readings over approximately 9 minutes
last_time = GetTickCount();
0
for
(i =
, i <
{
// do the conversion for all channels
usb_tc08_get_single( handle,
// print out the values
printf("\n\nTime: %d
0
for
(c =
; c <
{
// check for overflows on each channel
// with a bitwise & comparator
// shift the comparison bit to match the channel
if
(overflow_flags &
{
printf("\nChannel %d
}
else
// no overflow
{
printf("\nChannel %d:
}
}
if
(i < 9)
{
60000
while
(
{
Sleep(100);
}
last_time = GetTickCount();
}
}
0
(handle,
);
0
9
; channel <
; channel++)
(handle, channel, 'K');
usb_tc08_get_minimum_interval_ms
%d\n", minimum_interval);
10
, i++)
value_array,
&overflow_flags,
0
);
minute(s)", i);
9
; c++)
(1
<< c))
overflowed", c);
%f", c, value_array[c]);
> (GetTickCount() - last_time))
// let other applications run
// use 50Hz mains noise rejection
// short value_array[9]
// degrees Celsius units
// 60000ms = 1 minute
Technical reference
(handle);
11

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents