|
|
| Author |
Message |
MatrixCow Active User

Joined: 09 Apr 2008
Posts: 7
Location: Belgium
|
Posted: Wed Apr 09, 2008 12:41 pm Post subject: c# picoscope 2105 |
|
|
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 |
|
| Back to top |
|
 |
MatrixCow Active User

Joined: 09 Apr 2008
Posts: 7
Location: Belgium
|
Posted: Thu Apr 10, 2008 8:15 am Post subject: |
|
|
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. |
|
| Back to top |
|
 |
MatrixCow Active User

Joined: 09 Apr 2008
Posts: 7
Location: Belgium
|
Posted: Tue Apr 15, 2008 1:08 pm Post subject: |
|
|
Anybody?  |
|
| Back to top |
|
 |
gruntman Guru

Joined: 28 Sep 2006
Posts: 87
Location: Garden City, KS USA
|
Posted: Thu Apr 17, 2008 4:03 pm Post subject: |
|
|
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 |
|
| Back to top |
|
 |
MatrixCow Active User

Joined: 09 Apr 2008
Posts: 7
Location: Belgium
|
Posted: Fri Apr 18, 2008 7:22 am Post subject: |
|
|
| Code: | [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. |
|
| Back to top |
|
 |
MatrixCow Active User

Joined: 09 Apr 2008
Posts: 7
Location: Belgium
|
Posted: Wed May 07, 2008 1:06 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
markspencer Site Admin

Joined: 07 May 2003
Posts: 610
|
Posted: Tue May 13, 2008 12:07 pm Post subject: |
|
|
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: | [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. |
|
| Back to top |
|
 |
MatrixCow Active User

Joined: 09 Apr 2008
Posts: 7
Location: Belgium
|
Posted: Wed May 14, 2008 6:46 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
|
Powered by phpBB © 2001, 2005 phpBB Group
|