/ Published in: MatLab
These are two functions I wrote in MATLAB to perform the binary dump readout. There is little documentation on this outside of the manual, but I finally got it to work today. There are some superfluous bits to this code, but the essentials are there.
Expand |
Embed | Plain Text
-----------sr620_avar.m function sr620_avar(samples, minTau) sr620obj = gpib('agilent',7,14); sr620obj.InputBufferSize = 8*samples+1; out sr620obj.Timeout = 20; %fprintf(sr620obj, 'SIZE 65000'); %fprintf(sr620obj, 'UNT UNL MLA TALK 14'); %fprintf(sr620obj, 'MEAS? 0'); %binData = fscanf(sr620obj); sr620convert(1,1,binData,samples) end ---------- sr620convert.m function out = sr620convert(mode, expd, data, samples) sign = 0; end if words(4) < 0 sign = 1; end end end end end out = fdata; end
Comments
Subscribe to comments
You need to login to post a comment.

The convert file converts the binary words into proper frequency values. The instrument is capable of other modes, so the conversion factor would change, but right now the factor of 1.249e-9 is for the frequency conversion. The conversion code I tried to convert from the C code in the manual into MATLAB and it appears to work.
Most of the commented-out lines can be removed -- this is a very crudely written file, but it has the essentials captured in the "fread" command and the sr620convert.m routine.