variable count1:integer range 0 to 49999999;
begin
if(clk'event and clk='1')then count1:=count1+1;--在 clk 的上升沿计数
if count1<=24999999 then clk1s<='0';
elsif count1<=49999999 then clk1s<='1';
else count1:=0;--产生周期为 1s 的时钟信号
clk500ms<='0';
elsif count3<=24999999 then clk500ms<='1';
else count3:=0;--产生周期为 500ms 的时钟信号
end if;
end if;
end process p1;--结束进程 p1
p2:process(clk);--进程 p2
variable count2:integer range 0 to 99999;
begin
if(clk'event and clk='1')then count2:=count2+1;--在 clk 上升沿计数
if count2<=49999 then clk2ms<='0';
elsif count2<=99999 then clk2ms<='1';--产生周期为 2ms 的扫描信号
end if;
end if;
end process p2;--结束进程 p2
p3:process(clk); --进程 p3
variable count3:integer range 0 to 24999999;
begin
if(clk'event and clk='1')then count3:=count3+1; --在 clk 上升沿计数
if count3<=12499999 then
end if;
end if;
end process p3;
end beh;