03-15-2013 06:45 AM
Hi !
I'm designing an application for which I need to measure short pulses, so I get a waveform from a scope, and i need the range of the scope to adapt regarding on the value of the pulse (so if the range is'nt adapted, I delete the waveform, reconfigure the oscilloscope with a bigger range, and send the pulse again). But I want all of it to be automatic, so the application have to find if the range is ok or not by itself.
I use this little subVI to detect a saturation (= data out of range), but it detects a saturation rarely ever. So what do you think is wrong with it ?
thanks a lot 🙂
Solved! Go to Solution.
03-15-2013 07:11 AM
_zeyol_,
Most scopes can be queried for errors and warnings. An over range or clipping condition should generate an error or warning. I would think that that would be the quickest, most efficient method of detecting a problem.
03-15-2013 08:32 AM
thanks for that quick answer.
The scope I'm using is a agilent MSO6104. I querry it for errors after each measurment and it doesn't return anything, that's why I tried to do it by myself.
03-15-2013 08:57 AM
Is there a seperate command for warnings?
03-15-2013 09:03 AM
Hi,
comparing dbl values for equality may not work as expected due to the way these numbers are represented in the binary world of computers.
Maybe you can check if adjacent points are very similar instead? Before your loop you could multiply your array by say 10^12 convert it to i64 and then check for equality.
Also I'd recommend adding an abort condition to your for loop, get rid of the local and just wire the result of >=5 to your condition and to "flag" outside the loop.
Regards
Florian
03-15-2013 09:03 AM - edited 03-15-2013 09:06 AM
"Is there a seperate command for warnings?"
no, there's only "error querry", and I had a look in the configuaration VIs, nothing seems to be used for warning or over range detection
Florian.Ludwig, I didn't thought about this, it could explain why it work some times but often not ! I'll try it
03-15-2013 09:45 AM
I did a similar test for this condition quite easily, however, it was for a TEK scope.
I download the data in unsigned word format, then scale it to its correct values. So if any data is 0 or 65535, then it is likely that part of the data is out of range. (It is also possible that it is at the very limit of its range.) See attached snippet.
Cheers,
mcduff
03-15-2013 10:41 AM
I like you're solution, but I don't really get your code...
what do you mean by "scale it to its correct values" and how do you do it ?
03-15-2013 11:09 AM
I do not know how you are downloading your data from your scope. Scopes are typically 8 bits of precision, although when they average data the effective bits can increase.
So the data on the scope screen is typically an array of values from 0 - 255, (8 bit), possibly greater if someone averages the data, 0 - 65535. To get the real values in volts, you just do a linear transformation, ie, y = mx + b.
So in my program, I download the voltage values as an array of 16 bit words, in case someone decided to average the data. Along with that data, there is a header. The header contains a voltage offset, b in the equation above, and a scaling factor, m, in the equation above. Multiply and add the values to the array and you get an array of real voltage values. Also contained in the header is a starting time, a time increment, and the number of points. You can use these values to create the time array if it is needed.
The added advantage of downloading the data in this manner is that it is faster than downloading the values in ascii format.
So I would say, look at your program and see how the data is being downloaded.
Attached is a snippet from a program that converter the header and bytes from a HP54845A scope, I do NOT know whether your scope has the same format or not. But here is a description of what it is doing.
The data and header are combined in one data stream; earlier in the program I removed any ascii descriptions from the header so only numbers and a byte stream are being downloaded. The header data are parsed, and the byte stream is converted into signed 16bit integers in this case, then converted to real voltage values.
Hope this makes sense as I will be out of the office for a while and unable to follow up.
Cheers,
mcduff
03-18-2013 10:42 AM
I download the data of the scope using its drivers, so I get a waveform, from which i can extract the table of float values. so I don't have access to the digital values
but thanks for the explanations 🙂