beautypg.com

Omega Speaker Systems 8 Channel Thermocouple USB Data Acquisition Module TC-08 User Manual

Page 21

background image

Technical reference

17

Example

The following code is a fragment of a C application which demonstrates how to open
multiple units with the USB TC-08 driver. The handles to the open units are stored in
an array for later use:

//======================================================
// Opening multiple units
//======================================================

for

(i =

0

; (new_handle =

usb_tc08_open_unit

()) >

0

; i++)

{

// store the handle in an array

handle_array[i] = new_handle;
}
no_of_units = i;

// deal with the error if there is one,
// if new_handle was zero, then there was no error
// and we reached the last available unit

if

(new_handle == -

1

)

{
error_code =

usb_tc08_get_last_error

(

0

);

printf(

"Unit failed to open\nThe error code is %d"

, error_code);

// could terminate the application here

}

//
// Start using the open units
//