心率测试仪
- 格式:docx
- 大小:38.40 KB
- 文档页数:12
1.消抖电路:
2.分频器:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity fpq is
port (clk: in std_logic;
f50k:buffer std_logic:='0';
f1k:buffer std_logic;
f5k:buffer std_logic;
f2k:buffer std_logic;
f100hz:buffer std_logic;
f2hz:buffer std_logic;
f1s:buffer std_logic;
f6s:buffer std_logic:='1');
end fpq;
architecture one of fpq is
signal count_6s,count_100: std_logic_vector(3 downto 0);
signal
count_1m,count_1s,count_05s,count_1k,cou nt_2k,
count_5k: std_logic_vector(8 downto 0); signal count_hec:std_logic_vector(9 downto 0);
signal fpq_hec:std_logic_vector(9 downto 0); Begin
--50khz
process(clk)
begin
if(clk'event and clk='1')then
if(count_1m="011111001")then--500分频(系统时钟25MHz)
count_1m<="000000000";
f50k<=not f50k;
else
count_1m<=count_1m+1;
end if;
end if;
end process;
--5Khz
process(f50k)
begin
if(f50k'event and f50k='1')then
if(count_5k="00000100")then--10分频count_5k<="000000000";
f5k<=not f5k;
else
count_5k<=count_5k+1;
end if;
end if;
end process;
--1khz
process(f50k)
begin
if(f50k'event and f50k='1')then
if(count_1k="00011000")then--50分频count_1k<="000000000";
f1k<=not f1k;
else
count_1k<=count_1k+1;
end if;
end if;
end process;
--2.5khz
process(f50k)
begin
if(f50k'event and f50k='1')then
if(count_2k="00001001")then--20分频count_2k<="000000000";
f2k<=not f2k;
else
count_2k<=count_2k+1;
end if;
end if;
end process;
--100hz
process(f1k)
begin
if(f1k'event and f1k='1')then
if(count_100="0100")then--10分频count_100<="0000";
f100hz<=not f100hz;
else
count_100<=count_100+1;
end if;
end if;
end process;
--2hz process(f1k)
begin
if(f1k'event and f1k='1')then
if(count_05s="011111001")then--500分频count_05s<="000000000";
f2hz<=not f2hz;
else
count_05s<=count_05s+1;
end if;
end if;
end process;
--1hz
process(f1k)
begin
if(f1k'event and f1k='1')then
if(count_1s="111110100")then--1000分频count_1s<="000000000";
f1s<=not f1s;
else
count_1s<=count_1s+1;
end if;
end if;
end process;
--6s
process(f1s)
begin
if(f1s'event and f1s='1')then
if(count_6s="0101")then
f6s<='0';
count_6s<=count_6s+1;
elsif(count_6s="0110")then
f6s<='1';
count_6s<="0000";
else
count_6s<=count_6s+1;
f6s<='1';
end if;
end if;
end process;
end one;