## TC-08 (USB): Reading temperature in Kelvins problem

Post general discussions on using our drivers to write your own software here
duxxx001
User
Posts: 6
Joined: Tue Jun 07, 2005 12:11 pm
Location: Edinburgh

### TC-08 (USB): Reading temperature in Kelvins problem

I have a problem getting right temperature in Kelvins from the driver for the last channel (8.). Cold Junction temperature and first seven channels work OK, but 8. channel always output temperature in degrees Celsius.

Here is the C code that verifies that:

Code: Select all

``````/**************************************************************************
* C program for reading temperatures from TC-08 (USB) device in Kelvins
* author: Dusan P Djurdjevic, Edinburgh UNI, 2005.
***************************************************************************/

#include
#include "usbtc08.h"

#define TC_TYPE_K 'K'

int main()
{
short		 hTC08;
int        	 i;
float 	 buf1[10], buf2[10];
short 	 overflow;

// open unit
hTC08 = usb_tc08_open_unit ();

// check if everything OK
if (hTC08 <= 0)
{
printf("Error Code: %d\n",usb_tc08_get_last_error (0));
return(99);
}

// set channels
for (i=0; i<=8; i++) usb_tc08_set_channel (hTC08, i, TC_TYPE_K);

// read temperature in Celsius Kelvin
usb_tc08_get_single(hTC08, buf2, &overflow,USBTC08_UNITS_KELVIN);

// write output
printf("%10s %10s %10s\n","Channel No","C","K");
for (i=0; i<=8; i++) printf("%-10d %10.3f %10.3f\n", i, buf1[i], buf2[i]);
}``````
Results from the program:

Code: Select all

``````D:\Projects\Experiments_SEE\Driver\Drivers\Win32>kelvin_problem.exe
Channel No          C          K
0              25.757    298.757
1              25.467    298.595
2              25.544    298.555
3              25.695    298.672
4              25.743    298.643
5              25.503    298.444
6              25.698    298.621
7              25.312    298.235
8              25.772     25.728``````
This problem does not appear if I use other Temperature units (Rankine or Fahrenheit).

My feeling is that problem is in the driver, where temperature conversion takes place, and if ther is a loop, upper boundary of that loop should be increased by 1.
Please Note: No trees were destroyed in sending this contaminant free message. However, we do concede that significant number of electrons may have been inconvenienced.

Sarah
Hi

We have investigated this and found that there was an error in the driver. We have corrected this and if you email tech@picotech.com requesting a copy then we will send it to you.

Best Regards

duxxx001
User
Posts: 6
Joined: Tue Jun 07, 2005 12:11 pm
Location: Edinburgh
Sarah wrote: We have investigated this and found that there was an error in the driver. We have corrected this and if you email tech@picotech.com requesting a copy then we will send it to you.
Many Thanks Sarah.
Actually it would be of great help if the source code of the driver is available. In that case, more developers could be involved, and maintaining of such piece of software would be much easier.

Regards,
Dusan
Please Note: No trees were destroyed in sending this contaminant free message. However, we do concede that significant number of electrons may have been inconvenienced.

Sarah
Hi Dusan