Test and Measurement Forum

Amplitude Problems

Post your LabVIEW discussions here

Amplitude Problems

Postby ulek » Tue Jun 25, 2013 7:10 am

Hey all,

So I got my self a 6404 and I am trying to do some stuff with it using LabView as a interface.

I got the data from the oscilloscope no problem using the block subvi and it looks good, all but on regard. The voltage that is shown by the labview graph is half the voltage that I am using in my generator.
I am running a 5V square wave and when I use the picoscope software I am getting the correct readout of 5V but when I use the LabView with the conversion from ADC to analog I am getting only about 2.5V (it is (raw ADC/32152)*Range) and it isn't the conversion issue as on the ADC I am getting only ~17k

What could be the cause of this?

Thanks for the help!
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Re: Amplitude Problems

Postby Martyn » Tue Jun 25, 2013 10:04 am

Are you set for 50ohm input impedance on the channel settings ?

A quick test would be to change the channel setting in the Picoscope software and see if the readings are the same.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Amplitude Problems

Postby ulek » Tue Jun 25, 2013 10:39 am

I've tried:
- osci set to 50Ohm and FG to 50ohm
- osci set 1MOhm and FG to 50ohm
- osci set to 1MOhm and FG to High Z
- osci set to 50Ohm and FG to High Z

When the scope is set to 50Ohm the wave form is very bad (since the probe is 10MOhm).

I checked the accuracy of the FG using the picoscope software (I get max of about 5.1V ) and then some other oscilloscope (also about 5.1V max)

The shapes is the same in both LabView and Picoscope software, only the amplitude vary

Also the conversion to voltage that I found is not very robust. Is there any other conversion?
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Re: Amplitude Problems

Postby Martyn » Tue Jun 25, 2013 11:45 am

I've tried:
- osci set to 50Ohm and FG to 50ohm
- osci set 1MOhm and FG to 50ohm
- osci set to 1MOhm and FG to High Z
- osci set to 50Ohm and FG to High Z

Just needed to check this wasn't mismatched inputs

When the scope is set to 50Ohm the wave form is very bad (since the probe is 10MOhm).

Makes sense

The shapes is the same in both LabView and Picoscope software, only the amplitude vary

This would suggest that you have the wrong range set in Labview. What range are you using ? and what range in PicoScope ?

Also the conversion to voltage that I found is not very robust. Is there any other conversion?

There can only be one conversion formula, based on maximum ADC count and range.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Amplitude Problems

Postby ulek » Tue Jun 25, 2013 12:39 pm

Martyn wrote:
This would suggest that you have the wrong range set in Labview. What range are you using ? and what range in PicoScope ?

There can only be one conversion formula, based on maximum ADC count and range.


Regarding both things.

As I was checking on the Picoscope software I was using auto and then added a measurment for max. This gave me about 5V.

For the LabView. I am getting a rather strange behavior, for example. I have channel range set to 200mV then I see a saturation and the reading is not reliable. When I go above that value then the signal doesn't saturates but stays at 0.5 amplitude. No matter what the range.
From what I understand in my case the signal amplitude is quantizated by the 16 bit (which is confirmed by the raw ADC graph which swings between 32152 and -32152) NOT the range that is given. Therefore this is rather not robust unless we know what the max amplitude of the signal is.
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Re: Amplitude Problems

Postby Martyn » Tue Jun 25, 2013 2:22 pm

The scope will return ADC counts in the range 32152 and -32152 regardless of the chosen voltage range.

If you have set +/-200mV for your range then 32152 = 200mV and -32152 = -200mV, if you have set +/-2V then 32152 = 2V and -32152 = -2V. Hence the equation that uses the range and the maximum count to work out the voltage value from an individual ADC count.

As you can see from this we use the top 8 bits of a 16 bit value to represent the ADC count for an 8 bit scope, top 12 bits for a 12 bit scope and all 16 bits for our 16 bit scopes.

Our own software can auto range by stepping up if the value is greater than the maximum, or stepping down if the value would be less than the maximum value for the next range down.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Amplitude Problems

Postby ulek » Tue Jun 25, 2013 3:19 pm

I understand what is happening and it make a lot of sense, but I still see two problems:

1. It sitll doesn't explain why my amplitude is halved in LabView.

2. Even though my signal is 5V then theoretically it should saturate all the way untill the range is 5V, while in my case it stops to sarturate at 500mV which gives a false reading and appearance that the signal is 250mV not 2.5V.
´
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Re: Amplitude Problems

Postby Martyn » Tue Jun 25, 2013 6:51 pm

Is it possible that the range setting part has an issue and when you set 500mV it is actually setting a different level. Please post your vi here, or to support@picotech.com, and we can take a look.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Amplitude Problems

Postby ulek » Wed Jun 26, 2013 6:39 am

Attached is my vi.
It isn't even close to being done so there might be a lot of mess. I planning on cleaning it when I get most of the bugs done.

Also the setup is very similar if not identical to the labview examples from the SDK.
Attachments
Prototype_Rev_4_a.vi
(69.43 KiB) Downloaded 216 times
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Re: Amplitude Problems

Postby Martyn » Wed Jun 26, 2013 7:24 am

It's not clear what values you enter into the range box from your Vi.
Are the following values the ones you are using ?

The Picoscope Ranges and multiplication factor so that you graph in mV are
Code: Select all
PS6000_50MV = 50
   PS6000_100MV = 100
   PS6000_200MV = 200
   PS6000_500MV = 500
   PS6000_1V = 1000
   PS6000_2V = 2000
   PS6000_5V = 5000
   PS6000_10V = 10000
   PS6000_20V = 20000
   PS6000_50V = 50000
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Amplitude Problems

Postby ulek » Wed Jun 26, 2013 8:13 am

To be honest I have no idea how to get to that code so I am not sure. I programmed everyting in LabView.

This part I copied straight from the SDK labview example and modified it so it perfromed the way I wanted.

I attached a picture of the values visible in properties
Attachments
Unbenannt.PNG
Unbenannt.PNG (4.25 KiB) Viewed 7049 times
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Re: Amplitude Problems

Postby Martyn » Wed Jun 26, 2013 8:41 am

Those are the enumeration values passed to the set channel call so that the scope is set for a specific range.

What you need is the simple maths to convert ADC counts to mV. The following is how this is done in C
Code: Select all
unsigned short inputRanges [PS6000_MAX_RANGES] = {   10,
                                       20,
                                       50,
                                       100,
                                       200,
                                       500,
                                       1000,
                                       2000,
                                       5000,
                                       10000,
                                       20000,
                                       50000};


/****************************************************************************
* adc_to_mv
*
* If the user selects scaling to millivolts,
* Convert an 16-bit ADC count into millivolts
****************************************************************************/
int adc_to_mv(long raw, int ch)
{
   return (raw * inputRanges[ch]) / PS6000_MAX_VALUE;
}

so you just need to create an array mapping for the inputRanges array in your vi
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Amplitude Problems

Postby ulek » Wed Jun 26, 2013 9:11 am

Martyn wrote: maths to convert ADC counts to mV. ]


Well if the conversion range for the mulitplication should be in mV then I had it wrong. But it doesn't really matter after I converted it to the mV its still doesn't solve any of my problems, neither the amplitude issue nor the saturation at level issues. I made the scheme that I am using into a subvi and I attached it.

Still the main issue here is the half of the amplitude. The signals that I will be measuring will stay in rather predictible range and I will be interested in measuring timings not necessarily the levels and I could get out with using the raw adc range but using volts would be helpful.
Attachments
DAC_as_per_forum.vi
(22.33 KiB) Downloaded 237 times
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Re: Amplitude Problems

Postby Martyn » Wed Jun 26, 2013 9:47 am

Looking at the block diagram you originally posted there is a broken link between Channel A Settings and the PS6000 settings sub Vi block. I don't think that you are correctly setting up the channel which is why the readings are odd and you get saturation.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Amplitude Problems

Postby ulek » Wed Jun 26, 2013 10:13 am

From what I see when the vi is working everything is fine and there are no breaks.
When I change the range at the the main front panel the settings also change in the subvi.
ulek
Newbie
 
Posts: 0
Joined: Tue May 28, 2013 8:52 am

Next

Return to LabVIEW

Who is online

Users browsing this forum: No registered users and 0 guests