Test and Measurement Forum

ps2000_get_times_and_values: times buffer

Post your .Net discussions here

ps2000_get_times_and_values: times buffer

Postby Jimmy_Sk8a » Sun Nov 09, 2008 12:50 am

hello,

getting values with ps2000_get_times_and_values works, but times array is filled with the same number for each value. i think it's a type problem. I tried different declarations:

Code: Select all
[DllImport("PS2000.dll", EntryPoint = "ps2000_get_times_and_values")]
public static extern System.Int32 GetTimesAndValues1(short handle, System.Int32[] time_buffer, short[] buffer_a, short[] buffer_b, short[] buffer_c, short[] buffer_d, short overflow, short time_units, System.Int32 no_of_samples);
...
[DllImport("PS2000.dll", EntryPoint = "ps2000_get_times_and_values")]
   public static extern int GetTimesAndValues2(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);


buffer declaration and function call:
Code: Select all
short[] Values_a     = new short[200000];
short[] Values_b     = new short[200000];
System.Int32[] b_times = new System.Int32[200000];

GetTimesAndValues1(handle,b_times,Values_a,Values_b,new short[0],new short[0],overflow,2,100);
...
short[] Values_a     = new short[200000];
short[] Values_b     = new short[200000];
int[] b_times = new int[200000];

GetTimesAndValues2(handle,b_times,Values_a,Values_b,new short[0],new short[0],out overflow,2,100);


but times values have all the same values, eg. 204793
what am I doing wrong? In Delphi it works with a longint array, and the manuals says long* times, which should be a 32bit-Int in .Net if i'm right.

Thank you for your help!
jimmy
Jimmy_Sk8a
User
User
 
Posts: 2
Joined: Fri Oct 17, 2008 11:43 am
Location: Zurich, Switzerland

Postby Erik » Tue Jan 13, 2009 6:50 pm

Erik
PICO STAFF
PICO STAFF
 
Posts: 53
Joined: Mon Oct 23, 2006 8:16 am
Location: Cambridgeshire, UK

Re: ps2000_get_times_and_values: times buffer

Postby TimOster » Thu Dec 11, 2014 3:52 pm

THANK YOU Eric for the link. I've been struggling with this.

The example code returns raw ADC readings I think. How do you convert that to the actual voltage?

TIA,

Tim
TimOster
Active User
Active User
 
Posts: 12
Joined: Mon Dec 01, 2014 5:36 pm

Re: ps2000_get_times_and_values: times buffer

Postby Hitesh » Thu Dec 11, 2014 5:06 pm

Hi Tim,

You can convert the raw ADC values to milliVolts using the following formula:

Code: Select all
milliVolts = (raw_value / PS2000_MAX_VALUE) * voltage_range_mv

where

PS2000_MAX_VALUE = 32767

e.g.

For a 1V range:

(16384 / 32767) * 1000 = 500mV

Regards,
Hitesh

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


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

Who is online

Users browsing this forum: No registered users and 0 guests