beautypg.com

Matlab programming demo, Matlab programming demo -6 – RIGOL DP832A User Manual

Page 194

background image

RIGOL

Chapter 4 Programming Demos

4-6

DP800 Programming Guide

MATLAB Programming Demo

The program used in this demo: MATLAB R2009a

The function realized in this demo: read the output voltage, current and power measured internally on

CH1.

1

Run the MATLAB software and modify the current directory (namely modify the Current Directory at

the top of the software). In this demo, the current directory is modified to E:\DP800_Demo.

2

Click File New Blank M-File in the MATLAB interface to create an empty M file.

3

Add the following codes in the M file:

dp800 = visa(

'ni'

,

'USB0::0x1AB1::0x0E11::DP8A000001::INSTR'

);

%Create VISA object

fopen( dp800 );

%Open the VISA object created

fprintf(dp800, ':MEAS:ALL? CH1' );

%Send request

meas_CH1 = fscanf(dp800);

%Read data

fclose(dp800);

%Close the VISA object

display(meas_CH1)

%Display the device information read

4

Save the M file under the current directory. In this demo, the M file is named as

DP800_Demo_MATLAB.m.

5

Run the M file and the following running result is displayed in the command window.

This manual is related to the following products: