Test and Measurement Forum

Different Results From Picoscope 6 and My Program

Post general discussions on using our drivers to write your own software here

Different Results From Picoscope 6 and My Program

Postby Cwebster » Thu Sep 25, 2014 9:02 pm

Hi,

I'm trying to write a program to do some basic digital signal processing, and I want the program to mimic the data capture that I get when using Picoscope 6.

At the moment I am currently using Block Mode to capture the signal (all the signal is sent within 50ms).

With the settings I am using in Picoscope 6 I am receiving the correct data whereas in my own program, although I am attempting to mimic exactly the same settings from Picoscope 6; I am receiving a completely different signal.

I am just wondering if Picoscope 6 performs any actions on the data after receiving the data from the oscilloscope?

Below are my settings for PicoScope 6, and how I am configuring the unit in my own program (C++ 2206A).

Picoscope 6:

Channel A: ±200 mV, AC
Channel B: ±2 V, AC
Trigger: Single, Channel B, Rising Edge, 60 mV Threshold, 5% Pre-trigger
Left Axis: 200 mV to -200 mV
Right Axis: 2 V to -2 V
Bottom Axis: -2.5 ms to 47.5 ms
Sample Interval: 3072 microseconds
No. of Samples: 16276

My Program:

ps2000aSetChannel( Handle, PS2000A_CHANNEL_A, TRUE, PS2000A_AC, PS2000A_200MV, 0 )
ps2000aSetChannel( Handle, PS2000A_CHANNEL_B, TRUE, PS2000A_AC, PS2000A_2V, 0 )
ps2000aGetTimebase2( Handle, 194, 16276, NULL, 0, MaxSamples, 0 )
ps2000aSetSimpleTrigger( Handle, 1, PS2000A_CHANNEL_B, 975 (ADC Count equivalent to 60 mV?), PS2000A_RISING, 0, 0 )
ps2000aRunBlock( Handle, ( MaxSamples / 100 * 5 ), ( MaxSamples / 100 * 95 ), 194, 0, TimeIndisposed, 0, NULL, NULL )
I am using PS2000A_RATIO_MODE_NONE with Down Sample Ratio = 1

Thanks,
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: Different Results From Picoscope 6 and My Program

Postby Martyn » Mon Sep 29, 2014 1:56 pm

I take it you meant 3.072usecs to give 16272 samples in the 50ms of screen display with PicoScope 6

Using the timebase formula
Code: Select all
sample interval = (timebase - 2) / 125,000,000

this gives a timebase of 386.

BTW If you pass in a pointer to a float in ps2000aGetTimebase2 it will tell you the sample interval for the selected parameters
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Different Results From Picoscope 6 and My Program

Postby Cwebster » Tue Sep 30, 2014 2:23 pm

Thanks for the reply,

Im using the Picoscope 2206A, and in the programmers guide the timebase formula says:

Code: Select all
(timebase - 2) / 62,500,000


I changed the timebase to see if it helped and I'm still not getting the correct data, are there any other discrepancies in my code compared to the Picoscope 6 settings, or is there any other information I can provide that would help with solving this problem?
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: Different Results From Picoscope 6 and My Program

Postby Martyn » Tue Sep 30, 2014 3:04 pm

What does ps2000aGetTimebase2 return for the sample interval ?

and also make sure the number of active channels is the same in both.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Different Results From Picoscope 6 and My Program

Postby Cwebster » Tue Sep 30, 2014 5:42 pm

When I use 194 I get 3072, using 386 I get 6144.

How do I check the number of active channels in PicoScope?

In my own program I have only called SetChannel for A and B, would I need to call it for the others and then disable them? (I assumed they would all be disabled as default).
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: Different Results From Picoscope 6 and My Program

Postby Martyn » Tue Sep 30, 2014 7:35 pm

That is the correct sample interval, matching the PicoScope 6 value.

Are you changing the returned values, which are adc counts, to mv, as seen in PicoScope 6 ?
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Different Results From Picoscope 6 and My Program

Postby Martyn » Wed Oct 01, 2014 6:12 am

If you can also post some pictures of the waveforms you are receiving from both applications that would help.
Martyn
Technical Specialist
Martyn
Site Admin
Site Admin
 
Posts: 2355
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Different Results From Picoscope 6 and My Program

Postby Cwebster » Wed Oct 01, 2014 10:45 am

Martyn wrote:That is the correct sample interval, matching the PicoScope 6 value.

Are you changing the returned values, which are adc counts, to mv, as seen in PicoScope 6 ?


Yes, Im using the following formula to change my adc counts into mv:

mv = ( ( adc * max value of channel ) / maximum adc count of scope )

converting channel a's values means that the values are:

mv = ( ( adc * 200 ) / 32512 ) (returned as a float)

Is this correct?
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm

Re: Different Results From Picoscope 6 and My Program

Postby Cwebster » Wed Oct 01, 2014 11:42 am

Image from my program:
http://imgur.com/KAQ8RI5

Image from Picoscope 6:
http://imgur.com/ciXbNi3
Cwebster
Newbie
 
Posts: 0
Joined: Fri Aug 29, 2014 1:21 pm


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 0 guests