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

8 channel thermocouple usb data acquisition module
Table of Contents

Advertisement

Example
The following code is a fragment of a C application which demonstrates how to open a
single unit with the asynchronous open unit functions:
//======================================================
// Opening a unit asynchronously
//======================================================
// Tell the driver to start enumerating the unit in the background
// (usb_tc08_open_unit_async returns immediately)
result = usb_tc08_open_unit_async();
// handle any error conditions
if
(result == -
{
error_code = usb_tc08_get_last_error(
printf("Unit failed to open\nThe error code is
// could terminate the application here
}
else if
(result ==
{
printf("No USB TC08 units
// could terminate the application here
}
// No errors, so start polling usb_tc08_open_unit_progress
// continuously for its enumeration state
do
{
result = usb_tc08_open_unit_progress(&handle, &progress);
switch
(result)
{
case
USBTC08_PROGRESS_FAIL:
error_code = usb_tc08_get_last_error(
printf("Unit failed to open\nThe error code is
// could terminate the application here
break;
case
USBTC08_PROGRESS_PENDING:
printf("\nThe unit is %d percent
500
Sleep(
);
break;
case
USBTC08_PROGRESS_COMPLETE:
printf("\n\nThe unit with handle '%d', opened
handle);
break;
}
}
while
(result == USBTC08_PROGRESS_PENDING);
//
// Start using the open unit
//
1
)
0
)
found");
// wait for approx. half a second
0
);
%d", error_code);
// enum equates to: -1
0
);
// enum equates to: 0
enumerated", progress);
// enum equates to: 1
Technical reference
%d", error_code);
successfully",
19

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents