EasyManua.ls Logo

Keysight E4428C ESG RF - Page 295

Keysight E4428C ESG RF
404 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Keysight Signal Generators Programming Guide 287
Creating and Downloading Waveform Files
Programming Examples
%[Iwave;Qwave];
%waveform = waveform(:)';
% Normalize the data between +-1
waveform = waveform / max(abs(waveform)); % Watch out for divide by zero.
% Scale to use full range of the DAC
waveform = round(waveform * 32767); % Data is now effectively signed short integer values
% waveform = round(waveform * (32767 / max(abs(waveform)))); % More efficient than previous two
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); % close the file
% 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

Table of Contents

Related product manuals