image thumbnail

XY Text Writer

by

 

Uses the 33522A waveform generator to write text on scope screen. Turns scope into message board.

arbs_2_33522A(y_arb,x_arb)
function arbs_2_33522A(y_arb,x_arb)
%This function inputs two arb strings and sends them to the 33522A

%Start talking to 33522A %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Input IP address
IP_address = input('Enter IP address: ','S');

%create address string
V_Addr = ['TCPIP0::',IP_address,'::inst0::INSTR'];

% Find a VISA-TCPIP object.
obj1 = instrfind('Type', 'visa-tcpip', 'RsrcName', V_Addr, 'Tag', '');

% Create the VISA-TCPIP object if it does not exist
% otherwise use the object that was found.
if isempty(obj1)
   % obj1 = visa('AGILENT', 'TCPIP0::156.140.95.30::inst0::INSTR');
    obj1 = visa('AGILENT', V_Addr);
else
    fclose(obj1);
    obj1 = obj1(1)
end

% Configure instrument object, obj1
set(obj1, 'InputBufferSize', 512);

% Configure instrument object, obj1
set(obj1, 'OutputBufferSize', 2000000);

% Connect to instrument object, obj1.
fopen(obj1);

% Communicating with instrument object, obj1.
data1 = query(obj1, '*IDN?');
% print reply
fprintf('%s',data1);

%set the 33522A to arb for channel 1 and 2
fprintf(obj1, 'SOUR1:FUNC ARB');
fprintf(obj1, 'SOUR2:FUNC ARB');

%Clear violatile memory for chan 1 and 2
command = 'SOUR1:DATA:VOL:CLE';
fprintf(obj1,command);
command = 'SOUR2:DATA:VOL:CLE';
fprintf(obj1,command);

%Send the x and y arb to the instrument
fprintf(obj1, y_arb);
fprintf(obj1, x_arb);

%select arb in volatile memmory 
fprintf(obj1, 'SOUR1:FUNC:ARB "XAXIS"');
fprintf(obj1, 'SOUR2:FUNC:ARB "YAXIS"');

%store each arb in intermal NV memory
fprintf(obj1, 'MMEM:STOR:DATA1 "INT:\XAXIS.arb"');
fprintf(obj1, 'MMEM:STOR:DATA2 "INT:\YAXIS.arb"');

% set sample rate
fprintf(obj1, 'SOUR1:FUNC:ARB:SRAT 4e5');
fprintf(obj1, 'SOUR2:FUNC:ARB:SRAT 4e5');

% set output impedence to high Z to match scope
fprintf(obj1, 'OUTP1:LOAD INF');
fprintf(obj1, 'OUTP2:LOAD INF');

% set output amplitude on channel 1 on 2
fprintf(obj1, 'SOUR1:VOLT 5 VPP');
fprintf(obj1, 'SOUR2:VOLT 3 VPP');

% set output filter to off for both channels
fprintf(obj1, 'SOUR1:FUNC:ARB:FILT OFF');
fprintf(obj1, 'SOUR2:FUNC:ARB:FILT OFF');

%turn output on
fprintf(obj1, 'OUTP1 ON');
fprintf(obj1, 'OUTP2 ON');

%set trigger source to bus (LAN connection)
fprintf(obj1, 'TRIG1:SOUR BUS');
fprintf(obj1, 'TRIG2:SOUR BUS');

%set burst count to infinite for both channels
fprintf(obj1, 'SOUR1:BURS:NCYC INF');
fprintf(obj1, 'SOUR2:BURS:NCYC INF');

%turn on burst mode to sync chan 1 and 2 arbs
fprintf(obj1, 'SOUR1:BURS:STAT ON');
fprintf(obj1, 'SOUR2:BURS:STAT ON');

%trigger burst mode, both channels will output arbs in sync
fprintf(obj1, '*TRG');


%check for error
data1 = query(obj1,'SYST:ERR?');
% print reply
fprintf('%s',data1);

% Disconnect from instrument object, obj1.
fclose(obj1);

Contact us