• AD5620的VHDL控制程序 12bits AD芯片


    --基于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<=x"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;
    仿真时序图:
  • 相关阅读:
    关于Git学习-远程库(github) 命令
    关于git的学习
    python-自动化测试结果发送邮件报错(smtplib.SMTPDataError: (554, b'DT:SPM 163……)解决方法
    android SDK- 使用 AVD Manager.exe 创建虚拟机遇到报错 emulator
    性能测试方案大纲-学习笔记
    python + locust 记录一次性能测试的实施
    jmeter 做压测常见问题记录-单台测试机建议最大线程数
    jmeter 调用mysql数据库,使用JDBC请求执行相关SQL
    加解密原理
    SM1,SM2,SM3,SM4刨析
  • 原文地址:https://www.cnblogs.com/zcf287/p/2801223.html
Copyright © 2020-2023  润新知