- UID
- 831030
|
本帖最后由 keledui 于 2011-1-4 11:02 编辑
下面是我编写的串行接收数据部分,但是总是调不通,我用示波器量的输入信号及时钟都是正确的,但是我按照下面的程序将数据读入CPLD的缓冲区中,然后显示出来总是不正确,但是通过data_out将接收的数据转发出去,另一端用单片机接收却能接收到,实在找不出原因,望请大侠们帮我一下,非常感谢!
非常非常感谢!
data_rx:process(sck,data_in)
begin
if sck'event and sck = '0' then
data_in_buf(7 downto 0) <= data_in_buf(6 downto 0)& data_in;
end if;
end process data_rx;
data_show:process(data_in_buf)
begin
case data_in_buf(3 downto 0) is --ABCDEFG
when "0000" => show_pin <= "1111110";--0
when "0001" => show_pin <= "0110000";--1
when "0010" => show_pin <= "1101101";--2
when "0011" => show_pin <= "1111001";--3
when "0100" => show_pin <= "0110011";--4
when "0101" => show_pin <= "1011011";--5
when "0110" => show_pin <= "1011111";--6
when "0111" => show_pin <= "1110000";--7
when "1000" => show_pin <= "1111111";--8
when "1001" => show_pin <= "1111011";--9
when "1010" => show_pin <= "1110111";--A
when "1011" => show_pin <= "0011111";--B
when "1100" => show_pin <= "1001110";--C
when "1101" => show_pin <= "0111101";--D
when "1110" => show_pin <= "1001111";--E
when "1111" => show_pin <= "1000111";--F
when others => show_pin <= "0000000";-->turn off
end case;
end process data_show;
data_out <= data_in_buf(0); -- 发送数据赋值
我用的CPLD 为XC9572xl-10,再次感谢 |
|