4测试方案与测试结果4.1测试方案1、软件仿真测试
3、硬件软件联调
经检查测试硬件电路完整,联调成功。
附录1:电路原理图
附录2:源程序 1. . 数字信号产生程序
//mcu_interface//
library IEEE;
use IEEE.Std_logic_1164.all;
entity mcu_interface is
port(mcu_data : in std_logic_vector(7 downto 0);
wr : in std_logic;
count : out integer range 0 to 511);
end mcu_interface ;
architecture mcu_interface_arch of mcu_interface is
begin
with mcu_data select
count <= 500 when "00000001", --1 10k
250 when "00000010", --2 20k
167 when "00000011", --3 30k
125 when "00000100", --4 40k
100 when "00000101", --5 50k
83 when "00000110", --6 60k
71 when "00000111", --7 70k
62 when "00001000", --8 80k
56 when "00001001", --9 90k
50 when "00001010", --10 100k
500 when others;
end mcu_interface_arch ;
//f_freq//
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity f_freq is
port( count : in std_logic_vector(8 downto 0);
f_in : in std_logic;
f_out : out std_logic);
end f_freq;
architecture behav of f_freq is
signal f : std_logic;
signal count1 : std_logic_vector(8 downto 0);
--signal count1 : integer range 0 to 4294967295;
begin
process(f_in)
begin
if f_in='1' and f_in'event then
if count1<(count-1) then
count1<=count1+1;
else count1<="000000000";
f<=not f;
end if;
end if;
f_out<=f;
end process;