没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
/*CPLD接收VHDL源程序如下*/
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity cuanxing is
port (clk,cxin,cs:in std_logic;
cxout:out std_logic_vector(7 downto 0));
end;
architecture rtl of cuanxing is
signal shift:std_logic_vector(7 downto 0) ;八位暂存变量并行输出
begin
process(clk)
begin
if(cs='0')then
shift<=(others=>'0');若未被选中,输出全零
elsif(clk'event and clk='1')then ;若上升沿到达clk时,被选中。
shift(7 downto 1)<=shift(6 downto 0) ;八位数据前移一位
shift(0)<=cxin;最低位由cxin输入
end if;
end process;
cxout<=shift;将八位变量送至端口
end rtl;
/*与之相对应的单片机控制子程序如下(待发数据存放在A中)*/
CS EQU P1.4
EN EQU P1.5
DCLOCK EQU P1.6
DOUT EQU P1.7
Library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity cuanxing is
port (clk,cxin,cs:in std_logic;
cxout:out std_logic_vector(7 downto 0));
end;
architecture rtl of cuanxing is
signal shift:std_logic_vector(7 downto 0) ;八位暂存变量并行输出
begin
process(clk)
begin
if(cs='0')then
shift<=(others=>'0');若未被选中,输出全零
elsif(clk'event and clk='1')then ;若上升沿到达clk时,被选中。
shift(7 downto 1)<=shift(6 downto 0) ;八位数据前移一位
shift(0)<=cxin;最低位由cxin输入
end if;
end process;
cxout<=shift;将八位变量送至端口
end rtl;
/*与之相对应的单片机控制子程序如下(待发数据存放在A中)*/
CS EQU P1.4
EN EQU P1.5
DCLOCK EQU P1.6
DOUT EQU P1.7
资源评论
南天湖畔
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功