碰到怪事了 为什么我的cpld分频器程序少烧进去要等个大概一分钟才有反应啊...
如题 刚学cpld 大家指点指点小弟啊 我用的epm570的开发板 我将50m的时钟分频至1hz驱动led 可是上电了以后总要等个1分钟才能看到led闪烁 之前一直都在亮 大家帮着分析分析我上代码 library ieee;use ieee.std_logic_1164.all;
entity text is
port ( clk_in:in std_logic;
clk_out:out std_logic);
end text;
architecture structof text is
signal count: integer;
begin
process(clk_in)
begin
if(clk_in'event and clk_in='1')then count<=count+1;
if(count<25000000) then
clk_out <= '1';
else clk_out <= '0';
end if;
end if;
if(count>=49999999) then count<=0;
end if;
end process;
endstruct; 加个复位控制 888888888888谢谢你
请问你说的是硬件复位还是软件里面的复位啊 你这样写分频 还真是郁闷 软件里面写复位代码,硬件有个对应IO 现在我从新写过了程序
library ieee ;
library work ;
use ieee.std_logic_1164.all ;
use ieee.std_logic_unsigned.all ;
entity ss is
port (clk : in std_logic ;
sw: buffer std_logic ) ;
end entity ;
architecture one of ss is
signal temp : integer range 0 to 9999999 ;
begin
process(clk)
begin
if clk'event and clk = '1' then
if temp = 9999999 then temp <= 0 ;
sw <= not sw ;
else temp <= temp + 1 ;
end if ;
end if ;
end process ;
end ;
没有出现需要等待的问题了 可是我这样本应是把50mhz的时钟分到5hz的 结果却是出来2.5hz 我改变分频的数值也没有用 好像时钟出来的就是25mhz一样 可是我用示波器看过 有源晶振出来是50m的 谢谢大家帮忙了 回复【6楼】yuhang
-----------------------------------------------------------------------
你这样写分频 还真是郁闷
呵呵 我是刚刚开始接触这个东西 可能写出来是有些不伦不类 不知yuhang可否赐教 怎样写比较合适啊 sw <= not sw ; 这条语句又分了一次频 我觉得你先做个做2分频、3分频仿真一下,理清思路,再往下做比较合适。
页:
[1]