Hello!
I'm having an issue with data acquisition from an oscilloscope. MATLAB captures values that are over the limit of 255 for BYTE format and 65,535 for an unsigned 16-bit integer when using the WORD format, and loops these values back from 0 resulting in a very distorted waveform. I'm using the following code and reading the data using binblockread:
clear allclcclose all%%
DSO_S_104A=instrfind('Type', 'visa-usb', 'RsrcName', 'USB0::0x2A8D::0x904A::MY54340109::0::INSTR', 'Tag', '');DSO_S_104A.InputBufferSize = 350000;DSO_S_104A.ByteOrder = 'littleEndian';fopen(DSO_S_104A);%% SETUP
set(DSO_S_104A, 'Timeout', 0.5);%Set number of points
fprintf(DSO_S_104A, ':ACQUIRE:POINTS 48000');% Set sample rate
fprintf(DSO_S_104A, ':ACQUIRE:SRATE 0.5e9');% Turn interpolation off for faster averaging
fprintf(DSO_S_104A, ':ACQUIRE:INTERPOLATE OFF');fprintf(DSO_S_104A,'*TRG');fwrite(DSO_S_104A,'SYSTem:HEADer OFF');% Specify data from Channel 1
fprintf(DSO_S_104A,':WAVEFORM:SOURCE CHAN1'); fprintf(DSO_S_104A,':WAVEFORM:FORMAT BYTE'); % or WORD
fprintf(DSO_S_104A,':WAVEFORM:BYTEORDER LSBFirst');fprintf(DSO_S_104A, 'WAVEFORM:STREAMING OFF');%%fwrite(DSO_S_104A,sprintf(':WAV:DATA?\n'));data2 = binblockread(DSO_S_104A); %or data2 = binblockread(DSO_S_104A,'ushort') for WORD format
plot(data2)end
Is there any way to fix this? I know that for the case of 2pi jumps in phase measurements the "unwrap" command can help, but is there anything for amplitude?
Also, If anybody has any advice how to speed up the data acquisition process from a scope to MATLAB I would welcome any suggestions. Currently to capture one "screen" from the scope it takes MATLAB about 0.04 seconds which remains the same for up to 3-4x the number of points.
I can raise the number of points which puts multiple "scope screens" in one acquisition thus speeding up the proccess (by later cutting each "screen" into a different vector), but it also makes the data processing a bit more difficult.
Best Answer