Unable to add pl1000.dll to VB

Post your .Net discussions here
Post Reply
Clarimen
Newbie
Posts: 0
Joined: Wed Dec 19, 2012 4:08 am

Unable to add pl1000.dll to VB

Post by Clarimen »

Hi, I am a new user of Picolog 1012 as well as VB.

I couldn't able to add the reference to VB and this is the statement of the problem
"A reference to C:\Users\Name\Documents\Visual Studio 2010\LoadCell\pl1000.dll could not be added. Please make sure that the file is accessible and that it is a valid COM" is showing every time I try to add reference to it.
I have been trying for quite some time and couldn't find the reason for it.

I will be glad if i can get a bit of advise and help here.
Thank you.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Unable to add pl1000.dll to VB

Post by Martyn »

Add pl1000.lib to your project and then in your code declare the dll functions in the same way the vba code in the xls example does

Code: Select all

Declare Function pl1000OpenUnit Lib "pl1000.dll" (ByRef handle As Integer) As Long
Declare Function pl1000CloseUnit Lib "pl1000.dll" (ByVal handle As Integer) As Long
Declare Function pl1000GetUnitInfo Lib "pl1000.dll" (ByVal handle As Integer, ByVal S As String, ByVal lth As Integer, ByRef requiredSize As Integer, ByVal info As Integer) As Integer
Declare Function pl1000SetTrigger Lib "pl1000.dll" (ByVal handle As Integer, ByVal enabled As Integer, ByVal enable_auto As Integer, ByVal auto_ms As Integer, ByVal channel As Integer, ByVal dir As Integer, ByVal threshold As Integer, ByVal hysterisis As Integer, ByVal delay As Single) As Integer
Declare Function pl1000SetInterval Lib "pl1000.dll" (ByVal handle As Integer, ByRef us_for_block As Long, ByVal ideal_no_of_samples As Long, channels As Integer, ByVal No_of_channels As Integer) As Long
Declare Function pl1000GetValues Lib "pl1000.dll" (ByVal handle As Integer, ByRef values As Integer, ByRef no_of_values As Long, ByRef overflow As Integer, ByRef triggerIndex As Long) As Long
Declare Function pl1000Run Lib "pl1000.dll" (ByVal handle As Integer, ByVal no_of_values As Long, ByVal method As Integer) As Integer
Declare Function pl1000Ready Lib "pl1000.dll" (ByVal handle As Integer, ByRef ready As Integer) As Long
Declare Function pl1000MaxValue Lib "pl1000.dll" (ByVal handle As Integer, ByRef maxValue As Integer) As Long
You may need to change some of the function declarations for VB.Net, and need to ensure that pl1000.dll is accessible on the path
Martyn
Technical Support Manager

Karunen
Advanced User
Advanced User
Posts: 194
Joined: Thu Nov 21, 2013 9:22 am

Re: Unable to add pl1000.dll to VB

Post by Karunen »

Hi,

Below are some examples of how the functions will need to be declared in VB.net

Code: Select all

    Declare Function pl1000OpenUnit Lib "pl1000.dll" (ByRef picohandle As Short) As UInteger
    Declare Function pl1000CloseUnit Lib "pl1000.dll" (ByVal picohandle As Short) As UInteger
    Declare Function pl1000GetUnitInfo Lib "pl1000.dll" (ByVal picohandle As Short, ByVal S As String, ByVal lth As Integer, ByRef requiredSize As Integer, ByVal info As Integer) As UInteger
    Declare Function pl1000SetTrigger Lib "pl1000.dll" (ByVal picohandle As Short, ByVal enabled As UShort, ByVal enable_auto As UShort, ByVal auto_ms As UShort, ByVal channel As UShort, ByVal dir As UShort, ByVal threshold As UShort, ByVal hysterisis As UShort, ByVal delay As Single) As UInteger
    Declare Function pl1000SetInterval Lib "pl1000.dll" (ByVal picohandle As Short, ByRef us_for_block As UInteger, ByVal ideal_no_of_samples As UInteger, ByRef channels As Short, ByVal No_of_channels As Short) As UInteger
    Declare Function pl1000GetValues Lib "pl1000.dll" (ByVal picohandle As Short, ByRef values As UShort, ByRef no_of_values As UInteger, ByRef overflow As UShort, ByRef triggerIndex As UInteger) As UInteger
    Declare Function pl1000Run Lib "pl1000.dll" (ByVal picohandle As Short, ByVal no_of_values As UInteger, ByVal method As UInteger) As UInteger
    Declare Function pl1000Ready Lib "pl1000.dll" (ByVal picohandle As Short, ByRef ready As Short) As UInteger
    Declare Function pl1000MaxValue Lib "pl1000.dll" (ByVal picohandle As Short, ByRef maxValue As UShort) As UInteger
Thanks,
Karunen

Technical Specialist
Pico Technology

Post Reply