|
|
| DAC0832 接口电路程序 |
作者:本站 来源:www.elecfans.com 发布时间:2008-6-27 11:11:07 减小字体 增大字体 |
|
DAC0832 接口电路程序 见随书所附光盘中文件:DAC0832VHDL程序与仿真。 --文件名:DAC0832.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;
|
|
[]
[返回上一页]
[打 印]
[收 藏] |
| |
|
| ∷相关文章评论∷ (评论内容只代表网友观点,与本站立场无关!) [更多评论...] |
|
|