29 lines
1.4 KiB
Matlab
29 lines
1.4 KiB
Matlab
% --- Minimal N7714A example (MATLAB) ---
|
|
visa_addr = "TCPIP0::134.245.243.209::inst0::INSTR"; % <-- change to your laser's IP
|
|
port = 1; % 1..4 selects the N7714A output port
|
|
|
|
% v = visadev(visa_addr);
|
|
|
|
% Identify instrument
|
|
writeline(v,'*IDN?'); disp(strtrim(readline(v)));
|
|
|
|
% Make sure wavelength is settable (Auto mode)
|
|
writeline(v, sprintf('SOUR%d:WAV:AUTO 1', port)); % Auto Mode ON (wavelength set allowed).
|
|
|
|
% Set wavelength and power (units explicit)
|
|
writeline(v, sprintf('SOUR%d:WAV 1560NM', port)); % set 1550 nm. :contentReference[oaicite:3]{index=3}
|
|
writeline(v, sprintf('SOUR%d:POW:UNIT DBM', port)); % power unit = dBm. :contentReference[oaicite:4]{index=4}
|
|
writeline(v, sprintf('SOUR%d:POW:LEV:IMM:AMPL 6 DBM', port)); % set -3 dBm. :contentReference[oaicite:5]{index=5}
|
|
|
|
% Enable output (either OUTP or SOUR:POW:STAT works)
|
|
writeline(v, sprintf('OUTP%d:STAT ON', port)); % laser ON. :contentReference[oaicite:6]{index=6}
|
|
writeline(v, 'OUTP1 ON');
|
|
|
|
% ---- Read back to verify ----
|
|
writeline(v, sprintf('SOUR%d:WAV?', port)); wav_m = str2double(readline(v));
|
|
writeline(v, sprintf('SOUR%d:POW:LEV:IMM:AMPL?', port)); pow = str2double(readline(v));
|
|
writeline(v, sprintf('OUTP%d:ON?', port)); onoff = str2double(readline(v));
|
|
|
|
fprintf('Port %d -> %.2f nm, %.2f dBm, Output=%d\n', port, 1e9*wav_m, pow, onoff);
|
|
|
|
delete(v); |