Omega Speaker Systems TC-08 manual Usbtc08setmains handle, 0 // use 50Hz mains noise rejection

Page 15

Technical reference

11

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 Celsius 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))

{

printf("\nChannel %d overflowed", c);

}

else // no overflow

{

printf("\nChannel %d: %f", c, value_array[c]);

}

}

if (i < 9)

{

while (60000 > (GetTickCount() - last_time)) // 60000ms = 1 minute

{

Sleep(100); // let other applications run

}

last_time = GetTickCount();

}

}

Image 15
Contents User’s Guide Servicing North America Contents Page Overview Installing the driver Connecting the USB TC-08Refresh TC-08 Users GuideTC-08 Channels window, double-click on Channel 1 unused Mains voltages Safety warningSafety grounding Maximum input rangeSpecifications How a thermocouple works Introduction Modes of operationIntroduction Streaming mode ================================================== ExampleGet Single mode Usbtc08setmains handle, 0 // use 50Hz mains noise rejection Legacy mode Now do something with the cold junction temperature Driver routines Routine Description New USB and serial modeNew USB mode only Legacy mode onlyArguments New USB mode and legacy modeShort usbtc08openunit void NoneReturns Positive shortStore the handle in an array handlearrayi = newhandle Arguments None Returns Short usbtc08openunitasync voidHandle any error conditions if result == Progress HandleArguments handle Short tc08closeunit Short handleShort usbtc08stop Short handle Sixtyhertz Short usbtc08setmains Short handle, short sixtyhertzLong usbtc08getminimumintervalms Short handle MinimumInterval Info Short usbtc08getunitinfo Shorthandle, USBTC08INFO * infoShort usbgetformattedinfo Handle Char Unitinfo StringlengthUSBTC08MAXINFOCHARS characters long User/Developer error codes Error Further information Code Short usbtc08getlasterror Short handleError Reserved error codesCode New USB mode only ChannelTctype Long usbtc08run Short handle, long interval Temp OverflowflagsUnits Overflow Long usbtc08gettemp Short Handle Float * tempbufferTempbuffer TimesmsbufferShort Channel Units Fillmissing Long usbtc08gettempdeskew Short Handle Float * temp TimesShort usbtc08legacyrun Short handle Legacy mode onlyFilterfactor Filtered Short usbtc08legacygetcoldjunction Long * temp, short handle Driver version Number Short usbtc08legacygetdriverversion VoidVersion Short usbtc08legacygetversion Short * version, short handleCycle Short usbtc08legacygetcycle Long * cycle, short handleProgramming C++Delphi Agilent VEE ExcelLabVIEW Visual BasicKey TroubleshootingCold junction compensation. See CJC GlossaryTechnical reference Page Index TC-08 Users Guide WARRANTY/DISCLAIMER Shop online at omega.com