我用VHDL,用case:
process(clk)
begin
if clk'event and clk='1' then
i<=i+1;
case i is
when 1 => ce<= '1';
when 5 => sclk<='1';
when 6=> date(0)<=io;sclk<='0';
when 7 => sclk<='1';
when 8=> date(1)<=io;sclk<='0';
………
直到读完所有数据
when 29=>ce<='0';i<=0;
when others=>null;
end case;
end if;
process(clk)
begin
if clk'event and clk='1' then
i<=i+1;
case i is
when 1 => ce<= '1';
when 5 => sclk<='1';
when 6=> date(0)<=io;sclk<='0';
when 7 => sclk<='1';
when 8=> date(1)<=io;sclk<='0';
………
直到读完所有数据
when 29=>ce<='0';i<=0;
when others=>null;
end case;
end if;
一周热门 更多>