
Take readings from the THUM using your
own programs
THUM DLL
THUM
Dynamic Link Library
The THUM DLL is a Dynamic Link Library that allows custom applications to be
written to read temperature, RH, and dew point measurements from the
THUM. This adds a great deal of flexibility to the
THUM. Temperature/RH
measurements can easily be taken and integrated into any project or solution
capable of using DLLs. This is a great solution to add temperature
and humidity monitoring capabilities to automated equipment or kiosk
software.
The THUM DLL can be used in programming environments such as Visual
Basic, Visual C++, .Net, etc.
The DLL is very easy to use. Install
the DLL into the application folder or into the C:\Windows\System32
folder on the computer.
If using VC include the thum.h in your project and use some simple code to acquire the
readings.
Functions
Read -
instructs
the THUM device to take a reading. It will read both temperature and
humidity.
GetTempUnit - returns the unit of
temperature as 1 or 2 (1 means °C or 2 means °F)
SetTempUnit -
sets the unit of temperature - valid values 1 or 2 (1 sets to °C and 2
sets to °F)
GetTemp
- returns the temperature in the units set by
SetTempUnit
GetRH - returns the relative
humidity reading
GetDewPt - returns the dew point
reading
Reset - resets the THUM device - generally this function is
not needed
Possible Error Codes returned from functions
THUM_ERROR_SUCCESS
0 // no error
THUM_ERROR_BADTEMPUNIT 1 //
bad temperature unit (not 1 or 2)
THUM_ERROR_THUMNOTFOUND 2 // THUM device not found
THUM_ERROR_READTIMEOUT 3 // Read
operation timed out
THUM_ERROR_WRITEFAILED 4
// Write operation failed
THUM_ERROR_READFAILED 5
// Read operation failed
THUM_ERROR_RESULTOUTOFRANGE 6 // Temp or RH was
out of range
Note: Readings can not be taken from the THUM faster than one
reading every 3 seconds. Taking readings faster than this could raise
the internal temperature of the sensor. This could skew the temperature
and RH readings returned from the THUM.
License:
We require that you purchase one copy of a control per developer on a
project. If this is met, you may distribute the DLL with your
application royalty free. You may never distribute the .h file.
Click here for Sample VB.Net Example
Sample Visual Basic 6 code to read values from the THUM
'Reads from THUM and returns temp and dew point values in °F
'*****************************************************
'THUM DLL Declarations
'*****************************************************
'Tells the unit to take a temperature and RH reading
Public Declare Function Read Lib "thum.dll" () As Long
'Gets the temperature from temp/rh sensor of the unit
Public Declare Function GetTemp Lib "thum.dll" () As Double
'Sets the temperature unit (to F or C)
Public Declare Function SetTempUnit Lib "thum.dll" (ByVal cUnit As
Double) As Long
'Gets the relative humidity from the unit
Public Declare Function GetRH Lib "thum.dll" () As Double
'Gets the temperatire unit (F or C)
Public Declare Function GetTempUnit Lib "thum.dll" () As Long
'Gets the dew point from the unit
Public Declare Function GetDewPt Lib "thum.dll" () As Double
'*****************************************************
'THUM DLL readings
'*****************************************************
Dim returnvalue As Long
Dim cunits As Double
'1 is C and 2 is F
cunits = 2
'F
'set temp unit in dll
returnvalue = SetTempUnit(cunits)
'take temp only Reading
returnvalue = Read
'get temperature value
lblTemp.caption = Format(GetTemp, "###.00")
'get RH value
lblRH.caption = Format(GetRH, "###.00")
'get Dew point value
lblDewPt.caption = Format(GetDewPt, "###.00")
'get temp unit
If GetTempUnit = 2 Then
lblTempUnit.Caption = "°F"
Else
lblTempUnit.Caption = "°C"
End If
Start monitoring your environment with your own programs
Secure Server Purchase
