Problems for controllable output for 5204

Post your LabVIEW discussions here
Post Reply
Yang
Newbie
Posts: 0
Joined: Tue May 08, 2012 4:08 pm

Problems for controllable output for 5204

Post by Yang »

Hi there

I tried to use LABVIEW to develop a controllable output program. I faced, however, some problems:

ps5000SetSigGenBuiltIn
For "waveType", I cannot type "PS5000_SINE" as I can do it in C. If I use the "string convert into number", it cannot be done because "PS" is not number. The type of "waveType" is short, so I donot know how to deal with it.

There are many row in "ps5000SetSigGenBuiltIn", shall I need to make the same number of parameters in labview? From the examples from 5204 CD, it shows there is no need.

The vi attached cannot run well as the example. (the picoscope mark cannot be displayed.) I still have no idea why.

Cheers
Attachments
signal_generator.vi
(12.59 KiB) Downloaded 528 times

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problems for controllable output for 5204

Post by Martyn »

PS5000_SINE is one of the enumerations that we use, all of these are given in ps5000api.h, and is at the bottom of this list and it's value is 0

Code: Select all

typedef enum enPS5000Channel
{
	PS5000_CHANNEL_A,
	PS5000_CHANNEL_B,
	PS5000_CHANNEL_C,
	PS5000_CHANNEL_D,
	PS5000_EXTERNAL,	
	PS5000_MAX_CHANNELS = PS5000_EXTERNAL,
	PS5000_TRIGGER_AUX,
	PS5000_MAX_TRIGGER_SOURCES
}	PS5000_CHANNEL;

typedef enum enChannelBufferIndex
{
	PS5000_CHANNEL_A_MAX,
	PS5000_CHANNEL_A_MIN,
	PS5000_CHANNEL_B_MAX,
	PS5000_CHANNEL_B_MIN,
	PS5000_CHANNEL_C_MAX,
	PS5000_CHANNEL_C_MIN,
	PS5000_CHANNEL_D_MAX,
	PS5000_CHANNEL_D_MIN,
	PS5000_MAX_CHANNEL_BUFFERS
} PS5000_CHANNEL_BUFFER_INDEX;

typedef enum enPS5000Range
{
	PS5000_10MV,
	PS5000_20MV,
	PS5000_50MV,
	PS5000_100MV,
	PS5000_200MV,
	PS5000_500MV,
	PS5000_1V,
	PS5000_2V,
	PS5000_5V,
	PS5000_10V,
	PS5000_20V,
	PS5000_50V,
	PS5000_MAX_RANGES
}	PS5000_RANGE;


typedef enum enPS5000EtsMode
  {
  PS5000_ETS_OFF,             // ETS disabled
  PS5000_ETS_FAST,            // Return ready as soon as requested no of interleaves is available
  PS5000_ETS_SLOW,            // Return ready every time a new set of no_of_cycles is collected
  PS5000_ETS_MODES_MAX
  }	PS5000_ETS_MODE;

typedef enum enPS5000TimeUnits
  {
  PS5000_FS,
  PS5000_PS,
  PS5000_NS,
  PS5000_US,
  PS5000_MS,
  PS5000_S,
  PS5000_MAX_TIME_UNITS,
  }	PS5000_TIME_UNITS;

typedef enum enSweepType
{
	UP,
	DOWN,
	UPDOWN,
	DOWNUP,
	MAX_SWEEP_TYPES
} SWEEP_TYPE;

typedef enum enWaveType
{
	PS5000_SINE,
	PS5000_SQUARE,
	PS5000_TRIANGLE,
	PS5000_RAMP_UP,
	PS5000_RAMP_DOWN,
	PS5000_SINC,
	PS5000_GAUSSIAN,
	PS5000_HALF_SINE,
	PS5000_DC_VOLTAGE,
	PS5000_WHITE_NOISE,
	MAX_WAVE_TYPES
} WAVE_TYPE;
This will give you all the appropriate values that can be passed into the functions.

Not all parameters are needed in all cases as some reference sweeping frequency. Please check out the function definition in the programmers guide for more information.
Martyn
Technical Support Manager

Yang
Newbie
Posts: 0
Joined: Tue May 08, 2012 4:08 pm

Re: Problems for controllable output for 5204

Post by Yang »

Thank you for answering me.
And I still have a question, how to make it controllable. I hope if there is a feedback in program the output of picoscope can be controllable, as the amplitude can be reduced and frequency can be added.
Any suggestions will appreciated.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problems for controllable output for 5204

Post by Martyn »

If you wish to make changes to the amplitude or frequency you will need to make a call to ps5000SetSigGenBuiltIn with the new parameters.
Martyn
Technical Support Manager

Yang
Newbie
Posts: 0
Joined: Tue May 08, 2012 4:08 pm

Re: Problems for controllable output for 5204

Post by Yang »

Hi Martyn;
Now my VI can make a controllable output and sample. Thanks for your helps.
Because the frequency I use to test is almost 500 KHz, the capacitance (15pF) of the input channel will affect the data sampled. Now I want to measure the delta phase between the output (which is generated by program with 0 delta phase) and input samples (The circuit I use to test is RC circuit which means the will be 90 degree delta phase in theory). So how can i achieve the phase measurement?
Any suggestion will be appreciated.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problems for controllable output for 5204

Post by Martyn »

I know that with our Picoscope6 software you can add a maths channel to calculate the phase between two signals so I guess you could do the same. The equation is

Code: Select all

acos(integral(A*B)/(sqrt(integral(A*A))*sqrt(integral(B*B))))/Pi*180
Martyn
Technical Support Manager

Yang
Newbie
Posts: 0
Joined: Tue May 08, 2012 4:08 pm

Re: Problems for controllable output for 5204

Post by Yang »

Hi Martyn;

You are unbelievable. Thank you very much.
Could you tell me how`s the equation getting?
The equation can work in Pico 6. However, in labview the result from the equation is just 0 or 180. Kind of confused.
The equation I typed into Labview is as following:
acos(int(A*B)/(sqrt(int(A*A))*sqrt(int(B*B))))/pi*180

Again, thank you very much.

Best Regards
Yang

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problems for controllable output for 5204

Post by Martyn »

You need to be doing the integral in the equation, not int, which will require the LabView integral vi
Martyn
Technical Support Manager

Yang
Newbie
Posts: 0
Joined: Tue May 08, 2012 4:08 pm

Re: Problems for controllable output for 5204

Post by Yang »

Yes. I made a mistake. Thanks for letting me know.
Now I use integral (x).vi. However, the result is not as picoscope where the external components are all the same. For example, the output is 1v Peak to Peak and 10kHz; in picoscope, the delta phase is about 16 degree and the value in my vi is 35 degree. When the output with 100KHz the result no matter in pico or my vi is the same : 75 degree.
Kind of strange. I think the both of integration methods used in pico or labview is Simpson's Rule.
Any suggestion will be appreciated.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problems for controllable output for 5204

Post by Martyn »

One thing we have noted with the equation is that the initial values returned are incorrect, and that there needs to be a settling time to get a true value.
Martyn
Technical Support Manager

Yang
Newbie
Posts: 0
Joined: Tue May 08, 2012 4:08 pm

Re: Problems for controllable output for 5204

Post by Yang »

Hi,Martyn;

I still cannot get the same phase shift value in Labview as it is in Picoscope although I set the initial condition is 0. I assume the different result may be caused by different unit in picoscope 6 and Labview. The x-axis in picoscope is the information of time where unit is second, the x-axis in Labview is the same where unit is point. Will the difference influence the result?
I tried to prove your equation.Assume A=sin(wt+a), B=sin(wt+b) where a,b represent phase information of each signal. However, I cannot simplify it to be acos[cos(a-b)]/pi*180 (from the equation and result, i thought the simplified equation is the function of phase difference between A and B).
From help of Picoscope 6, Integral. Along the x-axis.. The integral (x).vi is the same function which is along the x-axis. Details of this vi are in the attachment.
The equation typed in labview I am so sure there is no problem. The initial condition of each integral function should be the same, from t=0. So I have no idea what causes the difference.
Any helps will be highly appreciated.

Yang
Attachments
integral vi help.jpg

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Problems for controllable output for 5204

Post by Martyn »

I would suggest putting in signals with a known phase shift (90 or 180) and see what results you get.
Martyn
Technical Support Manager

Post Reply