3940|2

6892

帖子

0

TA的资源

五彩晶圆(高级)

楼主
 

AD5620的VHDL控制程序 [复制链接]

--基于AD56XX的VHDL控制程序
--设计者 eeleader
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity Wr_Ad56XX is
  port
   (
   clk: in std_logic;------20MHZ
   rst: in std_logic;------低电平有效
  
   ctl_data:in std_logic_vector(11 downto 0);
  
   sclk:out std_logic;
   sync_n: out std_logic;
   dout  : out std_logic
   );
end Wr_Ad56XX;
architecture arch_Wr_Ad56XX of Wr_Ad56XX is
signal tran_data: std_logic_vector(15 downto 0);
signal cnt:integer range 0 to 31;
signal temp: std_logic_vector(7 downto 0);
signal ctl_data_reg: std_logic_vector(11 downto 0);
begin
process(clk,rst)
begin
if (rst='1') then
 sclk<='0';
 sync_n<='1';
 dout<='1';
 temp<=x"00";
 ctl_data_reg<=(others=>'0');
 tran_data<=(others=>'0');  ----默认DAC为正常工作模式
elsif clk'event and clk='1' then
 if (temp=x"00") then
      if(ctl_data_reg /=ctl_data) then  ------判断输入数据是否变化
           tran_data(13 downto 2)<=ctl_data;
           ctl_data_reg<=ctl_data;
           temp<="01";
      end if;
      sclk<='1';
      sync_n<='1';
 elsif (temp="01") then
      sclk<='0';  ------初始化,送入DAC sync_n 为高;
      cnt<=0;
      temp<=x"02";
 elsif (temp=x"02") then
      sync_n<='0';
      sclk<='1';  ------
      temp<=x"03";
 elsif (temp=x"03") then   ------循环16次扇入数据到DAC的数据寄存器
      sclk<='0';  ------
      dout<=tran_data(0);
      tran_data<='0' & tran_data(15 downto 1);
      if(cnt=15) then
        temp<=x"04";
        cnt<=0;
      else
        cnt<=cnt+1;
        temp<=x"02";
      end if;
elsif (temp=x"04") then
     sync_n<='0';       ----延迟50ns ,保证转换时间
     temp<=x"05";
elsif (temp=x"05") then
     sync_n<='1';
     temp<=x"00";
else
     temp<=x"00";
end if;
end if;
end process;
end arch_Wr_Ad56XX;
此帖出自FPGA/CPLD论坛

最新回复

顶了   很好的例子  详情 回复 发表于 2011-8-26 07:07
点赞 关注
 

回复
举报

6892

帖子

0

TA的资源

五彩晶圆(高级)

沙发
 

顶一下!

此帖出自FPGA/CPLD论坛
个人签名一个为理想不懈前进的人,一个永不言败人!
http://shop57496282.taobao.com/
欢迎光临网上店铺!
 
 

回复

155

帖子

0

TA的资源

一粒金砂(中级)

板凳
 
顶了   很好的例子
此帖出自FPGA/CPLD论坛
 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/6 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表