|
|
| Author |
Message |
Nicolas Guest
|
Posted: Fri Jul 11, 2003 5:10 am Post subject: Urgent ... Please advise |
|
|
how can I call the temperature of the th03 thermistor converter (COM1) from an asp page every minute?
Any help would be greately appreciated
Nicolas |
|
| Back to top |
|
 |
markspencer Site Admin

Joined: 07 May 2003
Posts: 610
|
Posted: Fri Jul 11, 2003 9:54 am Post subject: |
|
|
Hi,
I am not really able to help on this point as we do not do ASP, but you might be able to find the details from the microsoft MSDN library.
http://msdn.microsoft.com/library/
Perhaps someone else on the forum would be able to tell you how to do this.
Best regards, |
|
| Back to top |
|
 |
Nicolas Guest
|
Posted: Sat Jul 12, 2003 4:10 am Post subject: .net webservice (.asmx) |
|
|
hi markspencer and thanks for your prompt reply,
I tried the .net webservice approach, the code is running without errors but I'm getting 0 as the postback temperature. It's seems that the call th03_get_temp(temperature, Port, 1, False) allways returns 0.
Here's the code i'm using, hoping for some insight:
------------------------------------------------------------
<%@ WebService Language="VB" Class="GetTemperature" %>
Imports System
Imports System.Web.Services
Public Class GetTemperature:Inherits WebService
Declare Function th03_open_unit Lib "C:\PICO\DRIVERS\win32\th0332.DLL" (ByVal Port As Integer) As Boolean
Declare Sub th03_close_unit Lib "C:\PICO\DRIVERS\win32\th0332.DLL" (ByVal Port As Integer)
Declare Sub th03_set_channel Lib "C:\PICO\DRIVERS\win32\th0332.DLL" (ByVal Port As Integer, ByVal channel As Integer, ByVal THtype As Integer, ByVal Factor As Integer)
Declare Sub th03_poll_driver Lib "C:\PICO\DRIVERS\win32\th0332.DLL" ()
Declare Function th03_get_temp Lib "C:\PICO\DRIVERS\win32\th0332.DLL" (value As Long, ByVal Port As Integer, ByVal channel As Integer, ByVal filtered As Boolean) As Boolean
Declare Function th03_set_ref_update Lib "C:\PICO\DRIVERS\win32\th0332.DLL" (ByVal Port As Integer, ByVal Rate As Integer) As Boolean
Declare Function th03_get_version Lib "C:\PICO\DRIVERS\win32\th0332.DLL" (value As Integer, ByVal Port As Integer) As Boolean
Declare Function th03_get_cycle Lib "C:\PICO\DRIVERS\win32\th0332.DLL" (cycle As Long, ByVal Port As Integer) As Boolean
Declare Function GetTickCount Lib "kernel32" () As Long
Dim Port As Integer
Dim version As Integer
Dim temperature As Long
Dim ok As Boolean
dim i as Long
dim ticks As Long
<WebMethod()> Public Function GoGetTemperature() As Long
Port = 1
Call th03_open_unit(Port)
Call th03_set_channel(Port, 1, 1, 10)
for i=1 to 20
ticks = GetTickCount()
do while (GetTickCount() < ticks + 1000)
th03_poll_driver
loop
call th03_get_temp(temperature, Port, 1, False)
next
return(temperature)
' Close the driver
Call th03_close_unit(Port)
End Function
End Class |
|
| Back to top |
|
 |
markspencer Site Admin

Joined: 07 May 2003
Posts: 610
|
Posted: Mon Jul 14, 2003 9:02 am Post subject: |
|
|
Hi,
The get_temp function returns 1 when there is a temperature reading and 0 when there is no reading.
Check that the port is being opened and the value is one when you use the function open_unit.
I would suggest that you test the unit on the port that you are using to see if you are getting values back. Take a look at our examples especially the VB and the C code. There is no need to poll the driver.
Best regards, |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|