请教一个串并转换程序
本帖最后由 fpgaw 于 2010-7-18 10:48 编辑接受的数据按照51单片机串口接收时序:RXD上一直为高电平,出现低电平则为数据起始位,然后开始接收8位数据。接受串行数据的时钟为Baud_clk,发送并行数据的时钟为Byte_clk。程序仿真一直有问题,请大家帮我看看问题在哪呢。
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_arith.ALL;
USE ieee.std_logic_unsigned.all;
ENTITY parallel_send IS
PORT(clk,reset: in STD_LOGIC;
Byte_clk,Baud_clk: in std_logic;
Odata : out STD_LOGIC_VECTOR(8 downto 1);
Rxd: in STD_LOGIC);
END parallel_send;
ARCHITECTURE a OF parallel_send IS
signal do_latch: STD_LOGIC_VECTOR(8 DOWNTO 1); --并行数据发送锁存器
signal counts: integer range 0 to 9; --接受计数器
BEGIN
process(clk,reset,Baud_clk) --1
variable Rxd_last : STD_LOGIC;
begin
if reset='1' then
do_latch<="11111111";
counts<=0;
elsif(clk'event and clk='1')then
if Baud_clk='1' then
if Rxd='0' and Rxd_last='1' then
counts<=0;
do_latch(counts+1)<=Rxd;
else do_latch<="11111111";
end if;
if counts=8 then
counts<=0;
end if;
counts<=counts+1;
Rxd_last:=Rxd;
end if;
end if;
end process;
process(clk,Byte_clk) --2
variable Byte_clk_last : STD_LOGIC;
begin
if(clk'event and clk='1')then
if Byte_clk='1' and Byte_clk_last='0' then
Odata<=do_latch;
else Odata<="11111111";
end if;
Byte_clk_last:=Byte_clk;
end if ;
end process;
end a; 把你的仿真图形贴出来,说说那里有问题 ARCHITECTURE a OF parallel_send IS
signal do_latch: STD_LOGIC_VECTOR(8 DOWNTO 1); --并行数据发送锁存器
signal counts: integer range 0 to 9; --接受计数器
页:
[1]