Test and Measurement Forum

Identifying two Picologs on the same computer

Post your .Net discussions here

Identifying two Picologs on the same computer

Postby nogaluca » Wed Dec 28, 2011 7:36 am

Dear all,
how can I identify two Picologs connected to the same computer? I must distinguish the handlers of two instruments. I'm using Visual Basic .NET.

P.S. I'm using the Picolog access functions listed in the attached file, but I'm not able to run the pl1000GetUnitInfo correctly.

Could somebody help me, please?
Attachments
pl1000.txt
(2.16 KiB) Downloaded 168 times
nogaluca
Newbie
 
Posts: 0
Joined: Tue Sep 21, 2010 7:01 am

Re: Identifying two Picologs on the same computer

Postby Hitesh » Thu Dec 29, 2011 8:48 pm

Hi nogaluca,

Would it be possible to send in a snippet of code showing how you open the two units and then call the pl1000GetUnitInfo function please?

What is being returned for the string and requiredSize parameters from the call to the function?

Have you predefined the String S as a blank string e.g. S = " ". Also, referring to the Programmer's guide, in section 3.3.4, there is a line that states 'If you want to find out the length of the string before allocating a buffer for it, then call the function with string = NULL first.'

Any information on what is being returned as the PICO_STATUS value for each call to that function would be helpful.

Regards,
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2006
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Identifying two Picologs on the same computer

Postby nogaluca » Wed Jan 11, 2012 9:04 am

The two units are opened in this way:

Code: Select all
Public PicoLog1216_1 As Short
Public PicoLog1216_2 As Short
pl1000OpenUnit(PicoLog1216_1)
pl1000OpenUnit(PicoLog1216_2)


The real problem is that I'm not able to use pl1000GetUnitInfo function. It returns me unreadable information. Probably the function is uncorrectly definited... I'm using it in this way:

Code: Select all
Dim requiredSize As Short = 0, size As Short = 20, infos As Short = 0
Dim info As String = "........................."
pl1000GetUnitInfo(PicoLog1216_1, info, size, requiredSize, infos)


I need some help using (and corrently defining) pl1000GetUnitInfo function.

Regards,

Luca
nogaluca
Newbie
 
Posts: 0
Joined: Tue Sep 21, 2010 7:01 am

Re: Identifying two Picologs on the same computer

Postby Hitesh » Wed Jan 11, 2012 10:40 am

Hi,

You may wish to try setting requiredSize to something like 10 and your size to 80 or 255.

Below are some snippets of code that I've previously used which I hope will help

Code: Select all
Dim status As Short
Dim handle As Short

Dim handle2 As Short
Dim status2 As Short

Dim S As String

status = pl1000OpenUnit(handle)
status2 = pl1000OpenUnit(handle2)

S = "               "
status = pl1000GetUnitInfo(handle, S, 255, requiredSize, 3)
Console.WriteLine("Variant: " & S)

status2 = pl1000GetUnitInfo(handle2, S, 255, requiredSize, 3)
Console.WriteLine("Variant: " & S)
Hitesh

Technical Specialist
Pico Technology
Hitesh
Site Admin
Site Admin
 
Posts: 2006
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Identifying two Picologs on the same computer

Postby nogaluca » Mon Jan 23, 2012 1:22 pm

Thank you for your example. The problem was on the function definition that was incorrect. The working version is the following:

Code: Select all
pl1000GetUnitInfo Lib "pl1000.dll" (ByVal handle As Short, ByVal S As String, ByVal lth As Short, ByRef requiredSize As Short, ByVal info As Short) As Integer


Please check if there is sometingh other else wrong.
Is there a list of all picolog function correctly definied for Visual Basic .NET using?

Thanks again.

Best regargds,

Luca
nogaluca
Newbie
 
Posts: 0
Joined: Tue Sep 21, 2010 7:01 am

Re: Identifying two Picologs on the same computer

Postby Martyn » Wed Jan 25, 2012 8:33 am

In the VBA Excel macro that comes with the SDK, and pasted below
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
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2285
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots


Return to .Net Languages (C#, VB.Net, .)

Who is online

Users browsing this forum: No registered users and 0 guests