Test and Measurement Forum

c# picoscope 2105

Post your .Net discussions here

c# picoscope 2105

Postby MatrixCow » Wed Apr 09, 2008 12:41 pm

Hello,

I'm writing an application that uses the picoscope 2105. I need to analyse the values that I measure.
Is there a fast way to get the pulse width, frequency, ... .

And I also can't read values with the ps2000_get_times_and_values method.

I already wrote a class that implements the methods in the ps2000.dll. And I can make connection.

Can somebody help me?
Thanks
MatrixCow
Active User
Active User
 
Posts: 7
Joined: Wed Apr 09, 2008 12:37 pm
Location: Belgium

Postby MatrixCow » Thu Apr 10, 2008 8:15 am

I'm also having problems with understainding what is being returned by the get_values function.
Can't anybody help? It's an urgent project.
MatrixCow
Active User
Active User
 
Posts: 7
Joined: Wed Apr 09, 2008 12:37 pm
Location: Belgium

Postby MatrixCow » Tue Apr 15, 2008 1:08 pm

Anybody? :(
MatrixCow
Active User
Active User
 
Posts: 7
Joined: Wed Apr 09, 2008 12:37 pm
Location: Belgium

Postby gruntman » Thu Apr 17, 2008 4:03 pm

MatrixCow,

First off which issues are you having with the get_values function? I am assuming you are having issues with the scaling. The driver normalizes all readings to 16 bits, regardless of the vertical resolution of the oscilloscope. The values returned from the get_values function will vary between -32768 and 32767. -32768 will be outputed if you are overrunning the buffer, for example if you are on the 2V scale but are inputting a 5V signal. -32767 is the negative full scale, 0 is zero volts, and 32767 is the positive full scale. So for example if you are on the 2V scale, -2V is -32767 and +2V would be outputed as 32767. To change this to mV you take the raw value, times it by the voltage scale you are using (so 2V scale you would times it by 2, 500mV scale by .5 and so on) and then divide this value by 32767.

At which call is the error occuring with the ps2000_get_times_and_values function?

Measurements such as pusle width, frequency etc are all derived by applying math in the program to the raw mV and time values returned from the PicoScope. All these calcuations are done by the computer and not the scope itself. To obtain these values you will have to write code for them. Is there a specific reason why PicoScope 5 or 6 will not work for what you are doing? These measurements are avaliable with a click of the button in this software.

Regards,

Richard Boyd
Crag Technologies, Inc
http://www.pc-oscilloscopes.com
gruntman
Guru
Guru
 
Posts: 109
Joined: Thu Sep 28, 2006 3:50 pm

Postby MatrixCow » Fri Apr 18, 2008 7:22 am

Code: Select all
        [DllImport("PS2000.dll", EntryPoint = "ps2000_open_unit")]
        public static extern int OpenUnit();
        //[DllImport("PS2000.dll", EntryPoint = "ps2000_set_unit")]
        //public static extern int SetUnit(int handler);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_flash_led")]
        public static extern short FlashLed(short handler);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_close_unit")]
        public static extern void CloseUnit(short handler);

        //[DllImport("PS2000.dll", EntryPoint = "ps2000_get_unit_info")]
        //public static extern short GetUnitInfo(short handler, ref string str, short lth, short line_no);

        [DllImport("PS2000.dll", EntryPoint = "ps2000_set_channel")]
        public static extern short SetChannel(short handle, short channel, short enabled, short dc, short range);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_set_trigger")]
        public static extern short SetTrigger(short handle, short source, short threshold, short direction, short delay, short auto_trigger_ms);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_get_timebase")]
        public static extern short GetTimebase(short handle, short timebase, int no_of_samples, ref int time_interval, ref short time_units, short oversample, ref int max_samples);

        [DllImport("PS2000.dll", EntryPoint = "ps2000_run_block")]
        public static extern short RunBlock(short handle, int no_of_values, short timebase, short oversample, ref int time_indisposed_ms);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_run_streaming")]
        public static extern short RunStreaming(short handle, int time_interval, int max_samples, short windowed);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_ready")]
        public static extern short Ready(short handle);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_get_values")]
        public static extern int GetValues(short handle, ref short buffer_a, ref short buffer_b, ref short buffer_c, ref short buffer_d, out short overflow, int no_of_values);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_get_times_and_values")]
        public static extern int GetTimesAndValues(short handle, ref int times, ref short buffer_a, ref short buffer_b, ref short buffer_c, ref short buffer_d, ref short overflow, short time_units, int no_of_samples);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_stop")]
        public static extern short Stop(short handle);

        [DllImport("PS2000.dll", EntryPoint = "ps2000_set_ets")]
        public static extern int SetEts(short handle, short mode,short ets_cycles,short ets_interleave);

This is the class that i wrote to implement the methods. I could have made a mistake here.
The problem with the get_times_and_values method is that it returns 0 values. But with the get_values method I get methods.
I'm writing an application to automate an electronic test. And I need to compare values read from the picoscope.
MatrixCow
Active User
Active User
 
Posts: 7
Joined: Wed Apr 09, 2008 12:37 pm
Location: Belgium

Postby MatrixCow » Wed May 07, 2008 1:06 pm

Am I the only one that wants to write a .NET application for this?
And is there no support for .NET? The new PicoScope 6 is a .NET application.

Pico only supports vb6. I really don't get why it's so difficult to get to get some support on this topic.

I really need to know this. It's for my graduation project.
Maybee it's just a mistake in the settings that i send to the scope. I just need to read a 5V DC and calculate the pulse width.
MatrixCow
Active User
Active User
 
Posts: 7
Joined: Wed Apr 09, 2008 12:37 pm
Location: Belgium

Postby markspencer » Tue May 13, 2008 12:07 pm

Hi,

I am sorry to hear you are experiening problems. The first issue that I noticed is that you have decalred the following prototypes, they should actually read:


Code: Select all
     [DllImport("PS2000.dll", EntryPoint = "ps2000_get_values")]
        public static extern int GetValues(short handle, short [] buffer_a, short [] buffer_b, short [] buffer_c, short [] buffer_d, out short overflow, int no_of_values);
        [DllImport("PS2000.dll", EntryPoint = "ps2000_get_times_and_values")]
        public static extern int GetTimesAndValues(short handle, int [] times, short [] buffer_a,  short [] buffer_b, short [] buffer_c, short [] buffer_d, out short overflow, short time_units, int no_of_samples);


Once you ps2000_run_block has succeded and you have tested ps2000_ready to be true, then you can call either of the get values functions, they both should return the same ADC readings.
Regards,

Mark Spencer
User avatar
markspencer
Site Admin
Site Admin
 
Posts: 598
Joined: Wed May 07, 2003 9:45 am

Postby MatrixCow » Wed May 14, 2008 6:46 am

Hello,

I've been experimenting with the picoscope and I succeeded in reading the times and values.

I played around with the settings and it worked so I don't really know what the problem was.

Is there a limit on how many values you can read with the run_block method?
MatrixCow
Active User
Active User
 
Posts: 7
Joined: Wed Apr 09, 2008 12:37 pm
Location: Belgium

C# Analaysis

Postby fordp » Wed Feb 25, 2009 4:27 pm

I have a simalar need.

I would like to use the PicoScope 6 software in Single Trigger mode and then suck the samples out and analyse the samples in a C# in a Forms based application.

What is the nearest examle for this either from Pico or elsewhere ?
fordp
Newbie
 
Posts: 1
Joined: Wed Feb 25, 2009 2:25 pm

Postby Robin » Thu Feb 26, 2009 12:10 pm

Hi

The closest example that we have is a Win32 C example, PS2000.C in the SDK. We also have a C console example. These should give you a good idea of how to use the API.

We don't have any examples using .net, I'm afraid.

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: c# picoscope 2105

Postby TimOster » Thu Dec 04, 2014 4:12 pm

Why not, when the program you release is written in .net? Sure seems to be a lot more people interested in .net than vb6.
TimOster
Active User
Active User
 
Posts: 12
Joined: Mon Dec 01, 2014 5:36 pm

Re: c# picoscope 2105

Postby Martyn » Fri Dec 05, 2014 7:08 am

You may notice that the previous post was from 2009.

We do offer .Net example programs for our scopes, they are included in the current SDK's.

For interest there are still a large number of people who use VB6 and ask for support.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
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