50分急求AT89C52单片机电子琴汇编程序!!要求发出16个音!

来源:百度知道 编辑:UC知道 时间:2024/06/02 21:26:01
我们这次的设计用的是AT89C52芯片,矩阵键盘端口对应P2.0--P2.7,音频输出对应P2.4端口复用.经本人测试成功后立即给分,附带程序分析的话追加50分!!
望大虾们出手相救啊!!!!

-File:speaker.vhd
--Designer:
--Module:
--Description:
--Simulator:MAX plusII 10.0.9/Window XP
--Date:
--Modify date:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity speaker is
Port ( clk1 : in std_logic;
tone1 : in integer range 0 to 2047; --音符选择参数值
spks : out std_logic); --驱动扬声器的音频信号
end speaker;
architecture Behavioral of speaker is
signal preclk:std_logic;
signal spk:std_logic;
begin
pulse1:process(clk1) --此进程对系统时钟分频
variable count:integer range 0 to 6;
begin
if clk1'event and clk1='1' then
count:=count+1;
if count<3 then