Cannot find UsbPt104.dll

Post your VB and VBA discussions here
Post Reply
eqiom
Newbie
Posts: 0
Joined: Wed Mar 02, 2016 1:39 pm

Cannot find UsbPt104.dll

Post by eqiom »

Hello,

I'm running a computer with Windows Seven 64 bits and Excel 2016. I have 2 PT-104 USB (CV669/077 & CQ493/053) running fine with Picolog.

I'd like to control and do directly some data acquisition from excel. If I'm trying the file USBPT104.XLS, found in UsbPt104sdk10.5.0.11, I got an error message:
The code should be updated for being used on 64 bits system, you need to update the Declare instructions and mark them with PtrSafe.

So, in USBPT104.XLS, in the following part:

Declare Function UsbPt104OpenUnit Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByRef handle As Integer, ByVal serial As Long) As Long
Declare Function UsbPt104CloseUnit Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer) As Long
Declare Function UsbPt104GetUnitInfo Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer, ByVal str As String, ByVal stringLength As Integer, ByRef requiredSize As Integer, ByVal info As Long) As Long
Declare Function UsbPt104SetChannel Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer, ByVal channel As Long, ByVal measurementType As Long, ByVal noOfWires As Integer) As Long
Declare Function UsbPt104GetValue Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer, ByVal channel As Long, ByRef value As Long, ByVal filtered As Integer) As Long

Declare Sub Sleep Lib "kernel32.dll" (ByVal time As Long)


I made the change:

Declare PtrSafe Function UsbPt104OpenUnit Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByRef handle As Integer, ByVal serial As Long) As Long
Declare PtrSafe Function UsbPt104CloseUnit Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer) As Long
Declare PtrSafe Function UsbPt104GetUnitInfo Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer, ByVal str As String, ByVal stringLength As Integer, ByRef requiredSize As Integer, ByVal info As Long) As Long
Declare PtrSafe Function UsbPt104SetChannel Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer, ByVal channel As Long, ByVal measurementType As Long, ByVal noOfWires As Integer) As Long
Declare PtrSafe Function UsbPt104GetValue Lib "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll" (ByVal handle As Integer, ByVal channel As Long, ByRef value As Long, ByVal filtered As Integer) As Long

Declare PtrSafe Sub Sleep Lib "kernel32.dll" (ByVal time As Long)

Then after saving the file and executing it again, I have the message:
Cannot find the file "C:\CVSROOT\PICO\EXAMPLES\USBPT104\Excel\UsbPT104.dll"
So I made the following changes:

Declare PtrSafe Function UsbPt104OpenUnit Lib "C:\Program Files (x86)\Pico Technology\Pico Full\UsbPT104.dll" (ByRef handle As Integer, ByVal serial As Long) As Long
Declare PtrSafe Function UsbPt104CloseUnit Lib "C:\Program Files (x86)\Pico Technology\Pico Full\UsbPT104.dll" (ByVal handle As Integer) As Long
Declare PtrSafe Function UsbPt104GetUnitInfo Lib "C:\Program Files (x86)\Pico Technology\Pico Full\UsbPT104.dll" (ByVal handle As Integer, ByVal str As String, ByVal stringLength As Integer, ByRef requiredSize As Integer, ByVal info As Long) As Long
Declare PtrSafe Function UsbPt104SetChannel Lib "C:\Program Files (x86)\Pico Technology\Pico Full\UsbPT104.dll" (ByVal handle As Integer, ByVal channel As Long, ByVal measurementType As Long, ByVal noOfWires As Integer) As Long
Declare PtrSafe Function UsbPt104GetValue Lib "C:\Program Files (x86)\Pico Technology\Pico Full\UsbPT104.dll" (ByVal handle As Integer, ByVal channel As Long, ByRef value As Long, ByVal filtered As Integer) As Long

But I'm still having the same error type message:
Error 48 Cannot find the file "C:\Program Files (x86)\Pico Technology\Pico Full\UsbPT104.dll"

And the macro is waiting on the line :
status = UsbPt104OpenUnit (handle, 0)

So I don't know what is wrong
Can you help me ?

Thanks

Hitesh

Re: Cannot find UsbPt104.dll

Post by Hitesh »

Hi eqiom,

If you are using a 64-bit version of Microsoft Excel then you will need to use the 64-bit usbpt104.dll. The PicoLog application uses 32-bit drivers which is why the error message is still occurring.

I would recommend installing the 64-bit PicoSDK 10.6.11 file from our Downloads page (refer also to this post for instructions as you only need to install the driver and examples for the USB PT-104).

Below are updated Microsoft Excel VBA examples:
USBPT104.xls
MS Excel VBA Example for USB PT-104 (32-bit)
(51.5 KiB) Downloaded 757 times
USBPT104_x64.xls
MS Excel VBA Example for USB PT-104 (64-bit)
(47.5 KiB) Downloaded 736 times
Regards,

eqiom
Newbie
Posts: 0
Joined: Wed Mar 02, 2016 1:39 pm

Re: Cannot find UsbPt104.dll

Post by eqiom »

Hello,

I followed your instructions, by installing the 64-bit PicoSDK 10.6.11 file and use the USBPT104_x64.xls (MS Excel VBA Example for USB PT-104 (64-bit)), and the problem was solved.

Thanks a lot

Hitesh

Re: Cannot find UsbPt104.dll

Post by Hitesh »

Hi eqiom,

Thanks for confirming that the example is working.

Regards,

Post Reply