电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

818+电子琴程序设计与仿真

6页
  • 卖家[上传人]:llt8****5967
  • 文档编号:230741189
  • 上传时间:2021-12-28
  • 文档格式:DOCX
  • 文档大小:55.65KB
  • / 6 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 1、818+电子琴程序设计与仿真电子琴系统的设计包含四个模块,分别是操纵输入电路、FPGA、显示电路和扬声器电路。其中FPGA模块的设计是整个电子琴系统设计的核心内容。四个模块的有机组合完成了电子琴自动演奏的功能。文中还详细介绍了FPGA功能模块的原理及其工作时序仿真图。本产品的特点是成本较低,性能稳固,精度高,有一定的开发价值。关键词: 现场可编程逻辑器件FPGA 超高速硬件描述语言VHDL 电子琴系统 自动演奏8.18.4程序设计与仿真电子琴VHDL程序包含有:顶层程序、音阶发生器程序、数控分频模块程序和自动演奏模块程序。1.顶层程序与仿真1顶层VHDL程序-文件名:top.vhd-功能:顶层文件-最后修改日期:2004.3.20library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity top isPort ( clk32MHz :in std_logic; -32MHz系统时钟handTOauto : in std_logic

      2、; -键盘输入/自动演奏code1 :out std_logic_vector(6 downto 0); -音符显示信号index1 :in std_logic_vector(7 downto 0); -键盘输入信号high1 :out std_logic; -高低音节信号spkout :out std_logic); -音频信号end top;architecture Behavioral of top iscomponent automusicPort ( clk :in std_logic; Auto: in std_logic; index2:in std_logic_vector(7 downto 0); index0 : out std_logic_vector(7 downto 0); end component;component tonePort ( index : in std_logic_vector(7 downto 0); code : out std_logic_vector(6 downto 0); high : out std_logic; tone0

      3、: out integer range 0 to 2047);end component;component speakerPort ( clk1 : in std_logic;tone1 : in integer range 0 to 2047;spks : out std_logic);end component;signal tone2: integer range 0 to 2047;signal indx:std_logic_vector(7 downto 0);beginu0:automusic port map(clk=clk32MHZ,index2=index1,index0=indx,Auto=handtoAuto);u1: tone port map(index=indx,tone0=tone2,code=code1,high=high1);u2: speaker port map(clk1=clk32MHZ,tone1=tone2,spks=spkout);end Behavioral;2仿真顶层文件仿真图如图8.18.2所示。图8.18.2 顶层文件仿真图2.

      4、音阶发生器程序与仿真(1) 音阶发生器VHDL程序-文件名:tone.vhd。-功能:library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity tone isPort ( index : in std_logic_vector(7 downto 0); -音符输入信号code : out std_logic_vector(6 downto 0); -音符显示信号high : out std_logic; -高低音显示信号tone0 : out integer range 0 to 2047); -音符的分频系数end tone;architecture Behavioral of tone isbeginsearch :process(index) -此进程完成音符到音符的分频系数译码,音符的显示,高低音阶begincase index iswhen 00000001 = tone0=773;code=1001111;high

      5、tone0=912;code=0010010;high tone0=1036;code=0000110;high tone0=1116;code=1001100;high tone0=1197;code=0100100;high tone0=1290;code=0100000;high tone0=1372;code=0001111;high tone0=1410;code=0000000;high tone0=2047;code=0000001;high=0;end case;end process;end Behavioral;2音阶发生器程序仿真音阶发生器程序仿真图如图8.18.3所示。图8.18.3 音阶发生器仿真图3. 数控分频模块程序与仿真(1) 数控分频模块VHDL程序-文件名:speaker.vhd。-功 能:实现数控分频。-最后修改日期:20004.3.19。library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;enti

      6、ty speaker isPort ( clk1 : in std_logic; -系统时钟tone1 : in integer range 0 to 30624; -音符分频系数spks : out std_logic); -驱动扬声器的音频信号end speaker;architecture Behavioral of speaker issignal preclk,fullspks:std_logic;beginpulse1:process(clk1) -此进程对系统时钟进行4分频variable count:integer range 0 to 8;beginif clk1event and clk1=1 then count:=count+1;if count=2 then preclk=1; elsif count=4 then preclk=0;count:=0;end if; end if;end process pulse1;genspks:process(preclk,tone1) -此进程按照tone1输入的分频系数对8MHz的脉冲再次分频,得到所需要的音符频率v

      7、ariable count11:integer range 0 to 30624;beginif preclkevent and preclk=1 thenif count11tone1 then count11:=count11+1;fullspks=1; else count11:=0;fullspks=0;end if;end if;end process;delaysps:process(fullspks) -此进程对fullspks进行2分频variable count2 :std_logic:=0;beginif fullspksevent and fullspks=1 then count2:=not count2;if count2=1 then spks=1;else spks=0;end if;end if;end process;end Behavioral;2 数控分频模块程序仿真数控分频模块程序仿真图如图8.18.4所示。图8.18.4 数控分频模块仿真图4. 自动演奏模块程序与仿真(1) 自动演奏模块VHDL程序-文件名:automusic.vhd-功 能:实现自动演奏功能。-最后修改日期:2004.3.19。library IEEE;use IEEE.STD_LOGIC_1164.ALL;use IEEE.STD_LOGIC_ARITH.ALL;use IEEE.STD_LOGIC_UNSIGNED.ALL;entity automusic isPort ( clk,Auto : in std_logic; -系统时钟;键盘输入/自动演奏index2 : in std_logic_vector(7 downto 0); -键盘输入信号index0 : out std_logic_vector(7 downto 0); -音符信号输出end automusic;architecture Behavioral of automusic issignal count0:integer range 0 to 31;-changesignal clk2:std_logic;beginpulse0:pro

      《818+电子琴程序设计与仿真》由会员llt8****5967分享,可在线阅读,更多相关《818+电子琴程序设计与仿真》请在金锄头文库上搜索。

      点击阅读更多内容
    最新标签
    监控施工 信息化课堂中的合作学习结业作业七年级语文 发车时刻表 长途客运 入党志愿书填写模板精品 庆祝建党101周年多体裁诗歌朗诵素材汇编10篇唯一微庆祝 智能家居系统本科论文 心得感悟 雁楠中学 20230513224122 2022 公安主题党日 部编版四年级第三单元综合性学习课件 机关事务中心2022年全面依法治区工作总结及来年工作安排 入党积极分子自我推荐 世界水日ppt 关于构建更高水平的全民健身公共服务体系的意见 空气单元分析 哈里德课件 2022年乡村振兴驻村工作计划 空气教材分析 五年级下册科学教材分析 退役军人事务局季度工作总结 集装箱房合同 2021年财务报表 2022年继续教育公需课 2022年公需课 2022年日历每月一张 名词性从句在写作中的应用 局域网技术与局域网组建 施工网格 薪资体系 运维实施方案 硫酸安全技术 柔韧训练 既有居住建筑节能改造技术规程 建筑工地疫情防控 大型工程技术风险 磷酸二氢钾 2022年小学三年级语文下册教学总结例文 少儿美术-小花 2022年环保倡议书模板六篇 2022年监理辞职报告精选 2022年畅想未来记叙文精品 企业信息化建设与管理课程实验指导书范本 草房子读后感-第1篇 小数乘整数教学PPT课件人教版五年级数学上册 2022年教师个人工作计划范本-工作计划 国学小名士经典诵读电视大赛观后感诵读经典传承美德 医疗质量管理制度 2
    关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
    手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
    ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.