Test and Measurement Forum

C# unable to request data from PicoLog 1216

Post your .Net discussions here

C# unable to request data from PicoLog 1216

Postby bmac » Fri Aug 13, 2010 1:27 pm

Hi,

Have been trying to use the pl1000.dll library to access the PicoLog device through my own c# software so that i can access it's my measurements. However, when i try to use the pl1000OpenUnit(short handle) method it always returns the error code 12 ("PICO_INVALID_CONDITION_CHANNEL") therefore every device command i try to excute thereafter returns the error code 3 ("PICO_NOT_FOUND").

What do i need to change to initialize the device properly?

Here is a section of my code related to the pico device:

[DllImport("pl1000.dll", ExactSpelling = true, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
static extern short pl1000MaxValue(short handle,short maxValue);
[DllImport("pl1000.dll", ExactSpelling = true, CharSet = CharSet.Ansi, CallingConvention = CallingConvention.StdCall)]
static extern short pl1000OpenUnit(short handle);

private void accessDatak()
{
short handle = 0;
short max = 0;
short status;
status = pl1000OpenUnit(handle);
status = pl1000MaxValue(handle, max);
}
bmac
Newbie
 
Posts: 0
Joined: Fri Aug 13, 2010 1:14 pm

Re: C# unable to request data from PicoLog 1216

Postby ziko » Fri Aug 13, 2010 2:54 pm

Hi,

Try something along these lines:


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;


namespace pl10000
{
class Program
{
[DllImport("pl1000.dll")]
private static extern short pl1000OpenUnit(out short handle);

static void Main(string[] args)
{
short handle;
int x = pl1000OpenUnit(out handle);
}
}
}
Ziko

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Re: C# unable to request data from PicoLog 1216

Postby bmac » Mon Aug 16, 2010 9:28 am

Thanks a lot its now picking up the device. I just have one more question for requesting data in the PicoLog the methods contain external classes such as PL1000_INPUTS and BLOCK_METHOD for example:

short pl1000GetSingle(
short handle,
PL1000_INPUTS channel,
short value
)
short pl1000Run(
short handle,
long no_of_values,
BLOCK_METHOD method
)

How do i go about importing these classes from the dll so they can be used in my program?

The PICO_STATUS class is defined by short numbers in the programmers guide but there are no references for these classes.
bmac
Newbie
 
Posts: 0
Joined: Fri Aug 13, 2010 1:14 pm

Re: C# unable to request data from PicoLog 1216

Postby ziko » Mon Aug 16, 2010 11:08 am

Hi, PL1000_INPUTS, BLOCK_METHOD and PICO_STATUS are essentially enumerated types. So for example in Block Method you have,

BM_SINGLE,
BM_WINDOW,
BM_STREAM,

these can be substituted for a short or an int and would become,

0,
1,
2

Whilst with PICO_STATUS this is similar for a full breakdown of what the values are please look at the user manual under section 3.3.17

http://www.picotech.com/document/pdf/pl1000pg-en.pdf


Hope this helps.
Ziko

Technical Specialist
ziko
Zen Master
Zen Master
 
Posts: 1705
Joined: Fri Dec 01, 2006 10:03 am
Location: St Neots

Re: C# unable to request data from PicoLog 1216

Postby bmac » Mon Aug 16, 2010 3:29 pm

All sorted :D

Cheers for the help!
bmac
Newbie
 
Posts: 0
Joined: Fri Aug 13, 2010 1:14 pm


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

Who is online

Users browsing this forum: No registered users and 0 guests