20.01.2015 Views

Programming Guide DS2000 Series Digital Oscilloscope

Programming Guide DS2000 Series Digital Oscilloscope

Programming Guide DS2000 Series Digital Oscilloscope

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3 <strong>Programming</strong> Demos RIGOL<br />

Matlab <strong>Programming</strong> Demo<br />

The function of the program: make FFT operation on the waveform data and draw<br />

the waveform. You need to install the Matlab.<br />

1. Create the WaveData.m file under the user-defined directory.<br />

2. Create the device. The first parameter is the distributor and can be Agilent, NI<br />

or Tek. The second parameter is the resource descriptor. You need to set the<br />

properties of the device after creating the device. In this demo, the length of the<br />

input buffer is set to 2048.<br />

a) ds2000 = visa( 'ni','USB0::0x1AB1::0x04B0::DS2A0000000001::INSTR' );<br />

ds2000.InputBufferSize = 2048;<br />

3. Turn on the device.<br />

fopen( ds2000 );<br />

4. Request data.<br />

[data,len]= fread( ds2000, 2048 );<br />

5. Turn off the device.<br />

fclose( ds2000 );<br />

delete(ds2000);<br />

clear ds2000;<br />

6. Data processing. The waveform data read contains TMC header. The length of<br />

the header is 11 bytes, wherein, the first 2 bytes are the TMC header denoter (#)<br />

and the width descriptor (9) respectively, the 9 bytes following are the length of<br />

the data, then the waveform data and the last byte is the terminator (0x0A).<br />

Therefore, the effective waveform points read is from the 12nd to the next to<br />

last.<br />

<strong>DS2000</strong> <strong>Programming</strong> <strong>Guide</strong> 3-17

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!