实验代码:
library ieee;
use ieee.std_logic_1164.all;
entity junmo is
port(ina:in std_logic_vector(7 downto 0);
inb:in std_logic;
oua:out std_logic_vector(7 downto 0);
oub:out std_logic);
end junmo;
architecture rl of junmo is
begin
oua<=ina;
oub<=inb;
end rl;
函数为:
V=0.02*D,其中D为十进制
具体实验数据:
数字输入(D7~D0) 数字输入(十进制) 理论值(v) 实际值
00000000 0 0 0
00000001 1 0.02 20.1mv
00000010 2 0.04 40.3mv
00000100 4 0.08 80.7mv
00001000 8 0.16 161.3mv
00001111 15 0.3 302.2mv
00010000 16 0.32 322.4mv
00100000 32 0.64 0.644v
01000000 64 1.28 1.288v
10000000 128 2.56 2.575v
11110000 240 4.8 4.82v
11111111 255 5.1 5.12v