Identifying two Picologs on the same computer

Post your .Net discussions here
Post Reply
nogaluca
Newbie
Posts: 0
Joined: Tue Sep 21, 2010 7:01 am

Identifying two Picologs on the same computer

Post by nogaluca »

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 592 times

Hitesh

Re: Identifying two Picologs on the same computer

Post by Hitesh »

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,

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

Re: Identifying two Picologs on the same computer

Post by nogaluca »

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

Hitesh

Re: Identifying two Picologs on the same computer

Post by Hitesh »

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)

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

Re: Identifying two Picologs on the same computer

Post by nogaluca »

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

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

Re: Identifying two Picologs on the same computer

Post by Martyn »

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 Support Manager

Post Reply