標題: 計數計數模塊設計遇到的問題 [打印本頁] 作者: woshaogang123 時間: 2012-6-13 08:19 標題: 計數計數模塊設計遇到的問題 我正在用CPLD設計一個計時計數模塊:按下reset清零,按一下start開始計時,按一下stop停止計時把結果傳給單片機,現在就是控制不了stop,就是仿真時start為高電平1時計數器工作,為0時停止計數,stop控制不了,請問應該怎樣才能控制呢作者: asyou 時間: 2012-6-13 11:05
最好不用電平控制,而用沿控制!檢測start,stop的沿!作者: woshaogang123 時間: 2012-6-13 15:02
但是在一個進程中好像不能有超過兩個以上的邊沿檢測作者: szaeia 時間: 2012-6-13 15:37
最好不用電平控制,而用沿控制!檢測start,stop的沿! 汽車電子作者: woshaogang123 時間: 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
編譯后出現錯誤:can't infer register for "c[0]" at count.vhd,because it does not hold its value outside the clock edge作者: asyou 時間: 2012-6-14 16:33 回復5樓woshaogang123: