Keysight E4428C ESG RF Programming Manual page 295

Signal generators
Table of Contents

Advertisement

%[Iwave;Qwave];
%waveform = waveform(:)';
% Normalize the data between +-1
waveform = waveform / max(abs(waveform));
% Scale to use full range of the DAC
waveform = round(waveform * 32767);
% waveform = round(waveform * (32767 / max(abs(waveform))));
steps!
% PRESERVE THE BIT PATTERN but convert the waveform to
% unsigned short integers so the bytes can be swapped.
% Note: Can't swap the bytes of signed short integers in MatLab.
waveform = uint16(mod(65536 + waveform,65536)); %
% If on a PC swap the bytes to Big Endian
if strcmp( computer, 'PCWIN' )
waveform = bitor(bitshift(waveform,-8),bitshift(waveform,8));
end
% Save the data to a file
% Note: The waveform is saved as unsigned short integers. However,
%
the acual bit pattern is that of signed short integers and
%
that is how the ESG/PSG interprets them.
filename = 'C:\Temp\EsgTestFile';
[FID, message] = fopen(filename,'w');% Open a file to write data
if FID == -1 error('Cannot Open File'); end
fwrite(FID,waveform,'unsigned short');% write to the file
fclose(FID);
% 3.) Load the internal Arb format file *********************************
% This process is just the reverse of saving the waveform
% Read in waveform as unsigned short integers.
% Swap the bytes as necessary
% Convert to signed integers then normalize between +-1
% De-interleave the I/Q Data
% Open the file and load the internal format data
[FID, message] = fopen(filename,'r');% Open file to read data
Keysight Signal Generators Programming Guide
% Watch out for divide by zero.
% Data is now effectively signed short integer values
% close the file
Creating and Downloading Waveform Files
% More efficient than previous two
Programming Examples
287

Advertisement

Table of Contents
loading

Table of Contents