登录论坛

查看完整版本 : 【求助】高手帮忙做个题目


arthur.geng
2007-06-21, 11:46
六、七段数码管使用的译码电路
程序如下:
function shumaguan1(n)
n=input('请输入仿真时间:')
a=0.05:0.01:0.45;
A=1.5;
b=0.5;
B=1.05:0.01:1.45;
c=0.5;
C=0.55:0.01:0.95;
g=a;d=a;
G=1;D=0.5;
F=B;E=C;
f=0;e=0;
load answer.mat;
t0=answer(1,1);
t=0;
axis equal;
axis([t0-1,t0+n+1,0,2]);
title('A Digital Display Probe')
hold on;
while t<=n
if answer(2,t+1)~=0
plot(a+t+t0,A,'r-');
end
if answer(3,t+1)~=0
plot(b+t+t0,B,'r-');
end
if answer(4,t+1)~=0
plot(c+t+t0,C,'r-');
end
if answer(5,t+1)~=0
plot(d+t+t0,D,'r-');
end
if answer(6,t+1)~=0
plot(e+t+t0,E,'r-');
end
if answer(7,t+1)~=0
plot(f+t+t0,F,'r-');
end
if answer(8,t+1)~=0
plot(g+t+t0,G,'r-');
end
t=t+1;
end
http://files.xici.net/d54101357.0/%7B0A06318B-B241-423C-A205-B7C2121FFC3F%7D.JPG
七段数码管的模拟,首先建立如图示的电路,然后在Combinatorial Logic中输入如下的真值表值,不足处不上6行0即可,将d3,d2,d1,d0的幅度设为1,周期为2,脉宽1,相位延迟-1,抽样时间分别为8,4,2,1。同时将MUX值设为4,将TO File文档指定到answer.mat 将其中的Variable name指定为ans。最后建立一个数码管显示的m文件,内容见下。
http://files.xici.net/d54101357.0/%7BA608%7D.JPG