微波EDA网,见证研发工程师的成长!
首页 > 测试测量 > 测试测量技术文库 > 基于MAX5891的差分输出的测量方法简介

基于MAX5891的差分输出的测量方法简介

时间:10-26 来源:互联网 点击:

second level of segmentation is controlled with input codes 16 through

%112 in steps of 16. Create the code array and fill the measurements for

%this segmentation level

Seg2Codes=[16:16:16*7]’;

for i=1:7

Seg2V(i)=Measurements(i+5)-MS;

end

%Segmentation level 3 uses input codes 128 through 1920 in steps of 128.

%Create the code array and fill the measurements array.

Seg3Codes=[128:128:128*(2^4-1)]’;

for i=1:15

Seg3V(i)=Measurements(i+12)-MS;

end

%Segmentation level 3 uses input codes 2048 through 63,488 in steps of 2048.

%Create the code array and fill the measurements array.

Seg4Codes=[2048:2048:2048*(2^5-1)]’;

for i=1:31

Seg4V(i)=Measurements(i+27)-ZS;

end

%The endpoints have been defined, now fill in the voltages for the

%remaining points of the DAC transfer function.

for i = 2:65535

targetcode=i-1;

VOUT(i)=ZS;

for s=31:-1:1

if Seg4Codes(s)=targetcode

targetcode=targetcode-Seg4Codes(s);

VOUT(i)=VOUT(i)+Seg4V(s);

s=0;

end

end

for s=15:-1:1

if Seg3Codes(s)=targetcode

targetcode=targetcode-Seg3Codes(s);

VOUT(i)=VOUT(i)+Seg3V(s);

s=0;

end

if targetcode==0

s=0;

end

end

for s=7:-1:1

if Seg2Codes(s)=targetcode

targetcode=targetcode-Seg2Codes(s);

VOUT(i)=VOUT(i)+Seg2V(s);

s=0;

end

if targetcode==0

s=0;

end

end

if targetcode==0

s=0;

end

for s=4:-1:1

if Seg1Codes(s)=targetcode

targetcode=targetcode-Seg1Codes(s);

VOUT(i)=VOUT(i)+Seg1V(s);

end

end

end

%Plot the transfer function

figure(1)

plot(DacCodes, VOUT);

xlabel(‘DAC Input Code’);

ylabel(‘Measured Voltage’);

axis([0 65536 -1.1 1.1]);

title(‘DAC Transfer Function’);

set(gca,’XTick’,0:16384:65536)

%Calculate the linearity

LSB=(max(VOUT)-min(VOUT))/65535;

INL(1)=0;

DNL(1)=0;

for i=2:65536

INL(i)=(VOUT(i)-(VOUT(1)+(i-1)*LSB))/LSB;

DNL(i)=(VOUT(i)-VOUT(i-1)-LSB)/LSB;

end

%Plot INL

figure(2)

plot(DacCodes, INL);

title(‘DAC Integral Linearity’);

xlabel(‘DAC Input Code’);

ylabel(‘INL (LSBs)’);

axis([0 65536 min(INL)*1.1 max(INL)*1.1]);

set(gca,’XTick’,0:16384:65536)

%Plot DNL

figure(3)

plot(DacCodes, DNL);

title(‘DAC Differential Linearity’);

xlabel(‘DAC Input Code’);

ylabel(‘DNL (LSBs)’);

axis([0 65536 min(DNL)*1.1 max(DNL)*1.1]);

set(gca,’XTick’,0:16384:65536)

txtstr=sprintf(‘INL MAX = %f’, max(INL));

disp (txtstr);

txtstr=sprintf(‘INL MIN = %f’, min(INL));

disp (txtstr);

txtstr=sprintf(‘DNL MAX = %f’, max(DNL));

disp (txtstr);

txtstr=sprintf(‘DNL MIN = %f’, min(DNL));

disp (txtstr);

16位脚本产生的曲线

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top