%% DPO MATLAB ICT Get Screen 1 % developed on DPO4032 % should function for DPO/MSO 2k 3k 4k % visa method %% variables visa_vendor = 'tek'; visa_address = 'TCPIP::TSC-DPO4032::INSTR'; buffer = 20 * 1024; available_formats = {'png'; 'bmp'; 'tif'}; selected_format = available_formats{1}; inksaver = num2str(false); target_file = ['C:\my_file.' selected_format]; lf = 10; %line feed %% instrument communication dpo = visa(visa_vendor, visa_address, 'InputBufferSize', buffer, ... 'OutputBufferSize', buffer); fopen(dpo); fwrite(dpo, '*cls'); % configure image settings fwrite(dpo, [':sav:imag:filef ' selected_format ';inks ' inksaver ';']); % create destination for image data fid = fopen(target_file, 'w'); % start image data transfer fwrite(dpo, 'hardc start'); [data bytes msg] = fread(dpo); fwrite(fid, data); % loop continues reading if buffer limit reached while data(end)~=lf && bytes==buffer [data bytes msg] = fread(dpo); fwrite(fid, data); end % skip last byte (line feed) fwrite(fid, data(1:end-1)); fclose(fid); % check for errors query(dpo, '*esr?;allev?') % close connection fclose(dpo); delete(dpo); %% notes %{ The command HARDCOPY will send image data to the active printer The command HARDCOPY START will reply with file data %}