Test and Measurement Forum

Question on using PS_3000_Get_Timebase in LabVIEW

Post your LabVIEW discussions here

Question on using PS_3000_Get_Timebase in LabVIEW

Postby aiyoung » Sat Feb 18, 2012 12:39 am

Hi,

I'm trying to modify the ps3000_runBlock.vi example to use PS_3000_Get_Timebase and PS_3000_Get_Times_and_Values functions.

I've used "Call Library Function" nodes to call the functions to ps3000.dll in the same manner that the existing functions in the example use the "Call Library Function" nodes.

I think i am confused as to how the Get_Timebase function works.

Does the Get_timebase function spit out the best value for timebase given a user set "number of samples", "time_unit", and "time_interval" settings?

Thanks for reading my post.
aiyoung
Newbie
 
Posts: 0
Joined: Sat Feb 18, 2012 12:27 am

Re: Question on using PS_3000_Get_Timebase in LabVIEW

Postby aiyoung » Mon Feb 20, 2012 6:10 pm

I also had a question about how the ps3000_getvalues and ps3000_get_times_and_values function operates.

Using the ps3000_set_channel function, one can state if a channel is active or not. With ps3000_getvalues and ps3000_get_times_and_values, the programmers guide states that you have to write NULL to a buffer so that nothing will be written to the channel. In the ps3000_runblock.vi, all four channels receive a buffer array that is preconfigured outside of the while loop. Does this mean that all four channels are always active regardless of how the ps3000_set_channel function is set up in this example?

below is a link to my .vi's of my modified ps3000_runblock if that would be more helpful in answering my questions.

I had to use dropbox because the .zip is just a tad larger than the fileupload limit of these forums.

http://dl.dropbox.com/u/825092/revised%20picoscope%2002-17-2012.zip

It's a zip file because i've created some sub vi's of the "call library function nodes" to clean up the main vi.

Note that i've also replaced the ps3000_getvalues node with ps3000_get_times_and_value that is supposed to call that function in the ps3000.dll. Also, you will probably have to tell the subvi's where the ps3000.dll (included in the .zip) is before the main vi is ready to run.

Thanks again for reading my post.
aiyoung
Newbie
 
Posts: 0
Joined: Sat Feb 18, 2012 12:27 am

Re: Question on using PS_3000_Get_Timebase in LabVIEW

Postby Hitesh » Fri Feb 24, 2012 12:03 pm

Hi,

Thanks for waiting for a response to your queries.

The Programmers Guide provides some guidance to your queries:

http://www.picotech.com/document/pdf/PS3000-en-3.pdf

With respect to the get_timebase function, step 4 in section 4.2.4.2 (Using block mode) states that timebases are selected until the required ns per samples is achieved - you will probably need to run the call through a while loop to keep incrementing the timebase and checking the outputs from the function for the time interval and units until you achieve the desired sampling interval as per the C code example in the SDK. The function will return 1 if all the parameters are in range so you can use this as a check.

As per the Programmer's guide 'Timebase 0 is the fastest timebase, timebase 1 is twice the time per sample of timebase 0, timebase 2 is four times, etc.'. Which device are you using - the maximum sampling rate does vary across the old 3000 series range.

With regards to the second question in relation to the buffers, a channel will only be active if the ps3000_set_channel function has been called with the channel set to enabled. In the description of the ps3000_get_values, the arguments section states 'A pointer is unused if the oscilloscope is not collecting data from that channel. If a pointer is NULL, nothing will be written to it.'. There is no harm in setting a buffer to the channel as it won't be used unless the channel is activated.

I hope this provides sufficient clarification, but please respond to this post if you require any further information.

Regards,

Hitesh
Hitesh

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

Re: Question on using PS_3000_Get_Timebase in LabVIEW

Postby aiyoung » Mon Feb 27, 2012 5:04 pm

Hello Hitesh,

Thank you for responding to my inquirey.

The main thing i don't understand about the Get_Timebase function is what the input parameters to the function are.

The function is stated as follows in the programmers guide.

short ps3000_get_timebase (
short handle,
short timebase,
long no_of_samples,
long *time_interval,
short *time_units,
short oversample,
long *max_samples )

Here is how i am interpreting what is written in the programmers guide.

I know that i have to pass in handle as a parameter so that the function knows where the picoscope is. Timebase is what the function should spit out (correct?).

Then no_of_samples, time_interval, time_units, and oversample should all be passed into the function as user set values while max_samples is a value that is spit out by the function.

As to my question about get_values, i've seen that writting a buffer value doesn't affect if the example will run, however the picoscope seems to write data to these buffers even if the channel was disabled using the set_channel function. Or am i wrong and the get_values function simply passes the empty array?

My concern is that since the picoscope is writing data to these buffers, my maximum sampling rate, as shown on the table on page 8 of the programers guide, will be limited.
aiyoung
Newbie
 
Posts: 0
Joined: Sat Feb 18, 2012 12:27 am

Re: Question on using PS_3000_Get_Timebase in LabVIEW

Postby aiyoung » Mon Feb 27, 2012 5:12 pm

It might be helpful if i explain a bit more on what my end goal is.

What i want to get is time values that correspond to the data points that my picoscope read.

I am using a tunable laser that can output different wavelengths of light. I set the sweep range and the sweep rate on the laser. The laser sends a trigger signal to the picoscope when a sweep starts.

I want my .vi to collect data once it see's that trigger for the duration of the sweep (usually 2-3 sec depending on the laser settings) and output data in the form of voltage vs frequency.

If i have time values, that correspond to when a given datapoint was taken, i can use the sweep rate of my laser to figure out what frequency the laser was tuned to when that datapoint was taken.
aiyoung
Newbie
 
Posts: 0
Joined: Sat Feb 18, 2012 12:27 am

Re: Question on using PS_3000_Get_Timebase in LabVIEW

Postby Hitesh » Tue Feb 28, 2012 12:17 pm

Hi aiyoung,

Thanks for your 2 posts.

In relation to the ps3000_get_timebase() function, the time_intyerval will also be written back to in order to indicate the time interval between readings (in ns) at the specified timebase.

The time_units variable will also be written to by the driver to indicate the most suitable time units.

I've run a quick test using the C console example and modified the LabVIEW PS3000 Run Block vi. I used a PicoScope 3204 for both.

With the console example I left the array pointers for channels C and D to the ps3000_get_values() function despite there being only 2 channels on the scope and nothing was written to them.

In the LabVIEW example, I experimented with turning Channel B on and off - when it is off, nothing is written to the buffer as can be seen in the axis display. When it is turned on (with no signal applied) there is an offset.

This means that if the channel is NOT enabled the buffer will NOT be written to.

I presume you are intending to use the ps3000_get_times_and_values() function in order to capture the times?

I hope this provides suitable clarification for you.

Regards,
Hitesh

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


Return to LabVIEW

Who is online

Users browsing this forum: No registered users and 0 guests