集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
123
返回列表 发新帖
楼主: UFP

请教串并并串转换原理

[复制链接]
CHA 发表于 2010-6-28 18:45:17 | 显示全部楼层
偶也是新手
usb 发表于 2010-6-28 19:46:05 | 显示全部楼层
--串并转换8比特<br>
--同步置零<br>
--8位数据输出<br>
library ieee;<br>
use ieee.std_logic_1164.all;<br>
use ieee.std_logic_unsigned.all;<br>
entity serial_to_line is<br>
port(clk,reset,data:in std_logic;<br>
&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;outdata: out std_logic_vector(7 downto 0));<br>
end serial_to_line;<br>
<br>
architecture behave of serial_to_line is<br>
signal reg_data: std_logic_vector(7 downto 0);<br>
signal reg_count:integer range 8 downto 0;<br>
begin<br>
process(clk)<br>
variable reg_data1:std_logic_vector(7 downto 0);<br>
begin<br>
<br>
if rising_edge(clk) then <br>
&nbsp;&nbsp;case reset is<br>
&nbsp;&nbsp;when '0'=&gt;&nbsp;&nbsp;outdata&lt;="00000000";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;reg_data&lt;="00000000";<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;reg_count&lt;=0;<br>
&nbsp;&nbsp;when '1'=&gt;&nbsp;&nbsp;reg_data1:=reg_data;<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;reg_data1:=data&amp;reg_data1(7 downto 1);<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;case reg_count is<br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;when&nbsp;&nbsp;7 =&gt; reg_count&lt;=0;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; outdata&lt;=reg_data1;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; reg_data&lt;=reg_data1;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;when others=&gt; reg_count&lt;=reg_count+1;&nbsp; &nbsp; &nbsp; &nbsp; <br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; reg_data&lt;=reg_data1; <br>
&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp;&nbsp;end case;<br>
&nbsp;&nbsp;when others=&gt;NUll;<br>
&nbsp;&nbsp;end case;<br>
end if; <br>
--reg_data&lt;=reg_data1;<br>
end process;<br>
end architecture behave;
tim 发表于 2010-6-28 20:04:10 | 显示全部楼层
看uart的说明文档
longt 发表于 2010-6-28 21:25:22 | 显示全部楼层
哪里有74165的例子呢?
interige 发表于 2010-6-28 23:15:29 | 显示全部楼层

我自己写的,给点意见
您需要登录后才可以回帖 登录 | 我要注册

本版积分规则

关闭

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

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

GMT+8, 2024-12-25 01:23 , Processed in 0.057754 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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