Hello,
I'm having problems getting the szSerial number and temp readings to work correctly.
Here is the test sub I wrote to try to get things up and running.
Dim intRetStatus As Integer
Dim hTC08 As Integer
Dim tc08Info As USBTC08_INFO
ReDim temp_buffer(9) As Single
Dim intFlag As Integer
Dim intErrorCode As Integer
hTC08 = usb_tc08_open_unit()
If (hTC08) Then
List1.AddItem ("Device #" & hTC08 & " has been opened")
tc08Info.size = 30
intRetStatus = usb_tc08_get_unit_info(hTC08, tc08Info)
List1.AddItem ("Serial Number #" & tc08Info.szSerial)
The output of List1 is:
Device # 1 has been opened
Serial #
Notice that the serial number is blank. I noticed that in your sample VB application the serial number also does not appear.
The serial number is quite important to me as I will be running 8 devices.
At the "get_single" line I get an overflow error, however your sample application works just fine and I can't see the difference between the sample and my test function.
Any assistance here would be much appreciated.
Thanks in advance!
Declare Function usb_tc08_get_formatted_info Lib "usbtc08.dll" (ByVal handle As Integer, ByVal unit_info As String, ByVal string_length As Integer) As Integer
Dim info as String * 1024
ok = usb_tc08_get_formatted_info Lib(tc08_handle, info, 1024)
I have however tried to use this method before to no effect.
Here is what I wrote to quickly test it again:
(the function declaration is in my module)
Dim intRetVal As Integer
Dim hTC08 As Integer
Dim info As String * 255
hTC08 = usb_tc08_open_unit()
If (hTC08) Then
intRetVal = usb_tc08_get_formatted_info(hTC08, info, 255)
MsgBox (info)
Call usb_tc08_close_unit(hTC08 )
End If
The problem I get here is that anything larger then 255 for the string length causes VB and my project to crash.
However, when I run it at 255 OR with usb_tc08_get_unit_info the return value that I get for both functions is 0. According to the API guide this is an error and usb_tc08_get_last_error should be used. So I use it and it returns 0 as well - no error.
I also know that the device is working correctly because PicoLog Recorder software can get all the device info just fine.
Excellent markB, That worked perfectly!
I knew it had to be something small I was over looking, those always get me in the end.
It should be noted that the original declaration of the get_formated provided by Pico in the sample module, has it declared ByRef and this needs to be changed to use it in this manor.
OK, so that solves get_formated, any ideas on the structured version get_unit_info?