Electronic – Reading an Analog Voltage Waveform with a Programmable Scope

analoginstrumentationoscilloscopescpivoltage

I am trying to automate the use of a Tektronix TBS 1052B digital oscilloscope in order to get the waveform for an analog voltage signal. Or in other words, get a number of voltage measurement samples over time.

There seem to be at least two measurement modes for configuring the scope to perform the measurement, MEASurement and WAVFrm. This is where I am having some trouble. Based on the way that WAVFrm works, it seems like that is only used for interpreting binary data (this is where I could be wrong) so that seems like the configuration I should not be using. On the other hand, the documentation for MEASurement does not describe a way for taking a specific number of samples (which is what I need to do in order to get the analog waveform), so this also does not seem like a reasonable configuration.

It seems like no matter which configuration I pick, it will not give me the result I am looking for! I must be getting confused by their documentation [here].

Can anyone help shed light on which configuration I should be using, MEASurement or WAVFrm?

Best Answer

I've never used this particular oscilloscope, but I'll give it a go. Note that you'll need to figure out how to incorporate the command sequence I've recommended below into whichever data acquisition software package you're using (LabVIEW, MATLAB, VEE, etc.).

Start by resetting the oscilloscope's controls and settings to their "factory setup defaults" (see also appendix B "Factory Setup" in the TBS1000 Programmer manual [hint: search for "tbs1000 programmer manual" on tek.com]). This is done by issuing the SCPI "*RST" command:

*RST

Display channel 1, AND turn OFF channel 2:

SELECT:CH1 ON;CH2 OFF

Configure the horizontal, vertical, triggering controls, etc. as desired—e.g., horizontal time/div = 1ms/div; channel 1 volts/div = 1V/div:

HORIZONTAL:MAIN:SCALE 1E-3
CH1:SCALE 1

Configure the oscilloscope to acquire a single waveform when the oscilloscope detects that the triggering conditions are met:

ACQUIRE:STATE STOP
ACQUIRE:STOPAFTER SEQUENCE

Acquire a single waveform ("run once"):

ACQUIRE:STATE RUN

Wait for the data acquisition to complete. This is done by issuing the SCPI query "*OPC?" (operation complete?). As stated in the oscilloscope's Programmer manual, "[t]he *OPC? response is not available to read until all pending operations finish", meaning the *OPC? invocation blocks until the oscilloscope finishes the data acquisition task.

*OPC?

In the WAVEFORM commands group, use the CURVE? query to transfer Channel 1's waveform data from the oscilloscope to your computer:

DATA:SOURCE CH1
CURVE?

Note that the "CURVE?" query returns a stream of bytes that are typically stored in a buffer that your program creates for this purpose (e.g., a character array, or a byte array). Your program then parses the desired information from the stored data in the buffer. Exactly how this is done depends entirely upon the programming language and instrument I/O libraries you're using—e.g., LabVIEW, MATLAB, VEE, etc.—and is left as an exercise for the reader.

P.S. If you need help writing the code for a specific programming language, I recommend you find/use forums that are dedicated to the particular programming language you're working with—e.g., LabVIEW instrument I/O programming forums; MATLAB instrument I/O programming forums, etc. Those folks would be much better suited to answering programming language specific questions than the folks in an electronics forum. (<- Not complaining/whining, just sayin'...)

Related Topic