DAC0832 接口电路程序

[11-20 16:14:47]   来源:http://www.88dzw.com  FPGA   阅读:8986

文章摘要:DAC0832 接口电路程序见随书所附光盘中文件:VHDL程序与仿真。--文件名:.VHD--功能:产生频率为762.9Hz的锯齿波。--最后修改日期:2004.3.18。library ieee;use ieee.std_logic_1164.all;use ieee.std_logic_unsigned.all;use ieee.std_logic_arith.all;entity DAC0832 is port(clk:in std_logic; --系统时钟 rst:in std_logic;

DAC0832 接口电路程序,标签:fpga是什么,fpga教程,http://www.88dzw.com

DAC0832 接口电路程序
见随书所附光盘中文件:VHDL程序与仿真。
--文件名:.VHD
--功能:产生频率为762.9Hz的锯齿波。
--最后修改日期:2004.3.18。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity DAC0832 is
  port(clk:in std_logic;                            --系统时钟
       rst:in std_logic;                           --复位信号
       ile:out std_logic;                          --数据锁存允许信号
      cont:out std_logic;                         --控制信号(WR1、WR2、CS、Xfer)
  data_out:out std_logic_vector(7 downto 0));         --波形数据输出
  end DAC0832; 
architecture behav of DAC0832 is
signal q:integer range 0 to 63;                       --计数器
signal data:std_logic_vector(7 downto 0);             --波形数据
begin
process(clk)
begin
if rst='1' then q<=0;                               --复位,对计数器q清零
elsif clk'event and clk='1' then
   if q=63 then q<=0;                             --此IF语句对系统时钟进行64分频
      if data="11111111" then data<="00000000";      --此IF语句产生锯齿波波形数据
      else data<=data+1;
      end if;
   else q<=q+1;
   end if;
end if;
end process;
ile<='1';cont<='0';data_out<=data;                   --ile、cont赋值;波形数据输出;
end behav;


Tag:FPGAfpga是什么,fpga教程FPGA

《DAC0832 接口电路程序》相关文章

分类导航
最新更新
热门排行