Non-Return to Zero (NRZ) signals use two voltage levels (high and low) to represent logic one and logic zero values. Traditional oscilloscopes can capture and view these waveforms but do not have the capability to decode waveforms into their digital equivalents. Oscilloscopes with XDEV custom functionality can now decode these waveforms.
In Figure 1, a block of NRZ data is acquired as Function F1 and the parameter TIE@lv (Time Interval Error) is applied as parameter P1. The Virtual Clock capability of TIE reports the underlying bitrate as 2.488 Gb/s, which corresponds to this OC-48 datastream. Function F2 allows for a user-defined Matlab script to automatically decode each waveform as shown in Figure 2. The algorithm reads the base frequency from the TIE parameter to locate boundaries of each unit interval. As the algorithm processes each waveform edge, it appends the logic value into a buffer of datastream values. When the loop completes, the digitallydecoded waveform and its statistics are displayed as well as recorded to a file. This process will repeat for each acquisition allowing rapid in-line waveform conversion.
clear bitstream;
WformOut = WformIn1 - mean(WformIn1);
at zero
comclient off
h = actxserver('LeCroy.WaveMasterApplication');
the scope and Matlab
xincr = h.Math.F1.Out.Result.HorizontalPerStep;
basefreq = double(get(h.Measure.P1.Operator.BaseFrequency,'Value'));
determination
baseper = 1/basefreq;
samplesperbit = ceil(baseper/xincr);
n = find(diff(WformOut>0));
numberofedges = length(n);
bitcounter = 0;
virtualclockposition = n(1);
numones = 0;
numzeros = 0;
for i=1:(numberofedges-1)
virtualclockposition = n(i);
bitswide = round((n(i+1)-n(i))/samplesperbit);
between edges
for j=1:bitswide
execute this loop twice to check both bits
bitcounter = bitcounter + 1;
so far
if (WformOut(virtualclockposition + ceil(samplesperbit/2)) > 0)
bitstream(bitcounter) = 1;
future reference
numones = numones + 1;
else
bitstream(bitcounter) = 0;
numzeros = numzeros + 1;
values
end
end
end
disp(' ')
bitstream = char(bitstream+48)
outputfile = 'bitstream.txt';
fid = fopen(outputfile, 'w');
fwrite(fid,bitstream,'char');
fclose(fid);
fprintf('Stats: %d Bits, %d Ones, %d Zeros, output saved to %s
',
length(bitstream), numones, numzeros, outputfile);