集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1853|回复: 2

请教一个串并转换程序

[复制链接]
usd 发表于 2010-6-27 23:40:11 | 显示全部楼层 |阅读模式
本帖最后由 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;
CTT 发表于 2010-6-28 00:21:48 | 显示全部楼层
把你的仿真图形贴出来,说说那里有问题
Sunlife 发表于 2015-7-4 09:57:41 | 显示全部楼层
ARCHITECTURE a OF parallel_send IS
    signal do_latch: STD_LOGIC_VECTOR(8 DOWNTO 1); --并行数据发送锁存器
  signal counts: integer range 0 to 9; --接受计数器
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

QQ|小黑屋|手机版|Archiver|fpga论坛|fpga设计论坛 ( 京ICP备20003123号-1 )

GMT+8, 2025-8-18 14:22 , Processed in 0.092683 second(s), 20 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表