標(biāo)題: 計(jì)數(shù)計(jì)數(shù)模塊設(shè)計(jì)遇到的問(wèn)題 [打印本頁(yè)] 作者: woshaogang123 時(shí)間: 2012-6-13 08:19 標(biāo)題: 計(jì)數(shù)計(jì)數(shù)模塊設(shè)計(jì)遇到的問(wèn)題 我正在用CPLD設(shè)計(jì)一個(gè)計(jì)時(shí)計(jì)數(shù)模塊:按下reset清零,按一下start開(kāi)始計(jì)時(shí),按一下stop停止計(jì)時(shí)把結(jié)果傳給單片機(jī),現(xiàn)在就是控制不了stop,就是仿真時(shí)start為高電平1時(shí)計(jì)數(shù)器工作,為0時(shí)停止計(jì)數(shù),stop控制不了,請(qǐng)問(wèn)應(yīng)該怎樣才能控制呢作者: asyou 時(shí)間: 2012-6-13 11:05
最好不用電平控制,而用沿控制!檢測(cè)start,stop的沿!作者: woshaogang123 時(shí)間: 2012-6-13 15:02
但是在一個(gè)進(jìn)程中好像不能有超過(guò)兩個(gè)以上的邊沿檢測(cè)作者: szaeia 時(shí)間: 2012-6-13 15:37
最好不用電平控制,而用沿控制!檢測(cè)start,stop的沿! 汽車電子作者: woshaogang123 時(shí)間: 2012-6-14 10:19
程序是
entity count is
port(
clk,start,stop,reset : in std_logic;
cout ut std_logic_vector(7 downto 0)
);
end count;
architecture behav of count
begin
process(clk,start,stop,reset)
variable c : std_logic_vector(7 downto 0);
begin
if reset='1' then
c:="00000000";
if clk'event and clk='1' then
if start'event and start='1' then
c:=c+1
elsif stop'event and stop='1' then
cout<=c;
end if;
end if;
cout<=c;
end process;
end behav
編譯后出現(xiàn)錯(cuò)誤:can't infer register for "c[0]" at count.vhd,because it does not hold its value outside the clock edge作者: asyou 時(shí)間: 2012-6-14 16:33 回復(fù)5樓woshaogang123: