打印

VHDL串口程序有误码

[复制链接]
1427|5
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
wajtmusic|  楼主 | 2012-8-8 13:33 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用VHDL编写的串口接收程序,有时候会接收不到PC下发的数据,平均100次大概有1次接收不到。process(clk)
begin
  if clk'event and clk='1' then
   case st1 is

when 0=>if rxd<='0' then


st1<=1;

else

if cont='1' then
--cont=1则清除串口接收的数据

  reg<=(others=>'0');



end if;

end if;

when 1=>if cz<8 then

cz<=cz+1;

reg_m(7)<=rxd;

reg_m(6 downto 0)<=reg_m(7 downto 1);
--接收数据并存储

else reg<=reg_m;cz<=(others=>'0');st1<=0;



end if;

when others=>st1<=0;



   end case;
  end if;
end process;

相关帖子

沙发
mr.king| | 2012-8-8 21:21 | 只看该作者
很显然,对于接收异步信号,必须要用高于波特率的时钟去采样,一般是8--16倍,最差3倍,你用同频采样肯定不稳定

使用特权

评论回复
板凳
shell.albert| | 2012-8-9 10:22 | 只看该作者
使用更高的频率去采样,并且在中间的频率处进行采样,这样更可靠。

使用特权

评论回复
地板
wajtmusic|  楼主 | 2012-8-20 16:52 | 只看该作者
经过修改采样时钟后,现在接收正常,感谢2楼,感谢3楼,感谢版主,感谢21ic。。。。。。

使用特权

评论回复
5
GoldSunMonkey| | 2012-8-20 22:23 | 只看该作者
:lol

使用特权

评论回复
6
GoldSunMonkey| | 2012-8-20 22:23 | 只看该作者
还有我的事情。

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

263

主题

754

帖子

2

粉丝