我是靠谱客的博主 稳重水杯,最近开发中收集的这篇文章主要介绍ADC标准 INL&DNL(2),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

自己用的INL和DNL计算程序,因为使用过的并口输出的,前面一个while 是并转串的计算,
然后确定adc 的传输曲线,也就是标准的输入输出关系。
最后通过实测的输入输出关系逐点的计算偏差,单点最大的偏差就是DNL,偏差的和就是INL。
clear all;
close all;
data_output_file =‘sadc16.dat’; %x2b
file_id = fopen(‘sadc10.csv’); %x2b
up_bound = 2^12 -1;
x = fgetl(file_id);
x = fgetl(file_id);
number_of_point = 0;
number_of_merge = 0;
while 1
x = fgetl(file_id);
if ~ischar(x), break, end
number_of_point = number_of_point + 1;
codeh(number_of_point) = str2num(x);
x = fgetl(file_id);
if ~ischar(x), break, end
number_of_point = number_of_point + 1;
codeh(number_of_point) = str2num(x);
number_of_merge = number_of_merge + 1;
code(number_of_merge) = codeh(number_of_point-1)*16 + codeh(number_of_point);
end
fclose(file_id);
%plot saw wave
figure(1);
plot(code);
start_point = 1;
end_point = number_of_merge;
window_width_threshold = 20;

window_size = 0;
for i=1:number_of_merge,
if ((code(i)0) & (window_size0))
window_size=1;
follow_zero = 0;
elseif ((code(i)~=0) & (window_size>0))
window_size=0;
follow_zero = 0;
elseif ((code(i)0) & (window_sizewindow_width_threshold))
start_point = i - floor(window_width_threshold/2) +1;
break;
elseif ((code(i)==0) & (window_size>0))
window_size=window_size+1;
follow_zero = 1;
else
end
end

window_size = 0;
for i=number_of_merge?1,
if ((code(i)up_bound) & (window_size0))
window_size=1;
follow_zero = 0;
elseif ((code(i)~=up_bound) & (window_size>0))
window_size=0;
follow_zero = 0;
elseif ((code(i)up_bound) & (window_sizewindow_width_threshold))
end_point = i - floor(window_width_threshold/2);
break;
elseif ((code(i)==up_bound) & (window_size>0))
window_size=window_size+1;
follow_zero = 1;
else
end
end

for i=1:(up_bound+1),
k(i)=0;
for j=start_point:end_point,
if (code(j)==(i-1))
k(i)=k(i)+1;
end
end
end
avg = (end_point-start_point-k(up_bound+1)-k(1))/(up_bound-1);

DNL=0;
INL=0;
for i=1:(up_bound-1),
DNL(i)=(k(i+1)-avg)/avg;
INL(i+1)=INL(i)+DNL(i);
end

figure(3)
plot(DNL,‘b’)
hold on;
plot(INL,‘g’)
ylabel(‘LSB’)
title(‘DNL(blue) & INL(green)’)

最后

以上就是稳重水杯为你收集整理的ADC标准 INL&DNL(2)的全部内容,希望文章能够帮你解决ADC标准 INL&DNL(2)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(65)

评论列表共有 0 条评论

立即
投稿
返回
顶部