我用的是AD0804,按时序图写出的状态机程序,但是在数码管老是无法正常显示,数字不是老跳就是定在一个值不动,我让其每隔0.5秒就转换一次
always@(posedge clk)
if(sw)
begin
cs<=1;
rd<=1;
wr<=1;
statead<=idle;
end
else
case(statead)
idle:
begin
statead<=start;
cs<=0;
end
start:
begin
statead<=deng;
wr<=0;
cntwr<=0;
end
deng:
if(cntwr==4'd6)
begin
cntwr<=0;
wr<=1;
statead<=nobusy;
cntbusy<=0;
end
else
cntwr<=cntwr+1;
nobusy:
****** if(cntbusy==16'd50000)
begin
cntbusy<=0;
statead<=trans;
rd<=0;
cnttrans<=0;
end
else
cntbusy<=cntbusy+1;
trans:
if(cnttrans==4'd10)
begin
cnttrans<=0;
vol<=db;
rd<=1;
statead<=final;
end
else
cnttrans<=cnttrans+1;
final:
begin
statead<=idle;
cs<=1;
end
endcase