Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 29, 2024, 03:00:19 15:00


Login with username, password and session length


Pages: [1]
Print
Author Topic: pc based oscilloscope buffer size problem  (Read 4374 times)
0 Members and 1 Guest are viewing this topic.
larry_tye
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 38
-Receive: 1


« on: July 14, 2010, 01:53:43 13:53 »

I found several c# and c++ programs about pc based oscilloscope , they have buffer size range from ten thousands to store data from adc . If you use a rectangle size said 700x500 pixel to display the waveform , a maximium of horizontal 700 pairs of data to display on this rectangle (using drawline methods in c#) . But the buffer size is ten thousand long , how can this rectangle accommodate this large buffer size ??
Logged
DreamCat
Senior Member
****
Offline Offline

Posts: 284

Thank You
-Given: 223
-Receive: 116



« Reply #1 on: July 14, 2010, 04:37:10 16:37 »

if you want display all data, you need process the data and zoom out it( I don't know how to say it, just extract by scale)

Logged

May be I expressed the wrong meaning, sorry for my bad english. Please correct it for me if you can.
SBW
Newbie
*
Offline Offline

Posts: 7

Thank You
-Given: 0
-Receive: 0


« Reply #2 on: July 14, 2010, 05:18:37 17:18 »

Standalone digital oscilloscopes do this also.  They capture a full (bigger than can be displayed one-to-one) buffer, and then display a 'window' that displays part of the data.  The position and size of this window can be adjusted.

Usually they zoom out (display more horizontal time than would fit with a 1 sample to one pixel mapping) by sub-sampling: they just ignore the samples between the samples that are displayed.  This can cause aliasing: a signal at one frequency looks like it has a different frequency.  If you have 100 cycles of a sine wave displayed on the screen, and you zoom out (display more time on the x-axis) 100x, you would expect there to be 10,000 cycles across the display, but because you do not have that many pixels, you might see 1 (or any number) of cycles of an apparently perfect sine wave, but each pixel is coming from a different cycle of the input signal.  (Then you end up chasing a 300 kHz oscillation in your circuit that never existed--it was just the pickup of the 100 MHz FM radio transmitter near to your lab being aliased down.  I did this last week.)

If you down-sample instead of sub-sample, by averaging N adjacent samples together, you can reduce aliasing *and* get more vertical resolution.  To avoid aliasing, instead of just reducing it, you have to digitally filter the original samples to limit their signal bandwidth to the Nyquist limit for your new sample rate before sub-sampling.  Averaging is a low-pass filter, but it does not have a steep roll-off. 

If you average 256 successive 8-bit samples together, you can get log2(sqrt(256))=4 more bits of resolution, so it can be like you had a 12 bit A/D converter.  (You do need to have enough random noise so that the LSB of your actual A/D does not give you the same value each time.)  This only works if your A/D is faster than you need for the time resolution you are displaying.  Standalone oscilloscopes rarely do this, because they do not have enough DSP power to process the data and keep the frame rate up.
Logged
LabVIEWguru
Senior Member
****
Offline Offline

Posts: 300

Thank You
-Given: 270
-Receive: 593



« Reply #3 on: July 14, 2010, 07:17:03 19:17 »

If I understand what you are asking, back in the Radio Shack Model I days I used graph paper to work out the display then stored what I wanted to display in two bytes (it's been a LONG time ago) like: HHVV VALU (horizontal position, vertical position, value of that display point) - you can manipulate your data set for left - to - right or right - to - left to make it really fast and not store the entire display buffer. Of course, you have to adapt this idea to your particular application.

As the gentleman above me pointed out, you can use tricks to dither (you need speed) or I used "binning" - I assigned a memory location to each sample, took a number of samples and applied a "binning filter" to the memory location. That eliminated my noise because samples of the same size tended to "persist". I've seen proprietary systems that include their own memory (as in LOTS OF) on a daughter board to eliminate the problems you are describing (and others). 

Note: Your mileage may vary. This was done a long time ago. There are probably really cool algorithms in the last 20 years I couldn't even begin to understand.  National Instruments and Keithley make REALLY COOL O'scope cards if you have the money. As expensive as they are, they are only a fraction of a high end scope. Good luck - sounds like a cool project.
Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #4 on: July 14, 2010, 09:21:33 21:21 »

http://www.sonsivri.com/forum/index.php?topic=6114.msg77694#msg77694
EPE used Cache Ram for the storage.
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
larry_tye
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 38
-Receive: 1


« Reply #5 on: July 15, 2010, 01:45:47 13:45 »

Thanks for all of yours reply , as I  use cypress cy7c64013 (usb 2.0 high speed) FIFO to transmit adc data to pc (c# program to process the data) . ADC use Analog Device AD9288 (125 MSample/S) .Under this 125M Sample rate what
is the prefer value of buffer size , if 500 is enough ?  If so only 1/250000  of the data is used, a large amount of data is lost , any solutions to solve this problem, are there any calculation for this buffer size Huh
Logged
LabVIEWguru
Senior Member
****
Offline Offline

Posts: 300

Thank You
-Given: 270
-Receive: 593



« Reply #6 on: July 15, 2010, 07:16:34 19:16 »

What is the maximum frequency of your samples? If you are only looking in the audio range, you can drop the number of samples to a reasonable amount. You aren't going to sample much with the method you are using. The ADC is capable of reasonable fast (for experimentation) sampling, but:

1) You have Mr. Nyquist to contend with. for a reasonable sample, 2X isn't enough.
As an example, a square wave is the sum of all the harmonics (or is it algebraic sum). At your maximum frequency, you are going to need (just a guess) 8 or 16 samples for an accurate representation, then you still have to make assumptions (extrapolate points) between these samples. Once you have this particular set of samples you can decimate the number pf points comprising the sample, or as SBW pointed out, average "X" adjacent samples together.

2) Go wild, use two micros (one to sample, one for communications) and dual-port RAM. Of course, if you do all that, you may as well buy a scope card unless you just want the satisfaction of doing it, which would be very, very cool. Look up the magazine pickit2 mentioned. Find someone that has one of those advertised little scopes that hook to the USP port and pry it open for a quick look. Cool project. I hope you do well.

Posted on: July 15, 2010, 08:09:10 20:09 - Automerged

HeY Pickit! That is truly cool! Larry_Tye, goto the link Pickit2 provided. That is a truly incredible scope built around an ATMega. You have example software, example schematic, etc. You don't have to copy this, but it's a great place to start. That's why I love this site!
Logged
larry_tye
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 38
-Receive: 1


« Reply #7 on: July 16, 2010, 01:18:56 13:18 »

the frequency to be measured is from 200Hz to 12MHz . what get my head big is I have no idea about how the waveform (voltage) vary with different timebase . This link is great but have no source code and no idea to borrowed from . http://kudelsko.free.fr/oscilloscope/sommaire.htm
« Last Edit: July 16, 2010, 01:27:05 13:27 by larry_tye » Logged
LabVIEWguru
Senior Member
****
Offline Offline

Posts: 300

Thank You
-Given: 270
-Receive: 593



« Reply #8 on: July 16, 2010, 07:08:49 19:08 »

If you keep the sample size the same, the waveform till be less wide (to look at) but higher resolution.

If you take (just for easy numbers) 10 samples a second, and you have 1 waveform per second, you will have sampled the waveform 10 times. There are "empty" spaces between the samples, so you must average, or "dither" the samples on each side of the "space" in order to connect between the sample points.

Now at 10 samples a second, and your waveform is 10 seconds long you have 100 points = a very accurate representation of the waveform, but there are still "spaces" between the points that you have to extrapolate data between the points to show a nice waveform. You could also sample the same 100 points many, many times (like my scope does) to give an accurate representation.

Now, at 10 samples a second and you try to see a waveform that is one millisecond (.001 second) you may see it with 10 samples if you are lucky or you may not. Even if you do see it it won't be an accurate picture because you have at the most 1 point. You don't know if it gets larger, smaller, rings or whatever because you only got lucky to see it with one point.

This is why TEK and HP make so much money and have such cool products.

The quick answer is that if the number of samples is the same, you can make the waveform as nice (many points) as you want. You probably don't need 1,000,000 samples/second at 200 Hz but 1,000,000 samples/sec at 12 Mhz is not enough unless you do magic tricks with software.

Look up sampling theory, Nyquist theory or get some books on instrumentation to see how the scope works.

Look at this from Pickit2:

http://www.sonsivri.com/forum/index.php?topic=6114.msg77694#msg77694
EPE used Cache Ram for the storage.

unzip it, look at his code. This is a beautiful instrument - very, very smart person
« Last Edit: July 16, 2010, 07:11:20 19:11 by LabVIEWguru » Logged
pickit2
Moderator
Hero Member
*****
Offline Offline

Posts: 4639

Thank You
-Given: 823
-Receive: 4194


There is no evidence that I muted SoNsIvRi


« Reply #9 on: July 19, 2010, 03:48:31 15:48 »

This looks good

http://code.google.com/p/dsonano/downloads/detail?name=DS0201_OpenSource.rar&can=2&q=
Logged

Note: I stoped Muteing bad members OK I now put thier account in sleep mode
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC